/// <summary>
		/// Multiuverse Extension
		/// </summary>
		/// <param name="reader"></param>
		/// <param name="depends"></param>
		protected void ReadDependencyInfo( BinaryReader reader, DependencyInfo depends )
		{
			if ( !IsEOF( reader ) )
			{
				// check out the next chunk
				var chunkID = ReadChunk( reader );

				while ( !IsEOF( reader ) &&
				        ( chunkID == MeshChunkID.MeshDependency || chunkID == MeshChunkID.SkeletonDependency ||
				          chunkID == MeshChunkID.MaterialDependency ) )
				{
					switch ( chunkID )
					{
						case MeshChunkID.MeshDependency:
							ReadMeshDependency( reader, depends );
							break;
						case MeshChunkID.SkeletonDependency:
							ReadSkeletonDependency( reader, depends );
							break;
						case MeshChunkID.MaterialDependency:
							ReadMaterialDependency( reader, depends );
							break;
					}
				} // while
				if ( !IsEOF( reader ) )
				{
					// skip back so the continuation of the calling loop can look at the next chunk
					// since we already read past it
					Seek( reader, -ChunkOverheadSize );
				}
			}
		}
		protected void ReadMaterialDependency( BinaryReader reader, DependencyInfo depends )
		{
			int count = reader.ReadInt16();
			for ( var i = 0; i < count; ++i )
			{
				var name = reader.ReadString();
				depends.materials.Add( name );
			}
		}
		/// <summary>
		///		Imports mesh data from a .mesh file.
		/// </summary>
		/// <param name="stream">A stream containing the .mesh data.</param>
		/// <param name="mesh">Mesh to populate with the data.</param>
		public void ImportMesh( Stream stream, Mesh mesh )
		{
			this.mesh = mesh;

			var reader = new BinaryReader( stream, System.Text.Encoding.UTF8 );

			// check header
			ReadFileHeader( reader );

			MeshChunkID chunkID = 0;

			// read until the end
			while ( !IsEOF( reader ) )
			{
				chunkID = ReadChunk( reader );

				switch ( chunkID )
				{
					case MeshChunkID.DependencyInfo: // NOTE: This case and read is not in Ogre, why is it here?
						var info = new DependencyInfo();
						ReadDependencyInfo( reader, info );
						break;
					case MeshChunkID.Mesh:
						ReadMesh( reader );
						break;
				}
			}
		}
		/// <summary>
		/// Multiverse Extension
		/// </summary>
		/// <param name="stream"></param>
		/// <param name="mesh"></param>
		/// <returns></returns>
		public DependencyInfo GetDependencyInfo( Stream stream, Mesh mesh )
		{
			var reader = new BinaryReader( stream, System.Text.Encoding.UTF8 );

			// check header
			ReadFileHeader( reader );

			MeshChunkID chunkID = 0;

			// read until the end
			while ( !IsEOF( reader ) )
			{
				chunkID = ReadChunk( reader );
				if ( chunkID == MeshChunkID.DependencyInfo )
				{
					var info = new DependencyInfo();
					ReadDependencyInfo( reader, info );
					return info;
				}
				else
				{
					break;
				}
			}
			return null;
		}
 protected void ReadSkeletonDependency(BinaryMemoryReader reader, DependencyInfo depends)
 {
     int count = reader.ReadInt16();
     for (int i = 0; i < count; ++i) {
         string name = reader.ReadString();
         depends.skeletons.Add(name);
     }
 }
        /// <summary>
        ///		Imports mesh data from a .mesh file.
        /// </summary>
        /// <param name="stream">A stream containing the .mesh data.</param>
        /// <param name="mesh">Mesh to populate with the data.</param>
        public void ImportMesh(BinaryMemoryReader reader, Mesh mesh)
        {
            this.mesh = mesh;

            // check header
            ReadFileHeader(reader);

            MeshChunkID chunkID = 0;

            // read until the end
            while (!IsEOF(reader)) {
                chunkID = ReadChunk(reader);
                if (chunkID == MeshChunkID.DependencyInfo) {
                    DependencyInfo info = new DependencyInfo();
                    ReadDependencyInfo(reader, info);
                } else if (chunkID == MeshChunkID.Mesh) {
                    ReadMesh(reader);
                }
            }
        }
Example #7
0
		protected void ReadMeshDependency( BinaryReader reader, DependencyInfo depends )
		{
			int count = reader.ReadInt16();
			for ( int i = 0; i < count; ++i )
			{
				string name = reader.ReadString();
				depends.meshes.Add( name );
			}
		}