当前位置: 首页>>代码示例>>C++>>正文


C++ DataSourceRef::createStream方法代码示例

本文整理汇总了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);
     }
 }
开发者ID:arielm,项目名称:new-chronotext-toolkit,代码行数:20,代码来源:SplinePath.cpp

示例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 );
	}
}
开发者ID:AaronMeyers,项目名称:Cinder,代码行数:38,代码来源:TriMesh.cpp

示例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." );
}
开发者ID:CinimodStudio,项目名称:Cinder,代码行数:23,代码来源:ImageSourcePng.cpp

示例4:

ImageSourceFileRadiance::ImageSourceFileRadiance( DataSourceRef dataSourceRef, ImageSource::Options options )
{
	IStreamRef stream = dataSourceRef->createStream();
	
	loadStream( stream );
}
开发者ID:AbdelghaniDr,项目名称:Cinder,代码行数:6,代码来源:ImageSourceFileRadiance.cpp


注:本文中的DataSourceRef::createStream方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。