-
Notifications
You must be signed in to change notification settings - Fork 0
/
Wall.cs
158 lines (139 loc) · 5.2 KB
/
Wall.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
using Mogre;
using Mogre.TutorialFramework;
using System;
namespace Mogre.Tutorial
{
/// <summary>
/// This class implements the ground of the environment
/// </summary>
class Wall : StaticElement
{
Plane plane1;
Plane plane2;
Plane plane3;
Plane plane4; //ManualObject manual;
Entity wallEntity1;
SceneNode wallNode1;
Entity wallEntity2;
SceneNode wallNode2;
Entity wallEntity3;
SceneNode wallNode3;
Entity wallEntity4;
SceneNode wallNode4;
Vector3 vect;
Degree bob = 180;
public Plane Plane1
{
get { return plane1; }
}
public Plane Plane2
{
get { return plane2; }
}
public Plane Plane3
{
get { return plane3; }
}
public Plane Plane4
{
get { return plane4; }
}
int wallWidth = 10;
int wallHeight = 10;
int wallXSegs = 100;
int wallZSegs = 100;
int uTiles = 10;
int vTiles = 10;
/// <summary>
/// Constructor
/// </summary>
/// <param name="mSceneMgr">A reference of the scene manager</param>
public Wall(SceneManager mSceneMgr)
{
this.mSceneMgr = mSceneMgr;
wallWidth = 50;
wallHeight = 1000;
CreateWall();
}
/// <summary>
/// This method initializes the ground mesh and its node
/// </summary>
private void CreateWall()
{
WallPlane1();
WallPlane2();
WallPlane3();
WallPlane4();
}
/// <summary>
/// This method generates a plane in an Entity which will be used as a wall
/// </summary>
private void WallPlane1()
{
plane1 = new Plane(Vector3.UNIT_X, -0);
MeshPtr wallMeshPtr = MeshManager.Singleton.CreatePlane("wall1",
ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME, plane1, wallWidth,
wallHeight, wallXSegs, wallZSegs, true, 1, uTiles, vTiles,
Vector3.UNIT_Z);
wallEntity1 = mSceneMgr.CreateEntity("wall1");
wallNode1 = mSceneMgr.CreateSceneNode();
wallNode1.Translate(new Vector3(500, 000, 000));
wallNode1.Yaw(bob);
wallNode1.AttachObject(wallEntity1);
mSceneMgr.RootSceneNode.AddChild(wallNode1);
//wallEntity.SetMaterialName("Meteor");
}
/// <summary>
/// This method generates a plane in an Entity which will be used as a wall
/// </summary>
private void WallPlane2()
{
plane2 = new Plane(Vector3.UNIT_X, -0);
MeshPtr wallMeshPtr = MeshManager.Singleton.CreatePlane("wall2",
ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME, plane2, wallWidth,
wallHeight, wallXSegs, wallZSegs, true, 1, uTiles, vTiles,
Vector3.UNIT_Z);
wallEntity2 = mSceneMgr.CreateEntity("wall2");
wallNode2 = mSceneMgr.CreateSceneNode();
wallNode2.Translate(new Vector3(-500, 000, 000));
wallNode2.AttachObject(wallEntity2);
mSceneMgr.RootSceneNode.AddChild(wallNode2);
//wallEntity.SetMaterialName("Meteor");
}
/// <summary>
/// This method generates a plane in an Entity which will be used as a wall
/// </summary>
private void WallPlane3()
{
plane3 = new Plane(Vector3.UNIT_Z, -0);
MeshPtr wallMeshPtr = MeshManager.Singleton.CreatePlane("wall3",
ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME, plane3, wallWidth,
wallHeight, wallXSegs, wallZSegs, true, 1, uTiles, vTiles,
Vector3.UNIT_X);
wallEntity3 = mSceneMgr.CreateEntity("wall3");
wallNode3 = mSceneMgr.CreateSceneNode();
wallNode3.Translate(new Vector3(000, 000, -500));
wallNode3.AttachObject(wallEntity3);
mSceneMgr.RootSceneNode.AddChild(wallNode3);
//wallEntity.SetMaterialName("Meteor");
}
/// <summary>
/// This method generates a plane in an Entity which will be used as a wall
/// </summary>
private void WallPlane4()
{
plane4 = new Plane(Vector3.UNIT_Z, 0);
MeshPtr wallMeshPtr = MeshManager.Singleton.CreatePlane("wall4",
ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME, plane4, wallWidth,
wallHeight, wallXSegs, wallZSegs, true, 1, uTiles, vTiles,
Vector3.UNIT_X);
wallEntity4 = mSceneMgr.CreateEntity("wall4");
wallNode4 = mSceneMgr.CreateSceneNode();
wallNode4.Translate(new Vector3(000, 000, 500));
wallNode4.Yaw(bob);
wallNode4.AttachObject(wallEntity4);
mSceneMgr.RootSceneNode.AddChild(wallNode4);
//wallEntity.SetMaterialName("Meteor");
}
}
}