Clutter Engine 0.0.1
Loading...
Searching...
No Matches
clt::CameraComponent Class Reference

Camera component for rendering scenes from a specific viewpoint. More...

#include <CameraComponent.h>

Inheritance diagram for clt::CameraComponent:
clt::Component

Public Member Functions

 CameraComponent (float pFOV=70.0f, ProjectionMode pProjectionMode=ProjectionMode::Perspective, float pNearPlane=0.1f, float pFarPlane=10000.0f)
 Constructs a CameraComponent with specified parameters.
 
 ~CameraComponent ()
 Destructor.
 
virtual void Update () override
 Updates the camera component.
 
void SetFOV (float pFOV)
 Sets the field of view.
 
void SetProjectionMode (ProjectionMode pProjectionMode)
 Sets the projection mode.
 
void SetActive (CameraComponent *cam)
 Sets the specified camera as active.
 
void SetActive ()
 Sets this camera as the active camera.
 
const Matrix4RowGetViewMatrix ()
 Gets the view matrix.
 
const Matrix4RowGetProjectionMatrix ()
 Gets the projection matrix.
 
const Matrix4RowGetViewProjMatrices ()
 Gets the combined view-projection matrix.
 
- Public Member Functions inherited from clt::Component
 Component (int pUpdateOrder=0)
 Constructor for Component.
 
virtual ~Component ()=default
 Virtual destructor for Component.
 
virtual void Start ()
 Called when the component is started.
 
virtual void Destroy ()
 Called to destroy the component.
 
void SetActive (bool pActive)
 Enables or disables the component.
 
void OnDestroy ()
 Called when the component is destroyed.
 
bool IsActive () const
 Checks if the component is enabled.
 
int GetUpdateOrder () const
 Gets the update order of the component.
 
void SetRelativeLocation (const Vector3 &loc)
 Sets the relative location of the component.
 
void SetRelativeLocation (const Vector2 &loc)
 Sets the relative location of the component.
 
void SetWorldLocation (const Vector3 &loc)
 Sets the world location of the component.
 
void SetRelativeScale (const Vector3 &scale)
 Sets the relative scale of the component.
 
void SetRelativeScale (const Vector2 &scale)
 Sets the relative scale of the component.
 
void SetRelativeRotation (Quaternion rot)
 Sets the relative rotation of the component.
 
void SetRelativeRotation (Vector3 rot)
 Sets the relative rotation of the component.
 
void SetWorldRotation (const Quaternion &rot)
 Sets the world rotation of the component.
 
void SetWorldRotation (const Vector3 &rot)
 Sets the world rotation of the component.
 
void AddRelativeRotation (Vector3 rot)
 Adds a rotation to the current relative rotation.
 
void SetRelativeRotation (float rot)
 Sets the relative rotation of the component.
 
void SetRelativeTransform (Transform &transform)
 Sets the relative transform of the component.
 
Vector3 GetRelativeLocation () const
 Gets the relative location of the component.
 
Vector3 GetRelativeScale () const
 Gets the relative scale of the component.
 
Quaternion GetRelativeRotation () const
 Gets the relative rotation of the component.
 
Vector3 GetRelativeRotationEuler () const
 Gets the relative rotation of the component as Euler angles.
 
Transform GetRelativeTransform () const
 Gets the relative transform of the component.
 
Vector3 GetWorldLocation () const
 Gets the world location of the component.
 
Vector3 GetWorldScale () const
 Gets the world scale of the component.
 
Quaternion GetWorldRotation () const
 Gets the world rotation of the component.
 
virtual Transform GetWorldTransform () const
 Gets the world transform of the component.
 
ActorGetOwner () const
 Gets the owner actor of this component.
 

Static Public Member Functions

static CameraComponentGetActiveCamera ()
 Gets the currently active camera.
 

Additional Inherited Members

- Public Attributes inherited from clt::Component
friend Actor
 
- Protected Member Functions inherited from clt::Component
bool LineTrace (Vector3 start, Vector3 direction, float maxDistance, raycastHit &hit, bool debugPersistant=false)
 Performs a line trace (raycast) using the owning actor.
 
- Protected Attributes inherited from clt::Component
bool mIsActive = true
 Indicates if the component is active.
 
int mUpdateOrder = 0
 The order in which the component is updated.
 
ActormOwner
 The actor that owns this component.
 
Transform mRelativeTransform
 The relative transform of the component to its owner.
 

Detailed Description

Camera component for rendering scenes from a specific viewpoint.

Handles view and projection matrices, projection mode, and camera activation.

Constructor & Destructor Documentation

◆ CameraComponent()

CameraComponent::CameraComponent ( float pFOV = 70.0f,
ProjectionMode pProjectionMode = ProjectionMode::Perspective,
float pNearPlane = 0.1f,
float pFarPlane = 10000.0f )

Constructs a CameraComponent with specified parameters.

Parameters
pFOVField of view in degrees (default: 70.0f).
pProjectionModeProjection mode (default: Perspective).
pNearPlaneNear clipping plane (default: 0.1f).
pFarPlaneFar clipping plane (default: 10000.0f).

Member Function Documentation

◆ GetActiveCamera()

CameraComponent * CameraComponent::GetActiveCamera ( )
static

Gets the currently active camera.

Returns
Pointer to the active CameraComponent.

◆ GetProjectionMatrix()

const Matrix4Row & clt::CameraComponent::GetProjectionMatrix ( )
inline

Gets the projection matrix.

Returns
Reference to the projection matrix.

◆ GetViewMatrix()

const Matrix4Row & clt::CameraComponent::GetViewMatrix ( )
inline

Gets the view matrix.

Returns
Reference to the view matrix.

◆ GetViewProjMatrices()

const Matrix4Row & clt::CameraComponent::GetViewProjMatrices ( )
inline

Gets the combined view-projection matrix.

Returns
Reference to the combined view-projection matrix.

◆ SetActive()

void CameraComponent::SetActive ( CameraComponent * cam)

Sets the specified camera as active.

Parameters
camPointer to the camera to activate.

◆ SetFOV()

void CameraComponent::SetFOV ( float pFOV)

Sets the field of view.

Parameters
pFOVField of view in degrees.

◆ SetProjectionMode()

void CameraComponent::SetProjectionMode ( ProjectionMode pProjectionMode)

Sets the projection mode.

Parameters
pProjectionModeThe new projection mode.

◆ Update()

void CameraComponent::Update ( )
overridevirtual

Updates the camera component.

Reimplemented from clt::Component.


The documentation for this class was generated from the following files: