Line | |
---|
1 | #ifndef __SHAPE_H
|
---|
2 | #define __SHAPE_H
|
---|
3 |
|
---|
4 | #include "glInterface.h"
|
---|
5 | #include <Cg/cg.h>
|
---|
6 | #include <Cg/cgGL.h>
|
---|
7 | #include "common.h"
|
---|
8 | #include "Vector3.h"
|
---|
9 |
|
---|
10 |
|
---|
11 | namespace CHCDemoEngine
|
---|
12 | {
|
---|
13 |
|
---|
14 |
|
---|
15 | class Material;
|
---|
16 | class Geometry;
|
---|
17 | class RenderState;
|
---|
18 | class AxisAlignedBox3;
|
---|
19 | class Vector3;
|
---|
20 |
|
---|
21 | struct RenderQueueBucket;
|
---|
22 |
|
---|
23 |
|
---|
24 | /** Class representing a shape.
|
---|
25 | A shape basically consists of geometry and a material
|
---|
26 | */
|
---|
27 | class Shape
|
---|
28 | {
|
---|
29 | friend class RenderQueue;
|
---|
30 |
|
---|
31 | public:
|
---|
32 | /** Creates a scene entity.
|
---|
33 | */
|
---|
34 | Shape(Geometry *geometry, Material *mat, SceneEntity *parent);
|
---|
35 |
|
---|
36 | ~Shape();
|
---|
37 | /** Renders this node.
|
---|
38 | */
|
---|
39 | void Render(RenderState *state);
|
---|
40 | /** Set pointer to the geometry
|
---|
41 | */
|
---|
42 | void SetGeometry(Geometry *geom);
|
---|
43 | /** See set
|
---|
44 | */
|
---|
45 | Geometry *GetGeometry() const { return mGeometry; }
|
---|
46 | /** Set pointer to the material
|
---|
47 | */
|
---|
48 | void SetMaterial(Material *mat);
|
---|
49 | /** Returns the transformed bounding box.
|
---|
50 | */
|
---|
51 | AxisAlignedBox3 GetBoundingBox() const;
|
---|
52 | /** Returns bounding box transformed with the parent transform.
|
---|
53 | */
|
---|
54 | AxisAlignedBox3 GetTransformedBoundingBox() const;
|
---|
55 | /** Returns material of this shape.
|
---|
56 | */
|
---|
57 | inline Material *GetMaterial() const { return mMaterial; }
|
---|
58 | /** Returns transformed center point of this shape.
|
---|
59 | */
|
---|
60 | Vector3 GetCenter() const;
|
---|
61 |
|
---|
62 |
|
---|
63 | protected:
|
---|
64 |
|
---|
65 | Vector3 mCenter;
|
---|
66 |
|
---|
67 | Geometry *mGeometry;
|
---|
68 | Material *mMaterial;
|
---|
69 | SceneEntity *mParent;
|
---|
70 |
|
---|
71 | /// pointer to the renderqueue bucket this entity belongs to
|
---|
72 | RenderQueueBucket *mRenderQueueBucket;
|
---|
73 | };
|
---|
74 |
|
---|
75 | }
|
---|
76 |
|
---|
77 | #endif // __SCENEENTITY_H |
---|
Note: See
TracBrowser
for help on using the repository browser.