Changeset 6385d0f in opengl-game for shaders/asteroid.vert
- Timestamp:
- Apr 17, 2020, 3:09:05 AM (5 years ago)
- Branches:
- feature/imgui-sdl, master, points-test
- Children:
- 4994692
- Parents:
- a52ba87
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
shaders/asteroid.vert
ra52ba87 r6385d0f 14 14 15 15 layout(binding = 1) readonly buffer StorageBufferObject { 16 16 Object objects[]; 17 17 } sbo; 18 18 … … 33 33 34 34 void main() { 35 position_eye = vec3(ubo.view * sbo.objects[obj_index].model * vec4(vertex_position, 1.0));36 normal_eye = normalize(vec3(ubo.view * sbo.objects[obj_index].model * vec4(vertex_normal, 0.0)));35 position_eye = vec3(ubo.view * sbo.objects[obj_index].model * vec4(vertex_position, 1.0)); 36 normal_eye = normalize(vec3(ubo.view * sbo.objects[obj_index].model * vec4(vertex_normal, 0.0))); 37 37 38 float hp_percent = sbo.objects[obj_index].hp / 10.0;39 vec3 damage_color = vec3(1.0, 0.0, 0.0);40 color = (vertex_color * hp_percent) + (damage_color * (1.0 - hp_percent));38 float hp_percent = sbo.objects[obj_index].hp / 10.0; 39 vec3 damage_color = vec3(1.0, 0.0, 0.0); 40 color = (vertex_color * hp_percent) + (damage_color * (1.0 - hp_percent)); 41 41 42 light_position_eye = vec3(ubo.view * vec4(light_position_world, 1.0));43 light2_position_eye = vec3(ubo.view * vec4(light2_position_world, 1.0));42 light_position_eye = vec3(ubo.view * vec4(light_position_world, 1.0)); 43 light2_position_eye = vec3(ubo.view * vec4(light2_position_world, 1.0)); 44 44 45 if (sbo.objects[obj_index].deleted) {46 gl_Position = vec4(0.0, 0.0, 2.0, 1.0);47 } else {48 gl_Position = ubo.proj * vec4(position_eye, 1.0);49 }45 if (sbo.objects[obj_index].deleted) { 46 gl_Position = vec4(0.0, 0.0, 2.0, 1.0); 47 } else { 48 gl_Position = ubo.proj * vec4(position_eye, 1.0); 49 } 50 50 }
Note:
See TracChangeset
for help on using the changeset viewer.