1 | /* -*-c++-*- osgVisual - Copyright (C) 2009-2010 Torben Dannhauer |
---|
2 | * |
---|
3 | * This library is based on OpenSceneGraph, open source and may be redistributed and/or modified under |
---|
4 | * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or |
---|
5 | * (at your option) any later version. The full license is in LICENSE file |
---|
6 | * included with this distribution, and on the openscenegraph.org website. |
---|
7 | * |
---|
8 | * osgVisual requires for some proprietary modules a license from the correspondig manufacturer. |
---|
9 | * You have to aquire licenses for all used proprietary modules. |
---|
10 | * |
---|
11 | * This library is distributed in the hope that it will be useful, |
---|
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
14 | * OpenSceneGraph Public License for more details. |
---|
15 | */ |
---|
16 | |
---|
17 | |
---|
18 | #include <visual_core.h> |
---|
19 | |
---|
20 | using namespace osgVisual; |
---|
21 | |
---|
22 | visual_core::visual_core(osg::ArgumentParser& arguments_) : arguments(arguments_) |
---|
23 | { |
---|
24 | OSG_NOTIFY( osg::ALWAYS ) << "visual_core instantiated." << std::endl; |
---|
25 | } |
---|
26 | |
---|
27 | visual_core::~visual_core(void) |
---|
28 | { |
---|
29 | OSG_NOTIFY( osg::ALWAYS ) << "visual_core destroyed." << std::endl; |
---|
30 | } |
---|
31 | |
---|
32 | void visual_core::initialize() |
---|
33 | { |
---|
34 | OSG_NOTIFY( osg::ALWAYS ) << "Initialize visual_core..." << std::endl; |
---|
35 | |
---|
36 | // Configure osg to use KdTrees |
---|
37 | osgDB::Registry::instance()->setBuildKdTreesHint(osgDB::ReaderWriter::Options::BUILD_KDTREES); |
---|
38 | |
---|
39 | // Setup pathes |
---|
40 | osgDB::Registry::instance()->getDataFilePathList().push_back( "D:\\DA\\osgVisual\\models" ); |
---|
41 | |
---|
42 | // Setup viewer |
---|
43 | viewer = new osgViewer::Viewer(arguments); |
---|
44 | |
---|
45 | // Setup coordinate system node |
---|
46 | rootNode = new osg::CoordinateSystemNode; // todo memleakf |
---|
47 | rootNode->setEllipsoidModel(new osg::EllipsoidModel()); |
---|
48 | |
---|
49 | // Test memory leak (todo) |
---|
50 | double* test = new double[1000]; |
---|
51 | |
---|
52 | #ifdef USE_SPACENAVIGATOR |
---|
53 | mouse = NULL; |
---|
54 | #endif |
---|
55 | |
---|
56 | //osg::DisplaySettings::instance()->setNumOfDatabaseThreadsHint( 8 ); |
---|
57 | |
---|
58 | // Show model |
---|
59 | viewer->setSceneData( rootNode ); |
---|
60 | |
---|
61 | osg::Group* distortedSceneGraph = NULL; |
---|
62 | #ifdef USE_DISTORTION |
---|
63 | // Initialize distortion |
---|
64 | OSG_NOTIFY( osg::ALWAYS ) << "Using distortion." << std::endl; |
---|
65 | distortion = new visual_distortion( viewer, arguments ); |
---|
66 | distortion->initialize( rootNode, viewer->getCamera()->getClearColor() ); |
---|
67 | distortedSceneGraph = distortion->getDistortedSceneGraph(); |
---|
68 | #endif |
---|
69 | |
---|
70 | #ifdef USE_SKY_SILVERLINING |
---|
71 | // Initialize sky |
---|
72 | sky = new visual_skySilverLining( viewer ); |
---|
73 | sky->init(distortedSceneGraph, rootNode); // Without distortedSceneGraph=NULL |
---|
74 | #endif |
---|
75 | |
---|
76 | // Initialize DataIO interface |
---|
77 | visual_dataIO::getInstance()->init(viewer, arguments); |
---|
78 | |
---|
79 | // Add manipulators for user interaction - after dataIO to be able to skip it in slaves. |
---|
80 | addManipulators(); |
---|
81 | |
---|
82 | loadTerrain(arguments); |
---|
83 | |
---|
84 | // create the windows and run the threads. |
---|
85 | viewer->realize(); |
---|
86 | |
---|
87 | // setup scenery |
---|
88 | setupScenery(); |
---|
89 | |
---|
90 | // parse Configuration file |
---|
91 | parseConfigFile(arguments); |
---|
92 | |
---|
93 | // All modules are initialized - now check arguments for any unused parameter. |
---|
94 | checkCommandlineArgumentsForFinalErrors(); |
---|
95 | |
---|
96 | // Run visual main loop |
---|
97 | mainLoop(); |
---|
98 | } |
---|
99 | |
---|
100 | void visual_core::mainLoop() |
---|
101 | { |
---|
102 | // run main loop |
---|
103 | while( !viewer->done() ) |
---|
104 | { |
---|
105 | // next frame please.... |
---|
106 | viewer->advance(); |
---|
107 | |
---|
108 | /*double hat, hot, lat, lon, height; |
---|
109 | util::getWGS84ofCamera( viewer->getCamera(), rootNode, lat, lon, height); |
---|
110 | if (util::queryHeightOfTerrain( hot, rootNode, lat, lon) && util::queryHeightAboveTerrainInWGS84( hat, rootNode, lat, lon, height ) ) |
---|
111 | OSG_NOTIFY( osg::ALWAYS ) << "HOT is: " << hot << ", HAT is: " << hat << std::endl;*/ |
---|
112 | |
---|
113 | // perform all queued events |
---|
114 | viewer->eventTraversal(); |
---|
115 | |
---|
116 | // update the scene by traversing it with the the update visitor which will |
---|
117 | // call all node update callbacks and animations. |
---|
118 | viewer->updateTraversal(); |
---|
119 | |
---|
120 | // Render the Frame. |
---|
121 | viewer->renderingTraversals(); |
---|
122 | |
---|
123 | } // END WHILE |
---|
124 | } |
---|
125 | |
---|
126 | void visual_core::shutdown() |
---|
127 | { |
---|
128 | OSG_NOTIFY( osg::ALWAYS ) << "Shutdown visual_core..." << std::endl; |
---|
129 | |
---|
130 | // Shutdown Dbug HUD |
---|
131 | if(hud.valid()) |
---|
132 | hud->shutdown(); |
---|
133 | // Unset scene data |
---|
134 | viewer->setSceneData( NULL ); |
---|
135 | |
---|
136 | #ifdef USE_SKY_SILVERLINING |
---|
137 | // Shutdown sky |
---|
138 | if( sky.valid() ) |
---|
139 | sky->shutdown(); |
---|
140 | #endif |
---|
141 | |
---|
142 | #ifdef USE_DISTORTION |
---|
143 | // Shutdown distortion |
---|
144 | if( distortion.valid() ) |
---|
145 | distortion->shutdown(); |
---|
146 | #endif |
---|
147 | |
---|
148 | // Shutdown data |
---|
149 | rootNode = NULL; |
---|
150 | |
---|
151 | // Shutdown dataIO |
---|
152 | visual_dataIO::getInstance()->shutdown(); |
---|
153 | |
---|
154 | |
---|
155 | #ifdef USE_SPACENAVIGATOR |
---|
156 | //Delete SpaceMouse driver |
---|
157 | if(mouse) |
---|
158 | { |
---|
159 | mouse->shutdown(); |
---|
160 | delete mouse; |
---|
161 | } |
---|
162 | #endif |
---|
163 | |
---|
164 | // Destroy osgViewer |
---|
165 | viewer = NULL; |
---|
166 | } |
---|
167 | |
---|
168 | bool visual_core::loadTerrain(osg::ArgumentParser& arguments_) |
---|
169 | { |
---|
170 | osg::ref_ptr<osg::Node> model = osgDB::readNodeFiles(arguments_); |
---|
171 | if( model.valid() ) |
---|
172 | { |
---|
173 | rootNode->addChild( model.get() ); |
---|
174 | return true; |
---|
175 | } |
---|
176 | else |
---|
177 | { |
---|
178 | OSG_NOTIFY( osg::FATAL ) << "Load terrain: No data loaded" << std::endl; |
---|
179 | return false; |
---|
180 | } |
---|
181 | |
---|
182 | return false; |
---|
183 | } |
---|
184 | |
---|
185 | void visual_core::addManipulators() |
---|
186 | { |
---|
187 | if(!visual_dataIO::getInstance()->isSlave()) // set up the camera manipulators if not slave. |
---|
188 | { |
---|
189 | osg::ref_ptr<osgGA::KeySwitchMatrixManipulator> keyswitchManipulator = new osgGA::KeySwitchMatrixManipulator; |
---|
190 | |
---|
191 | keyswitchManipulator->addMatrixManipulator( '1', "Trackball", new osgGA::TrackballManipulator() ); |
---|
192 | keyswitchManipulator->addMatrixManipulator( '2', "Flight", new osgGA::FlightManipulator() ); |
---|
193 | keyswitchManipulator->addMatrixManipulator( '3', "Terrain", new osgGA::TerrainManipulator() ); |
---|
194 | nt = new osgGA::NodeTrackerManipulator(); |
---|
195 | keyswitchManipulator->addMatrixManipulator( '4', "NodeTrackerManipulator", nt ); |
---|
196 | |
---|
197 | #ifdef USE_SPACENAVIGATOR |
---|
198 | // SpaceNavigator manipulator |
---|
199 | mouse = new SpaceMouse(); |
---|
200 | mouse->initialize(); |
---|
201 | mouseTrackerManip = new NodeTrackerSpaceMouse(mouse); |
---|
202 | mouseTrackerManip->setTrackerMode(NodeTrackerSpaceMouse::NODE_CENTER); |
---|
203 | mouseTrackerManip->setRotationMode(NodeTrackerSpaceMouse::ELEVATION_AZIM); |
---|
204 | mouseTrackerManip->setAutoComputeHomePosition( true ); |
---|
205 | keyswitchManipulator->addMatrixManipulator( '5', "Spacemouse Node Tracker", mouseTrackerManip ); |
---|
206 | keyswitchManipulator->addMatrixManipulator( '6', "Spacemouse Free (Airplane)", new FreeManipulator(mouse) ); |
---|
207 | #endif |
---|
208 | |
---|
209 | // objectMounted Manipulator for Camera control by Nodes |
---|
210 | objectMountedCameraManip = new objectMountedManipulator(); |
---|
211 | keyswitchManipulator->addMatrixManipulator( '7', "Object mounted Camera", objectMountedCameraManip ); |
---|
212 | |
---|
213 | // Animation path manipulator |
---|
214 | std::string pathfile; |
---|
215 | char keyForAnimationPath = '8'; |
---|
216 | while (arguments.read("-p",pathfile)) |
---|
217 | { |
---|
218 | osgGA::AnimationPathManipulator* apm = new osgGA::AnimationPathManipulator(pathfile); |
---|
219 | if (apm || !apm->valid()) |
---|
220 | { |
---|
221 | unsigned int num = keyswitchManipulator->getNumMatrixManipulators(); |
---|
222 | keyswitchManipulator->addMatrixManipulator( keyForAnimationPath, "Path", apm ); |
---|
223 | keyswitchManipulator->selectMatrixManipulator(num); |
---|
224 | ++keyForAnimationPath; |
---|
225 | } |
---|
226 | } |
---|
227 | |
---|
228 | viewer->setCameraManipulator( keyswitchManipulator.get() ); |
---|
229 | } // If not Slave END |
---|
230 | |
---|
231 | // add the state manipulator |
---|
232 | viewer->addEventHandler( new osgGA::StateSetManipulator(rootNode->getOrCreateStateSet()) ); |
---|
233 | |
---|
234 | // add the thread model handler |
---|
235 | viewer->addEventHandler(new osgViewer::ThreadingHandler); |
---|
236 | |
---|
237 | // add the window size toggle handler |
---|
238 | viewer->addEventHandler(new osgViewer::WindowSizeHandler); |
---|
239 | |
---|
240 | // add the stats handler |
---|
241 | viewer->addEventHandler(new osgViewer::StatsHandler); |
---|
242 | |
---|
243 | // add the help handler |
---|
244 | viewer->addEventHandler(new osgViewer::HelpHandler(arguments.getApplicationUsage())); |
---|
245 | |
---|
246 | // add the record camera path handler |
---|
247 | viewer->addEventHandler(new osgViewer::RecordCameraPathHandler); |
---|
248 | |
---|
249 | // add the LOD Scale handler |
---|
250 | viewer->addEventHandler(new osgViewer::LODScaleHandler); |
---|
251 | |
---|
252 | // add the screen capture handler |
---|
253 | viewer->addEventHandler(new osgViewer::ScreenCaptureHandler); |
---|
254 | } |
---|
255 | |
---|
256 | void visual_core::parseConfigFile(osg::ArgumentParser& arguments_) |
---|
257 | { |
---|
258 | configFileValid = false; |
---|
259 | |
---|
260 | std::string filename; |
---|
261 | if( arguments.read("-c", filename) || arguments.read("--config", filename) ) |
---|
262 | { |
---|
263 | OSG_ALWAYS << "Using configuration file.." << std::endl; |
---|
264 | if( osgDB::fileExists(filename) ) |
---|
265 | { |
---|
266 | configFileValid = false; |
---|
267 | xmlDoc *doc = NULL; |
---|
268 | xmlNode *root_element = NULL; |
---|
269 | |
---|
270 | doc = xmlReadFile(filename.c_str(), NULL, 0); |
---|
271 | if (doc == NULL) |
---|
272 | { |
---|
273 | configFileValid = false; |
---|
274 | OSG_ALWAYS << "visual_core::parseConfigFile() - ERROR: could not parse osgVisual config file" << filename << std::endl; |
---|
275 | } |
---|
276 | else |
---|
277 | { |
---|
278 | // Get the root element node |
---|
279 | root_element = xmlDocGetRootElement(doc); |
---|
280 | |
---|
281 | // Parse the XML document. |
---|
282 | checkXMLNode(root_element); |
---|
283 | |
---|
284 | // free the document |
---|
285 | xmlFreeDoc(doc);; |
---|
286 | } |
---|
287 | // Free the global variables that may have been allocated by the parser. |
---|
288 | xmlCleanupParser(); |
---|
289 | |
---|
290 | if(!configFileValid) |
---|
291 | OSG_ALWAYS << "visual_core::parseConfigFile() - ERROR: XML file seems not to be a valid osgVisual configuration file!" << std::endl; |
---|
292 | |
---|
293 | } // IF configfile exists |
---|
294 | } // IF -c END |
---|
295 | } |
---|
296 | |
---|
297 | void visual_core::checkXMLNode(xmlNode * a_node) |
---|
298 | { |
---|
299 | for (xmlNode *cur_node = a_node; cur_node; cur_node = cur_node->next) |
---|
300 | { |
---|
301 | std::string node_name=reinterpret_cast<const char*>(cur_node->name); |
---|
302 | if(cur_node->type == XML_ELEMENT_NODE && node_name == "osgvisualconfiguration") |
---|
303 | { |
---|
304 | OSG_DEBUG << "XML node osgvisualconfiguration found" << std::endl; |
---|
305 | configFileValid = true; |
---|
306 | // Iterate to the next nodes to configure modules and scenery. |
---|
307 | checkXMLNode(cur_node->children); |
---|
308 | } |
---|
309 | |
---|
310 | if (cur_node->type == XML_ELEMENT_NODE && node_name == "module") |
---|
311 | { |
---|
312 | OSG_DEBUG << "XML node module found" << std::endl; |
---|
313 | |
---|
314 | parseModule(cur_node); |
---|
315 | |
---|
316 | //OSG_DEBUG << "node type=Element, name:" << cur_node->name << std::endl; |
---|
317 | //OSG_DEBUG << "Processing children at " << cur_node->children << std::endl; |
---|
318 | } // IF(module) END |
---|
319 | |
---|
320 | if (cur_node->type == XML_ELEMENT_NODE && node_name == "scenery") |
---|
321 | { |
---|
322 | OSG_DEBUG << "XML node scenery found" << std::endl; |
---|
323 | |
---|
324 | parseScenery(cur_node); |
---|
325 | |
---|
326 | //OSG_DEBUG << "node type=Element, name:" << cur_node->name << std::endl; |
---|
327 | //OSG_DEBUG << "Processing children at " << cur_node->children << std::endl; |
---|
328 | } // IF(scenery) END |
---|
329 | } // FOR END |
---|
330 | } |
---|
331 | |
---|
332 | void visual_core::parseModule(xmlNode * a_node) |
---|
333 | { |
---|
334 | OSG_ALWAYS << "parseModule()" << std::endl; |
---|
335 | } |
---|
336 | |
---|
337 | void visual_core::parseScenery(xmlNode * a_node) |
---|
338 | { |
---|
339 | OSG_ALWAYS << "parseScenery()" << std::endl; |
---|
340 | } |
---|
341 | |
---|
342 | bool visual_core::checkCommandlineArgumentsForFinalErrors() |
---|
343 | { |
---|
344 | // Setup Application Usage |
---|
345 | arguments.getApplicationUsage()->setApplicationName(arguments.getApplicationName()); |
---|
346 | arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is the new FSD visualization tool, written by Torben Dannhauer"); |
---|
347 | arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] Terrain_filename"); |
---|
348 | arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information"); |
---|
349 | |
---|
350 | // if user request help write it out to cout. |
---|
351 | if (arguments.read("-h") || arguments.read("--help")) |
---|
352 | { |
---|
353 | arguments.getApplicationUsage()->write(std::cout); |
---|
354 | //cause the viewer to exit and shut down clean. |
---|
355 | viewer->setDone(true); |
---|
356 | } |
---|
357 | |
---|
358 | // report any errors if they have occurred when parsing the program arguments. |
---|
359 | if (arguments.errors()) |
---|
360 | { |
---|
361 | arguments.writeErrorMessages(std::cout); |
---|
362 | //cause the viewer to exit and shut down clean. |
---|
363 | viewer->setDone(true); |
---|
364 | } |
---|
365 | |
---|
366 | // any option left unread are converted into errors to write out later. |
---|
367 | arguments.reportRemainingOptionsAsUnrecognized(); |
---|
368 | |
---|
369 | // report any errors if they have occurred when parsing the program arguments. |
---|
370 | if (arguments.errors()) |
---|
371 | { |
---|
372 | arguments.writeErrorMessages(std::cout); |
---|
373 | return false; |
---|
374 | } |
---|
375 | return true; |
---|
376 | } |
---|
377 | |
---|
378 | void visual_core::setupScenery() |
---|
379 | { |
---|
380 | // iterate manually through one frame to allow some modules like Sky_Silverlining to initialize properly befor we configure it according to the scenery data. |
---|
381 | viewer->advance(); |
---|
382 | viewer->eventTraversal(); |
---|
383 | viewer->updateTraversal(); |
---|
384 | viewer->renderingTraversals(); |
---|
385 | |
---|
386 | // Sky settings: |
---|
387 | sky->setTime(12,00,23); |
---|
388 | sky->setVisibility(50000); |
---|
389 | //addWindVolume( 0.0, 15000.0, 300.0, 90.0 ); |
---|
390 | |
---|
391 | sky->addCloudLayer( 0, 300000, 300000, 600.0, 2351.0, 0.5, STRATUS ); |
---|
392 | //sky->addCloudLayer( 0, 5000000, 5000000, 600.0, 7351.0, 0.2, CIRRUS_FIBRATUS ); |
---|
393 | //sky->addCloudLayer( 0, 50000, 50000, 600.0, 7351.0, 0.2, CIRROCUMULUS ); |
---|
394 | ///sky->addCloudLayer( 1, 200000, 200000, 3000, 2000.0, 0.05, CUMULUS_CONGESTUS ); |
---|
395 | //cloudLayerSlots[1].cloudLayerPointer->SetPrecipitation(SilverLining::CloudLayer::SLEET, 25.0 ); |
---|
396 | |
---|
397 | //testObj = new visual_object( rootNode, "testStab", objectMountedCameraManip ); |
---|
398 | //testObj->setNewPosition( osg::DegreesToRadians(47.7123), osg::DegreesToRadians(12.84088), 600 ); |
---|
399 | ///* using a huge cylinder to test position & orientation */ |
---|
400 | //testObj->setGeometry( util::getDemoCylinder(5000.0, 20.0 ) ); |
---|
401 | //testObj->addUpdater( new object_updater(testObj) ); |
---|
402 | |
---|
403 | //osg::ref_ptr<visual_object> testObj2 = new visual_object( rootNode, "neuschwanstein" ); // todo memleak |
---|
404 | ////testObj2->setNewPosition( osg::DegreesToRadians(47.8123), osg::DegreesToRadians(12.94088), 600 ); |
---|
405 | //testObj2->setNewPosition( osg::DegreesToRadians(47.557523564234), osg::DegreesToRadians(10.749646398595), 950 ); |
---|
406 | //testObj2->loadGeometry( "../models/neuschwanstein.osgb" ); |
---|
407 | ////testObj2->addUpdater( new object_updater(testObj2) ); // todo memleak |
---|
408 | |
---|
409 | osg::ref_ptr<visual_object> testObj3 = new visual_object( rootNode, "SAENGER1" ); // todo memleak |
---|
410 | testObj3->setNewPosition( osg::DegreesToRadians(47.8123), osg::DegreesToRadians(12.94088), 600 ); |
---|
411 | testObj3->loadGeometry( "../models/saenger1.flt" ); |
---|
412 | testObj3->addUpdater( new object_updater(testObj3) ); // todo memleak |
---|
413 | |
---|
414 | |
---|
415 | osg::ref_ptr<visual_object> testObj4 = new visual_object( rootNode, "SAENGER2" ); // todo memleak |
---|
416 | testObj4->setNewPosition( osg::DegreesToRadians(47.8123), osg::DegreesToRadians(12.94088), 650 ); |
---|
417 | testObj4->loadGeometry( "../models/saenger2.flt" ); |
---|
418 | testObj4->addUpdater( new object_updater(testObj4) ); // todo memleak |
---|
419 | testObj4->addLabel("testLabel", "LabelTest!!\nnächste Zeile :)",osg::Vec4(1.0f,0.25f,1.0f,1.0f)); |
---|
420 | |
---|
421 | osg::ref_ptr<visual_object> testObj5 = new visual_object( rootNode, "SAENGER" ); // todo memleak |
---|
422 | testObj5->setNewPosition( osg::DegreesToRadians(47.8123), osg::DegreesToRadians(12.94088), 550 ); |
---|
423 | testObj5->loadGeometry( "../models/saengerCombine.flt" ); |
---|
424 | //testObj5->setScale( 2 ); |
---|
425 | testObj5->addUpdater( new object_updater(testObj5) ); // todo memleak |
---|
426 | |
---|
427 | #ifdef USE_SPACENAVIGATOR |
---|
428 | // Manipulatoren auf dieses Objekt binden (Primärobjekt) |
---|
429 | if (objectMountedCameraManip.valid()) |
---|
430 | objectMountedCameraManip->setAttachedObject( testObj4 ); |
---|
431 | if (mouseTrackerManip.valid()) |
---|
432 | { |
---|
433 | mouseTrackerManip->setTrackNode( testObj4->getGeometry() ); |
---|
434 | mouseTrackerManip->setMinimumDistance( 100 ); |
---|
435 | } |
---|
436 | #endif |
---|
437 | |
---|
438 | if(nt.valid()) |
---|
439 | { |
---|
440 | osgGA::NodeTrackerManipulator::TrackerMode trackerMode = osgGA::NodeTrackerManipulator::NODE_CENTER; |
---|
441 | osgGA::NodeTrackerManipulator::RotationMode rotationMode = osgGA::NodeTrackerManipulator::ELEVATION_AZIM; |
---|
442 | nt->setTrackerMode(trackerMode); |
---|
443 | nt->setRotationMode(rotationMode); |
---|
444 | //nt->setAutoComputeHomePosition( true ); |
---|
445 | nt->setMinimumDistance( 100 ); |
---|
446 | nt->setTrackNode(testObj4->getGeometry()); |
---|
447 | //nt->computeHomePosition(); |
---|
448 | nt->setAutoComputeHomePosition( true ); |
---|
449 | nt->setDistance( 250 ); |
---|
450 | } |
---|
451 | |
---|
452 | |
---|
453 | // Load EDDF |
---|
454 | //std::string filename = "D:\\DA\\EDDF_test\\eddf.ive"; |
---|
455 | //if( !osgDB::fileExists(filename) ) |
---|
456 | //{ |
---|
457 | // OSG_NOTIFY(osg::ALWAYS) << "Warning: EDDF Model not loaded. File '" << filename << "' does not exist. Skipping."; |
---|
458 | //} |
---|
459 | //// read model |
---|
460 | //osg::ref_ptr<osg::Node> tmpModel = osgDB::readNodeFile( filename ); |
---|
461 | //if (tmpModel.valid()) |
---|
462 | // rootNode->addChild( tmpModel ); |
---|
463 | |
---|
464 | |
---|
465 | visual_draw2D::getInstance()->init( rootNode, viewer ); |
---|
466 | //osg::ref_ptr<visual_hud> hud = new visual_hud(); |
---|
467 | hud = new visual_debug_hud(); |
---|
468 | hud->init( viewer, rootNode ); |
---|
469 | |
---|
470 | |
---|
471 | |
---|
472 | //osg::ref_ptr<visual_draw3D> test = new visual_draw3D(); |
---|
473 | //test->init( rootNode, viewer ); |
---|
474 | |
---|
475 | //// Creating Testclasses |
---|
476 | //osg::ref_ptr<osgVisual::dataIO_transportContainer> test = new osgVisual::dataIO_transportContainer(); |
---|
477 | //osg::ref_ptr<osgVisual::dataIO_executer> testEx = new osgVisual::dataIO_executer(); |
---|
478 | //osg::ref_ptr<osgVisual::dataIO_slot> testSlot = new osgVisual::dataIO_slot(); |
---|
479 | //test->setFrameID( 22 ); |
---|
480 | //test->setName("ugamoep"); |
---|
481 | //testEx->setexecuterID( osgVisual::dataIO_executer::IS_COLLISION ); |
---|
482 | //testSlot->setVariableName(std::string("HalloName")); |
---|
483 | //testSlot->setdataDirection( osgVisual::dataIO_slot::TO_OBJ ); |
---|
484 | //testSlot->setvarType( osgVisual::dataIO_slot::DOUBLE ); |
---|
485 | //testSlot->setValue( 0.12345 ); |
---|
486 | //test->addExecuter( testEx ); |
---|
487 | //test->addSlot( testSlot ); |
---|
488 | |
---|
489 | visual_dataIO::getInstance()->setSlotData("TestSlot1", osgVisual::dataIO_slot::TO_OBJ, 0.12345); |
---|
490 | } |
---|