Beispiel #1
0
//---------------------------------------------------------------------
void PagedWorldSection::save(StreamSerialiser& ser)
{
    ser.writeChunkBegin(CHUNK_ID, CHUNK_VERSION);

    // Name
    ser.write(&mName);
    // AABB
    ser.write(&mAABB);
    // SceneManager type & name
    ser.write(&mSceneMgr->getTypeName());
    ser.write(&mSceneMgr->getName());
    // Page Strategy Name
    ser.write(&mStrategy->getName());
    // Page Strategy Data
    mStrategyData->save(ser);

    /// Save any data specific to a subtype of this class
    saveSubtypeData(ser);

    ser.writeChunkEnd(CHUNK_ID);

    // save all pages (in separate files)
    for (PageMap::iterator i = mPages.begin(); i != mPages.end(); ++i)
    {
        i->second->save();
    }


}
	//---------------------------------------------------------------------
	void SimplePageContentCollection::save(StreamSerialiser& stream)
	{
		stream.writeChunkBegin(SUBCLASS_CHUNK_ID, SUBCLASS_CHUNK_VERSION);

		for (ContentList::iterator i = mContentList.begin(); i != mContentList.end(); ++i)
			(*i)->save(stream);

		stream.writeChunkEnd(SUBCLASS_CHUNK_ID);
	}
	//---------------------------------------------------------------------
	void PagedWorld::save(StreamSerialiser& ser)
	{
		ser.writeChunkBegin(CHUNK_ID, CHUNK_VERSION);

		// Name
		ser.write(&mName);
		// Sections
		for (SectionMap::iterator i = mSections.begin(); i != mSections.end(); ++i)
		{
			PagedWorldSection* sec = i->second;
			// declaration
			ser.writeChunkBegin(CHUNK_SECTIONDECLARATION_ID);
			ser.write(&sec->getType());
			ser.write(&sec->getName());
			ser.writeChunkEnd(CHUNK_SECTIONDECLARATION_ID);
			// data
			i->second->save(ser);
		}

		ser.writeChunkEnd(CHUNK_ID);
	}
	//---------------------------------------------------------------------
	void Page::save(StreamSerialiser& stream)
	{
		stream.writeChunkBegin(CHUNK_ID, CHUNK_VERSION);

		// page id
		stream.write(&mID);

		// content collections
		for (ContentCollectionList::iterator i = mContentCollections.begin();
			i != mContentCollections.end(); ++i)
		{
			// declaration
			stream.writeChunkBegin(CHUNK_CONTENTCOLLECTION_DECLARATION_ID);
			stream.write(&(*i)->getType());
			stream.writeChunkEnd(CHUNK_CONTENTCOLLECTION_DECLARATION_ID);
			// data
			(*i)->save(stream);
		}

		stream.writeChunkEnd(CHUNK_ID);

		mModified = false;
	}
    //---------------------------------------------------------------------
    void Grid3DPageStrategyData::save(StreamSerialiser& ser)
    {
        ser.writeChunkBegin(CHUNK_ID, CHUNK_VERSION);

        ser.write(&mWorldOrigin);
        ser.write(&mCellSize);
        ser.write(&mLoadRadius);
        ser.write(&mHoldRadius);
        ser.write(&mMinCellX);
        ser.write(&mMaxCellX);
        ser.write(&mMinCellY);
        ser.write(&mMaxCellY);
        ser.write(&mMinCellZ);
        ser.write(&mMaxCellZ);

        ser.writeChunkEnd(CHUNK_ID);
    }