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 |
|
---|
8 | namespace CHCDemoEngine
|
---|
9 | {
|
---|
10 |
|
---|
11 |
|
---|
12 | SceneEntity::SceneEntity(Geometry *geometry,
|
---|
13 | Material *mat,
|
---|
14 | Matrix4x4 *trafo):
|
---|
15 | mGeometry(geometry), mMaterial(mat), mTransform(trafo), mRenderQueueBucket(NULL)
|
---|
16 | {
|
---|
17 | }
|
---|
18 |
|
---|
19 |
|
---|
20 | SceneEntity::~SceneEntity()
|
---|
21 | {
|
---|
22 | }
|
---|
23 |
|
---|
24 |
|
---|
25 | void 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 |
|
---|
44 | void SceneEntity::SetGeometry(Geometry *geom)
|
---|
45 | {
|
---|
46 | mGeometry = geom;
|
---|
47 | }
|
---|
48 |
|
---|
49 |
|
---|
50 | void SceneEntity::SetTransformation(Matrix4x4 *trafo)
|
---|
51 | {
|
---|
52 | mTransform = trafo;
|
---|
53 | }
|
---|
54 |
|
---|
55 |
|
---|
56 | void SceneEntity::SetMaterial(Material *mat)
|
---|
57 | {
|
---|
58 | mMaterial = mat;
|
---|
59 | }
|
---|
60 |
|
---|
61 |
|
---|
62 | void SceneEntity::SetLastRendered(int lastRendered)
|
---|
63 | {
|
---|
64 | mLastRendered = lastRendered;
|
---|
65 | }
|
---|
66 |
|
---|
67 |
|
---|
68 | int SceneEntity::GetLastRendered() const
|
---|
69 | {
|
---|
70 | return mLastRendered;
|
---|
71 | }
|
---|
72 |
|
---|
73 |
|
---|
74 | AxisAlignedBox3 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.