Changeset aa00bf2 in opengl-game


Ignore:
Timestamp:
Nov 22, 2019, 8:51:26 PM (5 years ago)
Author:
Dmitry Portnoy <dmitry.portnoy@…>
Branches:
feature/imgui-sdl, master, points-test
Children:
3782d66
Parents:
f97c5e7
git-author:
Dmitry Portnoy <dmitry.portnoy@…> (11/22/19 20:49:26)
git-committer:
Dmitry Portnoy <dmitry.portnoy@…> (11/22/19 20:51:26)
Message:

Re-enable some of the logic to render lights in the ship shader for vulkangame

Location:
shaders
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • shaders/ship.frag

    rf97c5e7 raa00bf2  
    55layout(location = 0) in vec3 position_eye;
    66layout(location = 1) in vec3 color;
     7layout(location = 2) in vec3 light_position_eye;
     8layout(location = 3) in vec3 light2_position_eye;
    79
    810layout(location = 0) out vec4 outColor;
     
    2628   vec3 Ia2 = La * Ka;
    2729
    28    //vec3 direction_to_light_eye = normalize(light_position_eye - position_eye);
     30   vec3 direction_to_light_eye = normalize(light_position_eye - position_eye);
    2931   //float dot_prod = max(dot(direction_to_light_eye, normal_eye), 0.0);
    3032
     
    3234   //vec3 Id = Ld * color * dot_prod;
    3335
    34    //vec3 direction_to_light2_eye = normalize(light2_position_eye - position_eye);
     36   vec3 direction_to_light2_eye = normalize(light2_position_eye - position_eye);
    3537   //float dot_prod2 = max(dot(direction_to_light2_eye, normal_eye), 0.0);
    3638
     
    5254   //vec3 Is2 = Ls * Ks * specular_factor2;
    5355
    54    //frag_color = vec4((Is + Id + Ia + Is2 + Id2 + Ia2)/2, 1.0);
     56   //outColor = vec4((Is + Id + Ia + Is2 + Id2 + Ia2)/2, 1.0);
    5557   outColor = vec4(color, 1.0);
    5658}
  • shaders/ship.vert

    rf97c5e7 raa00bf2  
    1717layout(location = 0) out vec3 position_eye;
    1818layout(location = 1) out vec3 color;
     19layout(location = 2) out vec3 light_position_eye;
     20layout(location = 3) out vec3 light2_position_eye;
    1921
    2022// fixed point light position
    21 //vec3 light_position_world = vec3(0.0, 0.0, 2.0);
    22 //vec3 light2_position_world = vec3(0.0, 1.5, -0.1);
     23vec3 light_position_world = vec3(0.0, 0.0, 2.0);
     24vec3 light2_position_world = vec3(0.0, 1.5, -0.1);
    2325
    2426void main() {
     
    2729   //normal_eye = normalize(vec3(view * model_mats[ubo_index] * vec4(vertex_normal, 0.0)));
    2830   color = vertex_color;
    29    //light_position_eye = vec3(view * vec4(light_position_world, 1.0));
    30    //light2_position_eye = vec3(view * vec4(light2_position_world, 1.0));
     31   light_position_eye = vec3(ubo.view * vec4(light_position_world, 1.0));
     32   light2_position_eye = vec3(ubo.view * vec4(light2_position_world, 1.0));
    3133
    3234   gl_Position = ubo.proj * vec4(position_eye, 1.0);
Note: See TracChangeset for help on using the changeset viewer.