/// <summary> /// Parses the mesh data from the current data segment. /// </summary> /// <param name="dataSegment"> /// Contains the data to be parsed. /// </param> protected void ParseMeshData(DataReader3DS dataSegment) { string name = dataSegment.GetString(); // mesh object name DataReader3DS subSegment = dataSegment.GetNextSubSegment(); // working subsegment this.currentMeshData = new MeshData3DS(); this.currentMeshData.Name = name; while (subSegment != null) { switch (subSegment.Tag) { case 0x4100: // Current subsegment contains the polygonal information this.ParsePolygonalData(subSegment); break; default: // Ignore all other subsegment types break; } subSegment = dataSegment.GetNextSubSegment(); } while (this.meshDataStore.ContainsKey(this.currentMeshData.Name)) { this.currentMeshData.Name += "X"; } this.meshDataStore.Add(this.currentMeshData.Name, this.currentMeshData); }
public Loader3DSModel(String filePath) { if (filePath != null && File.Exists(filePath)) { this.filePath = filePath; this.stream = new FileStream(filePath, FileMode.Open, FileAccess.Read); BinaryReader byteExtractor = new BinaryReader(this.stream); this.dataReader = new DataReader3DS(byteExtractor.ReadBytes((int) this.stream.Length)); this.meshDataStore = new Hashtable(); this.materialDataStore = new Hashtable(); this.currentMeshData = null; this.currentMaterialData = null; } else { throw new FileNotFoundException(); } }
public Loader3DSModel(String filePath) { if (filePath != null && File.Exists(filePath)) { this.filePath = filePath; this.stream = new FileStream(filePath, FileMode.Open, FileAccess.Read); BinaryReader byteExtractor = new BinaryReader(this.stream); this.dataReader = new DataReader3DS(byteExtractor.ReadBytes((int)this.stream.Length)); this.meshDataStore = new Hashtable(); this.materialDataStore = new Hashtable(); this.currentMeshData = null; this.currentMaterialData = null; } else { throw new FileNotFoundException(); } }