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 |
|
---|
18 | namespace Geometry
|
---|
19 | {
|
---|
20 | class NodeContainer;
|
---|
21 | class lodobj_node_t;
|
---|
22 |
|
---|
23 | class LodManager
|
---|
24 | {
|
---|
25 | public:
|
---|
26 | LodManager(Real near, Real far, const Geometry::Vector3 &campos, int numslots=10);
|
---|
27 | ~LodManager(void);
|
---|
28 | void AddLodObj(const std::string &name, LodObject*, const Geometry::Vector3 &);
|
---|
29 | void UpdateLOD(uint32 currFPS, uint32 targetFPS=30);
|
---|
30 | void UpdateCamera(const Geometry::Vector3 &);
|
---|
31 | void UpdateLODObjectPos(LodObject*,const Geometry::Vector3 &);
|
---|
32 |
|
---|
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
|
---|
35 |
|
---|
36 | private:
|
---|
37 | NodeContainer *lodobj_container;
|
---|
38 | uint32 lasttime;
|
---|
39 | bool camera_changed, node_added;
|
---|
40 | float near_range, far_range;
|
---|
41 | float SelectRandomDistance(void) const;
|
---|
42 | void ChangeLOD(lodobj_node_t*,Real);
|
---|
43 | void ReallyGoToLOD(lodobj_node_t*,Real);
|
---|
44 |
|
---|
45 | lodobj_node_t * FindMostSimilarRealLOD(const std::string &, Real desired_lod);
|
---|
46 |
|
---|
47 | void MakeDiscipleOf(lodobj_node_t *master, lodobj_node_t *disciple);
|
---|
48 | void MakeIndependent(lodobj_node_t*);
|
---|
49 | void RemoveDiscipleFrom(LodObject *master, LodObject *disciple);
|
---|
50 | void UpdateDisciples(lodobj_node_t *master);
|
---|
51 | void DeleteMeFromMyMastersDiscipleList(lodobj_node_t *);
|
---|
52 | void ChangeMaster(lodobj_node_t *orig, lodobj_node_t *newmaster);
|
---|
53 | };
|
---|
54 | }
|
---|
55 |
|
---|
56 | #endif |
---|