source:
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Shape.cpp
@
3238
Revision 3238, 820 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) |
[3238] | 17 | { |
[2847] | 18 | mCenter = GetBoundingBox().Center(); |
[3238] | 19 | |
[2839] | 20 | } |
21 | ||
22 | ||
23 | Shape::~Shape() | |
24 | {} | |
25 | ||
26 | ||
[3114] | 27 | void Shape::Render(RenderState *state, SceneEntity *ent) |
[2839] | 28 | { |
[3114] | 29 | if (mMaterial) mMaterial->Render(state, ent); |
[3074] | 30 | |
[2839] | 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 | ||
[2842] | 47 | |
48 | AxisAlignedBox3 Shape::GetBoundingBox() const | |
49 | { | |
50 | return mGeometry->GetBoundingBox(); | |
51 | } | |
52 | ||
53 | ||
[3071] | 54 | Vector3 Shape::GetCenter() const |
[2842] | 55 | { |
[3071] | 56 | return mCenter; |
[2842] | 57 | } |
58 | ||
[2847] | 59 | |
[2839] | 60 | } |
Note: See TracBrowser
for help on using the repository browser.