[2764] | 1 | #ifndef __SCENEENTITY_H
|
---|
| 2 | #define __SCENEENTITY_H
|
---|
| 3 |
|
---|
| 4 | #include "common.h"
|
---|
| 5 | #include "AxisAlignedBox3.h"
|
---|
| 6 | #include "Triangle3.h"
|
---|
| 7 |
|
---|
| 8 |
|
---|
[2776] | 9 | namespace CHCDemoEngine
|
---|
[2764] | 10 | {
|
---|
| 11 |
|
---|
| 12 | class Material;
|
---|
| 13 | class Geometry;
|
---|
| 14 | class RenderState;
|
---|
[2802] | 15 | struct RenderQueueBucket;
|
---|
[2764] | 16 |
|
---|
| 17 | /** Class representing a scene entity.
|
---|
[2793] | 18 | A scene entity basically consists of geometry, transformation, and a material
|
---|
[2764] | 19 | */
|
---|
| 20 | class SceneEntity
|
---|
| 21 | {
|
---|
[2802] | 22 | friend class RenderQueue;
|
---|
| 23 |
|
---|
[2764] | 24 | public:
|
---|
| 25 | /** Creates a scene entity.
|
---|
| 26 | */
|
---|
| 27 | SceneEntity(Geometry *geometry, Material *mat, Matrix4x4 *trafo);
|
---|
[2792] | 28 |
|
---|
| 29 | ~SceneEntity();
|
---|
[2764] | 30 | /** Renders this node.
|
---|
| 31 | */
|
---|
| 32 | void Render(RenderState *state);
|
---|
| 33 | /** Set pointer to the geometry
|
---|
| 34 | */
|
---|
| 35 | void SetGeometry(Geometry *geom);
|
---|
| 36 | /** See set
|
---|
| 37 | */
|
---|
| 38 | Geometry *GetGeometry() const { return mGeometry; }
|
---|
| 39 | /** Set pointer to the geometry
|
---|
| 40 | */
|
---|
| 41 | void SetTransformation(Matrix4x4 *trafo);
|
---|
| 42 | /** Set pointer to the material
|
---|
| 43 | */
|
---|
| 44 | void SetMaterial(Material *mat);
|
---|
| 45 | /** Returns the transformed bounding box.
|
---|
| 46 | */
|
---|
| 47 | AxisAlignedBox3 GetBoundingBox() const;
|
---|
| 48 | /** set frame where we last rendered this node
|
---|
| 49 | */
|
---|
| 50 | void SetLastRendered(int lastRendered);
|
---|
| 51 | /** returns frame where we last visited this node
|
---|
| 52 | */
|
---|
| 53 | int GetLastRendered() const;
|
---|
| 54 |
|
---|
[2768] | 55 | inline Material *GetMaterial() const { return mMaterial; }
|
---|
[2802] | 56 | inline Matrix4x4 *GetTransformation() const { return mTransform; }
|
---|
[2767] | 57 |
|
---|
[2764] | 58 | protected:
|
---|
| 59 |
|
---|
| 60 | /// transform matrix
|
---|
| 61 | Matrix4x4 *mTransform;
|
---|
| 62 | Geometry *mGeometry;
|
---|
| 63 | Material *mMaterial;
|
---|
| 64 |
|
---|
| 65 | int mLastRendered;
|
---|
[2802] | 66 | /// pointer to the renderqueue bucket this entity belongs to
|
---|
| 67 | RenderQueueBucket *mRenderQueueBucket;
|
---|
[2764] | 68 | };
|
---|
| 69 |
|
---|
| 70 | }
|
---|
| 71 |
|
---|
| 72 | #endif // __SCENEENTITY_H |
---|