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

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