Changeset 22217d4 in opengl-game for vulkan-game.cpp


Ignore:
Timestamp:
Mar 22, 2020, 10:07:01 PM (4 years ago)
Author:
Dmitry Portnoy <dmitry.portnoy@…>
Branches:
feature/imgui-sdl, master, points-test
Children:
1add0ed
Parents:
0807aeb
Message:

Make the view and projection matrices instaces variables of the VulkanGame class

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vulkan-game.cpp

    r0807aeb r22217d4  
    568568   mat4 R_view = pitch_mat * yaw_mat;
    569569   mat4 T_view = translate(mat4(1.0f), vec3(-cam_pos.x, -cam_pos.y, -cam_pos.z));
    570    mat4 view = R_view * T_view;
    571 
    572    mat4 proj = perspective(radians(FOV_ANGLE), (float)swapChainExtent.width / (float)swapChainExtent.height, NEAR_CLIP, FAR_CLIP);
    573    proj[1][1] *= -1; // flip the y-axis so that +y is up
    574 
    575    object_VP_mats.view = view;
    576    object_VP_mats.proj = proj;
    577 
    578    ship_VP_mats.view = view;
    579    ship_VP_mats.proj = proj;
    580 
    581    asteroid_VP_mats.view = view;
    582    asteroid_VP_mats.proj = proj;
     570   viewMat = R_view * T_view;
     571
     572   projMat = perspective(radians(FOV_ANGLE), (float)swapChainExtent.width / (float)swapChainExtent.height, NEAR_CLIP, FAR_CLIP);
     573   projMat[1][1] *= -1; // flip the y-axis so that +y is up
     574
     575   object_VP_mats.view = viewMat;
     576   object_VP_mats.proj = projMat;
     577
     578   ship_VP_mats.view = viewMat;
     579   ship_VP_mats.proj = projMat;
     580
     581   asteroid_VP_mats.view = viewMat;
     582   asteroid_VP_mats.proj = projMat;
    583583}
    584584
Note: See TracChangeset for help on using the changeset viewer.