Nazara Engine  0.4
A fast, complete, cross-platform API designed for game development
Nz::Light Class Reference

Graphics class that represents a light. More...

Inheritance diagram for Nz::Light:
Nz::Renderable

Public Member Functions

 Light (LightType type=LightType_Point)
 Constructs a Light object with a type. More...
 
 Light (const Light &light)
 Constructs a Light object by default.
 
 Light (Light &&light)=default
 
void AddToRenderQueue (AbstractRenderQueue *renderQueue, const Matrix4f &transformMatrix) const override
 Adds this light to the render queue. More...
 
LightClone () const
 Clones this light. More...
 
LightCreate () const
 Creates a default light. More...
 
bool Cull (const Frustumf &frustum, const Matrix4f &transformMatrix) const override
 Culls the light if not in the frustum. More...
 
void EnableShadowCasting (bool castShadows)
 Enables shadow casting. More...
 
void EnsureShadowMapUpdate () const
 Ensures that the shadow map is up to date.
 
float GetAmbientFactor () const
 Gets the ambient factor. More...
 
float GetAttenuation () const
 Gets the light attenuation (in 1 / R^2) More...
 
Color GetColor () const
 Gets the color of the light. More...
 
float GetDiffuseFactor () const
 Gets the diffuse factor. More...
 
float GetInnerAngle () const
 Gets the inner angle in spot light. More...
 
float GetInnerAngleCosine () const
 Gets the cosine inner angle in spot light. More...
 
float GetInvRadius () const
 Gets the inverse of the radius. More...
 
LightType GetLightType () const
 Gets the type of the light. More...
 
float GetOuterAngle () const
 Gets the outer angle in spot light. More...
 
float GetOuterAngleCosine () const
 Gets the cosine outer angle in spot light. More...
 
float GetOuterAngleTangent () const
 Gets the tangent outer angle in spot light. More...
 
float GetRadius () const
 Gets the radius of the light. More...
 
TextureRef GetShadowMap () const
 Gets the shadow map. More...
 
PixelFormatType GetShadowMapFormat () const
 Gets the format of the shadow map. More...
 
const Vector2uiGetShadowMapSize () const
 Gets the size of the shadow map. More...
 
bool IsShadowCastingEnabled () const
 Checks whether the shadow casting is enabled. More...
 
void SetAmbientFactor (float factor)
 Sets the ambient factor. More...
 
void SetAttenuation (float attenuation)
 Sets the light attenuation (in 1 / R^2) More...
 
void SetColor (const Color &color)
 Sets the color of the light. More...
 
void SetDiffuseFactor (float factor)
 Sets the diffuse factor. More...
 
void SetInnerAngle (float innerAngle)
 Sets the inner angle in spot light. More...
 
void SetLightType (LightType type)
 Sets the type of light. More...
 
void SetOuterAngle (float outerAngle)
 Sets the outer angle in spot light. More...
 
void SetRadius (float radius)
 Sets the radius of the light. More...
 
void SetShadowMapFormat (PixelFormatType shadowFormat)
 Sets the shadow map format. More...
 
void SetShadowMapSize (const Vector2ui &size)
 Sets the size of the shadow map. More...
 
void UpdateBoundingVolume (const Matrix4f &transformMatrix) override
 Updates the bounding volume by a matrix. More...
 
Lightoperator= (const Light &light)
 Sets the current light with the content of the other one. More...
 
Lightoperator= (Light &&light)=default
 
- Public Member Functions inherited from Nz::Renderable
 Renderable (const Renderable &renderable)=default
 
 Renderable (Renderable &&)=default
 
void EnsureBoundingVolumeUpdated () const
 Ensures that the bounding volume is up to date.
 
virtual const BoundingVolumefGetBoundingVolume () const
 Gets the bounding volume. More...
 
Renderableoperator= (const Renderable &renderable)=default
 
Renderableoperator= (Renderable &&renderable)=default
 

Additional Inherited Members

- Protected Member Functions inherited from Nz::Renderable
void InvalidateBoundingVolume ()
 Invalidates the bounding volume.
 
- Protected Attributes inherited from Nz::Renderable
BoundingVolumef m_boundingVolume
 

Detailed Description

Graphics class that represents a light.

Constructor & Destructor Documentation

◆ Light()

Nz::Light::Light ( LightType  type = LightType_Point)

Constructs a Light object with a type.

Parameters
typeType of the light

Member Function Documentation

◆ AddToRenderQueue()

void Nz::Light::AddToRenderQueue ( AbstractRenderQueue renderQueue,
const Matrix4f transformMatrix 
) const
overridevirtual

Adds this light to the render queue.

Parameters
renderQueueQueue to be added
transformMatrixMatrix transformation for this light
Remarks
Produces a NazaraError if type is invalid

Implements Nz::Renderable.

◆ Clone()

Light * Nz::Light::Clone ( ) const

Clones this light.

Returns
Pointer to newly allocated Light

◆ Create()

Light * Nz::Light::Create ( ) const

Creates a default light.

Returns
Pointer to newly allocated light

◆ Cull()

bool Nz::Light::Cull ( const Frustumf frustum,
const Matrix4f transformMatrix 
) const
overridevirtual

Culls the light if not in the frustum.

Returns
true If light is in the frustum
Parameters
frustumSymbolizing the field of view
transformMatrixMatrix transformation for our object
Remarks
Produces a NazaraError if type is invalid

