- Timestamp:
- Dec 6, 2019, 4:21:54 AM (5 years ago)
- Branches:
- feature/imgui-sdl, master, points-test
- Children:
- 60578ce
- Parents:
- 2b40f48
- Location:
- shaders
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
shaders/ship.frag
r2b40f48 r7c929fc 15 15 16 16 // reflectance of the object surface 17 // TODO: Eventually, I might want to move these properties into an ssbo so they differ per object 17 18 vec3 Ks = vec3(1.0, 1.0, 1.0); 18 vec3 Kd = vec3(1.0, 0.5, 0.0);19 vec3 Kd = color; 19 20 vec3 Ka = vec3(0.2, 0.2, 0.2); 20 21 float specular_exponent = 100.0; // specular 'power' … … 31 32 32 33 // diffuse intensity 33 vec3 Id = Ld * color * dot_prod; 34 //vec3 Id = Ld * Kd * dot_prod; 34 vec3 Id = Ld * Kd * dot_prod; 35 35 36 36 vec3 surface_to_viewer_eye = normalize(-position_eye); … … 43 43 vec3 Is = Ls * Ks * specular_factor; 44 44 45 //outColor = vec4(Is + Id + Ia, 1.0); 46 outColor = vec4(color, 1.0); 45 outColor = vec4(Is + Id + Ia, 1.0); 47 46 } -
shaders/ship.vert
r2b40f48 r7c929fc 27 27 // fixed point light position 28 28 //vec3 light_position_world = vec3(0.0, 0.0, 2.0); 29 vec3 light_position_world = vec3(0.4, 1.5, 0.8);30 //vec3 light_position_world = vec3(0.0, 1.0, -1.0);29 //vec3 light_position_world = vec3(0.4, 1.5, 0.8); 30 vec3 light_position_world = vec3(0.4, 0.0, 0.2); 31 31 32 32 // TODO: This does not account for scaling in the model matrix 33 33 // Check Anton's book to see how to fix this 34 34 void main() { 35 position_eye = vec3(ubo.view * sbo.objects[obj_index].model * vec4(vertex_position, 1.0)); 35 //position_eye = vec3(ubo.view * sbo.objects[obj_index].model * vec4(vertex_position, 1.0)); 36 position_eye = vec3(vec4(vertex_position, 1.0)); 36 37 37 38 // Using 0.0 instead of 1.0 means translations won't effect the normal 38 normal_eye = normalize(vec3(ubo.view * sbo.objects[obj_index].model * vec4(vertex_normal, 0.0))); 39 //normal_eye = normalize(vec3(ubo.view * sbo.objects[obj_index].model * vec4(vertex_normal, 0.0))); 40 normal_eye = normalize(vec3(vec4(vertex_normal, 0.0))); 39 41 color = vertex_color; 40 light_position_eye = vec3(ubo.view * vec4(light_position_world, 1.0)); 42 //light_position_eye = vec3(ubo.view * vec4(light_position_world, 1.0)); 43 light_position_eye = vec3(vec4(light_position_world, 1.0)); 41 44 42 45 //gl_Position = ubo.proj * vec4(position_eye, 1.0);
Note:
See TracChangeset
for help on using the changeset viewer.