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