source: GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoLodManager.h @ 1310

Revision 1310, 1.7 KB checked in by gumbau, 18 years ago (diff)

Lod Manager structure modification

Line 
1/*==========================================================================
2 *      (C) 2006 Universidad Jaime I de Castellón
3 *==========================================================================
4 *      PROYECT:        GAME TOOLS
5 *==========================================================================*/
6/*      CONTENT:
7 *
8 *
9 *      @file   GeoLodManager.h
10 *==========================================================================*/
11
12#ifndef _GEOLODMANAGER
13#define _GEOLODMANAGER
14
15#include "GeoVector3.h"
16#include "GeoLodObject.h"
17#include <map>
18#include <vector>
19
20namespace Geometry
21{
22        class lodobj_dist_node_t
23        {
24        public:
25                lodobj_dist_node_t(float dist, LodObject *o):dist2cam(dist),lodobj(o){ must_recalculate_distance=false; }
26                float dist2cam;
27                LodObject *lodobj;
28                bool must_recalculate_distance;
29                bool operator < (const lodobj_dist_node_t &o) const { return (dist2cam < o.dist2cam); }
30        };
31
32        class LodManager
33        {       
34        public:
35                LodManager(float near, float far, const Geometry::Vector3 &campos);
36                void AddLodObj(LodObject*, const Geometry::Vector3 &);
37                void UpdateLOD(void);
38                void UpdateCamera(const Geometry::Vector3 &);
39                void UpdateLODObjectPos(LodObject*,const Geometry::Vector3 &);
40        private:
41                std::vector<lodobj_dist_node_t> lodobj_dists; // key: dist2cam for efficient distance finding
42                std::map<uint32,Geometry::Vector3> lodobj_pos; // map key: LodObject UniqueID for efficient ID-based finding
43                unsigned int targetFPS;
44                Vector3 camera_pos;
45                bool camera_changed;
46                float near_range, far_range;
47                float CalculateDistToCamera(const Geometry::Vector3 &) const;
48                float SelectRandomDistance(void) const;
49                void RecalculateDist(lodobj_dist_node_t & node);
50        };
51};
52
53#endif
Note: See TracBrowser for help on using the repository browser.