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 | #include "LODInfo.h"
|
---|
11 |
|
---|
12 |
|
---|
13 | namespace CHCDemoEngine
|
---|
14 | {
|
---|
15 |
|
---|
16 | class Material;
|
---|
17 | class Geometry;
|
---|
18 | class RenderState;
|
---|
19 | class Transform3;
|
---|
20 |
|
---|
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 |
|
---|
31 | /** Creates a scene entity.
|
---|
32 | */
|
---|
33 | SceneEntity(Transform3 *trafo);
|
---|
34 |
|
---|
35 | ~SceneEntity();
|
---|
36 | /** Renders this node.
|
---|
37 | */
|
---|
38 | void Render(RenderState *state);
|
---|
39 | /** Set pointer to the shape
|
---|
40 | */
|
---|
41 | void AddShape(Shape *shape);
|
---|
42 | /** See set
|
---|
43 | */
|
---|
44 | inline Shape *GetShape(int i) const { return mShapes[i]; }
|
---|
45 | /** Returns number of shapes in vector.
|
---|
46 | */
|
---|
47 | inline int GetNumShapes() { return (int)mShapes.size(); }
|
---|
48 | /** Set pointer to the geometry
|
---|
49 | */
|
---|
50 | void SetTransform(Transform3 *trafo);
|
---|
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 | /** Returns the trafo of this scene entity.
|
---|
61 | */
|
---|
62 | inline Transform3 *GetTransform() const { return mTransform; }
|
---|
63 |
|
---|
64 | void GetCurrentLODLevel(ShapeContainer &shapes);
|
---|
65 |
|
---|
66 | int CountNumTriangles();
|
---|
67 |
|
---|
68 |
|
---|
69 | protected:
|
---|
70 |
|
---|
71 |
|
---|
72 | /// transform matrix
|
---|
73 | Transform3 *mTransform;
|
---|
74 | /// Stores information about the LOD levels
|
---|
75 | LODInfoContainer mLODInfos;
|
---|
76 | /// the renderable shapes
|
---|
77 | ShapeContainer mShapes;
|
---|
78 | /// when this entity was last rendered
|
---|
79 | int mLastRendered;
|
---|
80 | };
|
---|
81 |
|
---|
82 | }
|
---|
83 |
|
---|
84 | #endif // __SCENEENTITY_H |
---|