Wasabi
Public Member Functions | Static Public Member Functions | List of all members
WCamera Class Reference

#include <WCamera.hpp>

Inheritance diagram for WCamera:
WBase WOrientation

Public Member Functions

virtual std::string GetTypeName () const override
 
virtual void SetID (uint32_t newID) override
 
virtual void SetName (std::string newName) override
 
 WCamera (Wasabi *const app, uint32_t ID=0)
 
void OnStateChange (STATE_CHANGE_TYPE type) override
 
void UpdateInternals ()
 
void EnableAutoAspect ()
 
void DisableAutoAspect ()
 
void SetRange (float min, float max)
 
void SetFOV (float fValue)
 
void SetAspect (float aspect)
 
void SetProjectionType (W_PROJECTIONTYPE type)
 
void Render (uint32_t width, uint32_t height)
 
WMatrix GetViewMatrix () const
 
WMatrix GetProjectionMatrix (bool bForceOrtho=false) const
 
float GetMinRange () const
 
float GetMaxRange () const
 
float GetFOV () const
 
float GetAspect () const
 
bool CheckPointInFrustum (float x, float y, float z) const
 
bool CheckPointInFrustum (WVector3 point) const
 
bool CheckCubeInFrustum (float x, float y, float z, float radius) const
 
bool CheckCubeInFrustum (WVector3 pos, float radius) const
 
bool CheckSphereInFrustum (float x, float y, float z, float radius) const
 
bool CheckSphereInFrustum (WVector3 pos, float radius) const
 
bool CheckBoxInFrustum (float x, float y, float z, float xSize, float ySize, float zSize) const
 
bool CheckBoxInFrustum (WVector3 pos, WVector3 size) const
 
virtual bool Valid () const override
 
- Public Member Functions inherited from WBase
 WBase (class Wasabi *const app, uint32_t ID=0)
 
uint32_t GetID () const
 
std::string GetName () const
 
class WasabiGetAppPtr () const
 
void AddReference ()
 
void RemoveReference ()
 
- Public Member Functions inherited from WOrientation
void SetPosition (float x, float y, float z)
 
void SetPosition (const WVector3 pos)
 
void Point (float x, float y, float z)
 
void Point (WVector3 target)
 
void SetAngle (WQuaternion quat)
 
void SetToRotation (const WOrientation *const device)
 
void SetULRVectors (WVector3 up, WVector3 look, WVector3 right)
 
void SetToTransformation (WMatrix mtx)
 
void Yaw (float angle)
 
void Roll (float angle)
 
void Pitch (float angle)
 
void Move (float units)
 
void Strafe (float units)
 
void Fly (float units)
 
float GetPositionX () const
 
float GetPositionY () const
 
float GetPositionZ () const
 
WVector3 GetPosition () const
 
float GetAngleX () const
 
float GetAngleY () const
 
float GetAngleZ () const
 
WQuaternion GetRotation () const
 
WVector3 GetUVector () const
 
WVector3 GetLVector () const
 
WVector3 GetRVector () const
 
virtual void SetBindingMatrix (WMatrix mtx)
 
void RemoveBinding ()
 
WMatrix GetBindingMatrix () const
 
bool IsBound () const
 
WMatrix ComputeTransformation () const
 
WMatrix ComputeInverseTransformation () const
 

Static Public Member Functions

static std::string _GetTypeName ()
 

Additional Inherited Members

- Protected Attributes inherited from WBase
class Wasabim_app
 
uint32_t m_ID
 
std::string m_name
 

Detailed Description

This implements a camera in Wasabi.

Member Function Documentation

◆ _GetTypeName()

static std::string WCamera::_GetTypeName ( )
static

Returns "Camera" string.

Returns
Returns "Camera" string

◆ CheckBoxInFrustum() [1/2]

bool WCamera::CheckBoxInFrustum ( float  x,
float  y,
float  z,
float  xSize,
float  ySize,
float  zSize 
) const

Checks if a given box is in the viewing frustum of the camera

Parameters
xBox center x
yBox center y
zBox center z
xSizeBox dimension x from the center to the edge
ySizeBox dimension y from the center to the edge
zSizeBox dimension z from the center to the edge
Returns
true if the box is in the viewing frustum, false otherwise

◆ CheckBoxInFrustum() [2/2]

bool WCamera::CheckBoxInFrustum ( WVector3  pos,
WVector3  size 
) const

Checks if a given box is in the viewing frustum of the camera

Parameters
posBox center
sizeBox dimensions from the center to each edge
Returns
true if the box is in the viewing frustum, false otherwise

◆ CheckCubeInFrustum() [1/2]

bool WCamera::CheckCubeInFrustum ( float  x,
float  y,
float  z,
float  radius 
) const

Checks if a given cube is in the viewing frustum of the camera.

Parameters
xCube center x
yCube center y
zCube center z
radiusCube diagonal (distance from the center to a corner)
Returns
true if the cube is in the viewing frustum, false otherwise

◆ CheckCubeInFrustum() [2/2]

bool WCamera::CheckCubeInFrustum ( WVector3  pos,
float  radius 
) const

Checks if a given cube is in the viewing frustum of the camera.

