3#include <entt/entt.hpp>
30 std::shared_ptr<SceneNode> sceneNode,
32 float nearPlane = 0.01f,
33 float farPlane = 1000.0f);
38 void tick(
double deltaTime)
override;
A camera component that provides view and projection matrices based on its SceneNode transform....
void endPlay() override
Called when the component is removed or the game ends.
bool isActive() const
Checks if this camera is currently the active camera.
entt::entity cameraEntity_
void setAspectRatio(float aspectRatio)
Sets the aspect ratio (width / height)
glm::vec3 getForwardVector() const
Gets the forward direction vector of the camera.
glm::mat4 cachedProjectionMatrix_
glm::mat4 getProjectionMatrix() const
Gets the projection matrix based on FOV, aspect ratio, and clipping planes.
CameraComponent(Scene *owningScene, std::shared_ptr< SceneNode > sceneNode, float fov=60.0f, float nearPlane=0.01f, float farPlane=1000.0f)
Constructs a camera component with default parameters.
~CameraComponent() override=default
glm::mat4 getViewProjectionMatrix() const
Gets the combined view-projection matrix.
glm::vec3 getWorldPosition() const
Gets the camera's world position from its scene node.
glm::vec3 getUpVector() const
Gets the up direction vector of the camera.
glm::vec3 getRightVector() const
Gets the right direction vector of the camera.
void setActive(bool active)
Sets this camera as the active camera for rendering.
float getAspectRatio() const
Gets the aspect ratio.
glm::mat4 getViewMatrix() const
Gets the view matrix computed from the camera's world transform.
void setFov(float fov)
Sets the vertical field of view.
void updateProjectionMatrix()
void tick(double deltaTime) override
Called every frame if ticking is enabled.
float getFarPlane() const
Gets the far clipping plane distance.
float getFov() const
Gets the vertical field of view.
void beginPlay() override
Called when the component is added to the scene or the game starts.
static constexpr bool IsUnique
float getNearPlane() const
Gets the near clipping plane distance.
std::shared_ptr< SceneNode > getSceneNode() const
Gets the scene node associated with this camera.
void setNearPlane(float nearPlane)
Sets the near clipping plane distance.
std::shared_ptr< SceneNode > sceneNode_
void setFarPlane(float farPlane)
Sets the far clipping plane distance.
LogicComponent(Scene *owningScene)
Represents a node in the scene graph, containing information about its position, rotation,...
A scene is the overarching structure which can spawn actors.
Log category system implementation.
bool hasActiveCamera()
Checks if there is an active camera set.
CameraComponent * getActiveCamera()
Gets the currently active camera.