1 | /**************************************************************************************** |
2 | |
3 | Copyright (C) 2015 Autodesk, Inc. |
4 | All rights reserved. |
5 | |
6 | Use of this software is subject to the terms of the Autodesk license agreement |
7 | provided at the time of installation or download, or which otherwise accompanies |
8 | this software in either electronic or hard copy form. |
9 | |
10 | ****************************************************************************************/ |
11 | |
12 | //! \file fbxdeformationsevaluator.h |
13 | #ifndef _FBXSDK_UTILS_DEFORMATIONS_EVALUATOR_H_ |
14 | #define _FBXSDK_UTILS_DEFORMATIONS_EVALUATOR_H_ |
15 | |
16 | #include <fbxsdk/fbxsdk_def.h> |
17 | |
18 | #include <fbxsdk/fbxsdk_nsbegin.h> |
19 | |
20 | class FbxNode; |
21 | class FbxMesh; |
22 | class FbxTime; |
23 | class FbxAnimLayer; |
24 | class FbxPose; |
25 | class FbxCluster; |
26 | class FbxVector4; |
27 | class FbxAMatrix; |
28 | class FbxDualQuaternion; |
29 | |
30 | class FBXSDK_DLL FbxDeformationsEvaluator |
31 | { |
32 | public: |
33 | /** Configure this object to process the given mesh. |
34 | * \param pNode Node object owner of the mesh. |
35 | * \param pMesh Processed object. |
36 | * \return \c true if \e pMesh is connected to \e pNode and the internal data allocation succeeded. */ |
37 | bool Init(const FbxNode* pNode, const FbxMesh* pMesh); |
38 | |
39 | /** If this object is properly configured, evaluates the shape deformation of the mesh at the given time. |
40 | * \param pVertexArray The result of the evaluation. |
41 | * \param pTime Current time of the evaluation. |
42 | * \return \c true if the function completed successfully and \c false in case of errors. |
43 | * \remarks \e pVertexArray must be allocated and be of size: \e mMesh->GetControlPointCount(). */ |
44 | bool ComputeShapeDeformation(FbxVector4* pVertexArray, const FbxTime& pTime); |
45 | |
46 | /** If this object is properly configured, evaluates the skin deformation of the received mesh at the given time. |
47 | * \param pVertexArray The result of the evaluation. |
48 | * \param pTime Current time of the evaluation. |
49 | * \param pGX Local to World matrix to express the returned vertices in World space. |
50 | * \param pPose If defined, use the pose to evaluate the current transform. |
51 | * \return \c true if the function completed successfully and \c false in case of errors. |
52 | * \remarks \e pVertexArray must be allocated and be of size: \e mMesh->GetControlPointCount(). */ |
53 | bool ComputeSkinDeformation(FbxVector4* pVertexArray, const FbxTime& pTime, FbxAMatrix* pGX=NULL, const FbxPose* pPose=NULL); |
54 | |
55 | /***************************************************************************************************************************** |
56 | ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! ** |
57 | *****************************************************************************************************************************/ |
58 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
59 | FbxDeformationsEvaluator(); |
60 | virtual ~FbxDeformationsEvaluator(); |
61 | |
62 | private: |
63 | void ComputeClusterDeformation(FbxVector4* pVertexArray, const FbxTime& pTime, const FbxAMatrix& pGX, FbxCluster* pCluster, FbxAMatrix& , const FbxPose* pPose); |
64 | void ComputeLinearDeformation(FbxVector4* pVertexArray, const FbxTime& pTime, const FbxAMatrix& pGX, const FbxPose* pPose); |
65 | void ComputeDualQuaternionDeformation(FbxVector4* pVertexArray, const FbxTime& pTime, const FbxAMatrix& pGX, const FbxPose* pPose); |
66 | void Cleanup(); |
67 | |
68 | bool mIsConfigured; |
69 | FbxNode* mNode; |
70 | FbxMesh* mMesh; |
71 | FbxAnimLayer* mAnimLayer; |
72 | |
73 | int mVertexCount; |
74 | FbxVector4* mDstVertexArray; |
75 | FbxVector4* mVertexArrayLinear; |
76 | FbxVector4* mVertexArrayDQ; |
77 | |
78 | FbxAMatrix* mClusterDeformation; |
79 | double* mClusterWeight; |
80 | FbxDualQuaternion* mDQClusterDeformation; |
81 | #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ |
82 | }; |
83 | |
84 | #include <fbxsdk/fbxsdk_nsend.h> |
85 | |
86 | #endif /* _FBXSDK_UTILS_DEFORMATIONS_EVALUATOR_H_ */ |
87 | |