public M2Holder(M2 model) { Model = model; var min = model.Bounds.Min; var max = model.Bounds.Max; var minPoint = new Point(min.X, min.Y); var maxPoint = new Point(max.X, max.Y); Bounds = new Rect(minPoint, maxPoint); }
private static void ReadModels(BinaryReader br, TreeReference<M2> tree) { var numModels = br.ReadInt32(); for (var i = 0; i < numModels; i++) { var bounds = br.ReadBoundingBox(); Vector3[] vertices; var numVertices = br.ReadInt32(); if (numVertices > 0) { vertices = new Vector3[numVertices]; for (var j = 0; j < numVertices; j++) { vertices[j] = br.ReadVector3(); } } else { vertices = null; } Index3[] indices; var numIndices = br.ReadInt32(); if (numIndices > 0) { indices = new Index3[numIndices]; for (var j = 0; j < numIndices; j++) { indices[j] = br.ReadIndex3(); } } else { indices = null; } var model = new M2 { Bounds = bounds, Vertices = vertices, Triangles = indices }; tree.Tree.Insert(model); } }