public Mesh GetMesh(string file, bool allowDuplicates = false) { //if (!resource.originalPath.EndsWith(".obj")) throw new System.Exception("Resource path does not end with .obj"); Mesh s; if (allowDuplicates || !allMeshes.TryGetValue(file, out s)) { s = objLoader.Load(this.FileSystem.FindExistingFile(file)); allMeshes[file] = s; } return(s); }
public static Mesh GetMesh(Resource resource, bool allowDuplicates = false) { if (!resource.originalPath.EndsWith(".obj")) { throw new System.Exception("Resource path does not end with .obj"); } Mesh s; if (allowDuplicates || !allMeshes.TryGetValue(resource, out s)) { s = ObjLoader.Load(resource); allMeshes[resource] = s; UnloadFactory.Add(s); } return(s); }
//internal Dictionary<string, Mesh> allMeshes = new Dictionary<string, Mesh>(); public static void AppendMesh(Resource resource, GameObject appendTo) { if (!resource.originalPath.EndsWith(".obj")) { throw new System.Exception("Resource path does not end with .obj"); } ObjLoader.Load(resource, appendTo); /*Mesh s; * if (!allMeshes.TryGetValue(resource, out s)) * { * s = ObjLoader.Load(resource, appendTo); * allMeshes[resource] = s; * UnloadFactory.Add(s); * } * return s;*/ }