Untold Engine  Beta v0.0.16
docs
U4DEngine::U4DDirector Class Reference

The U4DDirector class controls the updates and rendering of every game entity. It informs the engine of any touch event. It loads every shader used in the engine. More...

Public Member Functions

void setDisplayWidthHeight (float uWidth, float uHeight)
 Method which sets the dimension of the display screen. More...
 
float getDisplayHeight ()
 Method which returns the height of the display screen. More...
 
float getDisplayWidth ()
 Method which returns the width of the display screen. More...
 
void setMTLDevice (id< MTLDevice > uMTLDevice)
 Set the device required for Metal. More...
 
id< MTLDevice > getMTLDevice ()
 Gets the metal device. More...
 
void setAspect (float uAspect)
 Sets the view aspect ratio for the window. More...
 
float getAspect ()
 Gets the window aspect ratio. More...
 
void setMTLView (MTKView *uMTLView)
 Set the Metal View. More...
 
MTKView * getMTLView ()
 Gets the Metal View. More...
 
void setPerspectiveSpace (U4DMatrix4n &uSpace)
 Set the perspective projection for the view. More...
 
void setOrthographicSpace (U4DMatrix4n &uSpace)
 Set the orthographic projection for the view. More...
 
void setOrthographicShadowSpace (U4DMatrix4n &uSpace)
 Set the orthographic projection for the shadow space. More...
 
U4DMatrix4n getPerspectiveSpace ()
 Get the perspective space of the view. More...
 
U4DMatrix4n getOrthographicSpace ()
 Get the orthographics space of the view. More...
 
U4DMatrix4n getOrthographicShadowSpace ()
 Get the orthographic space of the shadow. More...
 
U4DMatrix4n computePerspectiveSpace (float fov, float aspect, float near, float far)
 Computes the perspective space of the view. More...
 
U4DMatrix4n computeOrthographicSpace (float left, float right, float bottom, float top, float near, float far)
 Computes the orthographic space of the view. More...
 
U4DMatrix4n computeOrthographicShadowSpace (float left, float right, float bottom, float top, float near, float far)
 Computes the orthographic space of the shadow. More...
 
void determineVisibility ()
 Determines if the 3D models are within the camera frustum.
 
void setShadowBiasDepth (float uValue)
 Sets the bias depth for shadow rendering. More...
 
float getShadowBiasDepth ()
 Gets the shadow depth bias. More...
 
void setPolycount (int uValue)
 sets the number of polygons the engien can render per 3d model. It is recommended to set this value as low as possible. Suggested and default value is 3000 More...
 
int getPolycount ()
 returns the number of polygons the engine can render per 3d model More...
 
void setDeviceOSType (DEVICEOSTYPE &uDeviceOSType)
 Sets the current Device OS type. e.g., iOS or mac. More...
 
DEVICEOSTYPE getDeviceOSType ()
 Get the current device OS type. e.g, iOS or mac. More...
 
void setGamePadControllerPresent (bool uValue)
 Sets the presence of a game pad controller. More...
 
bool getGamePadControllerPresent ()
 Gets if the presence of the game pad controller. More...
 
void setModelsWithinFrustum (bool uValue)
 This method is set if any model, at least one, is within the camera frustum. More...
 
bool getModelsWithinFrustum ()
 Gets if any 3D model is within the camera frustum. More...
 
void setScreenScaleFactor (float uScreenScaleFactor)
 
float getScreenScaleFactor ()
 
void setFPS (float uFPS)
 sets the fps
 
float getFPS ()
 

Static Public Member Functions

static U4DDirectorsharedInstance ()
 Method which returns an instance of the U4DDirector singleton. More...
 

Static Public Attributes

static U4DDirectorinstance =0
 Instance for U4DDirector Singleton.
 

Protected Member Functions

 U4DDirector ()
 Director Constructor.
 
 ~U4DDirector ()
 Director Destructor.
 
 U4DDirector (const U4DDirector &value)
 Copy constructor.
 
U4DDirectoroperator= (const U4DDirector &value)
 Copy constructor.
 

Detailed Description

The U4DDirector class controls the updates and rendering of every game entity. It informs the engine of any touch event. It loads every shader used in the engine.

Member Function Documentation

◆ computeOrthographicShadowSpace()

U4DMatrix4n U4DEngine::U4DDirector::computeOrthographicShadowSpace ( float  left,
float  right,
float  bottom,
float  top,
float  near,
float  far 
)

Computes the orthographic space of the shadow.

Parameters
leftleft plane
rightright plane
bottombottom plane
toptop plane
nearnear plane
farfar plane
Returns
A 4x4 matrix representing the orthographic view

◆ computeOrthographicSpace()

U4DMatrix4n U4DEngine::U4DDirector::computeOrthographicSpace ( float  left,
float  right,
float  bottom,
float  top,
float  near,
float  far 
)

Computes the orthographic space of the view.

Parameters
leftleft plane
rightright plane
bottombottom plane
toptop plane
nearnear plane
farfar plane
Returns
A 4x4 matrix representing the orthographic view

◆ computePerspectiveSpace()

U4DMatrix4n U4DEngine::U4DDirector::computePerspectiveSpace ( float  fov,
float  aspect,
float  near,
float  far 
)

Computes the perspective space of the view.

Parameters
fovField of view in degrees
aspectAspect ratio of the view window
nearNear plane
farFar plane
Returns
A 4x4 matrix representing the perspective view

◆ getAspect()

float U4DEngine::U4DDirector::getAspect ( )

Gets the window aspect ratio.

Returns
window aspect ratio

◆ getDeviceOSType()

