public void ExportAllLodsWithMorph(MeshAsset mesh, MorphStaticAsset morph, string targetdir, float scale = 1.0f, bool bake = false) { for (int morphLod = 0; morphLod < morph.LodCount; morphLod++) { string fileName = string.Format("{0}_lod{1}.obj", morph.MorphName, morphLod); string targetFile = Path.Combine(targetdir, fileName); ExportLodWithMorph(mesh, morphLod, morph, targetFile, scale, bake); } }
public void ExportLodWithMorph(MeshAsset mesh, int lodIndex, MorphStaticAsset morph, string targetFile, float scale = 100f, bool bake = false) { exportScale = scale; if (bake) { morph.ApplyMorphToMesh(mesh); ExportMeshWithMorph(Skeleton, mesh, lodIndex, morph.BonesMorph, targetFile); } else { ExportMeshWithMorph(Skeleton, mesh, lodIndex, morph.GetVerticesForLod(lodIndex, mesh), morph.BonesMorph, targetFile); } }
public void ExportLodWithMorph(MeshAsset mesh, int lodIndex, MorphStaticAsset morph, string targetfile, float scale = 1.0f, bool bake = false) { morph.ApplyMorphToMesh(mesh); ExportLod(mesh, lodIndex, targetfile, scale); // export psa file holding a pose corresponding to the skeleton morph string psaFileName = Path.GetFileNameWithoutExtension(targetfile) + ".psa"; string targetPsaFile = Path.Combine(Path.GetDirectoryName(targetfile), psaFileName); try { byte[] psaData = ExportPoseToPsa(Skeleton, morph.BonesMorph, scale); File.WriteAllBytes(targetPsaFile, psaData); } catch (ArgumentNullException) { Console.WriteLine("Unable to export pose as psa : skeleton not provided"); } }
public void ExportLodWithMorph(MeshAsset mesh, int lodIndex, MorphStaticAsset morph, string targetfile, float scale = 1.0f, bool bake = false) { morph.ApplyMorphToMesh(mesh); ExportLod(mesh, lodIndex, targetfile, scale); }