#include <load_balancing_trav.h>
Inheritance diagram for NL3D::CLoadBalancingTrav:
NB: see CScene for 3d conventions (orthonormal basis...)
Nevrax France
Definition at line 120 of file load_balancing_trav.h.
LoadBalancing mgt. | |
typedef CLoadBalancingGroup::TPolygonBalancingMode | TPolygonBalancingMode |
float | getGroupNbFaceAsked (const std::string &group) const |
uint | getGroupNbFaceWanted (const std::string &group) |
float | getNbFaceAsked () const |
Get the last face count asked from the instances before reduction. Sum of all groups. | |
void | setGroupNbFaceWanted (const std::string &group, uint nFaces) |
TPolygonBalancingMode | PolygonBalancingMode |
Public Member Functions | |
void | addVisibleModel (CTransform *model) |
void | clearVisibleList () |
CLoadBalancingTrav () | |
Constructor. | |
CLoadBalancingGroup * | getDefaultGroup () |
uint | getLoadPass () |
CLoadBalancingGroup * | getOrCreateGroup (const std::string &group) |
void | reserveVisibleList (uint numModels) |
void | setCamMatrix (const NLMISC::CMatrix &camMatrix) |
Setup the camera matrix (a translation/rotation matrix). | |
void | setFrustum (float width, float height, float znear, float zfar, bool perspective=true) |
Setup the camera mode as a perspective/ortho camera. NB: znear and zfar must be >0 (if perspective). | |
void | setFrustum (float left, float right, float bottom, float top, float znear, float zfar, bool perspective=true) |
Setup the camera mode as a perspective/ortho camera. NB: znear and zfar must be >0 (if perspective). | |
ITrav/ITravScene Implementation. | |
void | traverse () |
Data Fields | |
CScene * | Scene |
Protected Member Functions | |
void | update () |
update the dependent information. | |
Private Types | |
typedef TGroupMap::iterator | ItGroupMap |
typedef std::map< std::string, CLoadBalancingGroup > | TGroupMap |
Private Member Functions | |
void | traverseVisibilityList () |
Private Attributes | |
uint32 | _CurrentNumVisibleModels |
CLoadBalancingGroup * | _DefaultGroup |
TGroupMap | _GroupMap |
uint | _LoadPass |
float | _SumNbFacePass0 |
std::vector< CTransform * > | _VisibleList |
|
Definition at line 202 of file load_balancing_trav.h. Referenced by getOrCreateGroup(), and traverse(). |
|
Definition at line 201 of file load_balancing_trav.h. |
|
Definition at line 138 of file load_balancing_trav.h. |
|
Constructor.
Definition at line 136 of file load_balancing_trav.cpp. References _GroupMap, and PolygonBalancingMode.
00137 { 00138 PolygonBalancingMode= CLoadBalancingGroup::PolygonBalancingOff; 00139 00140 // Add the default group and make it default 00141 _GroupMap["Default"].Name= "Default"; 00142 _GroupMap["Default"]._DefaultGroup= true; 00143 00144 // set the DefaultGroup ptr. 00145 _DefaultGroup= &_GroupMap["Default"]; 00146 00147 // prepare some space 00148 _VisibleList.resize(1024); 00149 _CurrentNumVisibleModels= 0; 00150 } |
|
Definition at line 178 of file load_balancing_trav.h. Referenced by NL3D::CParticleSystemModel::insertInVisibleList(), and NL3D::CTransform::traverseClip().
00179 { 00180 _VisibleList[_CurrentNumVisibleModels]= model; 00181 _CurrentNumVisibleModels++; 00182 } |
|
Definition at line 154 of file load_balancing_trav.cpp. Referenced by NL3D::CClipTrav::traverse().
00155 { 00156 _CurrentNumVisibleModels= 0; 00157 } |
|
Definition at line 168 of file load_balancing_trav.h. Referenced by NL3D::CTransform::initModel().
00168 {return _DefaultGroup;} |
|
Get the last face count asked from the instances before reduction. only for the given group return 0 if the Group does not exist. Definition at line 258 of file load_balancing_trav.cpp. References _GroupMap. Referenced by NL3D::CScene::getGroupNbFaceAsked().
|
|
Get the number of faces wanted for a LoadBlancingGroup. The Group is created if did not exist. Definition at line 251 of file load_balancing_trav.cpp. References NL3D::CLoadBalancingGroup::getNbFaceWanted(), getOrCreateGroup(), and uint. Referenced by NL3D::CScene::getGroupLoadMaxPolygon().
00252 { 00253 // get/create if needed, and get. 00254 return getOrCreateGroup(group)->getNbFaceWanted(); 00255 } |
|
Definition at line 166 of file load_balancing_trav.h. References _LoadPass, and uint. Referenced by NL3D::CTransformShape::traverseLoadBalancing(), and NL3D::CMeshMultiLodInstance::traverseLoadBalancing().
00166 {return _LoadPass;} |
|
Get the last face count asked from the instances before reduction. Sum of all groups.
Definition at line 220 of file load_balancing_trav.cpp. References _SumNbFacePass0. Referenced by NL3D::CScene::getNbFaceAsked().
00221 { 00222 return _SumNbFacePass0; 00223 } |
|
Definition at line 227 of file load_balancing_trav.cpp. References _GroupMap, and ItGroupMap. Referenced by getGroupNbFaceWanted(), setGroupNbFaceWanted(), and NL3D::CTransform::setLoadBalancingGroup().
00228 { 00229 // find 00230 ItGroupMap it; 00231 it= _GroupMap.find(group); 00232 // if not exist, create. 00233 if(it==_GroupMap.end()) 00234 { 00235 // create and set name. 00236 it= _GroupMap.insert(make_pair(group, CLoadBalancingGroup())).first; 00237 it->second.Name= group; 00238 } 00239 00240 return &(it->second); 00241 } |
|
Definition at line 270 of file load_balancing_trav.cpp. References uint. Referenced by NL3D::CScene::createModel().
00271 { 00272 // enlarge only. 00273 if(numModels>_VisibleList.size()) 00274 _VisibleList.resize(numModels); 00275 } |
|
Setup the camera matrix (a translation/rotation matrix).
Definition at line 102 of file trav_scene.h. References NL3D::CTravCameraScene::CamMatrix. Referenced by NL3D::CScene::render().
00103 { 00104 CamMatrix= camMatrix; 00105 } |
|
Setup the camera mode as a perspective/ortho camera. NB: znear and zfar must be >0 (if perspective).
Definition at line 97 of file trav_scene.h. References height, NL3D::CTravCameraScene::setFrustum(), and width.
00098 { 00099 setFrustum(-width/2, width/2, -height/2, height/2, znear, zfar, perspective); 00100 } |
|
Setup the camera mode as a perspective/ortho camera. NB: znear and zfar must be >0 (if perspective).
Definition at line 86 of file trav_scene.h. References NL3D::CTravCameraScene::Bottom, NL3D::CTravCameraScene::Far, NL3D::CTravCameraScene::Near, NL3D::CTravCameraScene::Perspective, and NL3D::CTravCameraScene::Right. Referenced by NL3D::CTravCameraScene::CTravCameraScene(), NL3D::CScene::render(), and NL3D::CTravCameraScene::setFrustum().
|
|
Set the number of faces wanted for a LoadBlancingGroup. The Group is created if did not exist. Definition at line 244 of file load_balancing_trav.cpp. References getOrCreateGroup(), NL3D::CLoadBalancingGroup::setNbFaceWanted(), and uint. Referenced by NL3D::CScene::setGroupLoadMaxPolygon().
00245 { 00246 // get/create if needed, and assign. 00247 getOrCreateGroup(group)->setNbFaceWanted(nFaces); 00248 } |
|
Definition at line 161 of file load_balancing_trav.cpp. References _GroupMap, _LoadPass, _SumNbFacePass0, H_AUTO, ItGroupMap, PolygonBalancingMode, and traverseVisibilityList(). Referenced by NL3D::CScene::render().
00162 { 00163 H_AUTO( NL3D_TravLoadBalancing ); 00164 00165 CTravCameraScene::update(); 00166 00167 // Reset each group. 00168 //================ 00169 ItGroupMap it= _GroupMap.begin(); 00170 for(;it!=_GroupMap.end();it++) 00171 { 00172 // reset _NbFacePass0. 00173 it->second._NbFacePass0= 0; 00174 } 00175 00176 00177 // Traverse the graph 2 times. 00178 00179 // 1st pass, count NBFaces drawed. 00180 //================ 00181 _LoadPass= 0; 00182 // count _NbFacePass0. 00183 traverseVisibilityList(); 00184 00185 00186 // Reset _SumNbFacePass0 00187 _SumNbFacePass0= 0; 00188 // For each group 00189 it= _GroupMap.begin(); 00190 for(;it!=_GroupMap.end();it++) 00191 { 00192 // compute ratio and smooth 00193 it->second.computeRatioAndSmooth(PolygonBalancingMode); 00194 // update _SumNbFacePass0 00195 _SumNbFacePass0+= it->second.getNbFaceAsked(); 00196 } 00197 00198 00199 // 2nd pass, compute Faces that will be drawed. 00200 //================ 00201 _LoadPass= 1; 00202 traverseVisibilityList(); 00203 00204 } |
|
Definition at line 208 of file load_balancing_trav.cpp. References NL3D::CTransform::traverseLoadBalancing(), and uint. Referenced by traverse().
00209 { 00210 // Traverse all nodes of the visibility list. 00211 for(uint i=0; i<_CurrentNumVisibleModels; i++) 00212 { 00213 CTransform *model= _VisibleList[i]; 00214 model->traverseLoadBalancing(); 00215 } 00216 } |
|
update the dependent information.
Definition at line 122 of file trav_scene.h. References NL3D::CTravCameraScene::CamLook, NL3D::CTravCameraScene::CamMatrix, NL3D::CTravCameraScene::CamPos, NLMISC::CMatrix::getPos(), NLMISC::CMatrix::inverted(), and NLMISC::CMatrix::mulVector().
|
|
Definition at line 207 of file load_balancing_trav.h. |
|
Definition at line 200 of file load_balancing_trav.h. |
|
Definition at line 203 of file load_balancing_trav.h. Referenced by CLoadBalancingTrav(), getGroupNbFaceAsked(), getOrCreateGroup(), and traverse(). |
|
Definition at line 190 of file load_balancing_trav.h. Referenced by getLoadPass(), and traverse(). |
|
Definition at line 193 of file load_balancing_trav.h. Referenced by getNbFaceAsked(), and traverse(). |
|
Definition at line 206 of file load_balancing_trav.h. |
|
Definition at line 75 of file trav_scene.h. Referenced by NL3D::CTravCameraScene::setFrustum(), NL3D::CWaterModel::traverseRender(), and NL3D::CFlareModel::traverseRender(). |
|
Definition at line 80 of file trav_scene.h. Referenced by NL3D::CLandscapeModel::clipAndRenderLandscape(), NL3D::CTravCameraScene::CTravCameraScene(), and NL3D::CTravCameraScene::update(). |
|
Definition at line 77 of file trav_scene.h. Referenced by NL3D::CTravCameraScene::CTravCameraScene(), NL3D::CTravCameraScene::setCamMatrix(), NL3D::CWaterModel::traverseRender(), NL3D::CFlareModel::traverseRender(), and NL3D::CTravCameraScene::update(). |
|
|
Definition at line 75 of file trav_scene.h. Referenced by NL3D::CWaterModel::computeClippedPoly(), NL3D::CTravCameraScene::setFrustum(), NL3D::CWaterModel::traverseRender(), and NL3D::CFlareModel::traverseRender(). |
|
Definition at line 75 of file trav_scene.h. Referenced by NL3D::CWaterModel::traverseRender(), and NL3D::CFlareModel::traverseRender(). |
|
Definition at line 75 of file trav_scene.h. Referenced by NL3D::CWaterModel::computeClippedPoly(), NL3D::CTravCameraScene::setFrustum(), NL3D::CWaterModel::traverseRender(), and NL3D::CFlareModel::traverseRender(). |
|
Definition at line 76 of file trav_scene.h. Referenced by NL3D::CTravCameraScene::setFrustum(). |
|
Definition at line 139 of file load_balancing_trav.h. Referenced by CLoadBalancingTrav(), NL3D::CScene::getPolygonBalancingMode(), NL3D::CScene::setPolygonBalancingMode(), and traverse(). |
|
Definition at line 75 of file trav_scene.h. Referenced by NL3D::CWaterModel::computeClippedPoly(), NL3D::CTravCameraScene::setFrustum(), NL3D::CWaterModel::traverseRender(), and NL3D::CFlareModel::traverseRender(). |
|
Definition at line 55 of file trav_scene.h. Referenced by NL3D::CScene::CScene(), NL3D::CMeshMRMSkinnedGeom::profileSceneRender(), NL3D::CMeshMRMGeom::profileSceneRender(), and NL3D::CMeshGeom::profileSceneRender(). |
|
Definition at line 75 of file trav_scene.h. Referenced by NL3D::CWaterModel::computeClippedPoly(), NL3D::CWaterModel::traverseRender(), and NL3D::CFlareModel::traverseRender(). |
|
Definition at line 78 of file trav_scene.h. Referenced by NL3D::CWaterModel::computeClippedPoly(), NL3D::CParticleSystemModel::doAnimate(), NL3D::CWaterModel::traverseRender(), and NL3D::CFlareModel::traverseRender(). |