source:
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Shape.cpp
@
3114
Revision 3114, 816 bytes checked in by mattausch, 16 years ago (diff) |
---|
Rev | Line | |
---|---|---|
[2839] | 1 | #include "Shape.h" |
2 | #include "Material.h" | |
3 | #include "RenderState.h" | |
4 | #include "Geometry.h" | |
[2840] | 5 | #include "SceneEntity.h" |
[2842] | 6 | #include "Transform3.h" |
[3072] | 7 | #include "glInterface.h" |
[2840] | 8 | |
[2839] | 9 | |
[3072] | 10 | |
[2839] | 11 | namespace CHCDemoEngine |
12 | { | |
13 | ||
[3071] | 14 | Shape::Shape(Geometry *geometry, Material *mat): |
[2840] | 15 | mGeometry(geometry), |
[3071] | 16 | mMaterial(mat) |
[2839] | 17 | { |
[2847] | 18 | mCenter = GetBoundingBox().Center(); |
[2839] | 19 | } |
20 | ||
21 | ||
22 | Shape::~Shape() | |
23 | {} | |
24 | ||
25 | ||
[3114] | 26 | void Shape::Render(RenderState *state, SceneEntity *ent) |
[2839] | 27 | { |
[3114] | 28 | if (mMaterial) mMaterial->Render(state, ent); |
[3074] | 29 | |
[2839] | 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 | ||
[2842] | 46 | |
47 | AxisAlignedBox3 Shape::GetBoundingBox() const | |
48 | { | |
49 | return mGeometry->GetBoundingBox(); | |
50 | } | |
51 | ||
52 | ||
[3071] | 53 | Vector3 Shape::GetCenter() const |
[2842] | 54 | { |
[3071] | 55 | return mCenter; |
[2842] | 56 | } |
57 | ||
[2847] | 58 | |
[2839] | 59 | } |
Note: See TracBrowser
for help on using the repository browser.