raylib-cpp
C++ object-oriented wrapper library for raylib.
Public Member Functions | Protected Member Functions | List of all members
raylib::Camera3D Class Reference

Camera type, defines a camera position/orientation in 3d space. More...

Public Member Functions

 Camera3D (::Vector3 position, ::Vector3 target=::Vector3{0.0f, 0.0f, 0.0f}, ::Vector3 up=::Vector3{0.0f, 1.0f, 0.0f}, float fovy=0, int projection=CAMERA_PERSPECTIVE)
 Create a new Camera3D. More...
 
 Camera3D (const ::Camera3D &camera)
 
Camera3DBeginMode ()
 Initializes 3D mode with custom camera (3D)
 
void DrawBillboard (const ::Texture2D &texture, ::Rectangle sourceRec, ::Vector3 center, ::Vector2 size, ::Color tint={255, 255, 255, 255}) const
 Draw a billboard texture defined by source.
 
void DrawBillboard (const ::Texture2D &texture, ::Vector3 center, float size, ::Color tint={255, 255, 255, 255}) const
 Draw a billboard texture.
 
Camera3DEndMode ()
 Ends 3D mode and returns to default 2D orthographic mode.
 
float GetFovy () const
 Retrieves the fovy value for the object. More...
 
Matrix GetMatrix () const
 Get camera transform matrix (view matrix)
 
Ray GetMouseRay (::Vector2 mousePosition) const
 Returns a ray trace from mouse position.
 
::Vector3 GetPosition () const
 Retrieves the position value for the object. More...
 
int GetProjection () const
 Retrieves the projection value for the object. More...
 
Ray GetScreenToWorldRay (::Vector2 position, int width, int height)
 Get a ray trace from screen position (i.e mouse) in a viewport.
 
::Vector3 GetTarget () const
 Retrieves the target value for the object. More...
 
::Vector3 GetUp () const
 Retrieves the up value for the object. More...
 
Vector2 GetWorldToScreen (::Vector3 position) const
 Returns the screen space position for a 3d world space position.
 
Camera3Doperator= (const ::Camera3D &camera)
 
void SetFovy (float value)
 Sets the fovy value for the object. More...
 
void SetPosition (::Vector3 value)
 Sets the position value for the object. More...
 
void SetProjection (int value)
 Sets the projection value for the object. More...
 
void SetTarget (::Vector3 value)
 Sets the target value for the object. More...
 
void SetUp (::Vector3 value)
 Sets the up value for the object. More...
 
Camera3DUpdate (::Vector3 movement, ::Vector3 rotation, float zoom=1.0f)
 Update camera movement/rotation.
 
Camera3DUpdate (int mode)
 Update camera position for selected mode.
 

Protected Member Functions

void set (const ::Camera3D &camera)
 

Detailed Description

Camera type, defines a camera position/orientation in 3d space.

Definition at line 12 of file Camera3D.hpp.

Constructor & Destructor Documentation

◆ Camera3D()

raylib::Camera3D::Camera3D ( ::Vector3  position,
::Vector3  target = ::Vector3{0.0f, 0.0f, 0.0f},
::Vector3  up = ::Vector3{0.0f, 1.0f, 0.0f},
float  fovy = 0,
int  projection = CAMERA_PERSPECTIVE 
)
inline

Create a new Camera3D.

Parameters
positionCamera position
targetCamera target it looks-at
upCamera up vector (rotation over its axis)
fovyCamera field-of-view apperture in Y (degrees) in perspective, used as near plane width in orthographic
projectionCamera projection: CAMERA_PERSPECTIVE or CAMERA_ORTHOGRAPHIC

Definition at line 26 of file Camera3D.hpp.

Member Function Documentation

◆ GetFovy()

float raylib::Camera3D::GetFovy ( ) const
inline

Retrieves the fovy value for the object.

Returns
The fovy value of the object.

Definition at line 39 of file Camera3D.hpp.

◆ GetPosition()

::Vector3 raylib::Camera3D::GetPosition ( ) const
inline

Retrieves the position value for the object.

Returns
The position value of the object.

Definition at line 36 of file Camera3D.hpp.

◆ GetProjection()

int raylib::Camera3D::GetProjection ( ) const
inline

Retrieves the projection value for the object.

Returns
The projection value of the object.

Definition at line 40 of file Camera3D.hpp.

◆ GetTarget()

::Vector3 raylib::Camera3D::GetTarget ( ) const
inline

Retrieves the target value for the object.

Returns
The target value of the object.

Definition at line 37 of file Camera3D.hpp.

◆ GetUp()

::Vector3 raylib::Camera3D::GetUp ( ) const
inline

Retrieves the up value for the object.

Returns
The up value of the object.

Definition at line 38 of file Camera3D.hpp.

◆ SetFovy()

void raylib::Camera3D::SetFovy ( float  value)
inline

Sets the fovy value for the object.

Parameters
valueThe value of which to set fovy to.

Definition at line 39 of file Camera3D.hpp.

◆ SetPosition()

void raylib::Camera3D::SetPosition ( ::Vector3  value)
inline

Sets the position value for the object.

Parameters
valueThe value of which to set position to.

Definition at line 36 of file Camera3D.hpp.

◆ SetProjection()

void raylib::Camera3D::SetProjection ( int  value)
inline

Sets the projection value for the object.

Parameters
valueThe value of which to set projection to.

Definition at line 40 of file Camera3D.hpp.

◆ SetTarget()

void raylib::Camera3D::SetTarget ( ::Vector3  value)
inline

Sets the target value for the object.

Parameters
valueThe value of which to set target to.

Definition at line 37 of file Camera3D.hpp.

◆ SetUp()

void raylib::Camera3D::SetUp ( ::Vector3  value)
inline

Sets the up value for the object.

Parameters
valueThe value of which to set up to.

Definition at line 38 of file Camera3D.hpp.