Revision 3074,
793 bytes
checked in by mattausch, 16 years ago
(diff) |
included vbo support for dynamic objects
|
Line | |
---|
1 | #include "Shape.h"
|
---|
2 | #include "Material.h"
|
---|
3 | #include "RenderState.h"
|
---|
4 | #include "Geometry.h"
|
---|
5 | #include "SceneEntity.h"
|
---|
6 | #include "Transform3.h"
|
---|
7 | #include "glInterface.h"
|
---|
8 |
|
---|
9 |
|
---|
10 |
|
---|
11 | namespace CHCDemoEngine
|
---|
12 | {
|
---|
13 |
|
---|
14 | Shape::Shape(Geometry *geometry, Material *mat):
|
---|
15 | mGeometry(geometry),
|
---|
16 | mMaterial(mat)
|
---|
17 | {
|
---|
18 | mCenter = GetBoundingBox().Center();
|
---|
19 | }
|
---|
20 |
|
---|
21 |
|
---|
22 | Shape::~Shape()
|
---|
23 | {}
|
---|
24 |
|
---|
25 |
|
---|
26 | void Shape::Render(RenderState *state)
|
---|
27 | {
|
---|
28 | if (mMaterial) mMaterial->Render(state);
|
---|
29 |
|
---|
30 | mGeometry->Render(state);
|
---|
31 | }
|
---|
32 |
|
---|
33 |
|
---|
34 | void Shape::SetGeometry(Geometry *geom)
|
---|
35 | {
|
---|
36 | mGeometry = geom;
|
---|
37 | }
|
---|
38 |
|
---|
39 |
|
---|
40 | void Shape::SetMaterial(Material *mat)
|
---|
41 | {
|
---|
42 | mMaterial = mat;
|
---|
43 | }
|
---|
44 |
|
---|
45 |
|
---|
46 |
|
---|
47 | AxisAlignedBox3 Shape::GetBoundingBox() const
|
---|
48 | {
|
---|
49 | return mGeometry->GetBoundingBox();
|
---|
50 | }
|
---|
51 |
|
---|
52 |
|
---|
53 | Vector3 Shape::GetCenter() const
|
---|
54 | {
|
---|
55 | return mCenter;
|
---|
56 | }
|
---|
57 |
|
---|
58 |
|
---|
59 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.