Changeset e1308e8 in opengl-game for shaders/ship.vert
- Timestamp:
- Nov 27, 2019, 6:39:18 PM (5 years ago)
- Branches:
- feature/imgui-sdl, master, points-test
- Children:
- 055750a
- Parents:
- 06d959f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
shaders/ship.vert
r06d959f re1308e8 2 2 #extension GL_ARB_separate_shader_objects : enable 3 3 4 // TODO: Figure out if the UniformBufferObject label is necessary and, if not, remove it5 4 layout (binding = 0) uniform UniformBufferObject { 6 5 mat4 model; … … 11 10 layout(location = 0) in vec3 vertex_position; 12 11 layout(location = 1) in vec3 vertex_color; 13 //layout(location = 2) in vec3 vertex_normal;12 layout(location = 2) in vec3 vertex_normal; 14 13 //layout(location = 3) in uint ubo_index; 15 14 16 //out vec3 position_eye, normal_eye, color, light_position_eye, light2_position_eye;17 15 layout(location = 0) out vec3 position_eye; 18 16 layout(location = 1) out vec3 color; 19 layout(location = 2) out vec3 light_position_eye;20 layout(location = 3) out vec3 light 2_position_eye;17 layout(location = 2) out vec3 normal_eye; 18 layout(location = 3) out vec3 light_position_eye; 21 19 22 20 // fixed point light position 23 vec3 light_position_world = vec3(0.0, 0.0, 2.0); 24 vec3 light2_position_world = vec3(0.0, 1.5, -0.1); 21 //vec3 light_position_world = vec3(0.0, 0.0, 2.0); 22 vec3 light_position_world = vec3(0.4, 1.5, 0.8); 23 //vec3 light_position_world = vec3(0.0, 1.0, -1.0); 25 24 25 // TODO: This does not account for scaling in the model matrix 26 // Check Anton's book to see how to fix this 26 27 void main() { 28 position_eye = vec3(ubo.view * ubo.model * vec4(vertex_position, 1.0)); 27 29 //position_eye = vec3(view * model_mats[ubo_index] * vec4(vertex_position, 1.0)); 28 position_eye = vec3(ubo.view * ubo.model * vec4(vertex_position, 1.0)); 30 31 // Using 0.0 instead of 1.0 means translations won't effect the normal 32 normal_eye = normalize(vec3(ubo.view * ubo.model * vec4(vertex_normal, 0.0))); 29 33 //normal_eye = normalize(vec3(view * model_mats[ubo_index] * vec4(vertex_normal, 0.0))); 30 34 color = vertex_color; 31 35 light_position_eye = vec3(ubo.view * vec4(light_position_world, 1.0)); 32 light2_position_eye = vec3(ubo.view * vec4(light2_position_world, 1.0));33 36 34 37 gl_Position = ubo.proj * vec4(position_eye, 1.0);
Note:
See TracChangeset
for help on using the changeset viewer.