Code-Cleanup: All samples now use the camera class and it's matrices
Cleaned up base class
This commit is contained in:
parent
27d5abc038
commit
ab38f8b150
42 changed files with 234 additions and 396 deletions
|
|
@ -61,9 +61,12 @@ public:
|
|||
|
||||
VulkanExample() : VulkanExampleBase(ENABLE_VALIDATION)
|
||||
{
|
||||
zoom = -10.5f;
|
||||
rotation = glm::vec3(-25.0f, 15.0f, 0.0f);
|
||||
title = "Pipeline state objects";
|
||||
camera.type = Camera::CameraType::lookat;
|
||||
camera.setPosition(glm::vec3(0.0f, 0.0f, -10.5f));
|
||||
camera.setRotation(glm::vec3(-25.0f, 15.0f, 0.0f));
|
||||
camera.setRotationSpeed(0.5f);
|
||||
camera.setPerspective(60.0f, (float)(width / 3.0f) / (float)height, 0.1f, 256.0f);
|
||||
settings.overlay = true;
|
||||
}
|
||||
|
||||
|
|
@ -379,15 +382,8 @@ public:
|
|||
|
||||
void updateUniformBuffers()
|
||||
{
|
||||
uboVS.projection = glm::perspective(glm::radians(60.0f), (float)(width / 3.0f) / (float)height, 0.1f, 256.0f);
|
||||
|
||||
glm::mat4 viewMatrix = glm::translate(glm::mat4(1.0f), glm::vec3(0.0f, 0.0f, zoom));
|
||||
|
||||
uboVS.modelView = viewMatrix * glm::translate(glm::mat4(1.0f), cameraPos);
|
||||
uboVS.modelView = glm::rotate(uboVS.modelView, glm::radians(rotation.x), glm::vec3(1.0f, 0.0f, 0.0f));
|
||||
uboVS.modelView = glm::rotate(uboVS.modelView, glm::radians(rotation.y), glm::vec3(0.0f, 1.0f, 0.0f));
|
||||
uboVS.modelView = glm::rotate(uboVS.modelView, glm::radians(rotation.z), glm::vec3(0.0f, 0.0f, 1.0f));
|
||||
|
||||
uboVS.projection = camera.matrices.perspective;
|
||||
uboVS.modelView = camera.matrices.view;
|
||||
memcpy(uniformBuffer.mapped, &uboVS, sizeof(uboVS));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue