source: experimental/TerrainTest/ModificationVisitor.cpp @ 252

Last change on this file since 252 was 252, checked in by Torben Dannhauer, 13 years ago

Pseudoloader works!

Next step: learn how to perform mdifications in the pseudoloader.

File size: 1.0 KB
Line 
1#include "ModificationVisitor.h"
2
3ModificationVisitor::ModificationVisitor(std::string extensionToSet) : _extensionToSet(extensionToSet)
4{
5        setTraversalMode( osg::NodeVisitor::TRAVERSE_ALL_CHILDREN );
6}
7
8void ModificationVisitor::apply( osg::Node& node )
9{
10        //OSG_NOTIFY( osg::ALWAYS ) << "ModVisitor: Node found: " << node.className() << std::endl;
11        traverse( node );
12}
13
14void ModificationVisitor::apply( osg::PagedLOD& pNode )
15{
16        //OSG_NOTIFY( osg::ALWAYS ) << "ModVisitor: pagedLOD found: " << pNode.className() << std::endl;
17
18        for( unsigned int i=0;i<pNode.getNumFileNames();i++)
19        {
20                //OSG_NOTIFY( osg::ALWAYS ) << "ModVisitor: pagedLOD Child #" << i << std::endl;
21                if(pNode.getFileName(i)!="")
22                {
23                        //OSG_NOTIFY( osg::ALWAYS ) << "ModVisitor: pagedLOD Child Name pre: " << pNode.getFileName(i) << std::endl;
24                        pNode.setFileName(i, pNode.getFileName(i)+_extensionToSet );
25                        //OSG_NOTIFY( osg::ALWAYS ) << "ModVisitor: pagedLOD Child Name post: " << newFileName << std::endl;
26                }
27        }
28
29        traverse( pNode );
30}
Note: See TracBrowser for help on using the repository browser.