1 | #include "ivreader.h"
|
---|
2 | #include "ExampleApplication.h"
|
---|
3 | //#include <OgreLogManager.h>
|
---|
4 |
|
---|
5 | #include "ExampleApplication.h"
|
---|
6 | #include "IVReader.h"
|
---|
7 |
|
---|
8 | Real timeDelay = 0;
|
---|
9 | /*#define KEY_PRESSED(_key,_timeDelay, _macro) \
|
---|
10 | { \
|
---|
11 | if (mInputDevice->isKeyDown(_key) && timeDelay <= 0) \
|
---|
12 | { \
|
---|
13 | timeDelay = _timeDelay; \
|
---|
14 | _macro ; \
|
---|
15 | } \
|
---|
16 | }*/
|
---|
17 |
|
---|
18 | RaySceneQuery* raySceneQuery = 0;
|
---|
19 |
|
---|
20 | //-- captions for overlays
|
---|
21 | String algorithmCaptions[] =
|
---|
22 | {
|
---|
23 | "Coherent Hierarchical Culling",
|
---|
24 | "View Frustum Culling",
|
---|
25 | "Stop and Wait Culling"
|
---|
26 | };
|
---|
27 |
|
---|
28 | class TutorialFrameListener : public ExampleFrameListener
|
---|
29 | {
|
---|
30 | protected:
|
---|
31 | int mCurrentAlgorithm;
|
---|
32 | Overlay* mDebugOverlay;
|
---|
33 | Overlay* mHelpOverlay;
|
---|
34 | Overlay* mCullStatsOverlay;
|
---|
35 | Overlay* mQueryOverlay;
|
---|
36 |
|
---|
37 | OverlayElement *mAlgorithmInfo;
|
---|
38 | OverlayElement *mThresholdInfo;
|
---|
39 | OverlayElement *mAssumedVisibilityInfo;
|
---|
40 | OverlayElement *mFrustumCulledNodesInfo;
|
---|
41 | OverlayElement *mQueryCulledNodesInfo;
|
---|
42 | OverlayElement *mTraversedNodesInfo;
|
---|
43 | OverlayElement *mHierarchyNodesInfo;
|
---|
44 | OverlayElement *mTestGeometryForVisibleLeavesInfo;
|
---|
45 | OverlayElement *mUseDepthPassInfo;
|
---|
46 | OverlayElement *mRenderedNodesInfo;
|
---|
47 | OverlayElement *mObjectsCountInfo;
|
---|
48 | OverlayElement *mQueriesIssuedInfo;
|
---|
49 | OverlayElement *mDelayedQueriesIssuedInfo;
|
---|
50 | OverlayElement *mDelayedTraversedNodesInfo;
|
---|
51 | OverlayElement *mCurrentObjectTypeInfo;
|
---|
52 |
|
---|
53 | OverlayElement *mQueryTypeInfo;
|
---|
54 | OverlayElement *mQueryVisibleNodesInfo;
|
---|
55 | OverlayElement *mQueryVisibleGeometryInfo;
|
---|
56 | OverlayElement *mQueryVisiblePatchInfo;
|
---|
57 |
|
---|
58 | OverlayElement *mQueryVisiblityInfo;
|
---|
59 | OverlayElement *mQueryNodeVisibilityInfo;
|
---|
60 | OverlayElement *mQueryGeometryVisibilityInfo;
|
---|
61 | OverlayElement *mQueryPatchVisibilityInfo;
|
---|
62 |
|
---|
63 | public:
|
---|
64 |
|
---|
65 | //-----------------------------------------------------------------------
|
---|
66 | void initOverlayElement(OverlayElement **elInfo, String ext,
|
---|
67 | String name, int top, String caption)
|
---|
68 | {
|
---|
69 | OverlayElement *el =
|
---|
70 | OverlayManager::getSingleton().getOverlayElement(ext + name);
|
---|
71 |
|
---|
72 | (*elInfo) = OverlayManager::getSingleton().getOverlayElement(ext + name + "Info");
|
---|
73 | (*elInfo)->setCaption(caption);
|
---|
74 |
|
---|
75 | el->setTop(top);
|
---|
76 | (*elInfo)->setTop(top);
|
---|
77 | }
|
---|
78 | //-----------------------------------------------------------------------
|
---|
79 | void initVisStatsOverlay()
|
---|
80 | {
|
---|
81 | const int border_height = 10;
|
---|
82 | const int vert_space = 15;
|
---|
83 |
|
---|
84 | //-- visibility culling stats overlay
|
---|
85 | int top = border_height;
|
---|
86 |
|
---|
87 | String ext = "Example/Visibility/";
|
---|
88 |
|
---|
89 | initOverlayElement(&mAlgorithmInfo, ext, "Algorithm", top,
|
---|
90 | ": " + algorithmCaptions[mCurrentAlgorithm]); top += vert_space;
|
---|
91 |
|
---|
92 | initOverlayElement(&mThresholdInfo, ext, "Threshold", top, ": 0"); top += vert_space;
|
---|
93 | initOverlayElement(&mTestGeometryForVisibleLeavesInfo, ext,
|
---|
94 | "TestGeometryForVisibleLeaves", top, ": true"); top += vert_space;
|
---|
95 | initOverlayElement(&mUseDepthPassInfo, ext, "UseDepthPass", top, ": false"); top += vert_space;
|
---|
96 | initOverlayElement(&mAssumedVisibilityInfo, ext, "AssumedVisibility", top, ": 0"); top += vert_space;
|
---|
97 | initOverlayElement(&mCurrentObjectTypeInfo, ext, "CurrentObjectType", top, ": "); top += vert_space;
|
---|
98 | //initOverlayElement(&mHelpInfo, ext, "Help", top, ": "); top += vert_space;
|
---|
99 |
|
---|
100 | OverlayElement *optionsPanel = OverlayManager::getSingleton().
|
---|
101 | getOverlayElement("Example/Visibility/VisibilityPanel");
|
---|
102 |
|
---|
103 | optionsPanel->setHeight(top + border_height);
|
---|
104 |
|
---|
105 | top = border_height;
|
---|
106 | //ext = "Example/Visibility/";
|
---|
107 | initOverlayElement(&mFrustumCulledNodesInfo, ext, "FrustumCulledNodes", top, ": 0"); top += vert_space;
|
---|
108 | initOverlayElement(&mQueryCulledNodesInfo, ext, "QueryCulledNodes", top, ": 0"); top += vert_space;
|
---|
109 | initOverlayElement(&mTraversedNodesInfo, ext, "TraversedNodes", top, ": 0"); top += vert_space;
|
---|
110 | initOverlayElement(&mHierarchyNodesInfo, ext, "HierarchyNodes", top, ": 0"); top += vert_space;
|
---|
111 | initOverlayElement(&mRenderedNodesInfo, ext, "RenderedNodes", top, ": 0"); top += vert_space;
|
---|
112 | initOverlayElement(&mObjectsCountInfo, ext, "ObjectsCount", top, ": 0"); top += vert_space;
|
---|
113 | initOverlayElement(&mQueriesIssuedInfo, ext, "QueriesIssued", top, ": 0"); top += vert_space;
|
---|
114 |
|
---|
115 | OverlayElement *visPanel = OverlayManager::getSingleton().
|
---|
116 | getOverlayElement("Example/Visibility/VisibilityStatsPanel");
|
---|
117 |
|
---|
118 | visPanel->setHeight(top + border_height);
|
---|
119 | }
|
---|
120 | //-----------------------------------------------------------------------
|
---|
121 | void initQueryOverlay()
|
---|
122 | {
|
---|
123 | const int border_height = 10;
|
---|
124 | const int vert_space = 15;
|
---|
125 |
|
---|
126 | //-- visibility culling stats overlay
|
---|
127 | int top = border_height + 25;
|
---|
128 |
|
---|
129 | String ext = "Example/Visibility/Query/";
|
---|
130 |
|
---|
131 | initOverlayElement(&mQueryTypeInfo , ext, "QueryType", top, ": 0"); top += vert_space;
|
---|
132 |
|
---|
133 | initOverlayElement(&mQueryVisibleNodesInfo , ext, "VisibleNodes", top, ": 0"); top += vert_space;
|
---|
134 | initOverlayElement(&mQueryVisibleGeometryInfo , ext, "VisibleGeometry", top, ": 0"); top += vert_space;
|
---|
135 | initOverlayElement(&mQueryVisiblePatchInfo , ext, "VisiblePatches", top, ": 0"); top += vert_space;
|
---|
136 |
|
---|
137 | initOverlayElement(&mQueryNodeVisibilityInfo , ext, "NodeVisibility", top, ": 0"); top += vert_space;
|
---|
138 | initOverlayElement(&mQueryGeometryVisibilityInfo , ext, "GeometryVisibility", top, ": 0"); top += vert_space;
|
---|
139 | initOverlayElement(&mQueryPatchVisibilityInfo , ext, "PatchVisibility", top, ": 0"); top += vert_space;
|
---|
140 |
|
---|
141 |
|
---|
142 | OverlayElement *queryPanel = OverlayManager::getSingleton().
|
---|
143 | getOverlayElement("Example/Visibility/Query/QueryPanel");
|
---|
144 |
|
---|
145 | queryPanel->setHeight(top + border_height);
|
---|
146 | }
|
---|
147 |
|
---|
148 | //-----------------------------------------------------------------------
|
---|
149 | void showStats(bool show)
|
---|
150 | {
|
---|
151 | if (mDebugOverlay && mCullStatsOverlay)
|
---|
152 | {
|
---|
153 | if (show)
|
---|
154 | {
|
---|
155 | mDebugOverlay->show();
|
---|
156 | mCullStatsOverlay->show();
|
---|
157 | }
|
---|
158 | else
|
---|
159 | {
|
---|
160 | mDebugOverlay->hide();
|
---|
161 | mCullStatsOverlay->hide();
|
---|
162 | }
|
---|
163 | }
|
---|
164 | }
|
---|
165 | }
|
---|
166 |
|
---|
167 | TutorialFrameListener(RenderWindow* win, Camera* cam, SceneManager *sceneMgr)
|
---|
168 | : ExampleFrameListener(win, cam, false, false), mSceneMgr(sceneMgr), mCurrentAlgorithm(0)
|
---|
169 | {
|
---|
170 | mMoveSpeed = 50;
|
---|
171 |
|
---|
172 | //-- overlays
|
---|
173 | mDebugOverlay = OverlayManager::getSingleton().getByName("Core/DebugOverlay");
|
---|
174 | //mHelpOverlay = OverlayManager::getSingleton().getByName("Example/Visibility/HelpOverlay");
|
---|
175 | mQueryOverlay = OverlayManager::getSingleton().getByName("Example/Visibility/QueryOverlay");
|
---|
176 | mCullStatsOverlay = OverlayManager::getSingleton().getByName("Example/Visibility/CullStatsOverlay");
|
---|
177 |
|
---|
178 | initVisStatsOverlay(); // visibility stats overlay
|
---|
179 | //initHelpOverlay(); // help overlay
|
---|
180 | initQueryOverlay(); // visibility query stats overlay
|
---|
181 |
|
---|
182 | // show stats overlays
|
---|
183 | showStats(true);
|
---|
184 | }
|
---|
185 |
|
---|
186 | bool frameStarted(const FrameEvent& evt)
|
---|
187 | {
|
---|
188 | /*mInputDevice->capture();
|
---|
189 | if (mInputDevice->isKeyDown(KC_B))
|
---|
190 | {
|
---|
191 | showbb = !showbb;
|
---|
192 | mSceneMgr->showBoundingBoxes(showbb);
|
---|
193 | } return ExampleFrameListener::frameStarted(evt);
|
---|
194 | */
|
---|
195 |
|
---|
196 | // clamp to terrain
|
---|
197 | bool ret = ExampleFrameListener::frameStarted(evt);
|
---|
198 |
|
---|
199 | static Ray updateRay;
|
---|
200 |
|
---|
201 | updateRay.setOrigin(mCamera->getPosition());
|
---|
202 | updateRay.setDirection(Vector3::NEGATIVE_UNIT_Y);
|
---|
203 | raySceneQuery->setRay(updateRay);
|
---|
204 |
|
---|
205 | RaySceneQueryResult& qryResult = raySceneQuery->execute();
|
---|
206 |
|
---|
207 | RaySceneQueryResult::iterator i = qryResult.begin();
|
---|
208 |
|
---|
209 | if (i != qryResult.end() && i->movable)
|
---|
210 | {
|
---|
211 | mCamera->setPosition(mCamera->getPosition().x,
|
---|
212 | i->movable->getWorldBoundingBox().getCenter().y + 5,
|
---|
213 | mCamera->getPosition().z);
|
---|
214 |
|
---|
215 | std::stringstream d;
|
---|
216 | d << "World: " << i->movable->getWorldBoundingBox().getCenter().y <<
|
---|
217 | ", Object: " << i->movable->getBoundingBox().getCenter().y <<
|
---|
218 | ", Camera: " << mCamera->getPosition();
|
---|
219 |
|
---|
220 | LogManager::getSingleton().logMessage(d.str());
|
---|
221 |
|
---|
222 | }
|
---|
223 |
|
---|
224 | return ret;
|
---|
225 | }
|
---|
226 |
|
---|
227 | /*bool frameEnded(const FrameEvent& evt)
|
---|
228 | {
|
---|
229 | if (timeDelay >= 0)
|
---|
230 | timeDelay -= evt.timeSinceLastFrame;
|
---|
231 |
|
---|
232 | return ExampleFrameListener::frameEnded(evt);
|
---|
233 | }*/
|
---|
234 |
|
---|
235 | protected:
|
---|
236 | bool mMouseDown; // Whether or not the left mouse button was down last frame
|
---|
237 | Real mToggle; // The time left until next toggle
|
---|
238 | Real mRotate; // The rotate constant
|
---|
239 | Real mMove; // The movement constant
|
---|
240 | SceneManager *mSceneMgr; // The current SceneManager
|
---|
241 | SceneNode *mCamNode; // The SceneNode the camera is currently attached to
|
---|
242 |
|
---|
243 |
|
---|
244 |
|
---|
245 | private:
|
---|
246 | bool showbb;
|
---|
247 | };
|
---|
248 |
|
---|
249 |
|
---|
250 | class TerrainApplication : public ExampleApplication
|
---|
251 | {
|
---|
252 | public:
|
---|
253 | TerrainApplication()
|
---|
254 | {
|
---|
255 | ivr = new IVReader();
|
---|
256 | }
|
---|
257 |
|
---|
258 | ~TerrainApplication()
|
---|
259 | {
|
---|
260 | OGRE_DELETE(ivr);
|
---|
261 | OGRE_DELETE(raySceneQuery);
|
---|
262 | }
|
---|
263 |
|
---|
264 | protected:
|
---|
265 |
|
---|
266 | IVReader *ivr;
|
---|
267 |
|
---|
268 |
|
---|
269 | virtual void chooseSceneManager(void)
|
---|
270 | {
|
---|
271 | //mSceneMgr = mRoot->getSceneManager(ST_EXTERIOR_CLOSE);
|
---|
272 | mSceneMgr = mRoot->getSceneManager(ST_GENERIC);
|
---|
273 | }
|
---|
274 |
|
---|
275 | virtual void createCamera(void)
|
---|
276 | {
|
---|
277 | // Create the camera
|
---|
278 | mCamera = mSceneMgr->createCamera("PlayerCam");
|
---|
279 |
|
---|
280 | mCamera->setPosition(Vector3(0, 15, -200));
|
---|
281 | // Look back along -Z
|
---|
282 | mCamera->lookAt(Vector3(0, 0, -300));
|
---|
283 | mCamera->setNearClipDistance(1);
|
---|
284 | mCamera->setFarClipDistance(20000);
|
---|
285 |
|
---|
286 | }
|
---|
287 |
|
---|
288 | ////////////////////////////
|
---|
289 | void createScene(void)
|
---|
290 | {
|
---|
291 | String path = "D:/gametools/trunk/VUT/Ogre/resources/";
|
---|
292 |
|
---|
293 | // Set ambient light
|
---|
294 | mSceneMgr->setAmbientLight(ColourValue(0.5, 0.5, 0.5));
|
---|
295 |
|
---|
296 | // Create a light
|
---|
297 | Light* l = mSceneMgr->createLight("MainLight");
|
---|
298 | // Accept default settings: point light, white diffuse, just set position
|
---|
299 | // NB I could attach the light to a SceneNode if I wanted it to move automatically with
|
---|
300 | // other objects, but I don't
|
---|
301 | l->setPosition(20,80,50);
|
---|
302 |
|
---|
303 | mSceneMgr->setSkyBox(true, "Examples/CloudyNoonSkyBox", 2000, true);
|
---|
304 | ColourValue fadeColour(0.1, 0.1, 0.6);
|
---|
305 | mWindow->getViewport(0)->setBackgroundColour(fadeColour);
|
---|
306 |
|
---|
307 |
|
---|
308 | SceneNode *node1 = mSceneMgr->getRootSceneNode()->createChildSceneNode("Node1");
|
---|
309 | SceneNode *node2 = mSceneMgr->getRootSceneNode()->createChildSceneNode("Node2");
|
---|
310 | SceneNode *node3 = mSceneMgr->getRootSceneNode()->createChildSceneNode("Node3");
|
---|
311 | SceneNode *node4 = mSceneMgr->getRootSceneNode()->createChildSceneNode("Node4");
|
---|
312 | SceneNode *node5 = mSceneMgr->getRootSceneNode()->createChildSceneNode("Node5");
|
---|
313 | SceneNode *node6 = mSceneMgr->getRootSceneNode()->createChildSceneNode("Node6");
|
---|
314 | SceneNode *node7 = mSceneMgr->getRootSceneNode()->createChildSceneNode("Node7");
|
---|
315 | SceneNode *node8 = mSceneMgr->getRootSceneNode()->createChildSceneNode("Node8");
|
---|
316 | SceneNode *node9 = mSceneMgr->getRootSceneNode()->createChildSceneNode("Node9");
|
---|
317 |
|
---|
318 |
|
---|
319 | node1->translate(Vector3(-500, 0, 750));
|
---|
320 | node2->translate(Vector3(-400, 0, 750));
|
---|
321 | node3->scale(Vector3(100, 100 ,100));
|
---|
322 | node3->pitch(Radian(3 * Math::HALF_PI));
|
---|
323 | node4->translate(Vector3(-100, 0, 0));
|
---|
324 | node5->translate(Vector3(0, 300, 0));
|
---|
325 |
|
---|
326 | node6->scale(Vector3(100, 100 ,100));
|
---|
327 | node6->pitch(Radian(3 * Math::HALF_PI));
|
---|
328 | node6->roll(Radian(Math::HALF_PI));
|
---|
329 | node6->translate(Vector3(0, -100, 0));
|
---|
330 |
|
---|
331 | node7->scale(Vector3(100, 100 ,100));
|
---|
332 | node7->pitch(Radian(3 * Math::HALF_PI));
|
---|
333 | node7->roll(Radian(Math::HALF_PI));
|
---|
334 | node7->translate(Vector3(100, 0, 0));
|
---|
335 |
|
---|
336 | node8->translate(Vector3(-300, -300, 0));
|
---|
337 |
|
---|
338 | Log *log = LogManager::getSingleton().createLog("IVLog.log");
|
---|
339 | ivr->setLog(log);
|
---|
340 |
|
---|
341 | /*if (ivr->loadFile("media\\house_test1.iv"))
|
---|
342 | {
|
---|
343 | ivr->buildTree(mSceneMgr, node1);
|
---|
344 | ivr->buildTree(mSceneMgr, node2);
|
---|
345 | }
|
---|
346 | if (ivr->loadFile("media\\anhk.wrl"))
|
---|
347 | {
|
---|
348 | ivr->buildTree(mSceneMgr, node3);
|
---|
349 | }
|
---|
350 | if (ivr->loadFile("media\\ant.wrl"))
|
---|
351 | {
|
---|
352 | ivr->buildTree(mSceneMgr, node4);
|
---|
353 | }
|
---|
354 | if (ivr->loadFile("media\\zepplin0.wrl"))
|
---|
355 | {
|
---|
356 | ivr->buildTree(mSceneMgr, node5);
|
---|
357 | }
|
---|
358 | if (ivr->loadFile("media\\warbird.wrl"))
|
---|
359 | {
|
---|
360 | ivr->buildTree(mSceneMgr, node6);
|
---|
361 | }
|
---|
362 | if (ivr->loadFile("media\\z_wing.wrl"))
|
---|
363 | {
|
---|
364 | ivr->buildTree(mSceneMgr, node7);
|
---|
365 | }*/
|
---|
366 |
|
---|
367 | String fileName = path + "media\\city1500_flat_1.iv";
|
---|
368 | if (ivr->loadFile(fileName.c_str()))
|
---|
369 | {
|
---|
370 | ivr->buildTree(mSceneMgr, node8);
|
---|
371 | }
|
---|
372 |
|
---|
373 | fileName = path + "media\\roofs_1500.iv";
|
---|
374 | if (ivr->loadFile(fileName.c_str()))
|
---|
375 | {
|
---|
376 | ivr->buildTree(mSceneMgr, node8);
|
---|
377 | }
|
---|
378 |
|
---|
379 | fileName = path + "media\\CityRoads60.iv";
|
---|
380 | if (ivr->loadFile(fileName.c_str()))
|
---|
381 | {
|
---|
382 | ivr->buildTree(mSceneMgr, node8);
|
---|
383 | }
|
---|
384 |
|
---|
385 | fileName = path + "media\\CityPlane60.iv";
|
---|
386 | if (ivr->loadFile(fileName.c_str()))
|
---|
387 | {
|
---|
388 | ivr->buildTree(mSceneMgr, node8);
|
---|
389 | }
|
---|
390 |
|
---|
391 | fileName = path + "media\\test.iv";
|
---|
392 | if (ivr->loadFile(fileName.c_str()))
|
---|
393 | {
|
---|
394 | ivr->buildTree(mSceneMgr, node9);
|
---|
395 | }
|
---|
396 |
|
---|
397 | ivr->collapse();
|
---|
398 |
|
---|
399 | raySceneQuery = mSceneMgr->createRayQuery(
|
---|
400 | Ray(mCamera->getPosition(), Vector3::NEGATIVE_UNIT_Y));
|
---|
401 | }
|
---|
402 |
|
---|
403 |
|
---|
404 |
|
---|
405 | // Create new frame listener
|
---|
406 | void createFrameListener(void)
|
---|
407 | {
|
---|
408 | mFrameListener = new TutorialFrameListener(mWindow, mCamera, mSceneMgr);
|
---|
409 | mRoot->addFrameListener(mFrameListener);
|
---|
410 | }
|
---|
411 | };
|
---|
412 |
|
---|
413 |
|
---|
414 |
|
---|
415 |
|
---|
416 | /*class TutorialApplication : public ExampleApplication
|
---|
417 | {
|
---|
418 |
|
---|
419 | public:
|
---|
420 | TutorialApplication()
|
---|
421 | {
|
---|
422 | //LogManager::getSingleton().logMessage("here 0");
|
---|
423 | ivr = new IVReader();
|
---|
424 | mfl = NULL;
|
---|
425 |
|
---|
426 | }
|
---|
427 |
|
---|
428 | ~TutorialApplication()
|
---|
429 | {
|
---|
430 | if (ivr != NULL) delete ivr;
|
---|
431 | if (mfl != NULL) delete mfl;
|
---|
432 | }
|
---|
433 | protected:
|
---|
434 |
|
---|
435 | IVReader *ivr;
|
---|
436 | TutorialFrameListener *mfl;
|
---|
437 |
|
---|
438 | ////////////////////////////
|
---|
439 | void createScene(void)
|
---|
440 | {
|
---|
441 | //LogManager::getSingleton().logMessage("here 1");
|
---|
442 |
|
---|
443 | mSceneMgr->setAmbientLight( ColourValue( 0.3, 0.3, 0.3 ) );
|
---|
444 |
|
---|
445 | Light *light = mSceneMgr->createLight( "Light1" );
|
---|
446 | light->setType( Light::LT_DIRECTIONAL );
|
---|
447 | light->setDiffuseColour( ColourValue( 1, 1, 1 ) );
|
---|
448 | light->setSpecularColour( ColourValue( .25, .25, .25 ) );
|
---|
449 | light->setDirection( Vector3( 0, -1, -1 ) );
|
---|
450 |
|
---|
451 | Light *light2 = mSceneMgr->createLight( "Light2" );
|
---|
452 | light2->setType( Light::LT_DIRECTIONAL );
|
---|
453 | light2->setDiffuseColour( ColourValue( 1, 1, 1 ) );
|
---|
454 | light2->setSpecularColour( ColourValue( .25, .25, .25 ) );
|
---|
455 | light2->setDirection( Vector3( 0, 1, 1 ) );
|
---|
456 |
|
---|
457 |
|
---|
458 | SceneNode *node1 = mSceneMgr->getRootSceneNode()->createChildSceneNode( "Node1" );
|
---|
459 | SceneNode *node2 = mSceneMgr->getRootSceneNode()->createChildSceneNode( "Node2" );
|
---|
460 | SceneNode *node3 = mSceneMgr->getRootSceneNode()->createChildSceneNode( "Node3" );
|
---|
461 | SceneNode *node4 = mSceneMgr->getRootSceneNode()->createChildSceneNode( "Node4" );
|
---|
462 | SceneNode *node5 = mSceneMgr->getRootSceneNode()->createChildSceneNode( "Node5" );
|
---|
463 | SceneNode *node6 = mSceneMgr->getRootSceneNode()->createChildSceneNode( "Node6" );
|
---|
464 | SceneNode *node7 = mSceneMgr->getRootSceneNode()->createChildSceneNode( "Node7" );
|
---|
465 | SceneNode *node8 = mSceneMgr->getRootSceneNode()->createChildSceneNode( "Node8" );
|
---|
466 | SceneNode *node9 = mSceneMgr->getRootSceneNode()->createChildSceneNode( "Node9" );
|
---|
467 |
|
---|
468 | LogManager::getSingleton().logMessage("here 2");
|
---|
469 |
|
---|
470 |
|
---|
471 | node1->translate(Vector3(-500, 0, 750));
|
---|
472 | node2->translate(Vector3(-400, 0, 750));
|
---|
473 | node3->scale(Vector3(100, 100 ,100));
|
---|
474 | node3->pitch(Radian(3*1.57));
|
---|
475 | node4->translate(Vector3(-100, 0, 0));
|
---|
476 | node5->translate(Vector3(0, 300, 0));
|
---|
477 | node6->scale(Vector3(100, 100 ,100));
|
---|
478 | node6->pitch(Radian(3*1.57));
|
---|
479 | node6->roll(Radian(1.57));
|
---|
480 | node6->translate(Vector3(0, -100, 0));
|
---|
481 | node7->scale(Vector3(100, 100 ,100));
|
---|
482 | node7->pitch(Radian(3*1.6));
|
---|
483 | node7->roll(Radian(1.57));
|
---|
484 | node7->translate(Vector3(100, 0, 0));
|
---|
485 | node8->translate(Vector3(-300, -300, 0));
|
---|
486 |
|
---|
487 | Log *log = LogManager::getSingleton().createLog("IVLog.log");
|
---|
488 |
|
---|
489 | LogManager::getSingleton().logMessage("here 3");
|
---|
490 | ivr->setLog(log);
|
---|
491 |
|
---|
492 | if (ivr->loadFile("media\\house_test1.iv"))
|
---|
493 | {
|
---|
494 | ivr->buildTree(mSceneMgr, node1);
|
---|
495 | ivr->buildTree(mSceneMgr, node2);
|
---|
496 | }
|
---|
497 | if (ivr->loadFile("media\\anhk.wrl"))
|
---|
498 | {
|
---|
499 | ivr->buildTree(mSceneMgr, node3);
|
---|
500 | }
|
---|
501 | if (ivr->loadFile("media\\ant.wrl"))
|
---|
502 | {
|
---|
503 | ivr->buildTree(mSceneMgr, node4);
|
---|
504 | }
|
---|
505 | if (ivr->loadFile("media\\zepplin0.wrl"))
|
---|
506 | {
|
---|
507 | ivr->buildTree(mSceneMgr, node5);
|
---|
508 | }
|
---|
509 | if (ivr->loadFile("media\\warbird.wrl"))
|
---|
510 | {
|
---|
511 | ivr->buildTree(mSceneMgr, node6);
|
---|
512 | }
|
---|
513 | if (ivr->loadFile("media\\z_wing.wrl"))
|
---|
514 | {
|
---|
515 | ivr->buildTree(mSceneMgr, node7);
|
---|
516 | }
|
---|
517 |
|
---|
518 | if (0) {
|
---|
519 | if (ivr->loadFile("media\\city1500_flat_1.iv"))
|
---|
520 | {
|
---|
521 | ivr->buildTree(mSceneMgr, node8);
|
---|
522 | }
|
---|
523 | if (ivr->loadFile("media\\roofs_1500.iv"))
|
---|
524 | {
|
---|
525 | ivr->buildTree(mSceneMgr, node8);
|
---|
526 | }
|
---|
527 | if (ivr->loadFile("media\\CityRoads60.iv"))
|
---|
528 | {
|
---|
529 | ivr->buildTree(mSceneMgr, node8);
|
---|
530 | }
|
---|
531 |
|
---|
532 | if (ivr->loadFile("media\\CityPlane60.iv"))
|
---|
533 | {
|
---|
534 | ivr->buildTree(mSceneMgr, node8);
|
---|
535 | }
|
---|
536 |
|
---|
537 | if (ivr->loadFile("media\\test.iv"))
|
---|
538 | {
|
---|
539 | ivr->buildTree(mSceneMgr, node9);
|
---|
540 | }
|
---|
541 | }
|
---|
542 | ivr->collapse();
|
---|
543 |
|
---|
544 |
|
---|
545 |
|
---|
546 | }
|
---|
547 | // Create new frame listener
|
---|
548 | void createFrameListener(void)
|
---|
549 | {
|
---|
550 | mfl = new TutorialFrameListener(mWindow, mCamera, mSceneMgr);
|
---|
551 | mRoot->addFrameListener(mfl);
|
---|
552 | }
|
---|
553 | };
|
---|
554 | */ |
---|