[221] | 1 | /* -*-c++-*- osgVisual - Copyright (C) 2009-2011 Torben Dannhauer |
---|
[31] | 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 | |
---|
[86] | 17 | |
---|
[31] | 18 | #include <visual_core.h> |
---|
[273] | 19 | #include <visual_util.h> |
---|
| 20 | #include <osgTerrain/Terrain> |
---|
[31] | 21 | |
---|
| 22 | using namespace osgVisual; |
---|
| 23 | |
---|
| 24 | visual_core::visual_core(osg::ArgumentParser& arguments_) : arguments(arguments_) |
---|
| 25 | { |
---|
| 26 | OSG_NOTIFY( osg::ALWAYS ) << "visual_core instantiated." << std::endl; |
---|
[86] | 27 | } |
---|
[31] | 28 | |
---|
[86] | 29 | visual_core::~visual_core(void) |
---|
| 30 | { |
---|
| 31 | OSG_NOTIFY( osg::ALWAYS ) << "visual_core destroyed." << std::endl; |
---|
| 32 | } |
---|
| 33 | |
---|
| 34 | void visual_core::initialize() |
---|
| 35 | { |
---|
| 36 | OSG_NOTIFY( osg::ALWAYS ) << "Initialize visual_core..." << std::endl; |
---|
| 37 | |
---|
[144] | 38 | // Check for config file to provide it to all modules during initialization. |
---|
| 39 | if( arguments.read("-c", configFilename) || arguments.read("--config", configFilename) ) |
---|
| 40 | { |
---|
| 41 | if( !osgDB::fileExists(configFilename) ) |
---|
| 42 | configFilename = ""; |
---|
| 43 | else |
---|
| 44 | OSG_ALWAYS << "Using configuration file: " << configFilename << std::endl; |
---|
| 45 | } |
---|
| 46 | |
---|
[86] | 47 | // Configure osg to use KdTrees |
---|
| 48 | osgDB::Registry::instance()->setBuildKdTreesHint(osgDB::ReaderWriter::Options::BUILD_KDTREES); |
---|
| 49 | |
---|
[305] | 50 | // Configure Multisampling |
---|
| 51 | osg::DisplaySettings::instance()->setNumMultiSamples(4); |
---|
| 52 | |
---|
[31] | 53 | // Setup pathes |
---|
| 54 | osgDB::Registry::instance()->getDataFilePathList().push_back( "D:\\DA\\osgVisual\\models" ); |
---|
| 55 | |
---|
| 56 | // Setup viewer |
---|
| 57 | viewer = new osgViewer::Viewer(arguments); |
---|
| 58 | |
---|
| 59 | // Setup coordinate system node |
---|
[87] | 60 | rootNode = new osg::CoordinateSystemNode; // todo memleakf |
---|
[31] | 61 | rootNode->setEllipsoidModel(new osg::EllipsoidModel()); |
---|
| 62 | |
---|
| 63 | // Test memory leak (todo) |
---|
[116] | 64 | double* test = new double[1000]; |
---|
[31] | 65 | |
---|
[55] | 66 | //osg::DisplaySettings::instance()->setNumOfDatabaseThreadsHint( 8 ); |
---|
[31] | 67 | |
---|
| 68 | // Show model |
---|
| 69 | viewer->setSceneData( rootNode ); |
---|
| 70 | |
---|
[71] | 71 | osg::Group* distortedSceneGraph = NULL; |
---|
[31] | 72 | #ifdef USE_DISTORTION |
---|
| 73 | // Initialize distortion |
---|
[144] | 74 | distortion = new visual_distortion( viewer, arguments, configFilename ); |
---|
[151] | 75 | distortedSceneGraph = distortion->initialize( rootNode, viewer->getCamera()->getClearColor() ); |
---|
[31] | 76 | #endif |
---|
| 77 | |
---|
| 78 | #ifdef USE_SKY_SILVERLINING |
---|
| 79 | // Initialize sky |
---|
[182] | 80 | bool disabled = false; // to ask if the skyp is disabled or enabled |
---|
| 81 | sky = new visual_skySilverLining( viewer, configFilename, disabled ); |
---|
| 82 | if(disabled) |
---|
| 83 | sky = NULL; |
---|
| 84 | if(sky.valid()) |
---|
| 85 | sky->init(distortedSceneGraph, rootNode); // Without distortion: distortedSceneGraph=NULL |
---|
[31] | 86 | #endif |
---|
| 87 | |
---|
| 88 | // Initialize DataIO interface |
---|
[185] | 89 | visual_dataIO::getInstance()->init(viewer, configFilename); |
---|
[31] | 90 | |
---|
[144] | 91 | // Add manipulators for user interaction - after dataIO to be able to skip it in slaves rendering machines. |
---|
[231] | 92 | manipulators = new core_manipulator(); |
---|
| 93 | manipulators->init( viewer, arguments, configFilename, rootNode); |
---|
[73] | 94 | |
---|
[31] | 95 | // create the windows and run the threads. |
---|
| 96 | viewer->realize(); |
---|
| 97 | |
---|
[189] | 98 | loadTerrain(arguments); |
---|
| 99 | |
---|
[127] | 100 | // All modules are initialized - now check arguments for any unused parameter. |
---|
| 101 | checkCommandlineArgumentsForFinalErrors(); |
---|
| 102 | |
---|
[31] | 103 | // Run visual main loop |
---|
| 104 | mainLoop(); |
---|
| 105 | } |
---|
| 106 | |
---|
| 107 | void visual_core::mainLoop() |
---|
| 108 | { |
---|
[134] | 109 | int framestoScenerySetup = 5; |
---|
[31] | 110 | // run main loop |
---|
| 111 | while( !viewer->done() ) |
---|
| 112 | { |
---|
[134] | 113 | // setup scenery |
---|
| 114 | if(framestoScenerySetup-- == 0) |
---|
| 115 | setupScenery(); |
---|
| 116 | |
---|
[31] | 117 | // next frame please.... |
---|
| 118 | viewer->advance(); |
---|
| 119 | |
---|
| 120 | /*double hat, hot, lat, lon, height; |
---|
| 121 | util::getWGS84ofCamera( viewer->getCamera(), rootNode, lat, lon, height); |
---|
| 122 | if (util::queryHeightOfTerrain( hot, rootNode, lat, lon) && util::queryHeightAboveTerrainInWGS84( hat, rootNode, lat, lon, height ) ) |
---|
| 123 | OSG_NOTIFY( osg::ALWAYS ) << "HOT is: " << hot << ", HAT is: " << hat << std::endl;*/ |
---|
| 124 | |
---|
[70] | 125 | // perform all queued events |
---|
| 126 | viewer->eventTraversal(); |
---|
| 127 | |
---|
[31] | 128 | // update the scene by traversing it with the the update visitor which will |
---|
| 129 | // call all node update callbacks and animations. |
---|
| 130 | viewer->updateTraversal(); |
---|
| 131 | |
---|
| 132 | // Render the Frame. |
---|
| 133 | viewer->renderingTraversals(); |
---|
| 134 | |
---|
| 135 | } // END WHILE |
---|
| 136 | } |
---|
| 137 | |
---|
| 138 | void visual_core::shutdown() |
---|
| 139 | { |
---|
| 140 | OSG_NOTIFY( osg::ALWAYS ) << "Shutdown visual_core..." << std::endl; |
---|
| 141 | |
---|
[87] | 142 | // Shutdown Dbug HUD |
---|
| 143 | if(hud.valid()) |
---|
| 144 | hud->shutdown(); |
---|
[31] | 145 | // Unset scene data |
---|
| 146 | viewer->setSceneData( NULL ); |
---|
| 147 | |
---|
| 148 | #ifdef USE_SKY_SILVERLINING |
---|
| 149 | // Shutdown sky |
---|
| 150 | if( sky.valid() ) |
---|
| 151 | sky->shutdown(); |
---|
| 152 | #endif |
---|
| 153 | |
---|
| 154 | #ifdef USE_DISTORTION |
---|
| 155 | // Shutdown distortion |
---|
| 156 | if( distortion.valid() ) |
---|
| 157 | distortion->shutdown(); |
---|
| 158 | #endif |
---|
| 159 | |
---|
[87] | 160 | // Shutdown data |
---|
| 161 | rootNode = NULL; |
---|
| 162 | |
---|
[31] | 163 | // Shutdown dataIO |
---|
| 164 | visual_dataIO::getInstance()->shutdown(); |
---|
| 165 | |
---|
[231] | 166 | // Shutdown manipulators |
---|
| 167 | if(manipulators.valid()) |
---|
| 168 | manipulators->shutdown(); |
---|
[86] | 169 | |
---|
| 170 | // Destroy osgViewer |
---|
| 171 | viewer = NULL; |
---|
[31] | 172 | } |
---|
| 173 | |
---|
| 174 | bool visual_core::loadTerrain(osg::ArgumentParser& arguments_) |
---|
| 175 | { |
---|
[192] | 176 | osg::ref_ptr<osg::Node> model = osgDB::readNodeFiles(util::getTerrainFromXMLConfig(configFilename)); |
---|
[31] | 177 | if( model.valid() ) |
---|
| 178 | { |
---|
[273] | 179 | osgTerrain::Terrain* terrain = util::findTopMostNodeOfType<osgTerrain::Terrain>(model.get()); |
---|
| 180 | if (!terrain) |
---|
| 181 | { |
---|
| 182 | terrain = new osgTerrain::Terrain; |
---|
| 183 | terrain->addChild(model.get()); |
---|
| 184 | |
---|
| 185 | model = terrain; |
---|
| 186 | } |
---|
| 187 | rootNode->addChild( terrain ); |
---|
[31] | 188 | return true; |
---|
| 189 | } |
---|
| 190 | else |
---|
| 191 | { |
---|
[58] | 192 | OSG_NOTIFY( osg::FATAL ) << "Load terrain: No data loaded" << std::endl; |
---|
[31] | 193 | return false; |
---|
| 194 | } |
---|
| 195 | |
---|
| 196 | return false; |
---|
| 197 | } |
---|
| 198 | |
---|
[188] | 199 | void visual_core::parseScenery(xmlNode* a_node) |
---|
[125] | 200 | { |
---|
[128] | 201 | OSG_ALWAYS << "parseScenery()" << std::endl; |
---|
[125] | 202 | |
---|
[188] | 203 | a_node = a_node->children; |
---|
| 204 | |
---|
| 205 | for (xmlNode *cur_node = a_node; cur_node; cur_node = cur_node->next) |
---|
| 206 | { |
---|
| 207 | std::string node_name=reinterpret_cast<const char*>(cur_node->name); |
---|
| 208 | |
---|
[194] | 209 | // terrain is parsend seperately |
---|
| 210 | // animationpath is parsend seperately |
---|
[188] | 211 | |
---|
| 212 | if(cur_node->type == XML_ELEMENT_NODE && node_name == "models") |
---|
| 213 | { |
---|
[202] | 214 | for (xmlNode *modelNode = cur_node->children; modelNode; modelNode = modelNode->next) |
---|
| 215 | { |
---|
[203] | 216 | std::string name=reinterpret_cast<const char*>(modelNode->name); |
---|
[227] | 217 | if(modelNode->type == XML_ELEMENT_NODE && name == "model") |
---|
[203] | 218 | { |
---|
| 219 | visual_object::createNodeFromXMLConfig(rootNode, modelNode); |
---|
| 220 | } |
---|
[227] | 221 | if(modelNode->type == XML_ELEMENT_NODE && name == "trackmodel") |
---|
[225] | 222 | { |
---|
[226] | 223 | // Extract track-ID and track the model |
---|
[227] | 224 | xmlAttr *attr = modelNode->properties; |
---|
[226] | 225 | while ( attr ) |
---|
| 226 | { |
---|
| 227 | std::string attr_name=reinterpret_cast<const char*>(attr->name); |
---|
| 228 | std::string attr_value=reinterpret_cast<const char*>(attr->children->content); |
---|
[231] | 229 | if( attr_name == "id" ) manipulators->trackNode( util::strToInt(attr_value) ); |
---|
[234] | 230 | if( attr_name == "updater_slot" ) manipulators->setTrackingIdUpdaterSlot(attr_value); |
---|
[226] | 231 | attr = attr->next; |
---|
| 232 | } |
---|
| 233 | |
---|
[225] | 234 | } |
---|
[202] | 235 | } |
---|
[188] | 236 | } |
---|
| 237 | |
---|
[211] | 238 | #ifdef USE_SKY_SILVERLINING |
---|
[188] | 239 | if(cur_node->type == XML_ELEMENT_NODE && node_name == "datetime") |
---|
| 240 | { |
---|
[248] | 241 | int day=-1, month=-1, year=-1, hour=-1, minute=-1; |
---|
[189] | 242 | |
---|
| 243 | xmlAttr *attr = cur_node->properties; |
---|
| 244 | while ( attr ) |
---|
| 245 | { |
---|
| 246 | std::string attr_name=reinterpret_cast<const char*>(attr->name); |
---|
| 247 | std::string attr_value=reinterpret_cast<const char*>(attr->children->content); |
---|
[219] | 248 | if( attr_name == "day" ) day = util::strToInt(attr_value); |
---|
| 249 | if( attr_name == "month" ) month = util::strToInt(attr_value); |
---|
| 250 | if( attr_name == "year" ) year = util::strToInt(attr_value); |
---|
| 251 | if( attr_name == "hour" ) hour = util::strToInt(attr_value); |
---|
| 252 | if( attr_name == "minute" ) minute = util::strToInt(attr_value); |
---|
| 253 | |
---|
[189] | 254 | attr = attr->next; |
---|
| 255 | } |
---|
| 256 | if(sky.valid()) |
---|
| 257 | { |
---|
| 258 | if(day!=0 && month!=0 && year!=0) |
---|
| 259 | sky->setDate(year, month, day); |
---|
| 260 | sky->setTime(hour,minute,00); |
---|
| 261 | } |
---|
[188] | 262 | } |
---|
| 263 | |
---|
| 264 | if(cur_node->type == XML_ELEMENT_NODE && node_name == "visibility") |
---|
| 265 | { |
---|
[195] | 266 | float range = 50000, turbidity=2.2; |
---|
| 267 | xmlAttr *attr = cur_node->properties; |
---|
| 268 | while ( attr ) |
---|
| 269 | { |
---|
| 270 | std::string attr_name=reinterpret_cast<const char*>(attr->name); |
---|
| 271 | std::string attr_value=reinterpret_cast<const char*>(attr->children->content); |
---|
[219] | 272 | if( attr_name == "range" ) range = util::strToDouble(attr_value); |
---|
| 273 | if( attr_name == "turbidity" ) turbidity = util::strToDouble(attr_value); |
---|
| 274 | |
---|
[195] | 275 | attr = attr->next; |
---|
| 276 | } |
---|
[211] | 277 | |
---|
[195] | 278 | if(sky.valid()) |
---|
| 279 | { |
---|
| 280 | sky->setVisibility( range ); |
---|
| 281 | sky->setTurbidity( turbidity ); |
---|
| 282 | } |
---|
[188] | 283 | } |
---|
| 284 | |
---|
[200] | 285 | if(cur_node->type == XML_ELEMENT_NODE && node_name == "clouds") |
---|
[188] | 286 | { |
---|
[198] | 287 | if(sky.valid()) |
---|
| 288 | sky->configureCloudlayerbyXML( cur_node ); |
---|
[188] | 289 | } |
---|
| 290 | |
---|
| 291 | if(cur_node->type == XML_ELEMENT_NODE && node_name == "windlayer") |
---|
| 292 | { |
---|
[195] | 293 | float bottom = 0.0, top=5000.0, speed=25.0, direction=0.0; |
---|
| 294 | xmlAttr *attr = cur_node->properties; |
---|
| 295 | while ( attr ) |
---|
| 296 | { |
---|
| 297 | std::string attr_name=reinterpret_cast<const char*>(attr->name); |
---|
| 298 | std::string attr_value=reinterpret_cast<const char*>(attr->children->content); |
---|
[219] | 299 | if( attr_name == "bottom" ) bottom = util::strToDouble(attr_value); |
---|
| 300 | if( attr_name == "top" ) top = util::strToDouble(attr_value); |
---|
| 301 | if( attr_name == "speed" ) speed = util::strToDouble(attr_value); |
---|
| 302 | if( attr_name == "direction" ) direction = util::strToDouble(attr_value); |
---|
| 303 | |
---|
[195] | 304 | attr = attr->next; |
---|
| 305 | } |
---|
| 306 | if(sky.valid()) |
---|
| 307 | { |
---|
| 308 | sky->addWindVolume( bottom, top, speed, direction ); |
---|
| 309 | } |
---|
[188] | 310 | } |
---|
[212] | 311 | |
---|
| 312 | // Track Node |
---|
| 313 | |
---|
[211] | 314 | #endif |
---|
[188] | 315 | }// FOR all nodes END |
---|
| 316 | |
---|
[129] | 317 | } |
---|
| 318 | |
---|
[67] | 319 | bool visual_core::checkCommandlineArgumentsForFinalErrors() |
---|
[31] | 320 | { |
---|
| 321 | // Setup Application Usage |
---|
| 322 | arguments.getApplicationUsage()->setApplicationName(arguments.getApplicationName()); |
---|
| 323 | arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is the new FSD visualization tool, written by Torben Dannhauer"); |
---|
[212] | 324 | arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [OSG options] -c XML-Configurationfile"); |
---|
[31] | 325 | arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information"); |
---|
[212] | 326 | arguments.getApplicationUsage()->addCommandLineOption("-c or --config","XML configuration filename"); |
---|
[31] | 327 | |
---|
[212] | 328 | |
---|
[31] | 329 | // if user request help write it out to cout. |
---|
| 330 | if (arguments.read("-h") || arguments.read("--help")) |
---|
| 331 | { |
---|
| 332 | arguments.getApplicationUsage()->write(std::cout); |
---|
| 333 | //cause the viewer to exit and shut down clean. |
---|
| 334 | viewer->setDone(true); |
---|
| 335 | } |
---|
| 336 | |
---|
| 337 | // report any errors if they have occurred when parsing the program arguments. |
---|
| 338 | if (arguments.errors()) |
---|
| 339 | { |
---|
| 340 | arguments.writeErrorMessages(std::cout); |
---|
| 341 | //cause the viewer to exit and shut down clean. |
---|
| 342 | viewer->setDone(true); |
---|
| 343 | } |
---|
| 344 | |
---|
| 345 | // any option left unread are converted into errors to write out later. |
---|
| 346 | arguments.reportRemainingOptionsAsUnrecognized(); |
---|
| 347 | |
---|
| 348 | // report any errors if they have occurred when parsing the program arguments. |
---|
| 349 | if (arguments.errors()) |
---|
| 350 | { |
---|
| 351 | arguments.writeErrorMessages(std::cout); |
---|
| 352 | return false; |
---|
| 353 | } |
---|
| 354 | return true; |
---|
| 355 | } |
---|
| 356 | |
---|
| 357 | void visual_core::setupScenery() |
---|
| 358 | { |
---|
[194] | 359 | // Parse Scenery from Configuration file |
---|
| 360 | xmlDoc* tmpDoc; |
---|
| 361 | xmlNode* sceneryNode = util::getSceneryXMLConfig(configFilename, tmpDoc); |
---|
| 362 | parseScenery(sceneryNode); |
---|
| 363 | if(sceneryNode) |
---|
| 364 | { |
---|
| 365 | xmlFreeDoc(tmpDoc); xmlCleanupParser(); |
---|
| 366 | } |
---|
[122] | 367 | |
---|
[273] | 368 | osgTerrain::Terrain* terrain = util::findTopMostNodeOfType<osgTerrain::Terrain>(rootNode); |
---|
| 369 | if (!terrain) |
---|
| 370 | { |
---|
| 371 | OSG_ALWAYS << "No TerrainNode found!" << std::endl; |
---|
| 372 | } |
---|
| 373 | else |
---|
| 374 | { |
---|
[305] | 375 | //OSG_ALWAYS << "BorderEqual activated" << std::endl; |
---|
| 376 | //terrain->setEqualizeBoundaries(true); |
---|
[273] | 377 | } |
---|
[194] | 378 | |
---|
[31] | 379 | //testObj = new visual_object( rootNode, "testStab", objectMountedCameraManip ); |
---|
| 380 | //testObj->setNewPosition( osg::DegreesToRadians(47.7123), osg::DegreesToRadians(12.84088), 600 ); |
---|
| 381 | ///* using a huge cylinder to test position & orientation */ |
---|
| 382 | //testObj->setGeometry( util::getDemoCylinder(5000.0, 20.0 ) ); |
---|
| 383 | //testObj->addUpdater( new object_updater(testObj) ); |
---|
[235] | 384 | //testObj->setTrackingId(2); |
---|
[31] | 385 | |
---|
[115] | 386 | //osg::ref_ptr<visual_object> testObj2 = new visual_object( rootNode, "neuschwanstein" ); // todo memleak |
---|
| 387 | ////testObj2->setNewPosition( osg::DegreesToRadians(47.8123), osg::DegreesToRadians(12.94088), 600 ); |
---|
| 388 | //testObj2->setNewPosition( osg::DegreesToRadians(47.557523564234), osg::DegreesToRadians(10.749646398595), 950 ); |
---|
| 389 | //testObj2->loadGeometry( "../models/neuschwanstein.osgb" ); |
---|
[216] | 390 | ////testObj2->addUpdater( new object_updater(testObj2) ); |
---|
[235] | 391 | //testObj2->setTrackingId(3); |
---|
[31] | 392 | |
---|
[212] | 393 | //osg::ref_ptr<visual_object> testObj3 = new visual_object( rootNode, "SAENGER1" ); // todo memleak |
---|
| 394 | //testObj3->setNewPosition( osg::DegreesToRadians(47.8123), osg::DegreesToRadians(12.94088), 600 ); |
---|
| 395 | //testObj3->loadGeometry( "../models/saenger1.flt" ); |
---|
[216] | 396 | //testObj3->addUpdater( new object_updater(testObj3) ); |
---|
[235] | 397 | //testObj3->setTrackingId(4); |
---|
[31] | 398 | |
---|
[224] | 399 | osg::ref_ptr<visual_object> testObj4 = new visual_object( rootNode, "SAENGER2" ); // todo memleak |
---|
[31] | 400 | testObj4->setNewPosition( osg::DegreesToRadians(47.8123), osg::DegreesToRadians(12.94088), 650 ); |
---|
| 401 | testObj4->loadGeometry( "../models/saenger2.flt" ); |
---|
[216] | 402 | testObj4->addUpdater( new object_updater(testObj4) ); |
---|
[215] | 403 | testObj4->addLabel("testLabel", "Object4 :)",osg::Vec4(1.0f,0.25f,1.0f,1.0f)); |
---|
[240] | 404 | testObj4->setTrackingId(2); |
---|
[31] | 405 | |
---|
[212] | 406 | //osg::ref_ptr<visual_object> testObj5 = new visual_object( rootNode, "SAENGER" ); // todo memleak |
---|
| 407 | //testObj5->setNewPosition( osg::DegreesToRadians(47.8123), osg::DegreesToRadians(12.94088), 550 ); |
---|
| 408 | //testObj5->loadGeometry( "../models/saengerCombine.flt" ); |
---|
| 409 | ////testObj5->setScale( 2 ); |
---|
[216] | 410 | //testObj5->addUpdater( new object_updater(testObj5) ); |
---|
[235] | 411 | //testObj5->setTrackingId(6); |
---|
[31] | 412 | |
---|
[235] | 413 | manipulators->trackNode( testObj4 ); |
---|
[31] | 414 | |
---|
| 415 | // Load EDDF |
---|
| 416 | //std::string filename = "D:\\DA\\EDDF_test\\eddf.ive"; |
---|
| 417 | //if( !osgDB::fileExists(filename) ) |
---|
| 418 | //{ |
---|
| 419 | // OSG_NOTIFY(osg::ALWAYS) << "Warning: EDDF Model not loaded. File '" << filename << "' does not exist. Skipping."; |
---|
| 420 | //} |
---|
| 421 | //// read model |
---|
| 422 | //osg::ref_ptr<osg::Node> tmpModel = osgDB::readNodeFile( filename ); |
---|
| 423 | //if (tmpModel.valid()) |
---|
| 424 | // rootNode->addChild( tmpModel ); |
---|
| 425 | |
---|
| 426 | |
---|
| 427 | visual_draw2D::getInstance()->init( rootNode, viewer ); |
---|
| 428 | //osg::ref_ptr<visual_hud> hud = new visual_hud(); |
---|
[87] | 429 | hud = new visual_debug_hud(); |
---|
[31] | 430 | hud->init( viewer, rootNode ); |
---|
| 431 | |
---|
[122] | 432 | |
---|
[31] | 433 | |
---|
| 434 | //osg::ref_ptr<visual_draw3D> test = new visual_draw3D(); |
---|
| 435 | //test->init( rootNode, viewer ); |
---|
| 436 | |
---|
[69] | 437 | //// Creating Testclasses |
---|
| 438 | //osg::ref_ptr<osgVisual::dataIO_transportContainer> test = new osgVisual::dataIO_transportContainer(); |
---|
| 439 | //osg::ref_ptr<osgVisual::dataIO_executer> testEx = new osgVisual::dataIO_executer(); |
---|
| 440 | //osg::ref_ptr<osgVisual::dataIO_slot> testSlot = new osgVisual::dataIO_slot(); |
---|
| 441 | //test->setFrameID( 22 ); |
---|
| 442 | //test->setName("ugamoep"); |
---|
| 443 | //testEx->setexecuterID( osgVisual::dataIO_executer::IS_COLLISION ); |
---|
| 444 | //testSlot->setVariableName(std::string("HalloName")); |
---|
| 445 | //testSlot->setdataDirection( osgVisual::dataIO_slot::TO_OBJ ); |
---|
| 446 | //testSlot->setvarType( osgVisual::dataIO_slot::DOUBLE ); |
---|
| 447 | //testSlot->setValue( 0.12345 ); |
---|
| 448 | //test->addExecuter( testEx ); |
---|
| 449 | //test->addSlot( testSlot ); |
---|
[31] | 450 | |
---|
[69] | 451 | visual_dataIO::getInstance()->setSlotData("TestSlot1", osgVisual::dataIO_slot::TO_OBJ, 0.12345); |
---|
[155] | 452 | |
---|
[31] | 453 | } |
---|