public static ModelRoot ToGltf(this SimpleSkin skn, Dictionary <string, MagickImage> materialTextues = null)
        {
            SceneBuilder sceneBuilder = new SceneBuilder("model");
            var          meshBuilder  = VERTEX.CreateCompatibleMesh();

            foreach (SimpleSkinSubmesh submesh in skn.Submeshes)
            {
                MaterialBuilder material         = new MaterialBuilder(submesh.Name).WithUnlitShader();
                var             submeshPrimitive = meshBuilder.UsePrimitive(material);

                // Assign submesh Image
                if (materialTextues is not null && materialTextues.ContainsKey(submesh.Name))
                {
                    MagickImage submeshImage = materialTextues[submesh.Name];
                    AssignMaterialTexture(material, submeshImage);
                }

                // Build vertices
                var vertices = new List <VERTEX>(submesh.Vertices.Count);
                foreach (SimpleSkinVertex vertex in submesh.Vertices)
                {
                    VertexPositionNormal positionNormal = new VertexPositionNormal(vertex.Position, vertex.Normal);
                    VertexTexture1       uv             = new VertexTexture1(vertex.UV);

                    vertices.Add(new VERTEX(positionNormal, uv));
                }

                // Add vertices to primitive
                for (int i = 0; i < submesh.Indices.Count; i += 3)
                {
                    VERTEX v1 = vertices[submesh.Indices[i + 0]];
                    VERTEX v2 = vertices[submesh.Indices[i + 1]];
                    VERTEX v3 = vertices[submesh.Indices[i + 2]];

                    submeshPrimitive.AddTriangle(v1, v2, v3);
                }
            }

            sceneBuilder.AddRigidMesh(meshBuilder, new AffineTransform(new Vector3(-1, 1, 1), Quaternion.Identity, Vector3.Zero).Matrix);

            return(sceneBuilder.ToGltf2());
        }
 public static ModelRoot ToGltf(this SimpleSkin skn, Skeleton skeleton, Dictionary <string, MagickImage> materialTextues = null, List <(string, LeagueAnimation)> leagueAnimations = null)