27#pragma region static_functions
39 static auto init(GLFWwindow* window,
int width,
int height) -> void;
45 static auto view() ->
const Eigen::Matrix4f&;
50 static auto projection() ->
const Eigen::Matrix4f&;
52 static auto screen() ->
const Eigen::Matrix4f&;
63#pragma region overridden_functions
67 return std::make_unique<Camera>(*
this);
70 auto onUpdate(
float dt) ->
void override;
81 auto load(
const Stream& stream) ->
void override;
82 auto save(
Stream& stream)
const ->
void override;
86#pragma region Camera_Functions
98#pragma region member_variables
102#pragma region helper_functions
110 static auto resizeViewport(GLFWwindow* window,
int width,
int height) -> void;
134 static auto lookAt(
const Eigen::Vector3f& eye,
const Eigen::Vector3f center,
135 const Eigen::Vector3f up) -> Eigen::Matrix4f;
140#pragma region static_variables
sys::Json Stream
Definition AudioObject.h:20
GameObject(std::string typeName, gobj::Type parentType, gobj::Type type)
constructor for gameobject.
Definition GameObject.cpp:24
Type
Definition System.h:20
@ Camera
Definition System.h:27
System(const std::string &typeName, Type systemType)
Definition System.cpp:75
auto systemShowMenu() -> void override
Specific systems should override this function to show their specific menu for the system.
Definition Camera.cpp:61
static Eigen::Matrix4f projectionTransform
the camera space to NDC transform
Definition Camera.h:145
static auto init(GLFWwindow *window, int width, int height) -> void
Definition Camera.cpp:225
static auto screen() -> const Eigen::Matrix4f &
Definition Camera.cpp:241
static Eigen::Matrix4f viewTransform
the world to camera space transform
Definition Camera.h:143
auto load(const Stream &stream) -> void override
Implementations will load the state of a GameObject from a th::Json Object.
Definition Camera.cpp:70
static auto resizeViewport(GLFWwindow *window, int width, int height) -> void
callback function that opengl calls when the window resizes
Definition Camera.cpp:199
Camera(const Camera &other)=default
auto operator=(const Camera &other) -> Camera &
Definition Camera.cpp:43
static void calculateAllTransforms(int width, int height)
helper function to update all the camera transforms based on camera's position, and new width and hei...
Definition Camera.cpp:176
static auto calculateScreen(int w, int h) -> void
helper function to calculate the screen matrix transform
Definition Camera.cpp:106
static auto getEnum() -> Type
function required by all systems
Definition Camera.h:34
auto clone() const -> std::unique_ptr< GameObject > override
makes a copy a GameObject even if it's held polymorphically
Definition Camera.h:65
auto save(Stream &stream) const -> void override
Implementations will load the state of a GameObject to a th::Json object.
Definition Camera.cpp:75
static auto lookAt(const Eigen::Vector3f &eye, const Eigen::Vector3f center, const Eigen::Vector3f up) -> Eigen::Matrix4f
calculate the camera matrix transform, based on pointing to a specific object
Definition Camera.cpp:85
auto operator=(Camera &&other) noexcept -> Camera &=default
auto onRender() -> void override
called every frame after update has been called for every object.
Definition Camera.cpp:66
auto endWindow() -> void override
currently unused, but intended to but was assumed to be necessary for a proper ImGui editor
Definition Camera.h:72
static auto view() -> const Eigen::Matrix4f &
gets the view transform for the camera
Definition Camera.cpp:231
Camera()
Definition Camera.cpp:31
static float nearPlane
Definition Camera.h:29
static Eigen::Matrix4f NDCToScreen
the NDC to screen transform
Definition Camera.h:147
static auto projection() -> const Eigen::Matrix4f &
Gets the orthogonal projection matrix for the camera.
Definition Camera.cpp:236
static float farPlane
Definition Camera.h:28
~Camera() override=default
static auto calculateProjection(int width, int height, Eigen::Vector3f cameraPos) -> void
helper function to calculate the projection matrix transform
Definition Camera.cpp:133
auto onUpdate(float dt) -> void override
called once every frame.
Definition Camera.cpp:56
the type of elements in a basic_json container
Definition GameObject.h:37