#ifndef __LODINFO_H #define __LODINFO_H #include "common.h" #include "Vector3.h" namespace CHCDemoEngine { /** Class representing information about an LOD level. The distance parameter indicates the distance where this lod level is invoked - if the parameter value is smaller or equal than the distance to the view point. */ struct LODLevel { friend class SceneEntity; public: LODLevel(float squaredDist): mSquaredDistance(squaredDist), mNumTriangles(0) {} inline float GetSquaredDistance() const { return mSquaredDistance; } inline int GetNumShapes() const { return (int)mShapes.size(); } inline int GetNumTriangles() const { return mNumTriangles; } inline Shape *GetShape(size_t i) const { return mShapes[i]; } inline ShapeContainer &GetShapes() { return mShapes; } void AddShape(Shape *shape); //////////////// /** Has to be called each frame in order to initialize the proper LOD level. */ static void InitFrame(const Vector3 &viewPoint); protected: static Vector3 sViewPoint; /** The current frame id is used to update LOD. */ static int sFrameId; ///////////////////// int mNumTriangles; /// distance of this LOD level float mSquaredDistance; /// shapes belonging to this LOD level ShapeContainer mShapes; }; } #endif // __LODINFO_H