Rigs of Rods 2023.09
Soft-body Physics Simulation
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Loading...
Searching...
No Matches
Public Member Functions
AngelOgre::Light Class Reference

Representation of a dynamic light source in the scene. More...

#include <AngelOgre_Light.h>

+ Inheritance diagram for AngelOgre::Light:

Public Member Functions

void setType (LightTypes type)
 Sets the type of light - see LightTypes for more info.
 
LightTypes getType () const
 Returns the light type.
 
void setDiffuseColour (float r, float g, float b)
 Sets the color of the diffuse light given off by this source.
 
void setDiffuseColour (const color &color)
 Sets the color of the diffuse light given off by this source.
 
const color & getDiffuseColour () const
 Returns the color of the diffuse light given off by this light source (see setDiffuseColour for more info).
 
void setSpecularColour (float r, float g, float b)
 Sets the color of the specular light given off by this source.
 
void setSpecularColour (const color &color)
 Sets the color of the specular light given off by this source.
 
const color & getSpecularColour () const
 Returns the color of specular light given off by this light source.
 
void setAttenuation (float range, float constant, float linear, float quadratic)
 Sets the attenuation parameters for this light source.
 
float getAttenuationRange () const
 Returns the absolute upper range of the light.
 
float getAttenuationConstant () const
 Returns the constant factor in the attenuation formula.
 
float getAttenuationLinear () const
 Returns the linear factor in the attenuation formula.
 
float getAttenuationQuadric () const
 Returns the quadric factor in the attenuation formula.
 
void setPosition (float x, float y, float z)
 Sets the position of the light.
 
void setPosition (const vector3 &pos)
 Sets the position of the light.
 
const vector3 & getPosition () const
 Returns the position of the light.
 
void setDirection (float x, float y, float z)
 Sets the direction in which a light points.
 
void setDirection (const vector3 &direction)
 Sets the direction in which a light points.
 
const vector3 & getDirection () const
 Returns the light's direction.
 
void setSpotlightRange (const radian &innerAngle, const radian &outerAngle, float falloff=1.0f)
 Sets the range of a spotlight, i.e.
 
const radian & getSpotlightInnerAngle () const
 Returns the angle covered by the spotlights inner cone.
 
const radian & getSpotlightOuterAngle () const
 Returns the angle covered by the spotlights outer cone.
 
float getSpotlightFalloff () const
 Returns the falloff between the inner and outer cones of the spotlight.
 
void setPowerScale (float power)
 Set a scaling factor to indicate the relative power of a light.
 
float getPowerScale () const
 Returns the scaling factor which indicates the relative power of a light.
 
void setCastShadows (bool enabled)
 Sets whether or not this light should cast shadows.
 
bool getCastShadows () const
 Returns whether or not this light casts shadows.
 
const vector3 & getDerivedPosition () const
 Gets the position of the light including any transform from nodes it is attached to.
 
const vector3 & getDerivedDirection () const
 Gets the direction of the light including any transform from nodes it is attached to.
 
const string & getName () const
 Returns the name of this object.
 
const string & getMovableType () const
 Returns the type name of this object.
 
Node getParentNode () const
 Returns the node to which this object is attached.
 
SceneNode getParentSceneNode () const
 Returns the scene node to which this object is attached.
 
bool isAttached () const
 Returns true if this object is attached to a SceneNode or TagPoint.
 
void detachFromParent ()
 Detaches an object from a parent SceneNode or TagPoint, if attached.
 
bool 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.
 
float getBoundingRadius () const
 Retrieves the radius of the origin-centered bounding sphere for this object.
 
void setVisible (bool visible)
 Tells this object whether to be visible or not, if it has a renderable component.
 
bool getVisible () const
 Gets this object whether to be visible or not, if it has a renderable component.
 
bool isVisible () const
 Returns whether or not this object is supposed to be visible or not.
 
void setRenderingDistance (float dist)
 Sets the distance at which the object is no longer rendered.
 
float getRenderingDistance () const
 Gets the distance at which batches are no longer rendered.
 
void setRenderingMinPixelSize (float pixelSize)
 Sets the minimum pixel size an object needs to be in both screen axes in order to be rendered.
 
float getRenderingMinPixelSize () const
 Returns the minimum pixel size an object needs to be in both screen axes in order to be rendered.
 

Additional Inherited Members

- Private Member Functions inherited from AngelOgre::MovableObject
const string & getName (void) const
 Returns the name of this object.
 
const string & getMovableType (void) const
 Returns the type name of this object.
 
NodegetParentNode (void) const
 Returns the node to which this object is attached.
 
SceneNode getParentSceneNode (void) const
 Returns the scene node to which this object is attached.
 
bool isParentTagPoint () const
 Gets whether the parent node is a TagPoint (or a SceneNode)
 
bool isAttached (void) const
 Returns true if this object is attached to a SceneNode or TagPoint.
 
void detachFromParent (void)
 Detaches an object from a parent SceneNode or TagPoint, if attached.
 
bool isInScene (void) 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.
 
float getBoundingRadius (void) const
 Retrieves the local axis-aligned bounding box for this object.
 
void setVisible (bool visible)
 Tells this object whether to be visible or not, if it has a renderable component.
 
bool getVisible (void) const
 Gets this object whether to be visible or not, if it has a renderable component.
 
bool isVisible (void) const
 Returns whether or not this object is supposed to be visible or not.
 
void setRenderingDistance (float dist)
 Sets the distance at which the object is no longer rendered.
 
float getRenderingDistance (void) const
 Gets the distance at which batches are no longer rendered.
 
void setRenderingMinPixelSize (float pixelSize)
 Sets the minimum pixel size an object needs to be in both screen axes in order to be rendered.
 
float getRenderingMinPixelSize () const
 Returns the minimum pixel size an object needs to be in both screen axes in order to be rendered.
 
void setCastShadows (bool enabled)
 Return an instance of user objects binding associated with this class.
 
bool getCastShadows (void) const
 Returns whether shadow casting is enabled for this object.
 
void setDebugDisplayEnabled (bool enabled)
 Sets whether or not the debug display of this object is enabled.
 
bool isDebugDisplayEnabled (void) const
 Gets whether debug display of this object is enabled.
 

Detailed 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 33 of file AngelOgre_Light.h.

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: