Rework arcball camera controller

This commit is contained in:
Georg Hagen
2024-07-02 15:05:06 +02:00
parent 2adf8d7b8e
commit 410f6b11a6
5 changed files with 116 additions and 33 deletions

View File

@@ -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; }
};
}

View File

@@ -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; }
};
}

View File

@@ -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; }
};