Revision 3072,
896 bytes
checked in by mattausch, 16 years ago
(diff) |
fucked up depth order for some reason!!
|
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)
|
---|
29 | mMaterial->Render(state);
|
---|
30 | //mDepthWriteEnabled = true;
|
---|
31 | glDepthMask(GL_TRUE); glDepthFunc(GL_LESS);
|
---|
32 | glEnable(GL_DEPTH_TEST);
|
---|
33 | mGeometry->Render(state);
|
---|
34 | }
|
---|
35 |
|
---|
36 |
|
---|
37 | void Shape::SetGeometry(Geometry *geom)
|
---|
38 | {
|
---|
39 | mGeometry = geom;
|
---|
40 | }
|
---|
41 |
|
---|
42 |
|
---|
43 | void Shape::SetMaterial(Material *mat)
|
---|
44 | {
|
---|
45 | mMaterial = mat;
|
---|
46 | }
|
---|
47 |
|
---|
48 |
|
---|
49 |
|
---|
50 | AxisAlignedBox3 Shape::GetBoundingBox() const
|
---|
51 | {
|
---|
52 | return mGeometry->GetBoundingBox();
|
---|
53 | }
|
---|
54 |
|
---|
55 |
|
---|
56 | Vector3 Shape::GetCenter() const
|
---|
57 | {
|
---|
58 | return mCenter;
|
---|
59 | }
|
---|
60 |
|
---|
61 |
|
---|
62 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.