From 2454b5449bbda815eb15327476e376d0d3a39617 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Wed, 5 Mar 2025 22:16:56 +0000 Subject: Move camera out of gl folder, it's not OpenGL specific --- gfx/gl/camera.h | 94 --------------------------------------------------------- 1 file changed, 94 deletions(-) delete mode 100644 gfx/gl/camera.h (limited to 'gfx/gl/camera.h') diff --git a/gfx/gl/camera.h b/gfx/gl/camera.h deleted file mode 100644 index d4fe6de..0000000 --- a/gfx/gl/camera.h +++ /dev/null @@ -1,94 +0,0 @@ -#pragma once - -#include "config/types.h" -#include -#include -#include - -class Camera { -public: - Camera(GlobalPosition3D, Angle fov, Angle aspect, GlobalDistance zNear, GlobalDistance zFar); - - [[nodiscard]] glm::mat4 - getViewProjection() const - { - return viewProjection; - } - - [[nodiscard]] Ray unProject(const ScreenRelCoord &) const; - - void - setPosition(const GlobalPosition3D & p) - { - position = p; - updateView(); - } - - void - setForward(const Direction3D & f) - { - setForward(f, upFromForward(f)); - } - - void - setForward(const Direction3D & f, const Direction3D & u) - { - forward = f; - up = u; - updateView(); - } - - void - setView(const GlobalPosition3D & p, const Direction3D & f) - { - position = p; - setForward(f); - } - - void - setView(const GlobalPosition3D & p, const Direction3D & f, const Direction3D & u) - { - position = p; - setView(f, u); - } - - void - lookAt(const GlobalPosition3D & target) - { - setForward(glm::normalize(RelativePosition3D(target - position))); - } - - [[nodiscard]] auto - getForward() const - { - return forward; - } - - [[nodiscard]] auto - getPosition() const - { - return position; - } - - [[nodiscard]] auto & - getFrustumPlanes() const - { - return frustumPlanes; - } - - [[nodiscard]] std::array extentsAtDist(GlobalDistance) const; - - [[nodiscard]] static Direction3D upFromForward(const Direction3D & forward); - -private: - void updateView(); - - GlobalPosition3D position; - Direction3D forward; - Direction3D up; - - GlobalDistance near, far; - glm::mat4 view, projection; - glm::mat4 viewProjection, inverseViewProjection; - std::array frustumPlanes; -}; -- cgit v1.2.3