static bool writeText(osgDB::OutputStream &os, const osgText::TextBase &text) { bool isACString = true; const osgText::String &string = text.getText(); for (osgText::String::const_iterator itr = string.begin(); itr != string.end(); ++itr) { if (*itr == 0 || *itr > 256) { isACString = false; break; } } os << isACString; if (isACString) { std::string acString; for (osgText::String::const_iterator itr = string.begin(); itr != string.end(); ++itr) { acString += (char)(*itr); } os.writeWrappedString(acString); os << std::endl; } else { osg::ref_ptr<osg::UIntArray> array = new osg::UIntArray(string.begin(), string.end()); os << array.get(); } return true; }
static bool writeInfluenceMap( osgDB::OutputStream& os, const osgAnimation::RigGeometry& geom ) { const osgAnimation::VertexInfluenceMap* map = geom.getInfluenceMap(); os.writeSize(map->size()); os << os.BEGIN_BRACKET << std::endl; for ( osgAnimation::VertexInfluenceMap::const_iterator itr=map->begin(); itr!=map->end(); ++itr ) { std::string name = itr->first; const osgAnimation::VertexInfluence& vi = itr->second; if ( name.empty() ) name = "Empty"; os << os.PROPERTY("VertexInfluence"); os.writeWrappedString(name); os.writeSize(vi.size()) ; os << os.BEGIN_BRACKET << std::endl; for ( osgAnimation::VertexInfluence::const_iterator vitr=vi.begin(); vitr != vi.end(); ++vitr ) { os << vitr->first << vitr->second << std::endl; } os << os.END_BRACKET << std::endl; } os << os.END_BRACKET << std::endl; return true; }
//------------------------------------------------------------------------------ static bool writeModules( osgDB::OutputStream& os, const osgCuda::Computation& computation ) { const osgCompute::ModuleList modList = computation.getModules(); // Count attached resources unsigned int numMods = 0; for( osgCompute::ModuleListCnstItr modItr = modList.begin(); modItr != modList.end(); ++modItr ) if( !(*modItr)->getLibraryName().empty() ) numMods++; // Write attached resources os << numMods << osgDB::BEGIN_BRACKET << std::endl; for( osgCompute::ModuleListCnstItr modItr = modList.begin(); modItr != modList.end(); ++modItr ) { if( !(*modItr)->getLibraryName().empty() ) { os.writeWrappedString( (*modItr)->getLibraryName() ); os << std::endl; } } os << osgDB::END_BRACKET << std::endl; return true; }
static bool writeFileNames( osgDB::OutputStream& os, const osg::ProxyNode& node ) { os << node.getNumFileNames() << os.BEGIN_BRACKET << std::endl; for ( unsigned int i=0; i<node.getNumFileNames(); ++i ) { os.writeWrappedString( node.getFileName(i) ); os << std::endl; } os << os.END_BRACKET << std::endl; return true; }
static bool writeFileNames( osgDB::OutputStream& os, const osg::ImageSequence& image ) { const osg::ImageSequence::ImageDataList& imageDataList = image.getImageDataList(); os.writeSize(imageDataList.size()); os << os.BEGIN_BRACKET << std::endl; for ( osg::ImageSequence::ImageDataList::const_iterator itr=imageDataList.begin(); itr!=imageDataList.end(); ++itr ) { os.writeWrappedString( itr->_filename ); os << std::endl; } os << os.END_BRACKET << std::endl; return true; }
static bool writeShaderSource( osgDB::OutputStream& os, const osg::Shader& shader ) { std::vector<std::string> lines; std::istringstream iss( shader.getShaderSource() ); std::string line; while ( std::getline(iss, line) ) { lines.push_back( line ); } os.writeSize(lines.size()); os << os.BEGIN_BRACKET << std::endl; for ( std::vector<std::string>::const_iterator itr=lines.begin(); itr!=lines.end(); ++itr ) { os.writeWrappedString( *itr ); os << std::endl; } os << os.END_BRACKET << std::endl; return true; }
static bool writeLayers( osgDB::OutputStream& os, const osgTerrain::CompositeLayer& layer ) { unsigned int size = layer.getNumLayers(); os << size << os.BEGIN_BRACKET << std::endl; for ( unsigned int i=0; i<size; ++i ) { const osgTerrain::Layer* child = layer.getLayer(i); std::string type = child ? std::string("Object") : std::string("File"); os << type; if ( child ) { os << child; } else { os.writeWrappedString( layer.getCompoundName(i) ); os << std::endl; } } os << os.END_BRACKET << std::endl; return true; }
static bool writeLightingMap( osgDB::OutputStream& os, const osgFX::AnisotropicLighting& effect ) { os.writeWrappedString( effect.getLightingMap()->getFileName() ); os << std::endl; return true; }
static bool writeFont(osgDB::OutputStream &os, const osgText::TextBase &text) { os.writeWrappedString(text.getFont()->getFileName()); os << std::endl; return true; }