Rigs of Rods 2026.01
Soft-body Physics Simulation
Loading...
Searching...
No Matches
Public Member Functions
AngelOgre::Light Class Reference

Description

Representation of a dynamic light source in the scene.

Remarks
Lights are added to the scene like any other MovableObject. They contain various configurable parameters like type, position, direction and color.
Remember that simply creating a light and adding it to a scene does not make a scene brighter; the SceneManager must choose to interpret it. Use the SceneManager::setAmbientLight method to set the overall ambient light level. Use the Light methods to configure your individual lights.

Definition at line 22 of file AngelOgre_Light.h.

+ Inheritance diagram for AngelOgre::Light:

Public Member Functions

void setType (LightTypes type)
 
LightTypes getType () const
 
void setDiffuseColour (float r, float g, float b)
 
void setDiffuseColour (const color &color)
 
const color & getDiffuseColour () const
 
void setSpecularColour (float r, float g, float b)
 
void setSpecularColour (const color &color)
 
const color & getSpecularColour () const
 
void setAttenuation (float range, float constant, float linear, float quadratic)
 
float getAttenuationRange () const
 
float getAttenuationConstant () const
 
float getAttenuationLinear () const
 
float getAttenuationQuadric () const
 
void setPosition (float x, float y, float z)
 
void setPosition (const vector3 &pos)
 
const vector3 & getPosition () const
 
void setDirection (float x, float y, float z)
 
void setDirection (const vector3 &direction)
 
const vector3 & getDirection () const
 
void setSpotlightRange (const radian &innerAngle, const radian &outerAngle, float falloff=1.0f)
 
const radian & getSpotlightInnerAngle () const
 
const radian & getSpotlightOuterAngle () const
 
float getSpotlightFalloff () const
 
void setPowerScale (float power)
 
float getPowerScale () const
 
void setCastShadows (bool enabled)
 
bool getCastShadows () const
 
const vector3 & getDerivedPosition () const
 
const vector3 & getDerivedDirection () const
 
const string & getName () const
 
const string & getMovableType () const
 
Node getParentNode () const
 
SceneNode getParentSceneNode () const
 
bool isAttached () const
 
void detachFromParent ()
 
bool isInScene () const
 
float getBoundingRadius () const
 
void setVisible (bool visible)
 
bool getVisible () const
 
bool isVisible () const
 
void setRenderingDistance (float dist)
 
float getRenderingDistance () const
 
void setRenderingMinPixelSize (float pixelSize)
 
float getRenderingMinPixelSize () const
 

Additional Inherited Members

- Private Member Functions inherited from AngelOgre::MovableObject
const string & getName (void) const
 
const string & getMovableType (void) const
 
Node * getParentNode (void) const
 
SceneNode getParentSceneNode (void) const
 
bool isParentTagPoint () const
 
bool isAttached (void) const
 
void detachFromParent (void)
 
bool isInScene (void) const
 
float getBoundingRadius (void) const
 
void setVisible (bool visible)
 
bool getVisible (void) const
 
bool isVisible (void) const
 
void setRenderingDistance (float dist)
 
float getRenderingDistance (void) const
 
void setRenderingMinPixelSize (float pixelSize)
 
float getRenderingMinPixelSize () const
 
void setCastShadows (bool enabled)
 
bool getCastShadows (void) const
 
void setDebugDisplayEnabled (bool enabled)
 
bool isDebugDisplayEnabled (void) const
 

Member Function Documentation

◆ detachFromParent()

void AngelOgre::Light::detachFromParent ( )

Detaches an object from a parent SceneNode or TagPoint, if attached.

◆ getAttenuationConstant()

float AngelOgre::Light::getAttenuationConstant ( ) const

Returns the constant factor in the attenuation formula.

◆ getAttenuationLinear()

float AngelOgre::Light::getAttenuationLinear ( ) const

Returns the linear factor in the attenuation formula.

◆ getAttenuationQuadric()

float AngelOgre::Light::getAttenuationQuadric ( ) const

Returns the quadric factor in the attenuation formula.

◆ getAttenuationRange()

float AngelOgre::Light::getAttenuationRange ( ) const

Returns the absolute upper range of the light.

◆ getBoundingRadius()

float AngelOgre::Light::getBoundingRadius ( ) const

Retrieves the radius of the origin-centered bounding sphere for this object.

◆ getCastShadows()

