#include <light_trav.h>
Inheritance diagram for NL3D::CLightTrav:
Lightable objects can be CTransform only.
NB: see CScene for 3d conventions (orthonormal basis...)
Nevrax France
Definition at line 60 of file light_trav.h.
Public Member Functions | |
CLightTrav (bool bSmallScene) | |
Constructor. | |
LightingList. Filled during clip traversal. | |
void | addLightedModel (CTransform *m) |
Add a model to the list of lighted models. DOESN'T CHECK if already inserted. | |
void | clearLightedList () |
Clear the list of lighted models. | |
void | reserveLightedList (uint numModels) |
Add a model to the list of lighted models. DOESN'T CHECK if already inserted. | |
LightingList. Add a PointLightModel to the list. | |
void | addPointLightModel (CPointLightModel *pl) |
void | traverse () |
Data Fields | |
CLightingManager | LightingManager |
The lightingManager, where objects/lights are inserted, and modelContributions are computed. | |
bool | LightingSystemEnabled |
CScene * | Scene |
Private Attributes | |
uint32 | _CurrentNumVisibleModels |
CFastPtrList< CPointLightModel > | _DynamicLightList |
std::vector< CTransform * > | _LightedList |
|
Constructor.
Definition at line 45 of file light_trav.cpp. References _LightedList, and LightingSystemEnabled.
00045 : LightingManager(bSmallScene) 00046 { 00047 _LightedList.resize(1024); 00048 _CurrentNumVisibleModels= 0; 00049 00050 LightingSystemEnabled= false; 00051 } |
|
Add a model to the list of lighted models. DOESN'T CHECK if already inserted.
Definition at line 77 of file light_trav.h. References _LightedList. Referenced by NL3D::CClipTrav::clipSkeletonShadowMaps(), and NL3D::CTransform::traverseClip().
00078 { 00079 _LightedList[_CurrentNumVisibleModels]= m; 00080 _CurrentNumVisibleModels++; 00081 } |
|
Definition at line 61 of file light_trav.cpp. References _DynamicLightList, NL3D::CPointLightModel::_PointLightNode, and NL3D::CFastPtrList< CPointLightModel >::insert(). Referenced by NL3D::CPointLightModel::initModel().
00062 { 00063 _DynamicLightList.insert(pl, &pl->_PointLightNode); 00064 } |
|
Clear the list of lighted models.
Definition at line 54 of file light_trav.cpp. Referenced by NL3D::CClipTrav::traverse().
00055 { 00056 _CurrentNumVisibleModels= 0; 00057 } |
|
Add a model to the list of lighted models. DOESN'T CHECK if already inserted.
Definition at line 124 of file light_trav.cpp. References _LightedList, and uint. Referenced by NL3D::CScene::createModel().
00125 { 00126 // enlarge only. 00127 if(numModels>_LightedList.size()) 00128 _LightedList.resize(numModels); 00129 } |
|
Definition at line 68 of file light_trav.cpp. References _DynamicLightList, _LightedList, NL3D::CFastPtrList< CPointLightModel >::begin(), NL3D::CLightingManager::clearDynamicLights(), H_AUTO, LightingManager, LightingSystemEnabled, NL3D::CFastPtrList< CPointLightModel >::size(), and uint. Referenced by NL3D::CScene::render().
00069 { 00070 H_AUTO( NL3D_TravLight ); 00071 00072 uint i; 00073 00074 00075 // If lighting System disabled, skip 00076 if(!LightingSystemEnabled) 00077 return; 00078 00079 /* for each visible lightable transform, reset them only if they have MergedPointLight. 00080 NB: dynamic objetcs don't need it because already done in traverseHRC() 00081 (but don't worry, reset state is flagged, so resetLighting() no op...) 00082 This is important only for static object (freezeHRC()). 00083 Why? because we are not sure the MergedPointLight does not represent moving DynamicPointLights. 00084 Actually, it surely does. Because most of the static light setup return<=2 lights, and MaxLightContribution 00085 is typically==3. So any additional light may surely be a dynamic one. 00086 NB: this may not be usefull since dynamicLights resetLighting() of all models in range. But this is important 00087 when the dynamic light leave the model quiclky! (because don't dirt the model). 00088 NB: this is also usefull only if there is no dynamic light but the ones merged in MergedPointLight. 00089 Because dynamic always reset their old attached models (see below). This still can arise if for example 00090 _MaxLightContribution=2 and there is a FrozenStaticLightSetup of 2 lights.... 00091 */ 00092 for(i=0; i<_CurrentNumVisibleModels; i++ ) 00093 { 00094 // if the model has a MergedPointLight, reset him (NB: already done for dynamics models) 00095 if(_LightedList[i]->useMergedPointLight()) 00096 { 00097 _LightedList[i]->resetLighting(); 00098 } 00099 } 00100 00101 00102 // clear the quadGrid of dynamicLights 00103 LightingManager.clearDynamicLights(); 00104 00105 // for each lightModel, process her: recompute position, resetLightedModels(), and append to the quadGrid. 00106 CPointLightModel **pLight= _DynamicLightList.begin(); 00107 uint numPls= _DynamicLightList.size(); 00108 for(;numPls>0;numPls--, pLight++) 00109 { 00110 (*pLight)->traverseLight(); 00111 } 00112 00113 // for each visible lightable transform 00114 for(i=0; i<_CurrentNumVisibleModels; i++ ) 00115 { 00116 // traverse(), to recompute light contribution (if needed). 00117 _LightedList[i]->traverseLight(); 00118 } 00119 00120 } |
|
Definition at line 105 of file light_trav.h. |
|
Definition at line 108 of file light_trav.h. Referenced by addPointLightModel(), and traverse(). |
|
Definition at line 104 of file light_trav.h. Referenced by addLightedModel(), CLightTrav(), reserveLightedList(), and traverse(). |
|
The lightingManager, where objects/lights are inserted, and modelContributions are computed.
Definition at line 97 of file light_trav.h. Referenced by NL3D::CLandscapeModel::clipAndRenderLandscape(), NL3D::CScene::getLightTransitionThreshold(), NL3D::CScene::getMaxLightContribution(), NL3D::CScene::setLightTransitionThreshold(), NL3D::CScene::setMaxLightContribution(), traverse(), NL3D::CTransform::traverseLight(), NL3D::CPointLightModel::traverseLight(), NL3D::CTransform::unfreezeHRC(), NL3D::CTransform::update(), and NL3D::CTransform::~CTransform(). |
|
Definition at line 94 of file light_trav.h. Referenced by CLightTrav(), NL3D::CScene::enableLightingSystem(), and traverse(). |
|
Definition at line 55 of file trav_scene.h. Referenced by NL3D::CScene::CScene(), NL3D::CMeshMRMSkinnedGeom::profileSceneRender(), NL3D::CMeshMRMGeom::profileSceneRender(), and NL3D::CMeshGeom::profileSceneRender(). |