public void ImportMesh( Stream stream, Mesh mesh )
{
BinaryReader reader = new BinaryReader( stream );
// read the header ID
ushort headerID = ReadUShort( reader );
if ( headerID != (ushort)MeshChunkID.Header )
{
throw new AxiomException( "File header not found." );
}
// read version
string fileVersion = ReadString( reader );
// set jump back to the start of the reader
Seek( reader, 0, SeekOrigin.Begin );
// barf if there specified version is not supported
if ( !implementations.ContainsKey( fileVersion ) )
{
throw new AxiomException( "Cannot find serializer implementation for version '{0}'.", fileVersion );
}
LogManager.Instance.Write( "Mesh: Loading '{0}'...", mesh.Name );
// call implementation
MeshSerializerImpl serializer = (MeshSerializerImpl)implementations[ fileVersion ];
serializer.ImportMesh( stream, mesh );
// warn on old version of mesh
if ( fileVersion != currentVersion )
{
LogManager.Instance.Write( "WARNING: {0} is an older format ({1}); you should upgrade it as soon as possible using the OgreMeshUpdate tool.", mesh.Name, fileVersion );
}
}