Rework arcball camera controller
This commit is contained in:
@@ -156,6 +156,9 @@ namespace OpenVulkano::Scene
|
||||
[[nodiscard]] std::array<uint8_t, 8>& GetUserData() { return m_userData; }
|
||||
|
||||
[[nodiscard]] float GetPixelScaleFactor() const { return m_perPixelScaleFactor; }
|
||||
|
||||
[[nodiscard]] virtual bool IsPerspective() const { return false; }
|
||||
[[nodiscard]] virtual bool IsOrtho() const { return false; }
|
||||
};
|
||||
|
||||
class PerspectiveCamera : public Camera
|
||||
@@ -250,6 +253,8 @@ namespace OpenVulkano::Scene
|
||||
m_projection = Math::Utils::perspectiveRH_ZO(m_fov, m_aspect, m_nearPlane, m_farPlane);
|
||||
UpdateViewProjectionMatrix();
|
||||
}
|
||||
|
||||
[[nodiscard]] bool IsPerspective() const override { return true; }
|
||||
};
|
||||
|
||||
class OrthographicCamera : public Camera
|
||||
@@ -262,6 +267,8 @@ namespace OpenVulkano::Scene
|
||||
m_projection = Math::Utils::orthoRH_ZO(-widthHalf, widthHalf, -heightHalf, heightHalf, m_nearPlane, m_farPlane);
|
||||
UpdateViewProjectionMatrix();
|
||||
}
|
||||
|
||||
[[nodiscard]] bool IsOrtho() const override { return true; }
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -29,5 +29,8 @@ namespace OpenVulkano::Scene
|
||||
}
|
||||
|
||||
void UpdateProjectionMatrix() override;
|
||||
|
||||
[[nodiscard]] bool IsPerspective() const override { return m_morphState == 0; }
|
||||
[[nodiscard]] bool IsOrtho() const override { return m_morphState == 1; }
|
||||
};
|
||||
}
|
||||
@@ -30,7 +30,7 @@ namespace OpenVulkano::Scene
|
||||
void Tick() override;
|
||||
|
||||
void SetDuration(double duration) { m_animationDuration = duration; }
|
||||
double GetDuration() { return m_animationDuration; }
|
||||
[[nodiscard]] double GetDuration() { return m_animationDuration; }
|
||||
void SetTargetState(bool toPerspective);
|
||||
void Reset() { m_currentTime = 0; }
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user