Changeset 7c929fc in opengl-game for shaders/ship.vert


Ignore:
Timestamp:
Dec 6, 2019, 4:21:54 AM (5 years ago)
Author:
Dmitry Portnoy <dmp1488@…>
Branches:
feature/imgui-sdl, master, points-test
Children:
60578ce
Parents:
2b40f48
Message:

In VulkanGame, make lighting work correctly in the ship shader before the MVP matrices are applied

File:
1 edited

Legend:

Unmodified
Added
Removed
  • shaders/ship.vert

    r2b40f48 r7c929fc  
    2727// fixed point light position
    2828//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);
     30vec3 light_position_world = vec3(0.4, 0.0, 0.2);
    3131
    3232// TODO: This does not account for scaling in the model matrix
    3333// Check Anton's book to see how to fix this
    3434void 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));
    3637
    3738   // 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)));
    3941   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));
    4144
    4245   //gl_Position = ubo.proj * vec4(position_eye, 1.0);
Note: See TracChangeset for help on using the changeset viewer.