Revision 2773,
1.2 KB
checked in by mattausch, 17 years ago
(diff) |
implemented multiqueries, but still buggy version
|
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 CHCDemo
|
---|
9 | {
|
---|
10 |
|
---|
11 |
|
---|
12 | SceneEntity::SceneEntity(Geometry *geometry,
|
---|
13 | Material *mat,
|
---|
14 | Matrix4x4 *trafo):
|
---|
15 | mGeometry(geometry), mMaterial(mat), mTransform(trafo)
|
---|
16 | {
|
---|
17 | }
|
---|
18 |
|
---|
19 |
|
---|
20 | void SceneEntity::Render(RenderState *state)
|
---|
21 | {
|
---|
22 | if (mMaterial) mMaterial->Render(state);
|
---|
23 |
|
---|
24 | if (mTransform)
|
---|
25 | {
|
---|
26 | glPushMatrix();
|
---|
27 | glMultMatrixf((float *)mTransform->x);
|
---|
28 | mGeometry->Render(state);
|
---|
29 |
|
---|
30 | glPopMatrix();
|
---|
31 | }
|
---|
32 | else
|
---|
33 | {
|
---|
34 | mGeometry->Render(state);
|
---|
35 | }
|
---|
36 | }
|
---|
37 |
|
---|
38 |
|
---|
39 | void SceneEntity::SetGeometry(Geometry *geom)
|
---|
40 | {
|
---|
41 | mGeometry = geom;
|
---|
42 | }
|
---|
43 |
|
---|
44 |
|
---|
45 | void SceneEntity::SetTransformation(Matrix4x4 *trafo)
|
---|
46 | {
|
---|
47 | mTransform = trafo;
|
---|
48 | }
|
---|
49 |
|
---|
50 |
|
---|
51 | void SceneEntity::SetMaterial(Material *mat)
|
---|
52 | {
|
---|
53 | mMaterial = mat;
|
---|
54 | }
|
---|
55 |
|
---|
56 |
|
---|
57 | void SceneEntity::SetLastRendered(int lastRendered)
|
---|
58 | {
|
---|
59 | mLastRendered = lastRendered;
|
---|
60 | }
|
---|
61 |
|
---|
62 |
|
---|
63 | int SceneEntity::GetLastRendered() const
|
---|
64 | {
|
---|
65 | return mLastRendered;
|
---|
66 | }
|
---|
67 |
|
---|
68 |
|
---|
69 | AxisAlignedBox3 SceneEntity::GetBoundingBox() const
|
---|
70 | {
|
---|
71 | AxisAlignedBox3 box = mGeometry->GetBoundingBox();
|
---|
72 | if (mTransform) Transform(box, *mTransform);
|
---|
73 |
|
---|
74 | return box;
|
---|
75 | }
|
---|
76 |
|
---|
77 |
|
---|
78 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.