source: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Shape.cpp @ 3238

Revision 3238, 820 bytes checked in by mattausch, 15 years ago (diff)
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
11namespace CHCDemoEngine
12{
13
14Shape::Shape(Geometry *geometry, Material *mat):
15mGeometry(geometry),
16mMaterial(mat)
17{       
18        mCenter = GetBoundingBox().Center();
19       
20}
21
22
23Shape::~Shape()
24{}
25
26
27void Shape::Render(RenderState *state, SceneEntity *ent)
28{
29        if (mMaterial) mMaterial->Render(state, ent);
30       
31        mGeometry->Render(state);
32}
33
34
35void Shape::SetGeometry(Geometry *geom)
36{
37        mGeometry = geom;
38}
39
40
41void Shape::SetMaterial(Material *mat)
42{
43        mMaterial = mat;
44}
45
46
47
48AxisAlignedBox3 Shape::GetBoundingBox() const
49{
50        return mGeometry->GetBoundingBox();
51}
52
53
54Vector3 Shape::GetCenter() const
55{
56        return mCenter;
57}
58
59
60}
Note: See TracBrowser for help on using the repository browser.