bool AngelOgre::Light::getCastShadows ( ) const

Returns whether or not this light casts shadows.

◆ getDerivedDirection()

const vector3 & AngelOgre::Light::getDerivedDirection ( ) const

Gets the direction of the light including any transform from nodes it is attached to.

◆ getDerivedPosition()

const vector3 & AngelOgre::Light::getDerivedPosition ( ) const

Gets the position of the light including any transform from nodes it is attached to.

◆ getDiffuseColour()

const color & AngelOgre::Light::getDiffuseColour ( ) const

Returns the color of the diffuse light given off by this light source (see setDiffuseColour for more info).

◆ getDirection()

const vector3 & AngelOgre::Light::getDirection ( ) const

Returns the light's direction.

Note
Applicable to directional and spotlights only.

◆ getMovableType()

const string & AngelOgre::Light::getMovableType ( ) const

Returns the type name of this object.

◆ getName()

const string & AngelOgre::Light::getName ( ) const

Returns the name of this object.

◆ getParentNode()

Node AngelOgre::Light::getParentNode ( ) const

Returns the node to which this object is attached.

◆ getParentSceneNode()

SceneNode AngelOgre::Light::getParentSceneNode ( ) const

Returns the scene node to which this object is attached.

◆ getPosition()

const vector3 & AngelOgre::Light::getPosition ( ) const

Returns the position of the light.

Note
Applicable to point lights and spotlights only.

◆ getPowerScale()

float AngelOgre::Light::getPowerScale ( ) const

Returns the scaling factor which indicates the relative power of a light.

◆ getRenderingDistance()

float AngelOgre::Light::getRenderingDistance ( ) const

Gets the distance at which batches are no longer rendered.

◆ getRenderingMinPixelSize()

float AngelOgre::Light::getRenderingMinPixelSize ( ) const

Returns the minimum pixel size an object needs to be in both screen axes in order to be rendered.

◆ getSpecularColour()

const color & AngelOgre::Light::getSpecularColour ( ) const

Returns the color of specular light given off by this light source.

◆ getSpotlightFalloff()

float AngelOgre::Light::getSpotlightFalloff ( ) const

Returns the falloff between the inner and outer cones of the spotlight.

◆ getSpotlightInnerAngle()

const radian & AngelOgre::Light::getSpotlightInnerAngle ( ) const

Returns the angle covered by the spotlights inner cone.

◆ getSpotlightOuterAngle()

const radian & AngelOgre::Light::getSpotlightOuterAngle ( ) const

Returns the angle covered by the spotlights outer cone.

◆ getType()

LightTypes AngelOgre::Light::getType ( ) const

Returns the light type.

◆ getVisible()

bool AngelOgre::Light::getVisible ( ) const

Gets this object whether to be visible or not, if it has a renderable component.

◆ isAttached()

bool AngelOgre::Light::isAttached ( ) const

Returns true if this object is attached to a SceneNode or TagPoint.

◆ isInScene()

bool AngelOgre::Light::isInScene ( ) const

Returns true if this object is attached to a SceneNode or TagPoint, and this SceneNode / TagPoint is currently in an active part of the scene graph.

◆ isVisible()

bool AngelOgre::Light::isVisible ( ) const

Returns whether or not this object is supposed to be visible or not.

◆ setAttenuation()

void AngelOgre::Light::setAttenuation ( float  range,
float  constant,
float  linear,
float  quadratic 
)

Sets the attenuation parameters for this light source.

Remarks
Attenuation means the how the light intensity reduces with distance. The attenuation is calculated as 1 / (constant + linear * distance + quadric * distance^2)
Parameters
rangeThe absolute upper range of the light in world units. If set to 0, light is attenuated to zero by the quadratic factor. In this case, the light will be visible up to infinity.
constantConstant factor, 1.0 means never attenuate, 0.0 is complete attenuation.
linearThe linear factor, 1 means attenuate evenly over the distance.
quadraticThe quadratic factor, adds a curvature to the attenuation formula.

◆ setCastShadows()

void AngelOgre::Light::setCastShadows ( bool  enabled)

Sets whether or not this light should cast shadows.

Remarks
This setting simply allows you to turn on/off shadows for a given light. An object will not cast shadows unless the scene supports it in any case (see SceneManager::setShadowTechnique), and also the material which is in use must also have shadow casting enabled.
Note
For Light objects, this method refers to whether the light causes shadows itself.

