MorphableCamera class

This commit is contained in:
Vladyslav Baranovskyi
2024-06-25 22:05:21 +03:00
parent 624742eeb5
commit 27c3e52f8c
2 changed files with 65 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
#pragma once
#include "Camera.hpp"
#include "Math/Math.hpp"
namespace OpenVulkano::Scene
{
class MorphableCamera : public PerspectiveCamera
{
float m_morphState;
Math::Matrix4f m_orthoMatrix;
public:
MorphableCamera(float fovDegrees, float width, float height, float nearPlane, float farPlane)
: PerspectiveCamera(fovDegrees, nearPlane, farPlane, width, height), m_morphState(0.0f)
{
UpdateProjectionMatrix();
}
void SetMorphState(float state)
{
m_morphState = Math::Utils::clamp(state, 0.0f, 1.0f);
UpdateProjectionMatrix();
}
void UpdateProjectionMatrix() override;
};
}