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