Skip to content
Snippets Groups Projects
Verified Commit da307b6b authored by Tobias Frisch's avatar Tobias Frisch
Browse files

[#69] Fixed crash because of local scope reference

parent c2e4a92d
No related branches found
No related tags found
1 merge request!56Resolve "Partikelsystem"
...@@ -77,7 +77,7 @@ namespace vkcv::camera { ...@@ -77,7 +77,7 @@ namespace vkcv::camera {
* @brief Gets the current projection of the camera * @brief Gets the current projection of the camera
* @return The current projection matrix * @return The current projection matrix
*/ */
const glm::mat4& getProjection() const; glm::mat4 getProjection() const;
/** /**
* @brief Gets the model-view-projection matrix of the camera with y-axis-correction applied * @brief Gets the model-view-projection matrix of the camera with y-axis-correction applied
......
...@@ -45,12 +45,12 @@ namespace vkcv::camera { ...@@ -45,12 +45,12 @@ namespace vkcv::camera {
0.0f, 0.0f, 0.0f, 1.0f 0.0f, 0.0f, 0.0f, 1.0f
); );
const glm::mat4& Camera::getProjection() const { glm::mat4 Camera::getProjection() const {
return y_correction * m_projection; return y_correction * m_projection;
} }
void Camera::setProjection(const glm::mat4& projection) { void Camera::setProjection(const glm::mat4& projection) {
m_projection = projection; m_projection = glm::inverse(y_correction) * projection;
} }
glm::mat4 Camera::getMVP() const { glm::mat4 Camera::getMVP() const {
......
...@@ -201,6 +201,8 @@ int main(int argc, const char **argv) { ...@@ -201,6 +201,8 @@ int main(int argc, const char **argv) {
glm::vec4 colorData = glm::vec4(1.0f, 1.0f, 0.0f, 1.0f); glm::vec4 colorData = glm::vec4(1.0f, 1.0f, 0.0f, 1.0f);
uint32_t camIndex0 = cameraManager.addCamera(vkcv::camera::ControllerType::PILOT); uint32_t camIndex0 = cameraManager.addCamera(vkcv::camera::ControllerType::PILOT);
uint32_t camIndex1 = cameraManager.addCamera(vkcv::camera::ControllerType::TRACKBALL); uint32_t camIndex1 = cameraManager.addCamera(vkcv::camera::ControllerType::TRACKBALL);
cameraManager.setActiveCamera(1);
cameraManager.getCamera(camIndex0).setPosition(glm::vec3(0, 0, -2)); cameraManager.getCamera(camIndex0).setPosition(glm::vec3(0, 0, -2));
cameraManager.getCamera(camIndex1).setPosition(glm::vec3(0.0f, 0.0f, -2.0f)); cameraManager.getCamera(camIndex1).setPosition(glm::vec3(0.0f, 0.0f, -2.0f));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment