Exemplo n.º 1
0
 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);
     }
 }
Exemplo n.º 2
0
 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);
     }
 }
Exemplo n.º 3
0
        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");
            }
        }
Exemplo n.º 4
0
 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);
 }