示例#1
0
        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");
        }
示例#2
0
        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)));
        }
示例#3
0
        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");
        }