Changeset 2153 for GTP/trunk/Lib/Geom


Ignore:
Timestamp:
02/22/07 17:41:33 (18 years ago)
Author:
gumbau
Message:

Added some comments to the class

Location:
GTP/trunk/Lib/Geom/shared/GTGeometry
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoLodManager.h

    r1526 r2153  
    2121        class lodobj_node_t; 
    2222 
     23        /// This class implements a LOD manager for level of detail objects such as (LodStrips and LodTree objects) 
     24        /** This class automatically manages the level of detail of all objects added to the lod manager.  
     25                The key idea is to minimize the number of real changes in levels of detail because they consume  
     26                CPU and that can cause stalls and CPU bottlenecks in massive applications. The LodManager solves 
     27                this issue by deciding which objects have to change the level of detail and which objects can just  
     28                share an already calculated one. The system also decides whether an object can chage its level of  
     29                detail or it is not needed because it would take not effect on the performance. This drastically  
     30                reduces the CPU usage. in a completely transparent way to the user. */ 
     31 
    2332        class LodManager 
    2433        {        
    2534        public: 
     35                /// LodManager constructor 
     36                /** Constucts a LodManager object from the following parameters: 
     37                        - The near and far distances that define the active LOD range. 
     38                        - The initial camera position 
     39                        - The number of LOD slots in the snapshot list (this parameter is optional) 
     40                */ 
    2641                LodManager(Real near, Real far, const Geometry::Vector3 &campos, int numslots=10); 
     42 
     43                /// class destructor 
    2744                ~LodManager(void); 
     45 
     46                /// Adds a new LOD object (a LodStrips or a LodTree object) 
     47                /** When an object is added to the system,  its level of detail is automatically managed, and the  
     48                        client application does not need to manually change its level of detail.  
     49                        The parameters needed to add an object to the system are: 
     50                        - The class name of the object. The class name is the type of object. This is used by the system to  
     51                          know which objects are compatible to change the level of detail between themselves.  
     52                        - A reference to the LodObject itself (a LodStrips or a LodTree object). 
     53                        - The initial position in the 3D space of the added object. */ 
    2854                void AddLodObj(const std::string &name, LodObject*, const Geometry::Vector3 &); 
    29                 void UpdateLOD(uint32 currFPS, uint32 targetFPS=30); 
     55 
     56                /// Performs all needed LOD updates 
     57                /** This function should be called once per frame (or at some reasonable interval).  
     58                        Internally it performs all needed steps to change the level of detail of the objects. */ 
     59                void UpdateLOD(void); 
     60 
     61                /// Updates the camera position 
    3062                void UpdateCamera(const Geometry::Vector3 &); 
     63 
     64                /// Updates the position of a certain LodObject 
    3165                void UpdateLODObjectPos(LodObject*,const Geometry::Vector3 &); 
    3266 
    33                 bool always_calculate_lod; // if true, there is no instant LOD changing 
    34                 bool force_highest_lod; // if set to true, all objects will be set to their highest level of detail 
     67                /// Set it to true to force all LOD calculations (disable the LodManager features) 
     68                bool always_calculate_lod; 
     69 
     70                /// if set to true, all objects will be set to their highest level of detail 
     71                bool force_highest_lod; 
    3572 
    3673        private: 
  • GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodManager.cpp

    r2084 r2153  
    136136 
    137137 
    138 void Geometry::LodManager::UpdateLOD(uint32 currFPS, uint32 targetFPS) 
     138void Geometry::LodManager::UpdateLOD(void) 
    139139{ 
    140140        if (!lodobj_container->lodobj_dists.IsEmpty()) 
Note: See TracChangeset for help on using the changeset viewer.