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


C++ InStream::GetNumObjects方法代码示例

本文整理汇总了C++中InStream::GetNumObjects方法的典型用法代码示例。如果您正苦于以下问题:C++ InStream::GetNumObjects方法的具体用法?C++ InStream::GetNumObjects怎么用?C++ InStream::GetNumObjects使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在InStream的用法示例。


在下文中一共展示了InStream::GetNumObjects方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: LoadCachedResource

//----------------------------------------------------------------------------
bool ResourceManager::LoadCachedResource (const std::string &filename)
{
	ScopedCS scopeCS(mResTableMutex);

	InStream inPut;

	if (inPut.Load(filename))
	{
		int numObjects = inPut.GetNumObjects();
		for (int i=0; i<numObjects; i++)
		{
			Object *obj = inPut.GetObjectAt(i);
			if (obj)
			{
				std::string filename = obj->GetResourcePath();
				LoadRecord rec;
				rec.Filename = filename;
				rec.Obj = obj;
				mResTable.insert(std::pair<std::string, LoadRecord>(filename, rec));
			}
		}

		return true;
	}

	return false;
}
开发者ID:manyxu,项目名称:Phoenix3D_2.0,代码行数:28,代码来源:PX2ResourceManager.cpp

示例2: Copy

//----------------------------------------------------------------------------
Object* Object::Copy(const std::string& uniqueNameAppend)
{
	// Save the object to a memory buffer.
	OutStream saveStream;

	saveStream.Insert((Object*)this);
	int bufferSize = 0;
	char* buffer = 0;
	saveStream.Save(bufferSize, buffer, BufferIO::BM_DEFAULT_WRITE);

	// Load the object from the memory buffer.
	InStream loadStream;
	loadStream.Load(bufferSize, buffer, BufferIO::BM_DEFAULT_READ);
	delete1(buffer);

	if (uniqueNameAppend != "")
	{
		int numObjects = loadStream.GetNumObjects();
		for (int i = 0; i < numObjects; i++)
		{
			PX2::Object *obj = loadStream.GetObjectAt(i);
			std::string name = obj->GetName();
			if (name.length() > 0)
			{
				name += uniqueNameAppend;
				obj->SetName(name);
			}
		}
	}

	return loadStream.GetObjectAt(0);
}
开发者ID:JamShan,项目名称:Phoenix3D_2.1,代码行数:33,代码来源:PX2Object_Stream.cpp

示例3: Copy

//----------------------------------------------------------------------------
Object* Object::Copy (const std::string& uniqueNameAppend) const
{
	// Save the object to a memory buffer.
	OutStream saveStream;
	saveStream.Insert((Object*)this);
	int bufferSize = 0;
	char* buffer = 0;
	saveStream.Save(bufferSize, buffer, BufferIO::BM_DEFAULT_WRITE);

	// Load the object from the memory buffer.
	InStream loadStream;
	loadStream.Load(bufferSize, buffer, BufferIO::BM_DEFAULT_READ);
	delete1(buffer);

	if (uniqueNameAppend != "")
	{
		// The names of the input scene were copied as is.  Generate unique
		// names for the output scene.
		int numObjects = loadStream.GetNumObjects();
		for (int i=0; i<numObjects; i++)
		{
			PX2::Object *obj = loadStream.GetObjectAt(i);
			std::string name = obj->GetName();
			if (name.length() > 0)
			{
				// The object has a name.  Append a string to make the name
				// unique.  TODO:  This code does not ensure that the
				// appended name is some other name in the copied scene.  To
				// do this would require building a set of names and verifying
				// that the appended names are not in this set.  For now we
				// think this is not worth the effort, but maybe later we can
				// add code to do this.
				name += uniqueNameAppend;
				obj->SetName(name);
			}
		}
	}

	return loadStream.GetObjectAt(0);
}
开发者ID:ascetic85,项目名称:Phoenix3d,代码行数:41,代码来源:PX2Object.cpp


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