Changeset 67527a5 in opengl-game for shaders/explosion.vert
- Timestamp:
- Jun 21, 2021, 4:12:08 PM (3 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/explosion.vert
rb01b50c r67527a5 9 9 }; 10 10 11 layout (binding = 0) uniform UniformBufferObject{11 layout (binding = 0) uniform camera_block { 12 12 mat4 view; 13 13 mat4 proj; 14 14 float cur_time; 15 } camera; 16 17 layout(binding = 1) uniform ubo_block { 18 Object objects[1024]; 15 19 } ubo; 16 17 layout(binding = 1) readonly buffer StorageBufferObject {18 Object objects[];19 } sbo;20 20 21 21 layout(location = 0) in vec3 particle_start_velocity; … … 26 26 27 27 void main() { 28 mat4 model = sbo.objects[obj_index].model;29 float explosion_start_time = sbo.objects[obj_index].explosion_start_time;30 float explosion_duration = sbo.objects[obj_index].explosion_duration;31 bool deleted = sbo.objects[obj_index].deleted;28 mat4 model = ubo.objects[obj_index].model; 29 float explosion_start_time = ubo.objects[obj_index].explosion_start_time; 30 float explosion_duration = ubo.objects[obj_index].explosion_duration; 31 bool deleted = ubo.objects[obj_index].deleted; 32 32 33 float t = ubo.cur_time - explosion_start_time - particle_start_time;33 float t = camera.cur_time - explosion_start_time - particle_start_time; 34 34 35 35 if (t < 0.0) { … … 56 56 p += normalize(particle_start_velocity) * mod(t, explosion_duration) / explosion_duration * 0.3; 57 57 58 gl_Position = ubo.proj * ubo.view * model * vec4(p, 1.0);58 gl_Position = camera.proj * camera.view * model * vec4(p, 1.0); 59 59 } 60 60 gl_PointSize = 10.0; // size in pixels
Note:
See TracChangeset
for help on using the changeset viewer.