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


C++ StreamSerialiser::readChunkBegin方法代码示例

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


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

示例1: load

	//---------------------------------------------------------------------
	bool PagedWorld::load(StreamSerialiser& ser)
	{
		if (!ser.readChunkBegin(CHUNK_ID, CHUNK_VERSION, "PagedWorld"))
			return false;

		// Name
		ser.read(&mName);
		// Sections
		while(ser.peekNextChunkID() == CHUNK_SECTIONDECLARATION_ID)
		{
			ser.readChunkBegin();
			String sectionType, sectionName;
			ser.read(&sectionType);
			ser.read(&sectionName);
			ser.readChunkEnd(CHUNK_SECTIONDECLARATION_ID);
			// Scene manager will be loaded
			PagedWorldSection* sec = createSection(0, sectionType, sectionName);
			bool sectionsOk = sec->load(ser);
			if (!sectionsOk)
				destroySection(sec);
		}

		ser.readChunkEnd(CHUNK_ID);

		return true;

	}
开发者ID:albmarvil,项目名称:The-Eternal-Sorrow,代码行数:28,代码来源:OgrePagedWorld.cpp

示例2: prepareImpl

	//---------------------------------------------------------------------
	bool Page::prepareImpl(StreamSerialiser& stream, PageData* dataToPopulate)
	{

		// Now do the real loading
		if (!stream.readChunkBegin(CHUNK_ID, CHUNK_VERSION, "Page"))
			return false;

		// pageID check (we should know the ID we're expecting)
		uint32 storedID;
		stream.read(&storedID);
		if (mID != storedID)
		{
			LogManager::getSingleton().stream() << "Error: Tried to populate Page ID " << mID
				<< " with data corresponding to page ID " << storedID;
			stream.undoReadChunk(CHUNK_ID);
			return false;
		}

		PageManager* mgr = getManager();
		
		while(stream.peekNextChunkID() == CHUNK_CONTENTCOLLECTION_DECLARATION_ID)
		{
			const StreamSerialiser::Chunk* collChunk = stream.readChunkBegin();
			String factoryName;
			stream.read(&factoryName);
			stream.readChunkEnd(CHUNK_CONTENTCOLLECTION_DECLARATION_ID);
			// Supported type?
			PageContentCollectionFactory* collFact = mgr->getContentCollectionFactory(factoryName);
			if (collFact)
			{
				PageContentCollection* collInst = collFact->createInstance();
				if (collInst->prepare(stream)) // read type-specific data
				{
					dataToPopulate->collectionsToAdd.push_back(collInst);
				}
				else
				{
					LogManager::getSingleton().stream() << "Error preparing PageContentCollection type: " 
						<< factoryName << " in " << *this;
					collFact->destroyInstance(collInst);
				}
			}
			else
			{
				LogManager::getSingleton().stream() << "Unsupported PageContentCollection type: " 
					<< factoryName << " in " << *this;
				// skip
				stream.readChunkEnd(collChunk->id);
			}

		}


		mModified = false;

		return true;
	}
开发者ID:JangoOs,项目名称:kbengine_ogre_demo,代码行数:58,代码来源:OgrePage.cpp

示例3: prepare

	//---------------------------------------------------------------------
	bool SimplePageContentCollection::prepare(StreamSerialiser& stream)
	{
		if (!stream.readChunkBegin(SUBCLASS_CHUNK_ID, SUBCLASS_CHUNK_VERSION, "SimplePageContentCollection"))
			return false;

		bool ret = true;
		for (ContentList::iterator i = mContentList.begin(); i != mContentList.end(); ++i)
			ret = (*i)->prepare(stream) && ret;


		stream.readChunkEnd(SUBCLASS_CHUNK_ID);

		return ret;

	}
开发者ID:airgames,项目名称:vuforia-gamekit-integration,代码行数:16,代码来源:OgreSimplePageContentCollection.cpp

示例4:

    //---------------------------------------------------------------------
    bool Grid3DPageStrategyData::load(StreamSerialiser& ser)
    {
        if (!ser.readChunkBegin(CHUNK_ID, CHUNK_VERSION, "Grid3DPageStrategyData"))
            return false;

        ser.read(&mOrigin);
        ser.read(&mCellSize);
        ser.read(&mLoadRadius);
        ser.read(&mHoldRadius);
        ser.read(&mMinCellX);
        ser.read(&mMaxCellX);
        ser.read(&mMinCellY);
        ser.read(&mMaxCellY);
        ser.read(&mMinCellZ);
        ser.read(&mMaxCellZ);

        ser.readChunkEnd(CHUNK_ID);

        return true;
    }
开发者ID:Gerviba,项目名称:MuOnline,代码行数:21,代码来源:OgreGrid3DPageStrategy.cpp

示例5: load

//---------------------------------------------------------------------
bool PagedWorldSection::load(StreamSerialiser& ser)
{
    if (!ser.readChunkBegin(CHUNK_ID, CHUNK_VERSION, "PagedWorldSection"))
        return false;

    // Name
    ser.read(&mName);
    // AABB
    ser.read(&mAABB);
    // SceneManager type
    String smType, smInstanceName;
    SceneManager* sm = 0;
    ser.read(&smType);
    ser.read(&smInstanceName);
    Root& root = Root::getSingleton();
    if (root.hasSceneManager(smInstanceName))
        sm = root.getSceneManager(smInstanceName);
    else
        sm = root.createSceneManager(smType, smInstanceName);
    setSceneManager(sm);
    // Page Strategy Name
    String stratname;
    ser.read(&stratname);
    setStrategy(stratname);
    // Page Strategy Data
    bool strategyDataOk = mStrategyData->load(ser);
    if (!strategyDataOk)
        LogManager::getSingleton().stream() << "Error: PageStrategyData for section '"
                                            << mName << "' was not loaded correctly, check file contents";

    /// Load any data specific to a subtype of this class
    loadSubtypeData(ser);

    ser.readChunkEnd(CHUNK_ID);

    return true;

}
开发者ID:logtcn,项目名称:ogre,代码行数:39,代码来源:OgrePagedWorldSection.cpp


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