OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Private Attributes | List of all members
SceneUtil::LightSource Class Reference

#include <lightmanager.hpp>

Inheritance diagram for SceneUtil::LightSource:
Collaboration diagram for SceneUtil::LightSource:

Public Member Functions

 META_Node (SceneUtil, LightSource) LightSource()
 
 LightSource (const LightSource &copy, const osg::CopyOp &copyop)
 
float getRadius () const
 
void setRadius (float radius)
 The LightSource will affect objects within this radius. More...
 
osg::Light * getLight (unsigned int frame)
 
void setLight (osg::Light *light)
 
int getId () const
 Get the unique ID for this light source. More...
 

Private Attributes

osg::ref_ptr< osg::Light > mLight [2]
 
float mRadius
 
int mId
 

Detailed Description

LightSource managed by a LightManager.

Typically used for point lights. Spot lights are not supported yet. Directional lights affect the whole scene
so do not need to be managed by a LightManager - so for directional lights use a plain osg::LightSource instead.
Note
LightSources must be decorated by a LightManager node in order to have an effect. Typical use would be one LightManager as the root of the scene graph.
One needs to attach LightListCallback's to the scene to have objects receive lighting from LightSources. See the documentation of LightListCallback for more information.
The position of the contained osg::Light is automatically updated based on the LightSource's world position.

Constructor & Destructor Documentation

SceneUtil::LightSource::LightSource ( const LightSource copy,
const osg::CopyOp &  copyop 
)

Member Function Documentation

int SceneUtil::LightSource::getId ( ) const
inline

Get the unique ID for this light source.

osg::Light* SceneUtil::LightSource::getLight ( unsigned int  frame)
inline

Get the osg::Light safe for modification in the given frame.

May be used externally to animate the light's color/attenuation properties,
and is used internally to synchronize the light's position with the position of the LightSource.

Here is the caller graph for this function:

float SceneUtil::LightSource::getRadius ( ) const
inline
SceneUtil::LightSource::META_Node ( SceneUtil  ,
LightSource   
)
void SceneUtil::LightSource::setLight ( osg::Light *  light)
inline
Warning
It is recommended not to replace an existing osg::Light, because there might still be references to it in the light StateSet cache that are associated with this LightSource's ID. These references will stay valid due to ref_ptr but will point to the old object.
Do not modify the light after you've called this function.

Here is the caller graph for this function:

void SceneUtil::LightSource::setRadius ( float  radius)
inline

The LightSource will affect objects within this radius.

Here is the caller graph for this function:

Member Data Documentation

int SceneUtil::LightSource::mId
private
osg::ref_ptr<osg::Light> SceneUtil::LightSource::mLight[2]
private
float SceneUtil::LightSource::mRadius
private

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