X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fgraphics%2FCamera.hpp;h=e4c0b7fce04ddc37841a78ab57f6d667140ddc84;hb=cd80d7cfcac3c58d601db2ab4e0381dd77c06f44;hp=7cc141ecb65e150b8b65b53632c19586a422ab23;hpb=be413456f57da06e918ae7bf4c4f35e5198ff7ce;p=blobs.git diff --git a/src/graphics/Camera.hpp b/src/graphics/Camera.hpp index 7cc141e..e4c0b7f 100644 --- a/src/graphics/Camera.hpp +++ b/src/graphics/Camera.hpp @@ -1,16 +1,22 @@ #ifndef BLOBS_GRAPHICS_CAMERA_HPP_ #define BLOBS_GRAPHICS_CAMERA_HPP_ -#include "glm.hpp" +#include "../math/glm.hpp" namespace blobs { +namespace creature { + class Creature; +} +namespace world { + class Body; +} namespace graphics { class Camera { public: - Camera() noexcept; + explicit Camera(const world::Body &) noexcept; ~Camera() noexcept; Camera(const Camera &) = delete; @@ -20,14 +26,22 @@ public: Camera &operator =(Camera &&) = delete; public: - void FOV(float f) noexcept; - void Aspect(float r) noexcept; - void Aspect(float w, float h) noexcept; - void Clip(float near, float far) noexcept; + Camera &FOV(float f) noexcept; + Camera &Aspect(float r) noexcept; + Camera &Aspect(float w, float h) noexcept; + Camera &Clip(float near, float far) noexcept; + + const world::Body &Reference() const noexcept { return *ref; } + Camera &Reference(const world::Body &) noexcept; + + /// look at center, position relative to orbital reference plane for children + Camera &Orbital(const glm::vec3 &pos) noexcept; + /// look at creature from the side, angle in euler (ZXY in surface reference plane) + Camera &Radial(const creature::Creature &, double distance, const glm::dvec3 &angle); const glm::mat4 &Projection() const noexcept { return projection; } const glm::mat4 &View() const noexcept { return view; } - void View(const glm::mat4 &v) noexcept; + glm::mat4 Model(const world::Body &) const noexcept; private: void UpdateProjection() noexcept; @@ -41,6 +55,11 @@ private: glm::mat4 projection; glm::mat4 view; + // reference frame + const world::Body *ref; + // track reference body's orientation + bool track_orient; + }; }