OROCHI
 
Loading...
Searching...
No Matches
GxMotionJoint.h
Go to the documentation of this file.
1//===========================================================================
11//===========================================================================
12#pragma once
13
14GX_MOTION_NAMESPACE_BEGIN()
15
16class GxIkChain;
17
18//===========================================================================
20//===========================================================================
22{
23 //-----------------------------------------------------------
25 //-----------------------------------------------------------
27public:
28 // RTTI宣言
29 GX_RTTI_CLASS(GxMotionJointData, GxClassBase)
30 // NEW,DELETEのオーバーライド
31 GX_OPERATOR_NEW_DELETE_USE_ARRAY(GxAllocatorList::ALLOCATOR_TYPE::UNIT)
32 // 禁止宣言
34
35 // friend宣言
36 friend class GxModUnitMotionBase;
37 friend class GxMotionPlayer;
38 friend class GxModUnitMotionBlend;
39 friend class GxMotionNodeDataReader;
40
42 enum class IK
43 {
44 NO,
45 CHAIN,
46 CHAIN_START = CHAIN,
47 JOINT,
48 CHAIN_MIDDLE = JOINT,
49 EFFECTOR,
50 CHAIN_END = EFFECTOR,
51 EFFECTOR_RIGHT,
52 SKIP_CALCULATE,
53 MAX,
54 };
55#if GX_DEVELOP
57 GX_ENUM_TABLE_MAX(IK)
58#endif //GX_DEVELOP
59
61 //-----------------------------------------------------------
63 //-----------------------------------------------------------
65
69 ~GxMotionJointData(void) override;
70
72 //-----------------------------------------------------------
74 //-----------------------------------------------------------
76
78 GxVector3& computePosition(GxVector3& jointPosition) const;
79
81 //-----------------------------------------------------------
83 //-----------------------------------------------------------
85
87 constexpr GxMotionJointData const* getParent(void) const { return _pParent; }
89 GX_FORCE_INLINE const GxVector3& getStaticTranslate(void) const { return _staticTranslate; }
91 GX_FORCE_INLINE const GxQuaternion& getBasePoseQuaternion(void) const { return _basePoseQuaternion; }
93 GxQuaternion getBasePoseLocalRotate(void) const;
95 GX_FORCE_INLINE const GxVector3 getTranslate(void) const { return _translate; }
97 void setTranslate(GxVector3 const& translate);
99 GX_FORCE_INLINE const GxQuaternion& getRotateQuaternion(void) const { return _rotate; }
101 GX_FORCE_INLINE void setRotateQuaternion(GxQuaternion const& rotate) { GxQuaternion newQua( rotate ); if( newQua._w < 0.f ){ newQua = -newQua;} _rotate = newQua; }
103 GX_FORCE_INLINE const GxVector3& getScale(void) const { return _scale; }
105 GX_FORCE_INLINE void setScale(GxVector3 const& scale) { _scale = scale; }
107 GX_FORCE_INLINE b32 isExistScale(void) const { return _scaleExist;}
109 GX_FORCE_INLINE void setExistScale(b32 scaleExist) { _scaleExist=scaleExist;}
111 constexpr s32 getId(void) const { return _id; }
113 constexpr IK getIkType(void) const { return _ikType; }
115 constexpr GxIkChain const* getIkChain(void) const { return _pIkChain; }
117 constexpr GxIkChain* getIkChain(void) { return _pIkChain; }
118
120 constexpr void getPropertyNonConstParent(void* const pValue) { *static_cast<GxMotionJointData**>(pValue) = const_cast<GxMotionJointData*>(_pParent); }
122 constexpr void setPropertyDummyParent(const void* const /*pValue*/) {}
123
125 //-----------------------------------------------------------
127 //-----------------------------------------------------------
129private:
130 GxQuaternion _basePoseQuaternion;
131 GxQuaternion _rotate;
132 GxVector3 _scale;
133 GxVector3 _translate;
134 GxVector3 _staticTranslate;
135protected:
137private:
138 GxIkChain* _pIkChain;
139 IK _ikType;
140 b32 _scaleExist;
141 s32 _id;
142
144};
145
146//===========================================================================
148//===========================================================================
150{
151 //-----------------------------------------------------------
153 //-----------------------------------------------------------
155public:
156 // RTTI宣言
157 GX_RTTI_CLASS(GxMotionJoint, GxMotionJointData)
158 // NEW,DELETEのオーバーライド
159 GX_OPERATOR_NEW_DELETE_USE_ARRAY(GxAllocatorList::ALLOCATOR_TYPE::UNIT)
160 // 禁止処理
162 // friend宣言
163 friend class GxModUnitMotionBase;
164 friend class GxMotionPlayer;
165 friend class GxModUnitMotionBlend;
166
168 //-----------------------------------------------------------
170 //-----------------------------------------------------------
172
174 GxMotionJoint(void);
176 ~GxMotionJoint(void) override;
177
179 //-----------------------------------------------------------
181 //-----------------------------------------------------------
183
185 GX_FORCE_INLINE const GxMatrixAffine& getMotionMatrix(void) const { return _motionMatrix; }
187 GX_FORCE_INLINE void setMotionMatrix(const GxMatrixAffine& matrix){ _motionMatrix = matrix; }
188
190 GX_FORCE_INLINE GxMotionJoint const* getParent(void) const { return static_cast<GxMotionJoint const*>(Super::getParent()); }
191
193 //-----------------------------------------------------------
195 //-----------------------------------------------------------
197private:
198 GxMatrixAffine _motionMatrix;
199
201};
202
203GX_MOTION_NAMESPACE_END()
#define GX_PROHIBIT_CLASS_BASE(__CLASS__)
GxClassBase継承の禁止宣言
Definition GxBase.h:240
@ MAX
定義数
オブジェクト基底クラス
Definition GxBase.h:88
IKチェイン基礎クラス
Definition GxIkChain.h:20
モーションモジュール基礎クラス
Definition GxModUnitMotionBase.h:19
モーションブレンドシステムの機能を導入するモジュール
Definition GxModUnitMotionBlend.h:18
GxMotionJointのローカルデータだけを保存するクラス
Definition GxMotionJoint.h:22
GxMotionJointData const * _pParent
親ジョイントポインタ
Definition GxMotionJoint.h:136
GX_FORCE_INLINE const GxVector3 & getScale(void) const
スケールを取得
Definition GxMotionJoint.h:103
GX_FORCE_INLINE void setExistScale(b32 scaleExist)
スケールデータが存在するか設定
Definition GxMotionJoint.h:109
GX_FORCE_INLINE const GxQuaternion & getRotateQuaternion(void) const
親ジョイントからの相対角度を取得
Definition GxMotionJoint.h:99
GX_FORCE_INLINE const GxVector3 & getStaticTranslate(void) const
ベースポーズで親ジョイントからの相対座標を取得
Definition GxMotionJoint.h:89
IK
関節IKタイプ
Definition GxMotionJoint.h:43
GX_FORCE_INLINE const GxVector3 getTranslate(void) const
親ジョイントからの相対座標を取得
Definition GxMotionJoint.h:95
constexpr s32 getId(void) const
IDを取得
Definition GxMotionJoint.h:111
constexpr void getPropertyNonConstParent(void *const pValue)
親関節を取得
Definition GxMotionJoint.h:120
GX_FORCE_INLINE b32 isExistScale(void) const
スケールデータが存在するか
Definition GxMotionJoint.h:107
GX_FORCE_INLINE const GxQuaternion & getBasePoseQuaternion(void) const
ベースポーズのワールド回転を取得
Definition GxMotionJoint.h:91
GX_FORCE_INLINE void setScale(GxVector3 const &scale)
スケールを設定
Definition GxMotionJoint.h:105
constexpr GxIkChain const * getIkChain(void) const
IKチェーンアドレスを取得
Definition GxMotionJoint.h:115
constexpr GxMotionJointData const * getParent(void) const
親ジョイントポインタ
Definition GxMotionJoint.h:87
GX_FORCE_INLINE void setRotateQuaternion(GxQuaternion const &rotate)
親ジョイントからの相対角度を設定
Definition GxMotionJoint.h:101
constexpr GxIkChain * getIkChain(void)
IKチェーンアドレスを取得
Definition GxMotionJoint.h:117
constexpr void setPropertyDummyParent(const void *const)
親関節を設定
Definition GxMotionJoint.h:122
constexpr IK getIkType(void) const
IKの種類を取得
Definition GxMotionJoint.h:113
GxMotionが使う関節クラス
Definition GxMotionJoint.h:150
GxMotionJoint(void)
デフォルトコンストラクタ
Definition GxMotionJoint.cpp:183
GX_FORCE_INLINE const GxMatrixAffine & getMotionMatrix(void) const
ルートジョイントに相当するマトリクスを取得
Definition GxMotionJoint.h:185
~GxMotionJoint(void) override
デストラクタ
Definition GxMotionJoint.cpp:191
GX_FORCE_INLINE GxMotionJoint const * getParent(void) const
親ジョイントポインタ
Definition GxMotionJoint.h:190
GX_FORCE_INLINE void setMotionMatrix(const GxMatrixAffine &matrix)
ルートジョイントに相当するマトリクスを設定
Definition GxMotionJoint.h:187
モーション再生クラス
Definition GxMotionPlayer.h:22
アフィン変換行列(行優先)
Definition GxMatrix.h:330
クォータニオン
Definition GxQuaternion.h:19
f32 _w
W値
Definition GxQuaternion.h:275
3次元ベクトル
Definition GxVector.h:245
32bitブーリアン
Definition GxDefine.h:173