Rev | Line | |
---|
[2839] | 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"
|
---|
[2847] | 8 | #include "Vector3.h"
|
---|
[2839] | 9 |
|
---|
| 10 |
|
---|
| 11 | namespace CHCDemoEngine
|
---|
| 12 | {
|
---|
| 13 |
|
---|
| 14 |
|
---|
| 15 | class Material;
|
---|
| 16 | class Geometry;
|
---|
| 17 | class RenderState;
|
---|
[2842] | 18 | class AxisAlignedBox3;
|
---|
[2847] | 19 | class Vector3;
|
---|
[2842] | 20 |
|
---|
[2839] | 21 | struct RenderQueueBucket;
|
---|
| 22 |
|
---|
[2842] | 23 |
|
---|
[2839] | 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);
|
---|
[2842] | 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;
|
---|
[2848] | 55 | /** Returns material of this shape.
|
---|
| 56 | */
|
---|
[2839] | 57 | inline Material *GetMaterial() const { return mMaterial; }
|
---|
[2847] | 58 | /** Returns transformed center point of this shape.
|
---|
| 59 | */
|
---|
| 60 | Vector3 GetCenter() const;
|
---|
[2839] | 61 |
|
---|
[2847] | 62 |
|
---|
[2839] | 63 | protected:
|
---|
| 64 |
|
---|
[2847] | 65 | Vector3 mCenter;
|
---|
| 66 |
|
---|
[2839] | 67 | Geometry *mGeometry;
|
---|
| 68 | Material *mMaterial;
|
---|
[2840] | 69 | SceneEntity *mParent;
|
---|
[3034] | 70 |
|
---|
[2839] | 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.