NL3D::CPointLightModel Class Reference

This model is a dynamic light. More...

#include <point_light_model.h>

Inherits NL3D::CTransform.

List of all members.

Public Member Functions

void setDeltaPosToSkeletonWhenOutOfFrustum (const CVector &deltaPos)
 setup the deltaPosToSkeletonWhenOutOfFrustum When a light is sticked to a skeleton, and if this skeleton is clipped, then the position of the light can't be computed correctly without animating the skeleton.
const CVectorgetDeltaPosToSkeletonWhenOutOfFrustum () const
 see setDeltaPosToSkeletonWhenOutOfFrustum()
void setInfluenceLightMap (bool enable)
 Special For Lightmap dynamic Lighting.
bool getInfluenceLightMap () const
virtual void traverseLight ()
 The traverse() method is called to update the worldPosition of the light, resetLightedModels(), and re-insert the light in the lightingManager.

Static Public Member Functions

static void registerBasic ()
 Call at the begining of the program, to register the model.

Public Attributes

CPointLight PointLight
 The pointLight setup (color/attenuation).

Protected Member Functions

 CPointLightModel ()
 Constructor.
virtual ~CPointLightModel ()
 Destructor.
virtual void initModel ()
 Implement the initModel method: link to the LightModelList.

Private Member Functions

bool isHrcVisible () const
 tells if the pointLightModel is not hidden by user actually, it is the result of hrc Visibility.

Static Private Member Functions

static CTransformcreator ()

Private Attributes

CFastPtrListNode _PointLightNode
CVector _DeltaPosToSkeletonWhenOutOfFrustum
 see setDeltaPosToSkeletonWhenOutOfFrustum()
CVector _LastWorldSpotDirectionWhenOutOfFrustum
 Same problem as _DeltaPosToSkeletonWhenOutOfFrustum, but this one is computed at each Visible frame.
float _TimeFromLastClippedSpotDirection
bool _InfluenceLightMap
 see setInfluenceLightMap()

Friends

class CLightTrav

Detailed Description

This model is a dynamic light.

It handles a PointLight, where Pos is the worldPos updated by CScene at each render(). CPointLightModel are linked to the LightModelList in the LightTrav. It can handles SpotLight too, see PointLight.

Hrc: Lights herit CTransform so they can be put in hierarchy, even sticked to a skeleton. They can be hide, moved etc... (default CTransform). Clip: Lights are always in frustum, not renderable (default CTransform). Light: lightModels are not lightables (ie they can't be lighted). (default CTransform). traverseLight() is specialised.

PERFORMANCE WARNING: big lights (disabled attenuation and big attenuationEnd) slow down performances. (by experience, with a factor of 2).

Author:
Lionel Berenguier
Nevrax France
Date:
2001

Definition at line 62 of file point_light_model.h.


Constructor & Destructor Documentation

NL3D::CPointLightModel::CPointLightModel (  )  [protected]
NL3D::CPointLightModel::~CPointLightModel (  )  [protected, virtual]

Destructor.

Definition at line 55 of file point_light_model.cpp.


Member Function Documentation

static CTransform* NL3D::CPointLightModel::creator (  )  [inline, static, private]

Reimplemented from NL3D::CTransform.

Definition at line 125 of file point_light_model.h.

Referenced by registerBasic().

const CVector & NL3D::CPointLightModel::getDeltaPosToSkeletonWhenOutOfFrustum (  )  const
bool NL3D::CPointLightModel::getInfluenceLightMap (  )  const [inline]

Definition at line 102 of file point_light_model.h.

References _InfluenceLightMap.

void NL3D::CPointLightModel::initModel (  )  [protected, virtual]

Implement the initModel method: link to the LightModelList.

Reimplemented from NL3D::CTransform.

Definition at line 61 of file point_light_model.cpp.

References NL3D::CLightTrav::addPointLightModel(), NL3D::CScene::getLightTrav(), and NL3D::CTransform::getOwnerScene().

bool NL3D::CPointLightModel::isHrcVisible (  )  const [inline, private]

tells if the pointLightModel is not hidden by user actually, it is the result of hrc Visibility.

Reimplemented from NL3D::CTransform.

Definition at line 133 of file point_light_model.h.

References NL3D::CTransform::_WorldVis.

Referenced by traverseLight().

void NL3D::CPointLightModel::registerBasic (  )  [static]

Call at the begining of the program, to register the model.

Reimplemented from NL3D::CTransform.

Definition at line 40 of file point_light_model.cpp.

References creator(), NL3D::PointLightModelId, NL3D::CScene::registerModel(), and NL3D::TransformId.

Referenced by NL3D::CScene::registerBasics().

void NL3D::CPointLightModel::setDeltaPosToSkeletonWhenOutOfFrustum ( const CVector deltaPos  ) 

setup the deltaPosToSkeletonWhenOutOfFrustum When a light is sticked to a skeleton, and if this skeleton is clipped, then the position of the light can't be computed correctly without animating the skeleton.

To allow good position of the light, and to avoid recomputing the skeleton even if it is clipped, the light position is set to skeletonMatrix * this "deltaPosToSkeletonWhenOutOfFrustum".

Default is (0, 0, 1.5). You may change this according to the approximate size of the skeleton (dwarf or giant), and you must take into account any mount (horse etc...). eg for a man on a elephant, a good value would be (0,0,5) :)

Definition at line 72 of file point_light_model.cpp.

References _DeltaPosToSkeletonWhenOutOfFrustum.

void NL3D::CPointLightModel::setInfluenceLightMap ( bool  enable  )  [inline]

Special For Lightmap dynamic Lighting.

if true, this light will influence lightmaped objects. Lightmaped objects can be lighted by ONLY ONE (preference big) dynamic light. If you setup multiple CPointLightModel with this flag, then it will randomly choose between one of those visible lights. NB: Lighting is made hardware per vertex.

Definition at line 101 of file point_light_model.h.

References _InfluenceLightMap.

void NL3D::CPointLightModel::traverseLight (  )  [virtual]

Friends And Related Function Documentation

friend class CLightTrav [friend]

Definition at line 123 of file point_light_model.h.


Member Data Documentation

Same problem as _DeltaPosToSkeletonWhenOutOfFrustum, but this one is computed at each Visible frame.

And we interpolate between actual direction and backuped direction when the spot become visible (5 frames, hardcoded)

Definition at line 144 of file point_light_model.h.

Referenced by traverseLight().

Definition at line 128 of file point_light_model.h.

Referenced by NL3D::CLightTrav::addPointLightModel().

Definition at line 145 of file point_light_model.h.

Referenced by CPointLightModel(), and traverseLight().

The pointLight setup (color/attenuation).

Do not use PointLight.Pos to setup the position. Use the CTransform interface to set the position. To enable SpotLight, use PointLight.setType(), and use PointLight.setSpotAngle() but don't use PointLight.setSpotDirection to setup the direction. The direction of the spotLight is driven by the J vector of the Transform WorldMatrix.

Definition at line 77 of file point_light_model.h.

Referenced by NL3D::CPSLight::step(), and traverseLight().


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

Generated on Thu Jan 7 08:30:07 2010 for NeL by  doxygen 1.6.1