void replaceEffectDatas( SceneSharedPtr const& scene, ReplacementMapEffectData const& replacements ) { ReplaceTraverser::replace( scene->getRootNode(), replacements ); }
void replaceEffectDatas( SceneSharedPtr const& scene, ReplacementMapNames const& replacements ) { replaceEffectDatas( scene->getRootNode(), replacements ); }
void XMLLoader::buildScene( GroupSharedPtr const& parent, TiXmlDocument & doc, TiXmlNode * node ) { if( !node ) { return; } TiXmlElement * element = node->ToElement(); const string value = node->Value(); // skip everything that is not an element if( element ) { if( value == "file" ) { //cout << "XMLLoader: Adding File: " << element->GetText() << endl; SceneSharedPtr scene = lookupFile( element->GetText() ); if( scene ) { // see if they positioned it const char * pos = element->Attribute( "position" ); const char * ori = element->Attribute( "orientation" ); const char * note = element->Attribute( "annotation" ); NodeSharedPtr root = scene->getRootNode(); NodeSharedPtr theNode; if( pos || ori ) { TransformSharedPtr transH( Transform::create() ); transH->addChild(std::static_pointer_cast<dp::sg::core::Node>(root->clone())); Trafo trafo; if( pos ) { stringstream ss( pos ); float x, y, z; ss >> x; ss >> y; ss >> z; trafo.setTranslation( Vec3f( x, y, z ) ); } if( ori ) { stringstream ss( ori ); float x, y, z, w; int args = 0; // read first value ss >> x; args++; if( ss.good() ) { args+=2; ss >> y; ss >> z; if( ss.good() ) { args++; ss >> w; } } if( args == 4 ) { trafo.setOrientation( Quatf( x, y, z, w ) ); } } transH->setTrafo( trafo ); // reset 'theNode' here theNode = transH; }