23 glm::mat4 projection_matrix;
26 glm::mat4 last_projection_matrix;
28 std::shared_ptr<ShaderManager> shader_manager;
30 float viewport_height;
35 glm::vec2 target_position;
37 int screen_padding_in_tiles;
39 float free_camera_speed;
41 Transform negateTransformForScreen(std::shared_ptr<Transform> trans);
49 Camera(
const std::shared_ptr<ShaderManager> shader_manager);
59 Camera(
const std::shared_ptr<ShaderManager> shader_manager,
const float viewport_width,
const float viewport_height,
const float near = 0.1,
const float far = 1.0);
60 virtual void onStart()
override;
61 virtual bool onUpdate(
const double delta)
override;
83 void setWidth(
const float width) noexcept;
95 void setHeight(
const float height) noexcept;
107 void setNear(
const float near) noexcept;
113 float getNear()
const noexcept;
119 void setFar(
const float far) noexcept;
125 float getFar()
const noexcept;
154 virtual std::string
className()
const noexcept
override;
159 virtual void onNotifyNow(std::shared_ptr<Events::Event> event)
override;
162 virtual void log(el::base::type::ostream_t& os)
const override;
Base Class for all components.
Definition: component.h:20
virtual void onStart() override
Called when the engine starts and when a new scene is loaded.
Definition: camera.cpp:27
glm::mat4 getProjectionMatrix() const noexcept
Gets the projection matrix.
Definition: camera.cpp:222
virtual std::string className() const noexceptoverride
Returns a string representing the class name.
Definition: camera.cpp:257
float getNear() const noexcept
Gets the near z plane.
Definition: camera.cpp:202
void setWidth(const float width) noexcept
Sets the width.
Definition: camera.cpp:182
int getScreenPaddingInTiles() const noexcept
Gets the screen padding in tiles.
Definition: camera.cpp:178
float getWidth() const noexcept
Gets the width.
Definition: camera.cpp:186
void setNear(const float near) noexcept
Sets the near z plane.
Definition: camera.cpp:198
virtual unsigned long long getValueForSorting() const noexceptoverride
Gets the value for sorting.
Definition: camera.cpp:226
virtual void handleQueuedEvent(std::shared_ptr< Events::Event > event) override
HandleQueuedEvent allows derived classes to define behaviour for when queuedEvents are received...
Definition: camera.cpp:83
virtual bool onUpdate(const double delta) override
Called every engine loop.
Definition: camera.cpp:43
void setFreeCameraSpeed(const float speed) noexcept
Sets the free camera speed when in free camera mode.
Definition: camera.cpp:214
virtual void log(el::base::type::ostream_t &os) const override
Definition: camera.cpp:252
void setHeight(const float height) noexcept
Sets the height.
Definition: camera.cpp:190
Class for camera.
Definition: camera.h:21
virtual void onDestroy() override
Called when the engine is shutting down.
Definition: camera.cpp:80
void setScreenPaddingInTiles(const int padding) noexcept
Sets the screen padding in tiles.
Definition: camera.cpp:174
float getHeight() const noexcept
Gets the height.
Definition: camera.cpp:194
bool isComponentWithin(const Component &component) const
Determines if component within.
Definition: camera.cpp:230
virtual void onNotifyNow(std::shared_ptr< Events::Event > event) override
When receiving an event that is immediate, onNotifyNow is used. It acts as an interrupt to make sure ...
Definition: camera.cpp:170
float getFreeCameraSpeed() const noexcept
Gets the free camera speed when in free camera mode.
Definition: camera.cpp:218
void setFar(const float far) noexcept
Sets the far z plane.
Definition: camera.cpp:206
float getFar() const noexcept
Gets the far z plane.
Definition: camera.cpp:210