/// <summary> /// Merge the list of given ObjData into a single one and returns it /// </summary> /// <param name="objFiles"></param> /// <returns></returns> public static ObjData MergeObjFiles(List <ObjData> objFiles) { if (objFiles != null) { int length = objFiles.Count; if (length >= 1) // Should always be the case { ObjData objData = objFiles[0]; if (length == 1) // Only one objData { return(objData); } else // More objData to merge with the first one { IntWrapper indexMaterial = new IntWrapper(0); // Rename every materials to be unique SetUniqueMaterialsNames(objData, objData.Mtl, indexMaterial); for (int i = 1; i < length; i++) { ObjData nextObjData = objFiles[i]; SetUniqueMaterialsNames(nextObjData, nextObjData.Mtl, indexMaterial); objData.MergeObjData(nextObjData); } return(objData); } } } return(null); }