- Timestamp:
- Mar 19, 2011, 5:39:16 PM (14 years ago)
- Location:
- osgVisual/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
osgVisual/trunk/bin/osgVisualConfig.xml
r249 r273 15 15 16 16 <scenery> 17 <terrain filename="D:/OpenSceneGraph/VPB-Testdatensatz/DB_Small/database.ive" filename2="J:\BRD1m_MUC0.25m_srtmEU_BM\terrain.ive "></terrain>18 <animationpath filename=" salzburg.path"></animationpath>17 <terrain filename="D:/OpenSceneGraph/VPB-Testdatensatz/DB_Small/database.ive" filename2="J:\BRD1m_MUC0.25m_srtmEU_BM\terrain.ive.terrainmod"></terrain> 18 <animationpath filename="airport_muc.path"></animationpath> 19 19 <models> 20 20 <model objectname="TestObject" trackingid="1" label="TestText!" dynamic="no"> -
osgVisual/trunk/include/util/visual_util.h
r226 r273 296 296 static bool strToBool(std::string s); 297 297 298 template<class T> 299 class FindTopMostNodeOfTypeVisitor : public osg::NodeVisitor 300 { 301 public: 302 FindTopMostNodeOfTypeVisitor(): 303 osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN), 304 _foundNode(0) 305 {} 306 307 void apply(osg::Node& node) 308 { 309 T* result = dynamic_cast<T*>(&node); 310 if (result) 311 { 312 _foundNode = result; 313 } 314 else 315 { 316 traverse(node); 317 } 318 } 319 320 T* _foundNode; 321 }; 322 323 template<class T> 324 static T* findTopMostNodeOfType(osg::Node* node) 325 { 326 if (!node) return 0; 327 328 FindTopMostNodeOfTypeVisitor<T> fnotv; 329 node->accept(fnotv); 330 331 return fnotv._foundNode; 332 } 333 298 334 private: 299 335 /** -
osgVisual/trunk/src/core/visual_core.cpp
r248 r273 17 17 18 18 #include <visual_core.h> 19 #include <visual_util.h> 20 #include <osgTerrain/Terrain> 19 21 20 22 using namespace osgVisual; … … 172 174 if( model.valid() ) 173 175 { 174 rootNode->addChild( model.get() ); 176 osgTerrain::Terrain* terrain = util::findTopMostNodeOfType<osgTerrain::Terrain>(model.get()); 177 if (!terrain) 178 { 179 terrain = new osgTerrain::Terrain; 180 terrain->addChild(model.get()); 181 182 model = terrain; 183 } 184 rootNode->addChild( terrain ); 175 185 return true; 176 186 } … … 353 363 } 354 364 365 osgTerrain::Terrain* terrain = util::findTopMostNodeOfType<osgTerrain::Terrain>(rootNode); 366 if (!terrain) 367 { 368 OSG_ALWAYS << "No TerrainNode found!" << std::endl; 369 } 370 else 371 { 372 OSG_ALWAYS << "BorderEqual activated" << std::endl; 373 terrain->setEqualizeBoundaries(true); 374 } 355 375 356 376 //testObj = new visual_object( rootNode, "testStab", objectMountedCameraManip );
Note: See TracChangeset
for help on using the changeset viewer.