Parameters
posCube center
radiusCube diagonal (distance from the center to a corner)
Returns
true if the cube is in the viewing frustum, false otherwise

◆ CheckPointInFrustum() [1/2]

bool WCamera::CheckPointInFrustum ( float  x,
float  y,
float  z 
) const

Checks if a given point is in the viewing frustum of the camera.

Parameters
xPoint x
yPoint y
zPoint z
Returns
true if (x, y, z) is in the viewing frustum, false otherwise

◆ CheckPointInFrustum() [2/2]

bool WCamera::CheckPointInFrustum ( WVector3  point) const

Checks if a given point is in the viewing frustum of the camera.

Parameters
pointPoint to check
Returns
true if point is in the viewing frustum, false otherwise

◆ CheckSphereInFrustum() [1/2]

bool WCamera::CheckSphereInFrustum ( float  x,
float  y,
float  z,
float  radius 
) const

Checks if a given sphere is in the viewing frustum of the camera.

Parameters
xSphere center x
ySphere center y
zSphere center z
radiusSphere radius
Returns
true if the sphere is in the viewing frustum, false otherwise

◆ CheckSphereInFrustum() [2/2]

bool WCamera::CheckSphereInFrustum ( WVector3  pos,
float  radius 
) const

Checks if a given sphere is in the viewing frustum of the camera.

Parameters
posSphere center
radiusSphere radius
Returns
true if the sphere is in the viewing frustum, false otherwise

◆ DisableAutoAspect()

void WCamera::DisableAutoAspect ( )

Enables auto aspect ratio calculation when the window/viewport size changes. Auto aspect ratio is calculated as viewport_width / viewport_height.

◆ EnableAutoAspect()

void WCamera::EnableAutoAspect ( )

Enables auto aspect ratio calculation when the window/viewport size changes. Auto aspect ratio is calculated as viewport_width / viewport_height.

◆ GetAspect()

float WCamera::GetAspect ( ) const

Retrieves the aspect ratio.

Returns
Aspect ratio

◆ GetFOV()

float WCamera::GetFOV ( ) const

Retrieves the FOV (field of view).

Returns
FOV (field of view) in degrees

◆ GetMaxRange()

float WCamera::GetMaxRange ( ) const

Retrieves the maximum draw distance.

Returns
Maximum draw distance

◆ GetMinRange()

float WCamera::GetMinRange ( ) const

Retrieves the minimum draw distance.

Returns
Minimum draw distance

◆ GetProjectionMatrix()

WMatrix WCamera::GetProjectionMatrix ( bool  bForceOrtho = false) const

Retrieves the current projection matrix

Returns
Current projection matrix Retrieves the current projection matrix
Parameters
bForceOrthoIf set to true, the returned projection matrix will be forcefully set to use PROJECTION_ORTHOGONAL for this call
Returns
Current projection matrix

◆ GetTypeName()

virtual std::string WCamera::GetTypeName ( ) const
overridevirtual

This function must be implemented by a child class. This is used for debugging, in which a class should return its name.

Returns
The name of the class

Implements WBase.

◆ GetViewMatrix()

WMatrix WCamera::GetViewMatrix ( ) const

Retrieves the current view matrix

Returns
Current view matrix

◆ OnStateChange()

void WCamera::OnStateChange ( STATE_CHANGE_TYPE  type)
overridevirtual

This is a callback (inherited from WOrientation) to inform this object of a change in orientation.

Parameters
typeOrientation change type (rotation or motion)

Reimplemented from WOrientation.

◆ Render()

void WCamera::Render ( uint32_t  width,
uint32_t  height 
)

Prepares the camera such that its' matrices can be used to perform transformations such as object rendering.

Parameters
widthWidth of the rendering viewport
heightHeight of the rendering viewport

◆ SetAspect()

void WCamera::SetAspect ( float  aspect)

Sets the aspect ratio. If auto aspect ratio is enabled, this will be overridden on the next UpdateInternals() or Render().

Parameters
aspectNew aspect ratio

◆ SetFOV()

void WCamera::SetFOV ( float  fValue)

Set the FOV (field of view) for the camera.

Parameters
fValueNew field of view, in degrees

◆ SetID()

virtual void WCamera::SetID ( uint32_t  newID)
overridevirtual

Sets the ID of this object and notifies its manager.

Parameters
newIDNew ID

Implements WBase.

◆ SetName()

virtual void WCamera::SetName ( std::string  newName)
overridevirtual

Sets the name of this object.

Parameters
nameNew name for the object

Implements WBase.

◆ SetProjectionType()

void WCamera::SetProjectionType ( W_PROJECTIONTYPE  type)

Sets the projection type for this camera.

Parameters
typeType of projection

◆ SetRange()

void WCamera::SetRange ( float  min,
float  max 
)

Sets the range in which the camera can see. The camera cannot render closer to it than min and farther to it than max.

Parameters
minminimum draw distance
maxmaximum draw distance

◆ UpdateInternals()

void WCamera::UpdateInternals ( )

Update the matrices to match the latest changes. This is automatically called during rendering of a camera.

◆ Valid()

virtual bool WCamera::Valid ( ) const
overridevirtual

Checks if the camera is valid (always true).

Returns
true

Implements WBase.


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