This model is a dynamic light. More...
#include <point_light_model.h>
Inherits NL3D::CTransform.
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 CVector & | getDeltaPosToSkeletonWhenOutOfFrustum () 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 CTransform * | creator () |
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 |
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).
Definition at line 62 of file point_light_model.h.
| NL3D::CPointLightModel::CPointLightModel | ( | ) | [protected] |
Constructor.
Definition at line 46 of file point_light_model.cpp.
References _DeltaPosToSkeletonWhenOutOfFrustum, _InfluenceLightMap, _TimeFromLastClippedSpotDirection, and NLMISC::CVector::set().
| NL3D::CPointLightModel::~CPointLightModel | ( | ) | [protected, virtual] |
Destructor.
Definition at line 55 of file point_light_model.cpp.
| 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 |
see setDeltaPosToSkeletonWhenOutOfFrustum()
Definition at line 79 of file point_light_model.cpp.
References _DeltaPosToSkeletonWhenOutOfFrustum.
| 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] |
The traverse() method is called to update the worldPosition of the light, resetLightedModels(), and re-insert the light in the lightingManager.
Reimplemented from NL3D::CTransform.
Definition at line 86 of file point_light_model.cpp.
References NL3D::CTransform::_AncestorSkeletonModel, _DeltaPosToSkeletonWhenOutOfFrustum, _InfluenceLightMap, _LastWorldSpotDirectionWhenOutOfFrustum, _TimeFromLastClippedSpotDirection, NL3D::CLightingManager::addDynamicLight(), NLMISC::CRGBA::Black, NL3D::CPointLight::getAttenuationBegin(), NL3D::CPointLight::getAttenuationEnd(), NL3D::CPointLight::getDiffuse(), NL3D::CScene::getDriver(), NLMISC::CMatrix::getJ(), NL3D::CScene::getLightTrav(), NL3D::CTransform::getOwnerScene(), NL3D::ITransformable::getPos(), NL3D::CPointLight::getPosition(), NL3D::CPointLight::getSpecular(), NL3D::CPointLight::getSpotAngleBegin(), NL3D::CPointLight::getSpotAngleEnd(), NL3D::CPointLight::getSpotDirection(), NL3D::CPointLight::getType(), NL3D::CTransform::getWorldMatrix(), NL3D::CTransform::isClipVisible(), isHrcVisible(), NLMISC::CVector::K, NL3D::CLightTrav::LightingManager, NLMISC::Pi, PointLight, NL3D::CPointLight::resetLightedModels(), NL3D::IDriver::setLightMapDynamicLight(), NL3D::CPointLight::setPosition(), NL3D::CLight::setupAttenuation(), NL3D::CLight::setupPointLight(), NL3D::CPointLight::setupSpotDirection(), NL3D::CLight::setupSpotExponent(), NL3D::CLight::setupSpotLight(), and NL3D::CPointLight::SpotLight.
friend class CLightTrav [friend] |
Definition at line 123 of file point_light_model.h.
see setDeltaPosToSkeletonWhenOutOfFrustum()
Definition at line 139 of file point_light_model.h.
Referenced by CPointLightModel(), getDeltaPosToSkeletonWhenOutOfFrustum(), setDeltaPosToSkeletonWhenOutOfFrustum(), and traverseLight().
Definition at line 149 of file point_light_model.h.
Referenced by CPointLightModel(), getInfluenceLightMap(), setInfluenceLightMap(), and traverseLight().
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().
1.6.1