◆ setDiffuseColour() [1/2]

void AngelOgre::Light::setDiffuseColour ( const color &  color)

Sets the color of the diffuse light given off by this source.

Parameters
colorThe color value

◆ setDiffuseColour() [2/2]

void AngelOgre::Light::setDiffuseColour ( float  r,
float  g,
float  b 
)

Sets the color of the diffuse light given off by this source.

Remarks
Material objects have ambient, diffuse and specular values which indicate how much of each type of light an object reflects. This value denotes the amount and color of this type of light the light exudes into the scene. The actual appearance of objects is a combination of the two.
Parameters
rRed component (0.0 to 1.0)
gGreen component (0.0 to 1.0)
bBlue component (0.0 to 1.0)

◆ setDirection() [1/2]

void AngelOgre::Light::setDirection ( const vector3 &  direction)

Sets the direction in which a light points.

Remarks
Applicable only to the spotlight and directional light types. This will be overridden if the light is attached to a SceneNode.
Parameters
directionVector with direction

◆ setDirection() [2/2]

void AngelOgre::Light::setDirection ( float  x,
float  y,
float  z 
)

Sets the direction in which a light points.

Remarks
Applicable only to the spotlight and directional light types. This will be overridden if the light is attached to a SceneNode.
Parameters
xX component
yY component
zZ component

◆ setPosition() [1/2]

void AngelOgre::Light::setPosition ( const vector3 &  pos)

Sets the position of the light.

Remarks
Applicable to point lights and spotlights only. This will be overridden if the light is attached to a SceneNode.
Parameters
posVector with the position

◆ setPosition() [2/2]

void AngelOgre::Light::setPosition ( float  x,
float  y,
float  z 
)

Sets the position of the light.

Remarks
Applicable to point lights and spotlights only. This will be overridden if the light is attached to a SceneNode.
Parameters
xX coordinate
yY coordinate
zZ coordinate

◆ setPowerScale()

void AngelOgre::Light::setPowerScale ( float  power)

Set a scaling factor to indicate the relative power of a light.

Remarks
This factor is only useful in High Dynamic Range (HDR) rendering. You can bind a value of 1.0 (the default) to indicate a light at normal intensity, and another value to indicate a brighter or dimmer light.
Parameters
powerThe power rating of this light, default is 1.0.

◆ setRenderingDistance()

void AngelOgre::Light::setRenderingDistance ( float  dist)

Sets the distance at which the object is no longer rendered.

Parameters
distDistance beyond which the object will not be rendered.

◆ setRenderingMinPixelSize()

void AngelOgre::Light::setRenderingMinPixelSize ( float  pixelSize)

Sets the minimum pixel size an object needs to be in both screen axes in order to be rendered.

Parameters
pixelSizeNumber of minimum pixels.

◆ setSpecularColour() [1/2]

void AngelOgre::Light::setSpecularColour ( const color &  color)

Sets the color of the specular light given off by this source.

Parameters
colorThe color value

◆ setSpecularColour() [2/2]

void AngelOgre::Light::setSpecularColour ( float  r,
float  g,
float  b 
)

Sets the color of the specular light given off by this source.

Remarks
As with setDiffuseColour, this property is a modifier to a material's specular component.
Parameters
rRed component (0.0 to 1.0)
gGreen component (0.0 to 1.0)
bBlue component (0.0 to 1.0)

◆ setSpotlightRange()

void AngelOgre::Light::setSpotlightRange ( const radian &  innerAngle,
const radian &  outerAngle,
float  falloff = 1.0f 
)

Sets the range of a spotlight, i.e.

the angle of the inner and outer cones and the rate of falloff between them.

Parameters
innerAngleAngle covered by the bright inner cone. The inner cone is at maximum brightness.
outerAngleAngle covered by the outer cone. The light attenuates from the inner cone to the outer cone. Outside the outer cone the light has zero intensity.
falloffThe rate of falloff between the inner and outer cones. 1.0 means a linear falloff, less means slower falloff, higher means faster falloff. Applicable to spotlights only.

◆ setType()

void AngelOgre::Light::setType ( LightTypes  type)

Sets the type of light - see LightTypes for more info.

◆ setVisible()

void AngelOgre::Light::setVisible ( bool  visible)

Tells this object whether to be visible or not, if it has a renderable component.


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