Changeset cf727ca in opengl-game for shaders


Ignore:
Timestamp:
Dec 5, 2019, 5:45:47 PM (5 years ago)
Author:
Dmitry Portnoy <dmitry.portnoy@…>
Branches:
feature/imgui-sdl, master, points-test
Children:
2b40f48
Parents:
055750a
Message:

In VulkanGame, add an objectIndex vertex attribute to the ship shader so it can be used as an index into the ssbo object array

File:
1 edited

Legend:

Unmodified
Added
Removed
  • shaders/ship.vert

    r055750a rcf727ca  
    1818layout(location = 1) in vec3 vertex_color;
    1919layout(location = 2) in vec3 vertex_normal;
    20 //layout(location = 3) in uint ubo_index;
     20layout(location = 3) in uint obj_index;
    2121
    2222layout(location = 0) out vec3 position_eye;
     
    3333// Check Anton's book to see how to fix this
    3434void main() {
    35    position_eye = vec3(ubo.view * sbo.objects[0].model * vec4(vertex_position, 1.0));
    36    //position_eye = vec3(view * model_mats[ubo_index] * vec4(vertex_position, 1.0));
     35   position_eye = vec3(ubo.view * sbo.objects[obj_index].model * vec4(vertex_position, 1.0));
    3736
    3837   // Using 0.0 instead of 1.0 means translations won't effect the normal
    39    normal_eye = normalize(vec3(ubo.view * sbo.objects[0].model * vec4(vertex_normal, 0.0)));
    40    //normal_eye = normalize(vec3(view * model_mats[ubo_index] * vec4(vertex_normal, 0.0)));
     38   normal_eye = normalize(vec3(ubo.view * sbo.objects[obj_index].model * vec4(vertex_normal, 0.0)));
    4139   color = vertex_color;
    4240   light_position_eye = vec3(ubo.view * vec4(light_position_world, 1.0));
Note: See TracChangeset for help on using the changeset viewer.