# Home    # nevrax.com   
Nevrax
Nevrax.org
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
Docs
 
Documentation  
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  

NL3D::CPointLightModel Class Reference

This model is a dynamic light. More...

#include <point_light_model.h>

Inheritance diagram for NL3D::CPointLightModel:

NL3D::CTransform NL3D::IModel NL3D::ITransformable NLMISC::CRefCount NL3D::IAnimatable List of all members.

Public Methods

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. More...

const CVector & getDeltaPosToSkeletonWhenOutOfFrustum () const
 see setDeltaPosToSkeletonWhenOutOfFrustum(). More...


Static Public Methods

void registerBasic ()
 Call at the begining of the program, to register the model, and the basic observers. More...


Public Attributes

CPointLight PointLight
 The pointLight setup (color/attenuation). More...


Protected Methods

 CPointLightModel ()
 Constructor. More...

virtual ~CPointLightModel ()
 Destructor. More...

virtual void initModel ()
 Implement the initModel method: link to the LightModelRoot. More...


Private Methods

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

bool isClipVisible () const
 tells if the pointLightModel has been clipped in the clip traversal. More...

CTransformHrcObsgetHrcObs () const
 get the Hrc obs. More...


Static Private Methods

IModelcreator ()

Private Attributes

CVector _DeltaPosToSkeletonWhenOutOfFrustum
 see setDeltaPosToSkeletonWhenOutOfFrustum(). More...

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

float _TimeFromLastClippedSpotDirection

Friends

class CPointLightModelLightObs

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 LightModelRoot 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). the observer 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 63 of file point_light_model.h.


Constructor & Destructor Documentation

NL3D::CPointLightModel::CPointLightModel   [protected]
 

Constructor.

Definition at line 45 of file point_light_model.cpp.

References _DeltaPosToSkeletonWhenOutOfFrustum, and _TimeFromLastClippedSpotDirection.

Referenced by creator.

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

Destructor.

Definition at line 53 of file point_light_model.cpp.


Member Function Documentation

IModel* NL3D::CPointLightModel::creator   [inline, static, private]
 

Reimplemented from NL3D::CTransform.

Definition at line 110 of file point_light_model.h.

References CPointLightModel, and NL3D::IModel::IModel.

const CVector & NL3D::CPointLightModel::getDeltaPosToSkeletonWhenOutOfFrustum   const
 

see setDeltaPosToSkeletonWhenOutOfFrustum().

Definition at line 81 of file point_light_model.cpp.

References _DeltaPosToSkeletonWhenOutOfFrustum.

CTransformHrcObs* NL3D::CPointLightModel::getHrcObs   const [inline, private]
 

get the Hrc obs.

Definition at line 131 of file point_light_model.h.

References NL3D::CTransform::_HrcObs.

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

Implement the initModel method: link to the LightModelRoot.

Reimplemented from NL3D::CTransform.

Definition at line 59 of file point_light_model.cpp.

References NL3D::IModel::getObs, NL3D::IModel::IObs, NL3D::LightTravId, and nlassert.

bool NL3D::CPointLightModel::isClipVisible   const [inline, private]
 

tells if the pointLightModel has been clipped in the clip traversal.

actually, it is the result of hrc Visibility * Skeleton cliping.

Definition at line 124 of file point_light_model.h.

References NL3D::CTransform::_ClipObs.

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

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

Definition at line 116 of file point_light_model.h.

References NL3D::CTransform::_HrcObs.

void NL3D::CPointLightModel::registerBasic   [static]
 

Call at the begining of the program, to register the model, and the basic observers.

Reimplemented from NL3D::CTransform.

Definition at line 38 of file point_light_model.cpp.

References NL3D::LightTravId, NL3D::PointLightModelId, and NL3D::TransformId.

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 74 of file point_light_model.cpp.

References _DeltaPosToSkeletonWhenOutOfFrustum.


Friends And Related Function Documentation

friend class CPointLightModelLightObs [friend]
 

Definition at line 108 of file point_light_model.h.


Member Data Documentation

CVector NL3D::CPointLightModel::_DeltaPosToSkeletonWhenOutOfFrustum [private]
 

see setDeltaPosToSkeletonWhenOutOfFrustum().

Definition at line 137 of file point_light_model.h.

Referenced by CPointLightModel, getDeltaPosToSkeletonWhenOutOfFrustum, and setDeltaPosToSkeletonWhenOutOfFrustum.

CVector NL3D::CPointLightModel::_LastWorldSpotDirectionWhenOutOfFrustum [private]
 

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 142 of file point_light_model.h.

float NL3D::CPointLightModel::_TimeFromLastClippedSpotDirection [private]
 

Definition at line 143 of file point_light_model.h.

Referenced by CPointLightModel.

CPointLight NL3D::CPointLightModel::PointLight
 

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 78 of file point_light_model.h.


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