- Timestamp:
- Dec 4, 2019, 9:33:43 PM (5 years ago)
- Branches:
- feature/imgui-sdl, master, points-test
- Children:
- 785333b, cf727ca
- Parents:
- e1308e8
- Location:
- shaders
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
shaders/scene.frag
re1308e8 r055750a 2 2 #extension GL_ARB_separate_shader_objects : enable 3 3 4 layout(binding = 1) uniform sampler2D texSampler;4 layout(binding = 2) uniform sampler2D texSampler; 5 5 6 6 layout(location = 0) in vec3 fragColor; -
shaders/scene.vert
re1308e8 r055750a 2 2 #extension GL_ARB_separate_shader_objects : enable 3 3 4 struct Object { 5 mat4 model; 6 }; 7 4 8 layout (binding = 0) uniform UniformBufferObject { 5 mat4 model;6 9 mat4 view; 7 10 mat4 proj; 8 11 } ubo; 12 13 layout(binding = 1) readonly buffer StorageBufferObject { 14 Object objects[]; 15 } sbo; 9 16 10 17 layout(location = 0) in vec3 inPosition; … … 19 26 fragTexCoord = inTexCoord; 20 27 21 gl_Position = ubo.proj * ubo.view * ubo.model * vec4(inPosition, 1.0);28 gl_Position = ubo.proj * ubo.view * sbo.objects[0].model * vec4(inPosition, 1.0); 22 29 } -
shaders/ship.vert
re1308e8 r055750a 2 2 #extension GL_ARB_separate_shader_objects : enable 3 3 4 struct Object { 5 mat4 model; 6 }; 7 4 8 layout (binding = 0) uniform UniformBufferObject { 5 mat4 model;6 9 mat4 view; 7 10 mat4 proj; 8 11 } ubo; 12 13 layout(binding = 1) readonly buffer StorageBufferObject { 14 Object objects[]; 15 } sbo; 9 16 10 17 layout(location = 0) in vec3 vertex_position; … … 26 33 // Check Anton's book to see how to fix this 27 34 void main() { 28 position_eye = vec3(ubo.view * ubo.model * vec4(vertex_position, 1.0));35 position_eye = vec3(ubo.view * sbo.objects[0].model * vec4(vertex_position, 1.0)); 29 36 //position_eye = vec3(view * model_mats[ubo_index] * vec4(vertex_position, 1.0)); 30 37 31 38 // 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)));39 normal_eye = normalize(vec3(ubo.view * sbo.objects[0].model * vec4(vertex_normal, 0.0))); 33 40 //normal_eye = normalize(vec3(view * model_mats[ubo_index] * vec4(vertex_normal, 0.0))); 34 41 color = vertex_color;
Note:
See TracChangeset
for help on using the changeset viewer.