private void ReadModel(ref SourceModel sourceModel) { float x, y, z; x = this.Stream.ReadSingle(); y = this.Stream.ReadSingle(); z = this.Stream.ReadSingle(); sourceModel.mins = new Float3(x, y, z); x = this.Stream.ReadSingle(); y = this.Stream.ReadSingle(); z = this.Stream.ReadSingle(); sourceModel.maxs = new Float3(x, y, z); x = this.Stream.ReadSingle(); y = this.Stream.ReadSingle(); z = this.Stream.ReadSingle(); sourceModel.origin = new Float3(x, y, z); sourceModel.headnode = this.Stream.ReadInt32(); sourceModel.firstface = this.Stream.ReadInt32(); sourceModel.numfaces = this.Stream.ReadInt32(); }
private void BuildModelAsNode(ref SourceModel sourceModel) { var streamMesh2 = new SeparateStreamsMesh(); var meshBuilder2 = new MeshBuilder(streamMesh2, this); var beginModelFace = sourceModel.firstface; var endModelFace = beginModelFace + sourceModel.numfaces; for (int index = beginModelFace; index < endModelFace; ++index) { //if (!usedFaces[index]) { int meshIndex; SeparateStreamsSubmesh subMesh2 = meshBuilder2.EnsureSubMesh( new BspSubmeshKey(0, new BspMaterialKey(0, 0)), out meshIndex); this.BuildFace(ref this.faces[index], new BspSubmeshStreams(subMesh2,meshStreams,StreamConverterFactory)); //Trace.WriteLine(string.Format("Face {0} is not references from leaves", index)); } } this.Scene.Geometries.Add(streamMesh2); }