Code-Cleanup: All samples now use the camera class and it's matrices

Cleaned up base class
This commit is contained in:
Sascha Willems 2020-04-22 20:58:24 +02:00
parent 27d5abc038
commit ab38f8b150
42 changed files with 234 additions and 396 deletions

View file

@ -98,10 +98,10 @@ public:
VulkanExample() : VulkanExampleBase(ENABLE_VALIDATION)
{
title = "Instanced mesh rendering";
zoom = -18.5f;
rotation = { -17.2f, -4.7f, 0.0f };
cameraPos = { 5.5f, -1.85f, 0.0f };
rotationSpeed = 0.25f;
camera.type = Camera::CameraType::lookat;
camera.setPosition(glm::vec3(5.5f, -1.85f, -18.5f));
camera.setRotation(glm::vec3(-17.2f, -4.7f, 0.0f));
camera.setPerspective(60.0f, (float)width / (float)height, 1.0f, 256.0f);
settings.overlay = true;
}
@ -544,11 +544,8 @@ public:
{
if (viewChanged)
{
uboVS.projection = glm::perspective(glm::radians(60.0f), (float)width / (float)height, 0.1f, 256.0f);
uboVS.view = glm::translate(glm::mat4(1.0f), cameraPos + glm::vec3(0.0f, 0.0f, zoom));
uboVS.view = glm::rotate(uboVS.view, glm::radians(rotation.x), glm::vec3(1.0f, 0.0f, 0.0f));
uboVS.view = glm::rotate(uboVS.view, glm::radians(rotation.y), glm::vec3(0.0f, 1.0f, 0.0f));
uboVS.view = glm::rotate(uboVS.view, glm::radians(rotation.z), glm::vec3(0.0f, 0.0f, 1.0f));
uboVS.projection = camera.matrices.perspective;
uboVS.view = camera.matrices.view;
}
if (!paused)