public void TestExport() { var tex = new RAMTexture(); tex.GetCoreData().DiskFilePath = "trolo.png"; var mesh = UtilityMeshes.CreateBoxWithTexture(tex, new Vector3(10, 10, 10)); var exporter = new OBJExporter(); var objMesh = exporter.ConvertFromTWMesh(mesh); exporter.SaveToFile(objMesh, TWDir.GameData.CreateSubdirectory("Scattered\\Tests").FullName + "\\OBJExporterTrolo.obj"); }
public IMesh GetIslandMesh(List <IBuildingElement> islandBase, int seed) { var hash = GetIslandBaseHash(islandBase) - seed; var file = getCachedMeshFile(hash); if (!file.Exists) { file.Directory.Create(); var gen = decorated.GetIslandMesh(islandBase, seed); objExporter.SaveToFile(objExporter.ConvertFromTWMesh(gen), file.FullName); } return(TW.Assets.LoadMesh(getGamedataPath(hash))); }
public void TestExportComplex() { var tex = new RAMTexture(); tex.GetCoreData().DiskFilePath = "trolo.png"; var meshFact = new EngineMeshFactory(new RAMTextureFactory()); var mesh = meshFact.loadMeshFromFile(TWDir.GameData.FullName + "\\Core\\MerchantsHouse.obj", TWDir.GameData.FullName + "\\Core\\MerchantsHouse.mtl", "MerchantsHouse.mtl"); var exporter = new OBJExporter(); var objMesh = exporter.ConvertFromTWMesh(mesh); exporter.SaveToFile(objMesh, TWDir.GameData.CreateSubdirectory("Scattered\\Tests").FullName + "\\OBJExporterHouse.obj"); }