Line | |
---|
1 | #include "ModificationVisitor.h" |
---|
2 | |
---|
3 | ModificationVisitor::ModificationVisitor(std::string extensionToSet) : _extensionToSet(extensionToSet) |
---|
4 | { |
---|
5 | setTraversalMode( osg::NodeVisitor::TRAVERSE_ALL_CHILDREN ); |
---|
6 | } |
---|
7 | |
---|
8 | void ModificationVisitor::apply( osg::Node& node ) |
---|
9 | { |
---|
10 | //OSG_NOTIFY( osg::ALWAYS ) << "ModVisitor: Node found: " << node.className() << std::endl; |
---|
11 | |
---|
12 | if(std::string(node.className())=="TerrainTile") |
---|
13 | { |
---|
14 | OSG_NOTIFY( osg::ALWAYS ) << "ModVisitor: Tile found" << std::endl; |
---|
15 | modifyTile(node); |
---|
16 | } |
---|
17 | |
---|
18 | traverse( node ); |
---|
19 | } |
---|
20 | |
---|
21 | void ModificationVisitor::apply( osg::PagedLOD& pNode ) |
---|
22 | { |
---|
23 | //OSG_NOTIFY( osg::ALWAYS ) << "ModVisitor: pagedLOD found: " << pNode.className() << std::endl; |
---|
24 | |
---|
25 | for( unsigned int i=0;i<pNode.getNumFileNames();i++) |
---|
26 | { |
---|
27 | //OSG_NOTIFY( osg::ALWAYS ) << "ModVisitor: pagedLOD Child #" << i << std::endl; |
---|
28 | if(pNode.getFileName(i)!="") |
---|
29 | { |
---|
30 | //OSG_NOTIFY( osg::ALWAYS ) << "ModVisitor: pagedLOD Child Name pre: " << pNode.getFileName(i) << std::endl; |
---|
31 | pNode.setFileName(i, pNode.getFileName(i)+_extensionToSet ); |
---|
32 | //OSG_NOTIFY( osg::ALWAYS ) << "ModVisitor: pagedLOD Child Name post: " << newFileName << std::endl; |
---|
33 | } |
---|
34 | } |
---|
35 | |
---|
36 | traverse( pNode ); |
---|
37 | } |
---|
38 | |
---|
39 | void ModificationVisitor::modifyTile(osg::Node& node) |
---|
40 | { |
---|
41 | OSG_NOTIFY( osg::ALWAYS ) << "ModificationVisitor::modifyTerrain()" << std::endl; |
---|
42 | |
---|
43 | |
---|
44 | |
---|
45 | |
---|
46 | |
---|
47 | OpenThreads::Thread::microSleep( 500000 ); |
---|
48 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.