1 | #ifndef __SCENEENTITY_H
|
---|
2 | #define __SCENEENTITY_H
|
---|
3 |
|
---|
4 | #include "common.h"
|
---|
5 | #include "AxisAlignedBox3.h"
|
---|
6 | #include "Triangle3.h"
|
---|
7 |
|
---|
8 |
|
---|
9 | namespace CHCDemoEngine
|
---|
10 | {
|
---|
11 |
|
---|
12 | class Material;
|
---|
13 | class Geometry;
|
---|
14 | class RenderState;
|
---|
15 | struct RenderQueueBucket;
|
---|
16 |
|
---|
17 | /** Class representing a scene entity.
|
---|
18 | A scene entity basically consists of geometry, transformation, and a material
|
---|
19 | */
|
---|
20 | class SceneEntity
|
---|
21 | {
|
---|
22 | friend class RenderQueue;
|
---|
23 |
|
---|
24 | public:
|
---|
25 | /** Creates a scene entity.
|
---|
26 | */
|
---|
27 | SceneEntity(Geometry *geometry, Material *mat, Matrix4x4 *trafo);
|
---|
28 |
|
---|
29 | ~SceneEntity();
|
---|
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 |
|
---|
55 | inline Material *GetMaterial() const { return mMaterial; }
|
---|
56 | inline Matrix4x4 *GetTransformation() const { return mTransform; }
|
---|
57 |
|
---|
58 | protected:
|
---|
59 |
|
---|
60 | /// transform matrix
|
---|
61 | Matrix4x4 *mTransform;
|
---|
62 | Geometry *mGeometry;
|
---|
63 | Material *mMaterial;
|
---|
64 |
|
---|
65 | int mLastRendered;
|
---|
66 | /// pointer to the renderqueue bucket this entity belongs to
|
---|
67 | RenderQueueBucket *mRenderQueueBucket;
|
---|
68 | };
|
---|
69 |
|
---|
70 | }
|
---|
71 |
|
---|
72 | #endif // __SCENEENTITY_H |
---|