示例#1
0
        public DependencyInfo GetDependencyInfo(Stream stream, Mesh mesh)
        {
            BinaryMemoryReader reader = new BinaryMemoryReader(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: Fetching dependency info '{0}'...", mesh.Name);

            // call implementation
            MeshSerializerImpl serializer = (MeshSerializerImpl)implementations[fileVersion];
            DependencyInfo     rv         = serializer.GetDependencyInfo(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);
            }
            return(rv);
        }