void WriteModelFiles(ThreeSceneRoot root, SceneFormat fmt) { // three.js는 단일 파일로 출력하는게 목적이라서 model 파일을 생성하지 않는다 var pathHelper = ExportPathHelper.Instance; if (fmt == SceneFormat.AFrame) { foreach (var el in root.SharedNodeTable.GetEnumerable <MeshElem>()) { var bufferGeom = el.Geometry as BufferGeometryElem; if (bufferGeom != null) { string filepath = pathHelper.ToModelPath(bufferGeom.CreateMeshFileName(".obj")); ObjExporter.MeshToFile(bufferGeom.Mesh, filepath); } var mtl = MaterialFacade.Instance.CreateMaterial(el.Material); if (bufferGeom != null) { string filepath = pathHelper.ToModelPath(bufferGeom.CreateMeshFileName(".mtl")); MtlExporter.ToFile(mtl, bufferGeom.SafeName, filepath); } } } }
void WriteMaterialFiles(ThreeSceneRoot root, SceneFormat fmt) { var pathHelper = ExportPathHelper.Instance; if (fmt == SceneFormat.AFrame) { foreach (var el in root.SharedNodeTable.GetEnumerable <MaterialElem>()) { var aframeMtl = MaterialFacade.Instance.CreateMaterial(el); var name = el.Name; string filepath = pathHelper.ToModelPath(name + ".mtl"); MtlExporter.ToFile(aframeMtl, name, filepath); } } }