Пример #1
0
    //---------------------------------------------------------------------
    void MeshSerializer::exportMesh(const Mesh* pMesh, DataStreamPtr stream,
                                    MeshVersion version, Endian endianMode)
    {
        MeshSerializerImpl* impl = 0;
        if (version == MESH_VERSION_LATEST)
            impl = mVersionData[0]->impl;
        else 
        {
            for (MeshVersionDataList::iterator i = mVersionData.begin(); 
                 i != mVersionData.end(); ++i)
            {
                if (version == (*i)->version)
                {
                    impl = (*i)->impl;
                    break;
                }
            }
        }
        
        if (!impl)
        {
            OGRE_EXCEPT(Exception::ERR_INTERNAL_ERROR, "Cannot find serializer implementation for "
                        "specified version", "MeshSerializer::exportMesh");
        }

                    
        impl->exportMesh(pMesh, stream, endianMode);
    }
	//---------------------------------------------------------------------
	void MeshSerializer::exportMesh(const Mesh* pMesh, DataStreamPtr stream,
									MeshVersion version, Endian endianMode)
	{
		if (version == MESH_VERSION_LEGACY)
			OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS, 
						"You may not supply a legacy version number (pre v1.0) for writing meshes.",
						"MeshSerializer::exportMesh");
		
		MeshSerializerImpl* impl = 0;
		if (version == MESH_VERSION_LATEST)
			impl = mVersionData[0]->impl;
		else 
		{
			for (MeshVersionDataList::iterator i = mVersionData.begin(); 
				 i != mVersionData.end(); ++i)
			{
				if (version == (*i)->version)
				{
					impl = (*i)->impl;
					break;
				}
			}
		}
		
		if (!impl)
			OGRE_EXCEPT(Exception::ERR_INTERNAL_ERROR, "Cannot find serializer implementation for "
					"specified version", "MeshSerializer::exportMesh");

					
		impl->exportMesh(pMesh, stream, endianMode);
	}