source: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneEntity.cpp @ 2802

Revision 2802, 1.2 KB checked in by mattausch, 17 years ago (diff)

worked on renderqueue

Line 
1#include "SceneEntity.h"
2#include "glInterface.h"
3#include "Geometry.h"
4#include "Material.h"
5#include "RenderState.h"
6
7
8namespace CHCDemoEngine
9{
10
11
12SceneEntity::SceneEntity(Geometry *geometry,
13                                                 Material *mat,
14                                                 Matrix4x4 *trafo):
15mGeometry(geometry), mMaterial(mat), mTransform(trafo), mRenderQueueBucket(NULL)
16{
17}
18
19
20SceneEntity::~SceneEntity()
21{
22}
23
24
25void SceneEntity::Render(RenderState *state)
26{
27        if (mMaterial) mMaterial->Render(state);
28
29        if (mTransform)
30        {
31                glPushMatrix();
32                glMultMatrixf((float *)mTransform->x);
33                mGeometry->Render(state);
34
35                glPopMatrix();
36        }
37        else
38        {
39                mGeometry->Render(state);
40        }
41}
42
43
44void SceneEntity::SetGeometry(Geometry *geom)
45{
46        mGeometry = geom;
47}
48
49
50void SceneEntity::SetTransformation(Matrix4x4 *trafo)
51{
52        mTransform = trafo;
53}
54
55
56void SceneEntity::SetMaterial(Material *mat)
57{
58        mMaterial = mat;
59}
60
61
62void SceneEntity::SetLastRendered(int lastRendered)
63{
64        mLastRendered = lastRendered;
65}
66
67
68int SceneEntity::GetLastRendered() const
69{
70        return mLastRendered;
71}
72
73
74AxisAlignedBox3 SceneEntity::GetBoundingBox() const
75{
76        AxisAlignedBox3 box = mGeometry->GetBoundingBox();
77        if (mTransform) Transform(box, *mTransform);
78
79        return box;
80}
81
82
83}
Note: See TracBrowser for help on using the repository browser.