private static void LoadDXM(string path, out string error, out DXMModel model) { error = string.Empty; float progress = 0; string[] textPaths; model = new DXMModel(); DXMImporter.Load(path, ref model, ref error, ref progress, out textPaths); }
private static void PopulateMeshWithDXMModel(DXMModel model, out Mesh mesh) { mesh = new Mesh(); mesh.indexFormat = UnityEngine.Rendering.IndexFormat.UInt32; mesh.vertices = model.vertexUnity; mesh.normals = model.normalUnity; mesh.uv = model.uvUnity; mesh.subMeshCount = model.groups.Length; for (int i = 0; i < model.groups.Length; i++) { //Flips the indices of the model to account for the flipping of the z axis. for (int j = 0; j < model.groups[i].index32.Length / 3; ++j) { int temp = model.groups[i].index32[j * 3 + 0]; model.groups[i].index32[j * 3 + 0] = model.groups[i].index32[j * 3 + 1]; model.groups[i].index32[j * 3 + 1] = temp; } mesh.SetIndices(model.groups[i].index32, MeshTopology.Triangles, i); } mesh.UploadMeshData(true); }