diff --git a/examples/multisampling/multisampling.cpp b/examples/multisampling/multisampling.cpp index 73c96c61..bf8644e9 100644 --- a/examples/multisampling/multisampling.cpp +++ b/examples/multisampling/multisampling.cpp @@ -87,12 +87,12 @@ public: VulkanExample() : VulkanExampleBase(ENABLE_VALIDATION) { - zoom = -7.5f; - zoomSpeed = 2.5f; - rotation = { 0.0f, -90.0f, 0.0f }; - cameraPos = glm::vec3(2.5f, 2.5f, 0.0f); title = "Multisampling"; settings.overlay = true; + camera.type = Camera::CameraType::lookat; + camera.setPerspective(60.0f, (float)width / (float)height, 0.1f, 256.0f); + camera.setRotation(glm::vec3(0.0f, -90.0f, 0.0f)); + camera.setTranslation(glm::vec3(2.5f, 2.5f, -7.5f)); } ~VulkanExample() @@ -681,19 +681,8 @@ public: void updateUniformBuffers() { - // Vertex shader - glm::mat4 viewMatrix = glm::mat4(1.0f); - uboVS.projection = glm::perspective(glm::radians(60.0f), (float)width / (float)height, 0.1f, 256.0f); - viewMatrix = glm::translate(viewMatrix, glm::vec3(0.0f, 0.0f, zoom)); - - float offset = 0.5f; - int uboIndex = 1; - uboVS.model = glm::mat4(1.0f); - uboVS.model = viewMatrix * glm::translate(uboVS.model, cameraPos); - uboVS.model = glm::rotate(uboVS.model, glm::radians(rotation.x), glm::vec3(1.0f, 0.0f, 0.0f)); - uboVS.model = glm::rotate(uboVS.model, glm::radians(rotation.y), glm::vec3(0.0f, 1.0f, 0.0f)); - uboVS.model = glm::rotate(uboVS.model, glm::radians(rotation.z), glm::vec3(0.0f, 0.0f, 1.0f)); - + uboVS.projection = camera.matrices.perspective; + uboVS.model = camera.matrices.view; memcpy(uniformBuffer.mapped, &uboVS, sizeof(uboVS)); } @@ -731,11 +720,9 @@ public: if (!prepared) return; draw(); - } - - virtual void viewChanged() - { - updateUniformBuffers(); + if (camera.updated) { + updateUniformBuffers(); + } } // Returns the maximum sample count usable by the platform