DEVICEOSTYPE U4DEngine::U4DDirector::getDeviceOSType ( )

Get the current device OS type. e.g, iOS or mac.

Returns
enum to device OS type.

◆ getDisplayHeight()

float U4DEngine::U4DDirector::getDisplayHeight ( )

Method which returns the height of the display screen.

Returns
Returns the height of the display screen

◆ getDisplayWidth()

float U4DEngine::U4DDirector::getDisplayWidth ( )

Method which returns the width of the display screen.

Returns
Returns the width of the display screen

◆ getGamePadControllerPresent()

bool U4DEngine::U4DDirector::getGamePadControllerPresent ( )

Gets if the presence of the game pad controller.

Returns
true if the user selected the Game pad controller

◆ getModelsWithinFrustum()

bool U4DEngine::U4DDirector::getModelsWithinFrustum ( )

Gets if any 3D model is within the camera frustum.

Returns
true if a 3D model is within the camera frustum

◆ getMTLDevice()

id< MTLDevice > U4DEngine::U4DDirector::getMTLDevice ( )

Gets the metal device.

Returns
pointer to the metal device

◆ getMTLView()

MTKView * U4DEngine::U4DDirector::getMTLView ( )

Gets the Metal View.

Returns
pointer to the Metal view

◆ getOrthographicShadowSpace()

U4DEngine::U4DMatrix4n U4DEngine::U4DDirector::getOrthographicShadowSpace ( )

Get the orthographic space of the shadow.

Returns
Orthographic space of the shadow in a 4x4 matrix

◆ getOrthographicSpace()

U4DEngine::U4DMatrix4n U4DEngine::U4DDirector::getOrthographicSpace ( )

Get the orthographics space of the view.

Returns
Orthographic space of the view in a 4x4 matrix

◆ getPerspectiveSpace()

U4DEngine::U4DMatrix4n U4DEngine::U4DDirector::getPerspectiveSpace ( )

Get the perspective space of the view.

Returns
perspective space of the view in a 4x4 matrix

◆ getPolycount()

int U4DEngine::U4DDirector::getPolycount ( )

returns the number of polygons the engine can render per 3d model

Returns
Number of polys

◆ getScreenScaleFactor()

float U4DEngine::U4DDirector::getScreenScaleFactor ( )

◆ getShadowBiasDepth()

float U4DEngine::U4DDirector::getShadowBiasDepth ( )

Gets the shadow depth bias.

Returns
Shadow depth bias

◆ setAspect()

void U4DEngine::U4DDirector::setAspect ( float  uAspect)

Sets the view aspect ratio for the window.

Parameters
uAspectwindow aspect ratio

◆ setDeviceOSType()

void U4DEngine::U4DDirector::setDeviceOSType ( DEVICEOSTYPE &  uDeviceOSType)

Sets the current Device OS type. e.g., iOS or mac.

Parameters
uDeviceOSTypeenum to the device type

◆ setDisplayWidthHeight()

void U4DEngine::U4DDirector::setDisplayWidthHeight ( float  uWidth,
float  uHeight 
)

Method which sets the dimension of the display screen.

Parameters
uWidthdisplay width
uHeightdisplay height

◆ setGamePadControllerPresent()

void U4DEngine::U4DDirector::setGamePadControllerPresent ( bool  uValue)

Sets the presence of a game pad controller.

Parameters
uValueSet it to true if you wans to use the Game Pad Controller. False otherwise.

◆ setModelsWithinFrustum()

void U4DEngine::U4DDirector::setModelsWithinFrustum ( bool  uValue)

This method is set if any model, at least one, is within the camera frustum.

Parameters
uValuetrue if a 3D model is within the camera frustum

◆ setMTLDevice()

void U4DEngine::U4DDirector::setMTLDevice ( id< MTLDevice >  uMTLDevice)

Set the device required for Metal.

Parameters
uMTLDevicepointer to the device

◆ setMTLView()

void U4DEngine::U4DDirector::setMTLView ( MTKView *  uMTLView)

Set the Metal View.

Parameters
uMTLViewpointer to the Metal view

◆ setOrthographicShadowSpace()

void U4DEngine::U4DDirector::setOrthographicShadowSpace ( U4DMatrix4n uSpace)

Set the orthographic projection for the shadow space.

Parameters
uSpaceorthographic projection (4x4 matrix) for the shadow

◆ setOrthographicSpace()

void U4DEngine::U4DDirector::setOrthographicSpace ( U4DMatrix4n uSpace)

Set the orthographic projection for the view.

Parameters
uSpaceorthographic projection in a 4x4 matrix

◆ setPerspectiveSpace()

void U4DEngine::U4DDirector::setPerspectiveSpace ( U4DMatrix4n uSpace)

Set the perspective projection for the view.

Parameters
uSpaceperspective projection in a 4x4 matrix

◆ setPolycount()

void U4DEngine::U4DDirector::setPolycount ( int  uValue)

sets the number of polygons the engien can render per 3d model. It is recommended to set this value as low as possible. Suggested and default value is 3000

Parameters
uValuevalue representing the polycount

◆ setScreenScaleFactor()

void U4DEngine::U4DDirector::setScreenScaleFactor ( float  uScreenScaleFactor)

◆ setShadowBiasDepth()

void U4DEngine::U4DDirector::setShadowBiasDepth ( float  uValue)

Sets the bias depth for shadow rendering.

Parameters
uValuebias depth

◆ sharedInstance()

U4DDirector * U4DEngine::U4DDirector::sharedInstance ( )
static

Method which returns an instance of the U4DDirector singleton.

Returns
instance of the U4DDirector singleton