Changeset 67527a5 in opengl-game for shaders/model.vert
- Timestamp:
- Jun 21, 2021, 4:12:08 PM (4 years ago)
- Branches:
- feature/imgui-sdl
- Children:
- 27e580e
- Parents:
- b01b50c
- git-author:
- Dmitry Portnoy <dportnoy@…> (06/21/21 15:13:03)
- git-committer:
- Dmitry Portnoy <dportnoy@…> (06/21/21 16:12:08)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
shaders/model.vert
rb01b50c r67527a5 6 6 }; 7 7 8 layout (binding = 0) uniform UniformBufferObject{8 layout (binding = 0) uniform camera_block { 9 9 mat4 view; 10 10 mat4 proj; 11 } camera; 12 13 // TODO: Verify that I can actually store 1024 values here. They last time I checked, I think I could only store 1016 values 14 layout (binding = 1) uniform ubo_block { 15 Object objects[1024]; 11 16 } ubo; 12 13 layout(binding = 1) readonly buffer StorageBufferObject {14 Object objects[];15 } sbo;16 17 layout (binding = 2) uniform UboInstance {18 mat4 model;19 } uboInstance;20 17 21 18 layout(location = 0) in vec3 inPosition; … … 31 28 void main() { 32 29 // Using 0.0 instead of 1.0 means translations won't effect the normal 33 normal_eye = normalize(vec3( ubo.view * sbo.objects[obj_index].model * vec4(vertex_normal, 0.0)));30 normal_eye = normalize(vec3(camera.view * ubo.objects[obj_index].model * vec4(vertex_normal, 0.0))); 34 31 35 32 fragColor = inColor; 36 33 fragTexCoord = inTexCoord; 37 34 38 gl_Position = ubo.proj * ubo.view * sbo.objects[obj_index].model * vec4(inPosition, 1.0);35 gl_Position = camera.proj * camera.view * ubo.objects[obj_index].model * vec4(inPosition, 1.0); 39 36 }
Note:
See TracChangeset
for help on using the changeset viewer.