#ifndef __SCENEENTITY_H #define __SCENEENTITY_H #include "common.h" #include "AxisAlignedBox3.h" #include "Triangle3.h" namespace CHCDemoEngine { class Material; class Geometry; class RenderState; struct RenderQueueBucket; /** Class representing a scene entity. A scene entity basically consists of geometry, transformation, and a material */ class SceneEntity { friend class RenderQueue; public: /** Creates a scene entity. */ SceneEntity(Geometry *geometry, Material *mat, Matrix4x4 *trafo); ~SceneEntity(); /** Renders this node. */ void Render(RenderState *state); /** Set pointer to the geometry */ void SetGeometry(Geometry *geom); /** See set */ Geometry *GetGeometry() const { return mGeometry; } /** Set pointer to the geometry */ void SetTransformation(Matrix4x4 *trafo); /** Set pointer to the material */ void SetMaterial(Material *mat); /** Returns the transformed bounding box. */ AxisAlignedBox3 GetBoundingBox() const; /** set frame where we last rendered this node */ void SetLastRendered(int lastRendered); /** returns frame where we last visited this node */ int GetLastRendered() const; inline Material *GetMaterial() const { return mMaterial; } inline Matrix4x4 *GetTransformation() const { return mTransform; } protected: /// transform matrix Matrix4x4 *mTransform; Geometry *mGeometry; Material *mMaterial; int mLastRendered; /// pointer to the renderqueue bucket this entity belongs to RenderQueueBucket *mRenderQueueBucket; }; } #endif // __SCENEENTITY_H