Reimplemented from Nz::Renderable.

◆ EnableShadowCasting()

void Nz::Light::EnableShadowCasting ( bool  castShadows)
inline

Enables shadow casting.

Parameters
castShadowsShould shadows be cast

◆ GetAmbientFactor()

float Nz::Light::GetAmbientFactor ( ) const
inline

Gets the ambient factor.

Returns
Current ambient factor

◆ GetAttenuation()

float Nz::Light::GetAttenuation ( ) const
inline

Gets the light attenuation (in 1 / R^2)

Returns
Attenuation

◆ GetColor()

Color Nz::Light::GetColor ( ) const
inline

Gets the color of the light.

Returns
Light color

◆ GetDiffuseFactor()

float Nz::Light::GetDiffuseFactor ( ) const
inline

Gets the diffuse factor.

Returns
Current diffuse factor

◆ GetInnerAngle()

float Nz::Light::GetInnerAngle ( ) const
inline

Gets the inner angle in spot light.

Returns
Inner angle

◆ GetInnerAngleCosine()

float Nz::Light::GetInnerAngleCosine ( ) const
inline

Gets the cosine inner angle in spot light.

Returns
Cosine inner angle

◆ GetInvRadius()

float Nz::Light::GetInvRadius ( ) const
inline

Gets the inverse of the radius.

Returns
Inverse of the radius

◆ GetLightType()

LightType Nz::Light::GetLightType ( ) const
inline

Gets the type of the light.

Returns
Light type

◆ GetOuterAngle()

float Nz::Light::GetOuterAngle ( ) const
inline

Gets the outer angle in spot light.

Returns
Outer angle

◆ GetOuterAngleCosine()

float Nz::Light::GetOuterAngleCosine ( ) const
inline

Gets the cosine outer angle in spot light.

Returns
Cosine outer angle

◆ GetOuterAngleTangent()

float Nz::Light::GetOuterAngleTangent ( ) const
inline

Gets the tangent outer angle in spot light.

Returns
Tangent outer angle

◆ GetRadius()

float Nz::Light::GetRadius ( ) const
inline

Gets the radius of the light.

Returns
Light radius

◆ GetShadowMap()

TextureRef Nz::Light::GetShadowMap ( ) const
inline

Gets the shadow map.

Returns
Reference to the shadow map texture

◆ GetShadowMapFormat()

PixelFormatType Nz::Light::GetShadowMapFormat ( ) const
inline

Gets the format of the shadow map.

Returns
Shadow map format

◆ GetShadowMapSize()

const Vector2ui & Nz::Light::GetShadowMapSize ( ) const
inline

Gets the size of the shadow map.

Returns
Shadow map size

◆ IsShadowCastingEnabled()

bool Nz::Light::IsShadowCastingEnabled ( ) const
inline

Checks whether the shadow casting is enabled.

Returns
true If it is the case

◆ operator=()

Light & Nz::Light::operator= ( const Light light)
inline

Sets the current light with the content of the other one.

Returns
A reference to this
Parameters
lightThe other Light
Remarks
Invalidates the shadow map

◆ SetAmbientFactor()

void Nz::Light::SetAmbientFactor ( float  factor)
inline

Sets the ambient factor.

Parameters
factorAmbient factor

◆ SetAttenuation()

void Nz::Light::SetAttenuation ( float  attenuation)
inline

Sets the light attenuation (in 1 / R^2)

Parameters
attenuationLight attenuation

◆ SetColor()

void Nz::Light::SetColor ( const Color color)
inline

Sets the color of the light.

Parameters
colorLight color

◆ SetDiffuseFactor()

void Nz::Light::SetDiffuseFactor ( float  factor)
inline

Sets the diffuse factor.

Parameters
factorDiffuse factor

◆ SetInnerAngle()

void Nz::Light::SetInnerAngle ( float  innerAngle)
inline

Sets the inner angle in spot light.

Returns
innerAngle Inner angle

◆ SetLightType()

void Nz::Light::SetLightType ( LightType  type)
inline

Sets the type of light.

Parameters
typeLight type

◆ SetOuterAngle()

void Nz::Light::SetOuterAngle ( float  outerAngle)
inline

Sets the outer angle in spot light.

Returns
outerAngle Outer angle
Remarks
Invalidates the bounding volume

◆ SetRadius()

void Nz::Light::SetRadius ( float  radius)
inline

Sets the radius of the light.

Returns
radius Light radius
Remarks
Invalidates the bounding volume

◆ SetShadowMapFormat()

void Nz::Light::SetShadowMapFormat ( PixelFormatType  shadowFormat)
inline

Sets the shadow map format.

Parameters
shadowFormatShadow map format
Remarks
Invalidates the shadow map
Produces a NazaraAssert if format is not a depth type

◆ SetShadowMapSize()

void Nz::Light::SetShadowMapSize ( const Vector2ui size)
inline

Sets the size of the shadow map.

Parameters
sizeShadow map size
Remarks
Invalidates the shadow map
Produces a NazaraAssert if size is zero

◆ UpdateBoundingVolume()

void Nz::Light::UpdateBoundingVolume ( const Matrix4f transformMatrix)
overridevirtual

Updates the bounding volume by a matrix.

Parameters
transformMatrixMatrix transformation for our bounding volume
Remarks
Produces a NazaraError if type is invalid

Reimplemented from Nz::Renderable.


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