예제 #1
0
        public FbxPose GetPose(int pIndex)
        {
            global::System.IntPtr cPtr = FbxWrapperNativePINVOKE.FbxScene_GetPose(swigCPtr, pIndex);
            FbxPose ret = (cPtr == global::System.IntPtr.Zero) ? null : new FbxPose(cPtr, false);

            return(ret);
        }
예제 #2
0
        protected void ExportBindPose(FbxNode meshNode, FbxScene fbxScene, List <FbxNode> boneNodes)
        {
            FbxPose fbxPose = FbxPose.Create(fbxScene, "Pose");

            // set as bind pose
            fbxPose.SetIsBindPose(true);

            // assume each bone node has one weighted vertex cluster
            foreach (FbxNode fbxNode in boneNodes)
            {
                // EvaluateGlobalTransform returns an FbxAMatrix (affine matrix)
                // which has to be converted to an FbxMatrix so that it can be passed to fbxPose.Add().
                // The hierarchy for FbxMatrix and FbxAMatrix is as follows:
                //
                //      FbxDouble4x4
                //      /           \
                // FbxMatrix     FbxAMatrix
                //
                // Therefore we can't convert directly from FbxAMatrix to FbxMatrix,
                // however FbxMatrix has a constructor that takes an FbxAMatrix.
                FbxMatrix fbxBindMatrix = new FbxMatrix(fbxNode.EvaluateGlobalTransform());

                fbxPose.Add(fbxNode, fbxBindMatrix);
            }

            FbxMatrix bindMatrix = new FbxMatrix(meshNode.EvaluateGlobalTransform());

            fbxPose.Add(meshNode, bindMatrix);

            // add the pose to the scene
            fbxScene.AddPose(fbxPose);
        }
예제 #3
0
        public new static FbxPose Create(FbxObject pContainer, string pName)
        {
            global::System.IntPtr cPtr = FbxWrapperNativePINVOKE.FbxPose_Create__SWIG_1(FbxObject.getCPtr(pContainer), pName);
            FbxPose ret = (cPtr == global::System.IntPtr.Zero) ? null : new FbxPose(cPtr, false);

            return(ret);
        }
예제 #4
0
        public new static FbxPose Create(FbxManager pManager, string pName)
        {
            global::System.IntPtr cPtr = fbx_wrapperPINVOKE.FbxPose_Create__SWIG_0(FbxManager.getCPtr(pManager), pName);
            FbxPose ret = (cPtr == global::System.IntPtr.Zero) ? null : new FbxPose(cPtr, false);

            return(ret);
        }
예제 #5
0
 public bool Equals(FbxPose other)
 {
     if (object.ReferenceEquals(other, null))
     {
         return(false);
     }
     return(this.swigCPtr.Handle.Equals(other.swigCPtr.Handle));
 }
