本文整理汇总了C++中DataSourceRef::createStream方法的典型用法代码示例。如果您正苦于以下问题:C++ DataSourceRef::createStream方法的具体用法?C++ DataSourceRef::createStream怎么用?C++ DataSourceRef::createStream使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataSourceRef
的用法示例。
在下文中一共展示了DataSourceRef::createStream方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: read
void SplinePath::read(DataSourceRef source)
{
auto stream = source->createStream();
int newPointsSize;
stream->readLittle(&newPointsSize);
points.reserve(size() + newPointsSize);
// ---
Vec2f point;
for (int i = 0; i < newPointsSize; i++)
{
stream->readLittle(&point.x);
stream->readLittle(&point.y);
add(point);
}
}
示例2: read
void TriMesh::read( DataSourceRef dataSource )
{
IStreamRef in = dataSource->createStream();
clear();
uint8_t versionNumber;
in->read( &versionNumber );
uint32_t numVertices, numNormals, numTexCoords, numIndices;
in->readLittle( &numVertices );
in->readLittle( &numNormals );
in->readLittle( &numTexCoords );
in->readLittle( &numIndices );
for( size_t idx = 0; idx < numVertices; ++idx ) {
Vec3f v;
in->readLittle( &v.x ); in->readLittle( &v.y ); in->readLittle( &v.z );
mVertices.push_back( v );
}
for( size_t idx = 0; idx < numNormals; ++idx ) {
Vec3f v;
in->readLittle( &v.x ); in->readLittle( &v.y ); in->readLittle( &v.z );
mNormals.push_back( v );
}
for( size_t idx = 0; idx < numTexCoords; ++idx ) {
Vec2f v;
in->readLittle( &v.x ); in->readLittle( &v.y );
mTexCoords.push_back( v );
}
for( size_t idx = 0; idx < numIndices; ++idx ) {
uint32_t v;
in->readLittle( &v );
mIndices.push_back( v );
}
}
示例3: ImageSourcePngException
ImageSourcePng::ImageSourcePng( DataSourceRef dataSourceRef, ImageSource::Options /*options*/ )
: ImageSource(), mInfoPtr( 0 ), mPngPtr( 0 )
{
mPngPtr = png_create_read_struct( PNG_LIBPNG_VER_STRING, (png_voidp)NULL, NULL, NULL );
if( ! mPngPtr ) {
throw ImageSourcePngException( "Could not create png struct." );
}
mCiInfoPtr = shared_ptr<ci_png_info>( new ci_png_info );
mCiInfoPtr->srcStreamRef = dataSourceRef->createStream();
png_set_read_fn( mPngPtr, reinterpret_cast<void*>( mCiInfoPtr.get() ), ci_PNG_stream_reader );
mInfoPtr = png_create_info_struct( mPngPtr );
if( ! mInfoPtr ) {
png_destroy_read_struct( &mPngPtr, (png_infopp)NULL, (png_infopp)NULL );
mPngPtr = 0;
throw ImageSourcePngException( "Could not destroy png read struct." );
}
if( ! loadHeader() )
throw ImageSourcePngException( "Could not load png header." );
}
示例4:
ImageSourceFileRadiance::ImageSourceFileRadiance( DataSourceRef dataSourceRef, ImageSource::Options options )
{
IStreamRef stream = dataSourceRef->createStream();
loadStream( stream );
}