TDME2 1.9.121
Public Member Functions | Private Attributes | List of all members
Light Class Referencefinal

Light representation. More...

#include <tdme/engine/Light.h>

Collaboration diagram for Light:
Collaboration graph

Public Member Functions

 Light ()
 Public default constructor. More...
 
 Light (Renderer *renderer, int32_t id)
 Public default constructor. More...
 
int32_t getId () const
 
bool isEnabled () const
 
void setEnabled (bool enabled)
 Set enabled. More...
 
const Color4getAmbient () const
 
void setAmbient (const Color4 &ambient)
 Set ambient light component. More...
 
const Color4getDiffuse () const
 
void setDiffuse (const Color4 &diffuse)
 Set diffuse light component. More...
 
const Color4getSpecular () const
 
void setSpecular (const Color4 &specular)
 Set specular light component. More...
 
const Vector4getPosition () const
 
void setPosition (const Vector4 &position)
 Set light position. More...
 
const Vector3getSpotDirection () const
 
void setSpotDirection (const Vector3 &spotDirection)
 Set spot direction. More...
 
float getSpotExponent () const
 
void setSpotExponent (float spotExponent)
 Set up spot exponent. More...
 
float getSpotCutOff () const
 
void setSpotCutOff (float spotCutOff)
 Set spot cut off. More...
 
float getConstantAttenuation () const
 
void setConstantAttenuation (float constantAttenuation)
 Set up constant attenuation. More...
 
float getLinearAttenuation () const
 
void setLinearAttenuation (float linearAttenuation)
 Set up linear attenuation. More...
 
float getQuadraticAttenuation () const
 
void setQuadraticAttenuation (float quadraticAttenuation)
 Set up quadratic attenuation. More...
 
float getRadius ()
 
bool isRenderSource () const
 Returns if rendering light source is enabled. More...
 
void setRenderSource (bool renderSource)
 Set rendering light source enabled/disabled. More...
 
float getSourceSize () const
 Returns light source size. More...
 
void setLightSourceSize (float sourceSize)
 Set light source size (moon, sun) More...
 
TexturegetSourceTexture () const
 Returns light source texture. More...
 
void setSourceTexture (Texture *texture)
 Returns light source texture. More...
 
int32_t getSourceTextureId () const
 Returns light source texture id. More...
 
bool isDirectional () const
 Returns if light is directional light like sun, moon lights. More...
 
void dispose ()
 Dispose. More...
 
void update (int contextIdx)
 Update light. More...
 

Private Attributes

int32_t id
 
bool enabled
 
Color4 ambient
 
Color4 diffuse
 
Color4 specular
 
Vector4 position
 
Vector3 spotDirection
 
float spotExponent
 
float spotCutOff
 
float constantAttenuation
 
float linearAttenuation
 
float quadraticAttenuation
 
bool renderSource
 
float sourceSize
 
TexturelightSourceTexture { nullptr }
 
int32_t lightSourceTextureId
 
Rendererrenderer { nullptr }
 

Detailed Description

Light representation.

Author
Andreas Drewke
Version
$Id$

Definition at line 31 of file Light.h.

Constructor & Destructor Documentation

◆ Light() [1/2]

Light ( )

Public default constructor.

Definition at line 23 of file Light.cpp.

◆ Light() [2/2]

Light ( Renderer renderer,
int32_t  id 
)

Public default constructor.

Parameters
rendererrenderer
idid

Definition at line 43 of file Light.cpp.

Member Function Documentation

◆ dispose()

void dispose ( )

Dispose.

Definition at line 70 of file Light.cpp.

◆ getAmbient()

const Color4 & getAmbient ( ) const
inline
Returns
ambient light component

Definition at line 89 of file Light.h.

◆ getConstantAttenuation()

float getConstantAttenuation ( ) const
inline
Returns
constant attenuation

Definition at line 194 of file Light.h.

◆ getDiffuse()

const Color4 & getDiffuse ( ) const
inline
Returns
diffuse light component

Definition at line 104 of file Light.h.

◆ getId()

int32_t getId ( ) const
inline
Returns
light id

Definition at line 67 of file Light.h.

◆ getLinearAttenuation()

float getLinearAttenuation ( ) const
inline
Returns
linear attenuation

Definition at line 209 of file Light.h.

◆ getPosition()

const Vector4 & getPosition ( ) const
inline
Returns
position of light

Definition at line 134 of file Light.h.

◆ getQuadraticAttenuation()

float getQuadraticAttenuation ( ) const
inline
Returns
quadratic attenuation

Definition at line 224 of file Light.h.

◆ getRadius()

float getRadius ( )
inline
Returns
radius

Definition at line 239 of file Light.h.

◆ getSourceSize()

float getSourceSize ( ) const
inline

Returns light source size.

Returns
light source size (moon, sun)

Definition at line 270 of file Light.h.

◆ getSourceTexture()

Texture * getSourceTexture ( ) const
inline

Returns light source texture.

Returns
light source texture

Definition at line 286 of file Light.h.

◆ getSourceTextureId()

int32_t getSourceTextureId ( ) const
inline

Returns light source texture id.

Returns
light source texture id

Definition at line 300 of file Light.h.

◆ getSpecular()

const Color4 & getSpecular ( ) const
inline
Returns
specular light component

Definition at line 119 of file Light.h.