예제 #6
0
        public bool AddPose(FbxPose pPose)
        {
            bool ret = NativeMethods.FbxScene_AddPose(swigCPtr, FbxPose.getCPtr(pPose));

            if (NativeMethods.SWIGPendingException.Pending)
            {
                throw NativeMethods.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
예제 #7
0
        public new static FbxPose Create(FbxObject pContainer, string pName)
        {
            global::System.IntPtr cPtr = NativeMethods.FbxPose_Create__SWIG_1(FbxObject.getCPtr(pContainer), pName);
            FbxPose ret = (cPtr == global::System.IntPtr.Zero) ? null : new FbxPose(cPtr, false);

            if (NativeMethods.SWIGPendingException.Pending)
            {
                throw NativeMethods.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
예제 #8
0
        public FbxPose GetPose(int pIndex)
        {
            global::System.IntPtr cPtr = NativeMethods.FbxScene_GetPose(swigCPtr, pIndex);
            FbxPose ret = (cPtr == global::System.IntPtr.Zero) ? null : new FbxPose(cPtr, false);

            if (NativeMethods.SWIGPendingException.Pending)
            {
                throw NativeMethods.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
예제 #9
0
        // Get the matrix of the given pose
        static FbxAMatrix GetPoseMatrix(FbxPose pPose, int pNodeIndex)
        {
            FbxMatrix lMatrix = pPose.GetMatrix(pNodeIndex);

            FbxAMatrix lPoseMatrix = new FbxAMatrix();

            //memcpy((double*)lPoseMatrix, (double*)lMatrix, sizeof(lMatrix.mData));
            lPoseMatrix.SetRow(0, lMatrix.GetRow(0));
            lPoseMatrix.SetRow(1, lMatrix.GetRow(1));
            lPoseMatrix.SetRow(2, lMatrix.GetRow(2));
            lPoseMatrix.SetRow(3, lMatrix.GetRow(3));
            return(lPoseMatrix);
        }
예제 #10
0
        public void TestAddPose()
        {
            using (FbxScene newScene = FbxScene.Create(Manager, "")) {
                FbxPose fbxPose = FbxPose.Create(Manager, "pose");
                bool    result  = newScene.AddPose(fbxPose);
                Assert.IsTrue(result);
                Assert.AreEqual(fbxPose, newScene.GetPose(0));

                // test null
                Assert.That(() => { newScene.AddPose(null); }, Throws.Exception.TypeOf <System.ArgumentNullException>());

                // test invalid
                fbxPose.Destroy();
                Assert.That(() => { newScene.AddPose(fbxPose); }, Throws.Exception.TypeOf <System.ArgumentNullException>());
            }
        }
예제 #11
0
        protected void CheckExportBindPose(FbxScene origScene, FbxScene importScene)
        {
            FbxPose origPose   = origScene.GetPose(0);
            FbxPose importPose = importScene.GetPose(0);

            Assert.IsNotNull(origPose);
            Assert.IsNotNull(importPose);
            Assert.AreEqual(origPose.IsBindPose(), importPose.IsBindPose());
            Assert.AreEqual(origPose.GetCount(), importPose.GetCount());

            for (int i = 0; i < origPose.GetCount(); i++)
            {
                Assert.AreEqual(origPose.GetNode(i).GetName(), importPose.GetNode(i).GetName());
                Assert.AreEqual(origPose.GetMatrix(i), importPose.GetMatrix(i));
            }
        }
예제 #12
0
파일: SceneTest.cs 프로젝트: shoff/FbxSharp
        public void Scene_ConnectSrcObject_AddsPose()
        {
            // given:
            var scene = new FbxScene("Scene");
            var pose  = new FbxPose("Pose");

            // require:
            Assert.AreEqual(3, scene.GetSrcObjectCount());
            Assert.AreEqual(scene.GetRootNode(), scene.GetSrcObject(0));
            Assert.AreEqual(scene.GetGlobalSettings(), scene.GetSrcObject(1));
            Assert.AreEqual(scene.GetAnimationEvaluator(), scene.GetSrcObject(2));
            Assert.AreEqual(0, scene.GetDstObjectCount());
            Assert.AreEqual(0, scene.GetPoseCount());

            Assert.AreEqual(0, pose.GetSrcObjectCount());
            Assert.AreEqual(0, pose.GetDstObjectCount());
            Assert.AreEqual(null, pose.GetScene());

            // when:
            scene.ConnectSrcObject(pose);

            // then:
            Assert.AreEqual(4, scene.GetSrcObjectCount());
            Assert.AreEqual(scene.GetRootNode(), scene.GetSrcObject(0));
            Assert.AreEqual(scene.GetGlobalSettings(), scene.GetSrcObject(1));
            Assert.AreEqual(scene.GetAnimationEvaluator(), scene.GetSrcObject(2));
            Assert.AreEqual(pose, scene.GetSrcObject(3));
            Assert.AreEqual(0, scene.GetDstObjectCount());
            Assert.AreEqual(1, scene.GetPoseCount());
            Assert.AreEqual(pose, scene.GetPose(0));

            Assert.AreEqual(0, pose.GetSrcObjectCount());
            Assert.AreEqual(1, pose.GetDstObjectCount());
            Assert.AreEqual(scene, pose.GetDstObject(0));
            Assert.AreEqual(scene, pose.GetScene());
        }
예제 #13
0
        public bool ComputeSkinDeformation(FbxVector4 pVertexArray, FbxTime pTime, FbxAMatrix pGX, FbxPose pPose)
        {
            bool ret = fbx_wrapperPINVOKE.FbxDeformationsEvaluator_ComputeSkinDeformation__SWIG_0(swigCPtr, FbxVector4.getCPtr(pVertexArray), FbxTime.getCPtr(pTime), FbxAMatrix.getCPtr(pGX), FbxPose.getCPtr(pPose));

            if (fbx_wrapperPINVOKE.SWIGPendingException.Pending)
            {
                throw fbx_wrapperPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
예제 #14
0
        public bool AddPose(FbxPose pPose)
        {
            bool ret = FbxWrapperNativePINVOKE.FbxScene_AddPose(swigCPtr, FbxPose.getCPtr(pPose));

            return(ret);
        }
예제 #15
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(FbxPose obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }
예제 #16
0
        public bool RemovePose(FbxPose pPose)
        {
            bool ret = FbxWrapperNativePINVOKE.FbxScene_RemovePose__SWIG_0(swigCPtr, FbxPose.getCPtr(pPose));

            return(ret);
        }
예제 #17
0
        public bool AddPose(FbxPose pPose)
        {
            bool ret = fbx_wrapperPINVOKE.FbxScene_AddPose(swigCPtr, FbxPose.getCPtr(pPose));

            return(ret);
        }