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 |
|
---|
23 | Shape::~Shape()
|
---|
24 | {}
|
---|
25 |
|
---|
26 |
|
---|
27 | void Shape::Render(RenderState *state, SceneEntity *ent)
|
---|
28 | {
|
---|
29 | if (mMaterial) mMaterial->Render(state, ent);
|
---|
30 |
|
---|
31 | mGeometry->Render(state);
|
---|
32 | }
|
---|
33 |
|
---|
34 |
|
---|
35 | void Shape::SetGeometry(Geometry *geom)
|
---|
36 | {
|
---|
37 | mGeometry = geom;
|
---|
38 | }
|
---|
39 |
|
---|
40 |
|
---|
41 | void Shape::SetMaterial(Material *mat)
|
---|
42 | {
|
---|
43 | mMaterial = mat;
|
---|
44 | }
|
---|
45 |
|
---|
46 |
|
---|
47 |
|
---|
48 | AxisAlignedBox3 Shape::GetBoundingBox() const
|
---|
49 | {
|
---|
50 | return mGeometry->GetBoundingBox();
|
---|
51 | }
|
---|
52 |
|
---|
53 |
|
---|
54 | Vector3 Shape::GetCenter() const
|
---|
55 | {
|
---|
56 | return mCenter;
|
---|
57 | }
|
---|
58 |
|
---|
59 |
|
---|
60 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.