◆ getSpotCutOff()

float getSpotCutOff ( ) const
inline
Returns
spot cutoff

Definition at line 179 of file Light.h.

◆ getSpotDirection()

const Vector3 & getSpotDirection ( ) const
inline
Returns
spot direction

Definition at line 149 of file Light.h.

◆ getSpotExponent()

float getSpotExponent ( ) const
inline
Returns
spot exponent

Definition at line 164 of file Light.h.

◆ isDirectional()

bool isDirectional ( ) const
inline

Returns if light is directional light like sun, moon lights.

Returns
directional light like sun, moon lights

Definition at line 308 of file Light.h.

◆ isEnabled()

bool isEnabled ( ) const
inline
Returns
enabled

Definition at line 74 of file Light.h.

◆ isRenderSource()

bool isRenderSource ( ) const
inline

Returns if rendering light source is enabled.

Returns
rendering light source is enabled

Definition at line 254 of file Light.h.

◆ setAmbient()

void setAmbient ( const Color4 ambient)
inline

Set ambient light component.

Parameters
ambientambient light component

Definition at line 97 of file Light.h.

◆ setConstantAttenuation()

void setConstantAttenuation ( float  constantAttenuation)
inline

Set up constant attenuation.

Parameters
constantAttenuationconstant attenuation

Definition at line 202 of file Light.h.

◆ setDiffuse()

void setDiffuse ( const Color4 diffuse)
inline

Set diffuse light component.

Parameters
diffusediffuse light

Definition at line 112 of file Light.h.

◆ setEnabled()

void setEnabled ( bool  enabled)
inline

Set enabled.

Parameters
enabledenabled

Definition at line 82 of file Light.h.

◆ setLightSourceSize()

void setLightSourceSize ( float  sourceSize)
inline

Set light source size (moon, sun)

Parameters
lightSourceSizelight source size

Definition at line 278 of file Light.h.

◆ setLinearAttenuation()

void setLinearAttenuation ( float  linearAttenuation)
inline

Set up linear attenuation.

Parameters
linearAttenuationlinear attenuation

Definition at line 217 of file Light.h.

◆ setPosition()

void setPosition ( const Vector4 position)
inline

Set light position.

Parameters
positionposition of light

Definition at line 142 of file Light.h.

◆ setQuadraticAttenuation()

void setQuadraticAttenuation ( float  quadraticAttenuation)
inline

Set up quadratic attenuation.

Parameters
quadraticAttenuationquadraticAttenuation

Definition at line 232 of file Light.h.

◆ setRenderSource()

void setRenderSource ( bool  renderSource)
inline

Set rendering light source enabled/disabled.

Parameters
renderLightSourcerender light source enabled

Definition at line 262 of file Light.h.

◆ setSourceTexture()

void setSourceTexture ( Texture texture)

Returns light source texture.

Returns
light source texture

Definition at line 63 of file Light.cpp.

◆ setSpecular()

void setSpecular ( const Color4 specular)
inline

Set specular light component.

Parameters
specularspecular light

Definition at line 127 of file Light.h.

◆ setSpotCutOff()

void setSpotCutOff ( float  spotCutOff)
inline

Set spot cut off.

Parameters
spotCutOffspot cut off

Definition at line 187 of file Light.h.

◆ setSpotDirection()

void setSpotDirection ( const Vector3 spotDirection)
inline

Set spot direction.

Parameters
spotDirectionspot direction

Definition at line 157 of file Light.h.

◆ setSpotExponent()

void setSpotExponent ( float  spotExponent)
inline

Set up spot exponent.

Parameters
spotExponentspot exponent

Definition at line 172 of file Light.h.

◆ update()

void update ( int  contextIdx)

Update light.

Parameters
contextIdxcontext index

Definition at line 74 of file Light.cpp.

Member Data Documentation

◆ ambient

Color4 ambient
private

Definition at line 36 of file Light.h.

◆ constantAttenuation

float constantAttenuation
private

Definition at line 43 of file Light.h.

◆ diffuse

Color4 diffuse
private

Definition at line 37 of file Light.h.

◆ enabled

bool enabled
private

Definition at line 35 of file Light.h.

◆ id

int32_t id
private

Definition at line 34 of file Light.h.

◆ lightSourceTexture

Texture* lightSourceTexture { nullptr }
private

Definition at line 48 of file Light.h.

◆ lightSourceTextureId

int32_t lightSourceTextureId
private

Definition at line 49 of file Light.h.

◆ linearAttenuation

float linearAttenuation
private

Definition at line 44 of file Light.h.

◆ position

Vector4 position
private

Definition at line 39 of file Light.h.

◆ quadraticAttenuation

float quadraticAttenuation
private

Definition at line 45 of file Light.h.

◆ renderer

Renderer* renderer { nullptr }
private

Definition at line 50 of file Light.h.

◆ renderSource

bool renderSource
private

Definition at line 46 of file Light.h.

◆ sourceSize

float sourceSize
private

Definition at line 47 of file Light.h.

◆ specular

Color4 specular
private

Definition at line 38 of file Light.h.

◆ spotCutOff

float spotCutOff
private

Definition at line 42 of file Light.h.

◆ spotDirection

Vector3 spotDirection
private

Definition at line 40 of file Light.h.

◆ spotExponent

float spotExponent
private

Definition at line 41 of file Light.h.


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