Changeset 25b47d7 in opengl-game for asteroid.vert
- Timestamp:
- Oct 17, 2018, 1:47:23 AM (6 years ago)
- Branches:
- feature/imgui-sdl, master, points-test
- Children:
- 1e3dddf, 8e8aed6
- Parents:
- 0e0f851
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
asteroid.vert
r0e0f851 r25b47d7 3 3 #define MAX_NUM_OBJECTS 1024 4 4 5 uniform mat4 view, proj, hp; 5 uniform mat4 view, proj; 6 uniform float hp[1016]; 6 7 7 8 layout (std140) uniform models { 8 9 mat4 model_mats[MAX_NUM_OBJECTS]; 9 10 }; 10 11 /*12 layout (std140) uniform hp_uniform {13 mat4 hp[MAX_NUM_OBJECTS];14 };15 */16 11 17 12 layout(location = 0) in vec3 vertex_position; … … 29 24 position_eye = vec3(view * model_mats[ubo_index] * vec4(vertex_position, 1.0)); 30 25 normal_eye = normalize(vec3(view * model_mats[ubo_index] * vec4(vertex_normal, 0.0))); 31 //color = vertex_color * (hp[ubo_index][0][0] * 10.0); //(hp[ubo_index*4] / 10.0); 32 color = vertex_color * (hp[0][0] * 2.0 / 10.0); 26 27 float hp_percent = hp[ubo_index] / 10.0; 28 vec3 damage_color = vec3(1.0, 0.0, 0.0); 29 color = (vertex_color * hp_percent) + (damage_color * (1.0 - hp_percent)); 30 33 31 light_position_eye = vec3(view * vec4(light_position_world, 1.0)); 34 32 light2_position_eye = vec3(view * vec4(light2_position_world, 1.0));
Note:
See TracChangeset
for help on using the changeset viewer.