source: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/LODInfo.h @ 2854

Revision 2854, 1.3 KB checked in by mattausch, 16 years ago (diff)
Line 
1#ifndef __LODINFO_H
2#define __LODINFO_H
3
4#include "common.h"
5#include "Vector3.h"
6
7
8namespace CHCDemoEngine
9{
10
11/** Class representing information about an LOD level.
12        The distance parameter indicates the distance where this
13        lod level is invoked - if the parameter value is smaller or equal
14        than the distance to the view point.
15*/
16struct LODLevel
17{
18        friend class SceneEntity;
19
20public:
21       
22        LODLevel(float squaredDist): mSquaredDistance(squaredDist) {}
23
24        inline float GetSquaredDistance() const { return mSquaredDistance; }
25
26        inline int GetNumShapes() const { return (int)mShapes.size(); }
27       
28        inline int GetNumTriangles() const { return mNumTriangles; }
29
30        inline Shape *GetShape(size_t i) const { return mShapes[i]; }
31
32        inline ShapeContainer &GetShapes() { return mShapes; }
33
34        void AddShape(Shape *shape);
35
36
37        ////////////////
38
39        /** Has to be called each frame in order to initialize the proper LOD level.
40        */
41        static void InitFrame(const Vector3 &viewPoint);
42
43
44protected:
45
46        static Vector3 sViewPoint;
47        /** The current frame id is used to update LOD.
48        */
49        static int sFrameId;
50
51
52        /////////////////////
53
54        int mNumTriangles;
55
56        /// distance of this LOD level
57        float mSquaredDistance;
58        /// shapes belonging to this LOD level
59        ShapeContainer mShapes;
60};
61
62}
63
64#endif // __LODINFO_H
Note: See TracBrowser for help on using the repository browser.