U4DEngine::U4DLights class

The U4DLights class implements a light entity used for providing light and shadows to a game.

Base classes

class U4DEngine::U4DVisibleEntity
The U4DVisibleEntity class represents all visible entities in a game.

Public static variables

static U4DLights* instance
Instance for U4DLights Singleton.

Public static functions

static auto sharedInstance() -> U4DLights*
Method which returns an instance for the U4DLights Singleton.

Constructors, destructors, conversion operators

U4DLights() protected
Light Constructor which sets the light position to (5.0,5.0,5.0) and its view direction to (0.0,0.0,0.0)
~U4DLights() protected
Light Destructor.

Public functions

void viewInDirection(U4DVector3n& uDestinationPoint) virtual
Method which sets the view direction of the light.
auto getViewInDirection() -> U4DVector3n virtual
Gets the view direction of the light.
void computeLightVolume(U4DPoint3n& uMin, U4DPoint3n& uMax)
Computes the light volume which determines the vertices for the light shape (a small cube)
void render(id<MTLRenderCommandEncoder> uRenderEncoder) virtual
Renders the current Light entity.
void setDiffuseColor(U4DVector3n& uDiffuseColor)
Sets the diffuse color for the light.
void setSpecularColor(U4DVector3n& uSpecularColor)
Sets the specular color for the light.
auto getDiffuseColor() -> U4DVector3n
gets the light diffuse color
auto getSpecularColor() -> U4DVector3n
gets the light specular color

Function documentation

static U4DLights* U4DEngine::U4DLights::sharedInstance()

Method which returns an instance for the U4DLights Singleton.

Returns Returns an instance of the U4DLights Singleton

void U4DEngine::U4DLights::viewInDirection(U4DVector3n& uDestinationPoint) virtual

Method which sets the view direction of the light.

Parameters
uDestinationPoint Destination point where the light should be directed

U4DVector3n U4DEngine::U4DLights::getViewInDirection() virtual

Gets the view direction of the light.

Returns Returns the view direction. Note that the coordinate space for the light is different due to its implementation. +z points outward. -z points inward into the screen.

void U4DEngine::U4DLights::computeLightVolume(U4DPoint3n& uMin, U4DPoint3n& uMax)

Computes the light volume which determines the vertices for the light shape (a small cube)

Parameters
uMin min points for the cube
uMax max points for the cube

void U4DEngine::U4DLights::render(id<MTLRenderCommandEncoder> uRenderEncoder) virtual

Renders the current Light entity.

Parameters
uRenderEncoder Metal encoder object for the current entity

Updates the space matrix and any rendering flags. It encodes the pipeline, buffers and issues the draw command

void U4DEngine::U4DLights::setDiffuseColor(U4DVector3n& uDiffuseColor)

Sets the diffuse color for the light.

Parameters
uDiffuseColor diffuse color in vector format

void U4DEngine::U4DLights::setSpecularColor(U4DVector3n& uSpecularColor)

Sets the specular color for the light.

Parameters
uSpecularColor specular color in vector format

U4DVector3n U4DEngine::U4DLights::getDiffuseColor()

gets the light diffuse color

Returns diffuse color in vector format

U4DVector3n U4DEngine::U4DLights::getSpecularColor()

gets the light specular color

Returns specular color in vector format