From 2f8d7643d03f39fa848576692264d0fe3a37ed91 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Mon, 6 Nov 2023 20:48:33 +0000 Subject: Reformat with new clang-format --- gfx/gl/camera.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'gfx/gl/camera.h') diff --git a/gfx/gl/camera.h b/gfx/gl/camera.h index 3f1c3a7..7956ec3 100644 --- a/gfx/gl/camera.h +++ b/gfx/gl/camera.h @@ -13,6 +13,7 @@ public: { return viewProjection; } + [[nodiscard]] Ray unProject(const glm::vec2 &) const; void @@ -21,11 +22,13 @@ public: position = p; updateView(); } + void setForward(const glm::vec3 & f) { setForward(f, upFromForward(f)); } + void setForward(const glm::vec3 & f, const glm::vec3 & u) { @@ -33,28 +36,33 @@ public: up = u; updateView(); } + void setView(const glm::vec3 & p, const glm::vec3 & f) { position = p; setForward(f); } + void setView(const glm::vec3 & p, const glm::vec3 & f, const glm::vec3 & u) { position = p; setView(f, u); } + void lookAt(const glm::vec3 & target) { setForward(glm::normalize(target - position)); } + [[nodiscard]] auto getForward() const { return forward; } + [[nodiscard]] auto getPosition() const { -- cgit v1.2.3 From d6e99a696aa582b81018078b68f6600c8030d643 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Tue, 7 Nov 2023 02:51:42 +0000 Subject: WIP typedefing all the things - headers --- gfx/gl/camera.h | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'gfx/gl/camera.h') diff --git a/gfx/gl/camera.h b/gfx/gl/camera.h index 7956ec3..469df0d 100644 --- a/gfx/gl/camera.h +++ b/gfx/gl/camera.h @@ -1,12 +1,13 @@ #pragma once +#include "config/types.h" #include #include #include class Camera { public: - Camera(glm::vec3 pos, float fov, float aspect, float zNear, float zFar); + Camera(Position3D, Angle fov, Angle aspect, Distance zNear, Distance zFar); [[nodiscard]] glm::mat4 getViewProjection() const @@ -14,23 +15,23 @@ public: return viewProjection; } - [[nodiscard]] Ray unProject(const glm::vec2 &) const; + [[nodiscard]] Ray unProject(const ScreenRelCoord &) const; void - setPosition(const glm::vec3 & p) + setPosition(const Position3D & p) { position = p; updateView(); } void - setForward(const glm::vec3 & f) + setForward(const Direction3D & f) { setForward(f, upFromForward(f)); } void - setForward(const glm::vec3 & f, const glm::vec3 & u) + setForward(const Direction3D & f, const Direction3D & u) { forward = f; up = u; @@ -38,21 +39,21 @@ public: } void - setView(const glm::vec3 & p, const glm::vec3 & f) + setView(const Position3D & p, const Direction3D & f) { position = p; setForward(f); } void - setView(const glm::vec3 & p, const glm::vec3 & f, const glm::vec3 & u) + setView(const Position3D & p, const Direction3D & f, const Direction3D & u) { position = p; setView(f, u); } void - lookAt(const glm::vec3 & target) + lookAt(const Position3D & target) { setForward(glm::normalize(target - position)); } @@ -71,14 +72,14 @@ public: [[nodiscard]] std::array extentsAtDist(float) const; - [[nodiscard]] static glm::vec3 upFromForward(const glm::vec3 & forward); + [[nodiscard]] static Direction3D upFromForward(const Direction3D & forward); private: void updateView(); - glm::vec3 position; - glm::vec3 forward; - glm::vec3 up; + Position3D position; + Direction3D forward; + Direction3D up; float near, far; glm::mat4 projection; -- cgit v1.2.3