Copperfield Engine 0.1
C++ Game Engine
Loading...
Searching...
No Matches
CameraCmp Struct Reference

Component used to render the scene. There must be one and only one of this component on the scene. More...

#include <default_components.hpp>

Public Member Functions

 CameraCmp (const CameraProjection projection, const coma::Vec3 &target, const float fov=60.0f, const float z_near=0.01f, const float z_far=1000.0f)
 Creates a CameraCmp with rotate_towards_target_ set to true. More...
 
 CameraCmp (const CameraProjection projection, const float fov=60.0f, const float z_near=0.01f, const float z_far=1000.0f)
 Creates a CameraCmp with rotate_towards_target_ set to false. More...
 

Public Attributes

CameraProjection projection_ = CameraProjection::kPerspective
 Defines the CameraProjection to use.
 
float fov_ = 60.0f
 Angular extent of the observable world that is seen at any given moment.
 
float z_near_ = 0.01f
 Minimum distance to render.
 
float z_far_ = 1000.0f
 Maximum distance to render.
 
coma::Vec3 target_ = coma::Vec3::zero
 Defines the position the camera will look at if rotate_towards_target_ is set to true.
 
bool rotate_towards_target_ = false
 Defines how the rotation of the camera should behave: More...
 

Detailed Description

Component used to render the scene. There must be one and only one of this component on the scene.

Constructor & Destructor Documentation

◆ CameraCmp() [1/2]

CameraCmp::CameraCmp ( const CameraProjection  projection,
const coma::Vec3 target,
const float  fov = 60.0f,
const float  z_near = 0.01f,
const float  z_far = 1000.0f 
)
inline

Creates a CameraCmp with rotate_towards_target_ set to true.

Parameters
projectionprojection_
targettarget_
fovfov_
z_nearz_near_
z_farz_far_

◆ CameraCmp() [2/2]

CameraCmp::CameraCmp ( const CameraProjection  projection,
const float  fov = 60.0f,
const float  z_near = 0.01f,
const float  z_far = 1000.0f 
)
inline

Creates a CameraCmp with rotate_towards_target_ set to false.

Parameters
projectionprojection_
fovfov_
z_nearz_near_
z_farz_far_

Member Data Documentation

◆ rotate_towards_target_

bool CameraCmp::rotate_towards_target_ = false

Defines how the rotation of the camera should behave:

  • false: will use the rotation of the TransformCmp.
  • true: will use target_ to rotate itself towards it.