Beispiel #1
0
        private void AddMorphToMesh(FBXScene pScene, FBXNode pFbxNode, List <Vector> morph)
        {
            FBXShape lShape = FBXShape.Create(pScene, "MorphShape");
            FBXMesh  mesh   = (FBXMesh)pFbxNode.GetMesh();
            int      count  = mesh.GetControlPointsCount();

            lShape.InitControlPoints(count);
            List <FBXVector4> lControlPoints = lShape.GetControlPoints();

            for (int i = 0; i < count; i++)
            {
                FBXVector4 cp = new FBXVector4(morph[i].members[0] * exportScale,
                                               morph[i].members[1] * exportScale,
                                               morph[i].members[2] * exportScale,
                                               0);
                lControlPoints[i] = cp;
            }
            lShape.SetControlPoints(lControlPoints);

            FBXBlendShape        lBlendShape        = FBXBlendShape.Create(pScene, "morph");
            FBXBlendShapeChannel lBlendShapeChannel = FBXBlendShapeChannel.Create(pScene, "morphchannel");

            mesh.AddDeformer(lBlendShape);
            lBlendShape.AddBlendShapeChannel(lBlendShapeChannel);
            lBlendShapeChannel.AddTargetShape(lShape);
        }