#include <load_balancing_trav.h>
Nevrax France
Definition at line 60 of file load_balancing_trav.h.
Public Types | |
| enum | TPolygonBalancingMode { PolygonBalancingOff = 0, PolygonBalancingOn, PolygonBalancingClamp, CountPolygonBalancing } |
Public Member Functions | |
| void | addNbFacesPass0 (float v) |
| CLoadBalancingGroup () | |
| float | computeModelNbFace (float faceIn) |
| Compute the number of face to be rendered for thismodel, according to the number of faces he want to draw. | |
| float | getNbFaceAsked () const |
| uint | getNbFaceWanted () const |
| void | setNbFaceWanted (uint nFaces) |
Data Fields | |
| std::string | Name |
Private Member Functions | |
| void | computeRatioAndSmooth (TPolygonBalancingMode polMode) |
Private Attributes | |
| bool | _DefaultGroup |
| float | _FaceRatio |
| float | _NbFacePass0 |
| uint | _NbFaceWanted |
| TPolygonBalancingMode | _PrecPolygonBalancingMode |
| NLMISC::CValueSmoother | _ValueSmoother |
Friends | |
| class | CLoadBalancingTrav |
|
|
Definition at line 64 of file load_balancing_trav.h.
|
|
|
Definition at line 54 of file load_balancing_trav.cpp. References _DefaultGroup, _FaceRatio, _NbFacePass0, _NbFaceWanted, _PrecPolygonBalancingMode, _ValueSmoother, NLMISC::CValueSmootherTemplate< float >::init(), and NL3D_DEFAULT_LOADBALANCING_VALUE_SMOOTHER.
00055 {
00056 _PrecPolygonBalancingMode= CLoadBalancingGroup::PolygonBalancingOff;
00057 _NbFaceWanted= 20000;
00058 _ValueSmoother.init(NL3D_DEFAULT_LOADBALANCING_VALUE_SMOOTHER);
00059 _DefaultGroup= false;
00060
00061 _NbFacePass0= 0;
00062 _FaceRatio= 1;
00063 }
|
|
|
Definition at line 80 of file load_balancing_trav.h. References _NbFacePass0, and v. Referenced by NL3D::CTransformShape::traverseLoadBalancingPass0().
00080 {_NbFacePass0+= v;}
|
|
|
Compute the number of face to be rendered for thismodel, according to the number of faces he want to draw.
Definition at line 83 of file load_balancing_trav.h. References _FaceRatio. Referenced by NL3D::CTransformShape::traverseLoadBalancingPass1().
00083 {return faceIn * _FaceRatio;}
|
|
|
Definition at line 67 of file load_balancing_trav.cpp. References _DefaultGroup, _FaceRatio, _NbFacePass0, _NbFaceWanted, _PrecPolygonBalancingMode, _ValueSmoother, NLMISC::CValueSmootherTemplate< float >::addValue(), NLMISC::clamp(), NLMISC::CValueSmootherTemplate< float >::getSmoothValue(), NLMISC::CValueSmootherTemplate< float >::init(), NLMISC::isValidDouble(), NL3D_DEFAULT_LOADBALANCING_VALUE_SMOOTHER, NL3D_LOADBALANCING_SMOOTHER_MAX_RATIO, PolygonBalancingClamp, PolygonBalancingOff, PolygonBalancingOn, and NLMISC::CValueSmootherTemplate< float >::reset().
00068 {
00069 // If Default group, disable load balancing
00070 if(_DefaultGroup)
00071 polMode= PolygonBalancingOff;
00072
00073 // Compute ratio
00074 switch(polMode)
00075 {
00076 case PolygonBalancingOff:
00077 _FaceRatio= 1;
00078 break;
00079 case PolygonBalancingOn :
00080 if(_NbFacePass0!=0)
00081 _FaceRatio= (float)_NbFaceWanted / _NbFacePass0;
00082 else
00083 _FaceRatio= 1;
00084 break;
00085 case PolygonBalancingClamp:
00086 if(_NbFacePass0!=0)
00087 _FaceRatio= (float)_NbFaceWanted / _NbFacePass0;
00088 else
00089 _FaceRatio= 1;
00090 clamp(_FaceRatio, 0, 1);
00091 break;
00092 default: break;
00093 };
00094
00095 // smooth the value.
00096 // if change of PolygonBalancingMode, reset the _ValueSmoother.
00097 if(polMode!=_PrecPolygonBalancingMode)
00098 {
00099 _ValueSmoother.init(NL3D_DEFAULT_LOADBALANCING_VALUE_SMOOTHER);
00100 _PrecPolygonBalancingMode= polMode;
00101 }
00102 // if not PolygonBalancingOff, smooth the ratio.
00103 if(polMode!=PolygonBalancingOff)
00104 {
00105 // FIX: If the _FaceRatio is not a float (NaN or +-oo), don't add it!!
00106 if(isValidDouble(_FaceRatio))
00107 _ValueSmoother.addValue(_FaceRatio);
00108 float fSmooth= _ValueSmoother.getSmoothValue();
00109
00110 // If after smoothing, the number of faces is still too big, reduce smooth effect! (frustrum clip effect)
00111 if(fSmooth*_NbFacePass0 > _NbFaceWanted*NL3D_LOADBALANCING_SMOOTHER_MAX_RATIO)
00112 {
00113 // reset the smoother
00114 _ValueSmoother.reset();
00115 // reduce smooth effect
00116 fSmooth= _FaceRatio*NL3D_LOADBALANCING_SMOOTHER_MAX_RATIO;
00117 _ValueSmoother.addValue(fSmooth);
00118 }
00119
00120 // take the smoothed value.
00121 _FaceRatio= fSmooth;
00122 }
00123
00124
00125 }
|
|
|
Definition at line 76 of file load_balancing_trav.h. References _NbFacePass0.
00076 {return _NbFacePass0;}
|
|
|
Definition at line 74 of file load_balancing_trav.h. References _NbFaceWanted, and uint. Referenced by NL3D::CLoadBalancingTrav::getGroupNbFaceWanted().
00074 {return _NbFaceWanted;}
|
|
|
Definition at line 73 of file load_balancing_trav.h. References _NbFaceWanted, and uint. Referenced by NL3D::CLoadBalancingTrav::setGroupNbFaceWanted().
00073 {_NbFaceWanted= nFaces;}
|
|
|
Definition at line 86 of file load_balancing_trav.h. |
|
|
Definition at line 89 of file load_balancing_trav.h. Referenced by CLoadBalancingGroup(), and computeRatioAndSmooth(). |
|
|
Definition at line 98 of file load_balancing_trav.h. Referenced by CLoadBalancingGroup(), computeModelNbFace(), and computeRatioAndSmooth(). |
|
|
Definition at line 92 of file load_balancing_trav.h. Referenced by addNbFacesPass0(), CLoadBalancingGroup(), computeRatioAndSmooth(), and getNbFaceAsked(). |
|
|
Definition at line 95 of file load_balancing_trav.h. Referenced by CLoadBalancingGroup(), computeRatioAndSmooth(), getNbFaceWanted(), and setNbFaceWanted(). |
|
|
Definition at line 103 of file load_balancing_trav.h. Referenced by CLoadBalancingGroup(), and computeRatioAndSmooth(). |
|
|
Definition at line 101 of file load_balancing_trav.h. Referenced by CLoadBalancingGroup(), and computeRatioAndSmooth(). |
|
|
Definition at line 68 of file load_balancing_trav.h. Referenced by NL3D::CTransform::getLoadBalancingGroup(). |
1.3.6