本文整理汇总了C++中osgdb::InputStream类的典型用法代码示例。如果您正苦于以下问题:C++ InputStream类的具体用法?C++ InputStream怎么用?C++ InputStream使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了InputStream类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readText
static bool readText(osgDB::InputStream &is, osgText::TextBase &text)
{
bool isACString; is >> isACString;
if (isACString)
{
std::string acString; is.readWrappedString(acString);
text.setText(acString);
}
else
{
osg::UIntArray *array = dynamic_cast<osg::UIntArray*>(is.readArray());
if (array)
{
osgText::String string;
for (osg::UIntArray::iterator itr = array->begin(); itr != array->end(); ++itr)
{
string.push_back(*itr);
}
text.setText(string);
}
}
return true;
}
示例2: readInfluenceMap
static bool readInfluenceMap( osgDB::InputStream& is, osgAnimation::RigGeometry& geom )
{
osg::ref_ptr<osgAnimation::VertexInfluenceMap> map = new osgAnimation::VertexInfluenceMap;
unsigned int size = is.readSize(); is >> is.BEGIN_BRACKET;
for ( unsigned int i=0; i<size; ++i )
{
std::string name;
unsigned int viSize = 0;
is >> is.PROPERTY("VertexInfluence");
is.readWrappedString(name);
viSize = is.readSize(); is >> is.BEGIN_BRACKET;
osgAnimation::VertexInfluence vi;
vi.setName( name );
vi.reserve( viSize );
for ( unsigned int j=0; j<viSize; ++j )
{
int index = 0;
float weight = 0.0f;
is >> index >> weight;
vi.push_back( osgAnimation::VertexIndexWeight(index, weight) );
}
(*map)[name] = vi;
is >> is.END_BRACKET;
}
is >> is.END_BRACKET;
if ( !map->empty() ) geom.setInfluenceMap( map.get() );
return true;
}
示例3: readMask
static bool readMask( osgDB::InputStream& is, osg::PolygonStipple& attr )
{
char mask[128] = {0};
if ( is.isBinary() )
{
unsigned int size; is >> size;
is.readCharArray( mask, size );
}
示例4: readImages
static bool readImages( osgDB::InputStream& is, osg::ImageSequence& image )
{
unsigned int images = is.readSize(); is >> is.BEGIN_BRACKET;
for ( unsigned int i=0; i<images; ++i )
{
osg::Image* img = dynamic_cast<osg::Image*>( is.readObject() );
if ( img ) image.addImage( img );
}
is >> is.END_BRACKET;
return true;
}
示例5: readImages
static bool readImages( osgDB::InputStream& is, osg::ImageSequence& image )
{
unsigned int images = is.readSize(); is >> is.BEGIN_BRACKET;
for ( unsigned int i=0; i<images; ++i )
{
osg::ref_ptr<osg::Image> img = is.readImage();
if ( img ) image.addImage( img );
}
is >> is.END_BRACKET;
return true;
}
示例6: readAnimations
static bool readAnimations( osgDB::InputStream& is, osgAnimation::AnimationManagerBase& manager )
{
unsigned int size = is.readSize(); is >> osgDB::BEGIN_BRACKET;
for ( unsigned int i=0; i<size; ++i )
{
osgAnimation::Animation* ani = dynamic_cast<osgAnimation::Animation*>( is.readObject() );
if ( ani ) manager.registerAnimation( ani );
}
is >> osgDB::END_BRACKET;
return true;
}
示例7: readShaders
static bool readShaders( osgDB::InputStream& is, osg::Program& attr )
{
unsigned int size = is.readSize(); is >> is.BEGIN_BRACKET;
for ( unsigned int i=0; i<size; ++i )
{
osg::Shader* shader = dynamic_cast<osg::Shader*>( is.readObject() );
if ( shader ) attr.addShader( shader );
}
is >> is.END_BRACKET;
return true;
}
示例8: readFileNames
static bool readFileNames( osgDB::InputStream& is, osg::ImageSequence& image )
{
unsigned int files = 0; is >> files >> is.BEGIN_BRACKET;
if (is.getOptions()) image.setReadOptions(new osgDB::Options(*is.getOptions()));
for ( unsigned int i=0; i<files; ++i )
{
std::string filename; is.readWrappedString( filename );
image.addImageFile( filename );
}
is >> is.END_BRACKET;
return true;
}
示例9: readLocatorCallbacks
static bool readLocatorCallbacks( osgDB::InputStream& is, osgVolume::Locator& locator )
{
unsigned int size = is.readSize(); is >> is.BEGIN_BRACKET;
for ( unsigned int i=0; i<size; ++i )
{
osgVolume::Locator::LocatorCallback* cb =
dynamic_cast<osgVolume::Locator::LocatorCallback*>( is.readObject() );
if ( cb ) locator.addCallback( cb );
}
is >> is.END_BRACKET;
return true;
}
示例10: readStackedTransforms
static bool readStackedTransforms( osgDB::InputStream& is, osgAnimation::UpdateMatrixTransform& obj )
{
osgAnimation::StackedTransform& transform = obj.getStackedTransforms();
unsigned int size = is.readSize(); is >> is.BEGIN_BRACKET;
for ( unsigned int i=0; i<size; ++i )
{
osgAnimation::StackedTransformElement* element =
dynamic_cast<osgAnimation::StackedTransformElement*>( is.readObject() );
if ( element ) transform.push_back( element );
}
is >> is.END_BRACKET;
return true;
}
示例11: readShaderSource
static bool readShaderSource( osgDB::InputStream& is, osg::Shader& shader )
{
std::string code;
unsigned int size = is.readSize(); is >> is.BEGIN_BRACKET;
for ( unsigned int i=0; i<size; ++i )
{
std::string line;
is.readWrappedString( line );
code.append( line ); code.append( 1, '\n' );
}
is >> is.END_BRACKET;
shader.setShaderSource( code );
return true;
}
示例12: readFont
static bool readFont(osgDB::InputStream &is, osgText::TextBase &text)
{
std::string fontName; is.readWrappedString(fontName);
text.setFont(osgText::readFontFile(fontName));
return true;
}
示例13: readModules
//------------------------------------------------------------------------------
static bool readModules( osgDB::InputStream& is, osgCuda::Computation& computation )
{
unsigned int numMods = 0;
is >> numMods >> osgDB::BEGIN_BRACKET;
for( unsigned int i=0; i<numMods; ++i )
{
std::string moduleLibraryName;
is.readWrappedString( moduleLibraryName );
moduleLibraryName = osgCuda::trim( moduleLibraryName );
if( !osgCompute::Module::existsModule(moduleLibraryName) )
{
osg::notify(osg::WARN)
<<" osgCuda_Computation::readModules(): cannot find module library "
<< moduleLibraryName << "." << std::endl;
continue;
}
osgCompute::Module* module = osgCompute::Module::loadModule( moduleLibraryName );
if( module != NULL )
{
computation.addModule( *module );
}
}
is >> osgDB::END_BRACKET;
return true;
}
示例14: readResources
//------------------------------------------------------------------------------
static bool readResources( osgDB::InputStream& is, osgCuda::Computation& computation )
{
unsigned int numRes = 0;
is >> numRes >> osgDB::BEGIN_BRACKET;
for( unsigned int i=0; i<numRes; ++i )
{
osg::Object* newRes = is.readObject();
if( newRes != NULL )
{
osgCompute::GLMemoryAdapter* ioo = dynamic_cast<osgCompute::GLMemoryAdapter*>( newRes );
if( ioo != NULL )
{
computation.addResource( *ioo->getMemory() );
}
else
{
osgCompute::Resource* curRes = dynamic_cast<osgCompute::Resource*>( newRes );
if( curRes != NULL ) computation.addResource( *curRes );
}
}
}
is >> osgDB::END_BRACKET;
return true;
}
示例15: readTransformUpdating
static bool readTransformUpdating( osgDB::InputStream& is, osgManipulator::Dragger& dragger )
{
unsigned int size = is.readSize(); is >> osgDB::BEGIN_BRACKET;
for ( unsigned int i=0; i<size; ++i )
{
std::string name; is >> name >> osgDB::BEGIN_BRACKET;
if ( name=="DraggerTransformCallback" )
{
osg::MatrixTransform* transform = dynamic_cast<osg::MatrixTransform*>( is.readObject() );
if ( transform ) dragger.addTransformUpdating( transform );
}
is >> osgDB::END_BRACKET;
}
is >> osgDB::END_BRACKET;
return true;
}