From 0ea5fc66924303d1bf73ba283a383e2aadee02f2 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Aug 2018 20:21:34 +0200 Subject: Initial commit --- .../nel/load__balancing__trav_8h-source.html | 299 +++++++++++++++++++++ 1 file changed, 299 insertions(+) create mode 100644 docs/doxygen/nel/load__balancing__trav_8h-source.html (limited to 'docs/doxygen/nel/load__balancing__trav_8h-source.html') diff --git a/docs/doxygen/nel/load__balancing__trav_8h-source.html b/docs/doxygen/nel/load__balancing__trav_8h-source.html new file mode 100644 index 00000000..62661184 --- /dev/null +++ b/docs/doxygen/nel/load__balancing__trav_8h-source.html @@ -0,0 +1,299 @@ + + + + nevrax.org : docs + + + + + + + + + + + + + + +
# 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  
+

load_balancing_trav.h

Go to the documentation of this file.
00001 
+00007 /* Copyright, 2001 Nevrax Ltd.
+00008  *
+00009  * This file is part of NEVRAX NEL.
+00010  * NEVRAX NEL is free software; you can redistribute it and/or modify
+00011  * it under the terms of the GNU General Public License as published by
+00012  * the Free Software Foundation; either version 2, or (at your option)
+00013  * any later version.
+00014 
+00015  * NEVRAX NEL is distributed in the hope that it will be useful, but
+00016  * WITHOUT ANY WARRANTY; without even the implied warranty of
+00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+00018  * General Public License for more details.
+00019 
+00020  * You should have received a copy of the GNU General Public License
+00021  * along with NEVRAX NEL; see the file COPYING. If not, write to the
+00022  * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+00023  * MA 02111-1307, USA.
+00024  */
+00025 
+00026 #ifndef NL_LOAD_BALANCING_TRAV_H
+00027 #define NL_LOAD_BALANCING_TRAV_H
+00028 
+00029 #include "nel/misc/types_nl.h"
+00030 #include "nel/misc/matrix.h"
+00031 #include "nel/misc/plane.h"
+00032 #include "3d/trav_scene.h"
+00033 #include "nel/misc/value_smoother.h"
+00034 
+00035 
+00036 namespace NL3D 
+00037 {
+00038 
+00039 
+00040 using NLMISC::CVector;
+00041 using NLMISC::CPlane;
+00042 using NLMISC::CMatrix;
+00043 
+00044 
+00045 class IBaseLoadBalancingObs;
+00046 class IBaseHrcObs;
+00047 class IBaseClipObs;
+00048 class CClipTrav;
+00049 class CLoadBalancingTrav;
+00050 
+00051 
+00052 // ***************************************************************************
+00053 // ClassIds.
+00054 const NLMISC::CClassId          LoadBalancingTravId=NLMISC::CClassId(0x7181548, 0x36ad3c10);
+00055 
+00056 
+00057 // ***************************************************************************
+00067 class CLoadBalancingGroup
+00068 {
+00069 public:
+00070         // see CScene.
+00071         enum                    TPolygonBalancingMode {PolygonBalancingOff=0, PolygonBalancingOn, PolygonBalancingClamp, CountPolygonBalancing };
+00072 
+00073 public:
+00074         // Name of the group.
+00075         std::string             Name;
+00076 
+00077 public:
+00078         CLoadBalancingGroup();
+00079 
+00080         void                            setNbFaceWanted(uint nFaces) {_NbFaceWanted= nFaces;}
+00081         uint                            getNbFaceWanted() const {return _NbFaceWanted;}
+00082 
+00083         float                           getNbFaceAsked () const {return _NbFacePass0;}
+00084 
+00085 public:
+00086         // ONLY FOR OBSERVERS
+00087         void                            addNbFacesPass0(float v) {_NbFacePass0+= v;}
+00088 
+00090         float                           computeModelNbFace(float faceIn)        {return faceIn * _FaceRatio;}
+00091 
+00092 private:
+00093         friend class    CLoadBalancingTrav;
+00094 
+00095         // DefaultGroup means LoadBalancing disabled.
+00096         bool                            _DefaultGroup;
+00097 
+00098         // The number of faces count in Pass0.
+00099         float                           _NbFacePass0;
+00100 
+00101         // The number of face the user want
+00102         uint                            _NbFaceWanted;
+00103 
+00104         // use this ratio into Pass 1 to reduce faces.
+00105         float                           _FaceRatio;
+00106 
+00107         // To smooth the faceRatio
+00108         NLMISC::CValueSmoother          _ValueSmoother;
+00109         // Balancing Mode
+00110         TPolygonBalancingMode           _PrecPolygonBalancingMode;
+00111 
+00112         // as it sounds..
+00113         void                            computeRatioAndSmooth(TPolygonBalancingMode polMode);
+00114 };
+00115 
+00116 
+00117 
+00118 // ***************************************************************************
+00129 class CLoadBalancingTrav : public ITravCameraScene
+00130 {
+00131 public:
+00132 
+00134         CLoadBalancingTrav();
+00135 
+00136 
+00138 
+00139         IObs                            *createDefaultObs() const;
+00140         NLMISC::CClassId        getClassId() const {return LoadBalancingTravId;}
+00144         sint                            getRenderOrder() const {return 2300;}
+00145         void                            traverse();
+00147 
+00148 
+00150 
+00151 
+00152         // The PolygonBalancingMode
+00153         typedef CLoadBalancingGroup::TPolygonBalancingMode      TPolygonBalancingMode;
+00154         TPolygonBalancingMode   PolygonBalancingMode;
+00155 
+00156 
+00160         void                            setGroupNbFaceWanted(const std::string &group, uint nFaces);
+00161 
+00165         uint                            getGroupNbFaceWanted(const std::string &group);
+00166 
+00167 
+00171         float                           getGroupNbFaceAsked (const std::string &group) const;
+00172 
+00174         float                           getNbFaceAsked () const;
+00175 
+00177 
+00178 
+00179 public:
+00180         // ONLY FOR OBSERVERS
+00181         uint                            getLoadPass() {return _LoadPass;}
+00182 
+00183         CLoadBalancingGroup     *getDefaultGroup() {return _DefaultGroup;}
+00184 
+00185         // Get a group by name, create if needed.
+00186         CLoadBalancingGroup     *getOrCreateGroup(const std::string &group);
+00187 
+00188 
+00189         // For clipTrav. cleared at beginning of CClipTrav::traverse
+00190         void                            clearVisibleList();
+00191 
+00192         // For ClipObservers only. NB: list is cleared at begining of traverse().
+00193         void                            addVisibleObs(IBaseLoadBalancingObs *obs);
+00194 
+00195 // **************
+00196 private:
+00197         // Pass: 0 (compute faceCount from all models) or 1 (setup wanted faceCount).
+00198         uint                            _LoadPass;
+00199 
+00200         // The sum of all Pass0 groups.
+00201         float                           _SumNbFacePass0;
+00202 
+00203         // The loadBalancing balance only visible objects.
+00204         void                            traverseVisibilityList();
+00205 
+00206 
+00207         // The groups.
+00208         CLoadBalancingGroup     *_DefaultGroup;
+00209         typedef std::map<std::string, CLoadBalancingGroup>      TGroupMap;
+00210         typedef TGroupMap::iterator                                                     ItGroupMap;
+00211         TGroupMap                       _GroupMap;
+00212 
+00213         // traverse list of model visible and usefull to loadBalance.
+00214         std::vector<IBaseLoadBalancingObs*>     _VisibleList;
+00215 
+00216 };
+00217 
+00218 
+00219 // ***************************************************************************
+00236 class IBaseLoadBalancingObs : public IObs
+00237 {
+00238 public:
+00240         IBaseHrcObs             *HrcObs;
+00241         IBaseClipObs    *ClipObs;
+00242 
+00243         // Which group owns this model
+00244         CLoadBalancingGroup             *LoadBalancingGroup;
+00245 
+00246 public:
+00247 
+00249         IBaseLoadBalancingObs()
+00250         {
+00251                 HrcObs=NULL;
+00252                 ClipObs= NULL;
+00253         }
+00255         virtual void    init();
+00256 
+00257 
+00259 
+00260         virtual void    traverse(IObs *caller) =0;
+00262 
+00263 
+00264 };
+00265 
+00266 
+00267 // ***************************************************************************
+00279 class CDefaultLoadBalancingObs : public IBaseLoadBalancingObs
+00280 {
+00281 public:
+00282 
+00283 
+00285         CDefaultLoadBalancingObs() {}
+00286 
+00288 
+00289         virtual void    traverse(IObs *caller)
+00290         {
+00291                 // no need to traverseSons. No graph here.
+00292         }
+00294 
+00295 };
+00296 
+00297 
+00298 } // NL3D
+00299 
+00300 
+00301 #endif // NL_LOAD_BALANCING_TRAV_H
+00302 
+00303 /* End of load_balancing_trav.h */
+
+ + +
                                                                                                                                                                    +
+ + -- cgit v1.2.1