27 std::shared_ptr<Entities::SceneNode> sceneNode,
29 float nearPlane = 0.01f,
30 float farPlane = 1000.0f);
35 void tick(
double deltaTime)
override;
A camera component that provides view and projection matrices based on its SceneNode transform....
void tick(double deltaTime) override
Called every frame if ticking is enabled.
std::shared_ptr< Entities::SceneNode > getSceneNode() const
Gets the scene node associated with this camera.
virtual glm::mat4 getViewMatrix() const
Gets the view matrix computed from the camera's world transform.
virtual glm::mat4 getEyeViewMatrix(size_t eyeIndex) const
Gets the view matrix for a specific eye. Base returns getViewMatrix() for both (mono).
static constexpr bool IsUnique
void setAspectRatio(float aspectRatio)
Sets the aspect ratio (width / height)
void setActive(bool active)
Sets this camera as the active camera for rendering.
glm::vec3 getRightVector() const
Gets the right direction vector of the camera.
float getNearPlane() const
Gets the near clipping plane distance.
glm::mat4 cachedProjectionMatrix_
void setFov(float fov)
Sets the vertical field of view.
glm::vec3 getWorldPosition() const
Gets the camera's world position from its scene node.
void endPlay() override
Called when the component is removed or the game ends.
float getFarPlane() const
Gets the far clipping plane distance.
Camera(Entities::Scene *owningScene, std::shared_ptr< Entities::SceneNode > sceneNode, float fov=60.0f, float nearPlane=0.01f, float farPlane=1000.0f)
Constructs a camera component with default parameters.
glm::vec3 getUpVector() const
Gets the up direction vector of the camera.
std::shared_ptr< Entities::SceneNode > sceneNode_
virtual glm::mat4 getProjectionMatrix() const
Gets the projection matrix based on FOV, aspect ratio, and clipping planes.
glm::vec3 getForwardVector() const
Gets the forward direction vector of the camera.
~Camera() override=default
void setNearPlane(float nearPlane)
Sets the near clipping plane distance.
bool isActive() const
Checks if this camera is currently the active camera.
virtual glm::mat4 getEyeProjectionMatrix(size_t eyeIndex) const
Gets the projection matrix for a specific eye. Base returns getProjectionMatrix() for both (mono).
entt::entity cameraEntity_
void updateProjectionMatrix()
void setFarPlane(float farPlane)
Sets the far clipping plane distance.
static constexpr const char * ComponentName
void beginPlay() override
Called when the component is added to the scene or the game starts.
glm::mat4 getViewProjectionMatrix() const
Gets the combined view-projection matrix.
float getFov() const
Gets the vertical field of view.
float getAspectRatio() const
Gets the aspect ratio.
Logic(Entities::Scene *owningScene)
A scene is the overarching structure which can spawn, contain and destroy actors or entities.
bool hasActiveCamera()
Checks if there is an active camera set.
Camera * getActiveCamera()
Gets the currently active camera.