OROCHI
 
Loading...
Searching...
No Matches
GxMotionCurvesContainer.h
1//===========================================================================
9//===========================================================================
10#pragma once
11
12class KeyCache;
13
14GX_MOTION_NAMESPACE_BEGIN()
15
16//===========================================================================
18//===========================================================================
20{
21 //-----------------------------------------------------------
23 //-----------------------------------------------------------
25public:
26 // RTTI
27 GX_RTTI_ABSTRACT_CLASS(GxMotionCurvesContainer, GxClassBase)
28 // NEW,DELETEのオーバーライド
29 GX_OPERATOR_NEW_DELETE_USE_ARRAY(GxAllocatorList::ALLOCATOR_TYPE::UNIT);
30 // GxClassBase継承クラス用禁止宣言
32
33
34 //-----------------------------------------------------------
36 //-----------------------------------------------------------
38public:
42 ~GxMotionCurvesContainer(void) override {}
44 virtual b32 initialize(const void* pAddress, const u32 jointCount) = 0;
45
47 //-----------------------------------------------------------
49 //-----------------------------------------------------------
51public:
53 constexpr f32 getFrame(void) const { return _frame; }
55 virtual void setFrame(f32 frame) = 0;
57 virtual f32 getMotionRotateY(void) = 0;
59 virtual f32 getMotionTranslateY(void) = 0;
60
62 //-----------------------------------------------------------
64 //-----------------------------------------------------------
66protected:
68 f32 _frame;
69
71};
72
73//===========================================================================
75//memo: 旧リソースとの互換用
76//===========================================================================
78{
79 //-----------------------------------------------------------
81 //-----------------------------------------------------------
83public:
84 // RTTI
86 // NEW,DELETEのオーバーライド
87 GX_OPERATOR_NEW_DELETE_USE_ARRAY(GxAllocatorList::ALLOCATOR_TYPE::UNIT);
88 // GxClassBase継承クラス用禁止宣言
91
92 static const f32 FLOAT_MAX;
94 static constexpr u32 MOTION_DATA_COMPONENT_COUNT = 3;
110 enum class MOTION_DATA
111 {
112 LOCATOR_ROTATE_Y = 0,
114 };
115
117 static const f32 STATIC_VALUE_TABLE[static_cast<s32>(FUNCTION_CURVE::STATIC_DATA)];
118
121 {
122 //-----------------------------------------------------------
124 //-----------------------------------------------------------
126 public:
127 // RTTI宣言
128 GX_RTTI_CLASS(GxMotionCurve, GxClassBase)
129 // NEW,DELETEのオーバーライド
130 GX_OPERATOR_NEW_DELETE_USE_ARRAY(GxAllocatorList::ALLOCATOR_TYPE::UNIT)
131
132
133 //-----------------------------------------------------------
135 //-----------------------------------------------------------
137
139 GxMotionCurve(void);
140
142 //-----------------------------------------------------------
144 //-----------------------------------------------------------
146
148 void getCurveValue(void* pValue, u32 index);
150 void getCurveSlope(void* pValue, u32 index);
152 void getCurveKeyFrame(void* pValue, u32 index);
160 void setDummyCount(u32){}
162 constexpr void setDummyValue(const void*, u32){}
163
165 //-----------------------------------------------------------
167 //-----------------------------------------------------------
169
173 f32 const* _pValuesArray;
174 void const* _pKeyFramesArray;
175
177 };
178
180 //-----------------------------------------------------------
182 //-----------------------------------------------------------
184public:
188 ~GxMotionCurvesContainerEuler(void) override;
190 b32 initialize(const void* pAddress, const u32 jointCount) override;
191private:
193 void clearKey(void);
194
196 //-----------------------------------------------------------
198 //-----------------------------------------------------------
200public:
202 void setFrame (f32 frame) override;
204 constexpr void setFrameWithoutComputeCurves(f32 frame){ _frame = frame; }
206 constexpr f32 const* getCurrentValuesArray(void) const { return _pMotionCurvesCurrentValuesArray; }
208 GX_FORCE_INLINE f32 getMotionRotateY(void) override { return _pMotionCurvesCurrentValuesArray[static_cast<s32>(MOTION_DATA::LOCATOR_ROTATE_Y)];}
210 GX_FORCE_INLINE f32 getMotionTranslateY(void) override { return _pMotionCurvesCurrentValuesArray[static_cast<s32>(MOTION_DATA::LOCATOR_TRANSLATE_Y)];}
212 constexpr s32 getFunctionCurveCount(void) const { return _functionCurveCount; }
213private:
215 constexpr f32 getFrameMax(void) const { return static_cast<f32>(_frameCount) - 1.f; }
217 void computeCurvesValuesBegin(void);
219 void computeCurvesValuesEnd(s32 end = 0);
221 template<typename T>
222 b32 computeCurvesValues(f32 frame, s32 end = 0);
224 b32 computeCurvesValues(f32 frame, s32 end = 0);
225
227 //-----------------------------------------------------------
229 //-----------------------------------------------------------
231private:
232 GxMotionCurve* _pMotionCurvesArray;
233 s32 _functionCurveCount;
234 u16 _frameCount;
235
237};
238
239class jointCache;
242{
243 //-----------------------------------------------------------
245 //-----------------------------------------------------------
247public:
248 GX_OPERATOR_NEW_DELETE(GxAllocatorList::ALLOCATOR_TYPE::UNIT);
249
251 //-----------------------------------------------------------
253 //-----------------------------------------------------------
255
257 MotionCache(void) : _pJointCache(nullptr), _jointCount(0){}
259 ~MotionCache(void);
261 void initialize(u32 jointCount);
263 void release(void);
264
266 //-----------------------------------------------------------
268 //-----------------------------------------------------------
270
272 void setFrame(u32 jointIndex, u32 frame);
274 u32 getFrame(u32 jointIndex);
276 jointCache* getJointCache(u32 jointIndex);
278 KeyCache* getKeyCache(u32 jointIndex, u32 channelIndex);
279
281 //-----------------------------------------------------------
283 //-----------------------------------------------------------
285private:
286 jointCache* _pJointCache;
287 u32 _jointCount;
288
290};
291
292//===========================================================================
294//memo: 新しく作成するモーションは必ずこちらのモジュールを利用してください
295//===========================================================================
297{
298 //-----------------------------------------------------------
300 //-----------------------------------------------------------
302public:
303 // RTTI
305 // NEW,DELETEのオーバーライド
306 GX_OPERATOR_NEW_DELETE_USE_ARRAY(GxAllocatorList::ALLOCATOR_TYPE::UNIT);
307 // GxClassBase継承クラス用禁止宣言
309
310
311 static constexpr u32 NUM_CHANNEL = 10;
313 static constexpr u32 NUM_CHANNEL_ROTATE = 4;
314
324
326 //-----------------------------------------------------------
328 //-----------------------------------------------------------
330public:
336 b32 initialize(const void* pAddress, const u32 jointCount) override;
338 b32 initialize(const void* pAddress, const u32 jointCount, const DECODE_TYPE decodeType, b32 enableInterporation = true);
339#if GX_DEVELOP
341 void checkUncompress(const void* pAddress, const u32 jointCount, const b32 uncompressNow);
342#endif // GX_DEVELOP
343
345 //-----------------------------------------------------------
347 //-----------------------------------------------------------
349public:
351 void setFrame(f32 frame) override;
353 b32 computeCurvesValues(s32 jointIndex, u32 jointCount, GxVector3& translate, GxQuaternion& quaternion, GxVector3& scale);
355 f32 getMotionRotateY(void) override;
357 f32 getMotionTranslateY(void) override;
360private:
362 f32 getCurvesValue(s32 jointIndex,u32 channelIndex,f32 frame) const;
364 f32 getCurvesValueRotate(s32 jointIndex, u32 axis, f32 frame) const;
366 f32 getCurvesValue(f32* pJointValues, u32 channelIndex, f32 frame) const;
367
368 //メモリ使わないバージョン
370 f32 getCurvesValueRotateWithoutDecode(s32 jointIndex, u32 axis, f32 frame) const;
372 f32 getCurvesValueWithoutDecode( s32 jointIndex,u32 channelIndex,f32 frame, b32 cache);
374 void getQuaternionValueWithoutDecode(s32 jointIndex, f32 frame, f32 quaternion[4], b32 cache);
375
377 void uncompressJoint(s32 targetJointIndex, u32*& pAddressU32, u32& index, f32* pUncompressedData);
379 void uncompressJointFrame(s32 targetJointIndex, u32 frame0, u32 frame1, f32* pUncompressedData, b32 skipsRotation = false);
381 void initializeCache(u32 jointCount, u32* pAddress);
382
384 //-----------------------------------------------------------
386 //-----------------------------------------------------------
388private:
389 s32 _keyCount;
390 u16 _frameCount;
391
392 DECODE_TYPE _decodeType;
393 u32** _ppMotionRawDataStart;
394 f32* _pJointValues;
395 f32* _pValuesRotate;
396 f32* _pDataStw[3];
397 b32 _enableLinearInterpolation;
398 MotionCache _cache;
399
401};
402
403GX_MOTION_NAMESPACE_END()
#define GX_PROHIBIT_CLASS_BASE(__CLASS__)
GxClassBase継承の禁止宣言
Definition GxBase.h:240
オブジェクト基底クラス
Definition GxBase.h:88
モーションの曲線関数を管理するクラス(オイラーベース)
Definition GxMotionCurvesContainer.h:78
MOTION_DATA
GMPファイル中のデータアクセス用定義
Definition GxMotionCurvesContainer.h:111
@ LOCATOR_ROTATE_Y
モーションデータの始めはrot_yの角度
GX_FORCE_INLINE f32 getMotionTranslateY(void) override
rot_y関節の移動値を取得
Definition GxMotionCurvesContainer.h:210
GX_FORCE_INLINE f32 getMotionRotateY(void) override
rot_y関節の回転値を取得
Definition GxMotionCurvesContainer.h:208
~GxMotionCurvesContainerEuler(void) override
デストラクタ
Definition GxMotionCurvesContainer.cpp:112
constexpr f32 const * getCurrentValuesArray(void) const
格カーブの現在の値の行列を取得
Definition GxMotionCurvesContainer.h:206
void setFrame(f32 frame) override
現在のフレームを設定
Definition GxMotionCurvesContainer.cpp:277
FUNCTION_CURVE
曲線関数の種類
Definition GxMotionCurvesContainer.h:97
@ SPLINE_EXIST
データカーブがあるカーブ
@ STATIC_BASEPOSE
ベースポーズと同じのカーブ
@ SPLINE_DATA
値のカーブデータもスロープデータもあるカーブ
@ SPLINE_SLOPE_0
値のカーブデータがあるが、スロープデータがないカーブ
constexpr void setFrameWithoutComputeCurves(f32 frame)
現在のフレームを設定(カーブ情報の再計算は行いません)
Definition GxMotionCurvesContainer.h:204
static const f32 STATIC_VALUE_TABLE[static_cast< s32 >(FUNCTION_CURVE::STATIC_DATA)]
静的値テーブル
Definition GxMotionCurvesContainer.h:90
GxMotionCurvesContainerEuler(void)
デフォルトコンストラクタ
Definition GxMotionCurvesContainer.cpp:102
static const f32 FLOAT_MAX
固定値:GxModMotionDataPlayerに、ベースポーズを使いたいと伝えたい時
Definition GxMotionCurvesContainer.h:92
b32 initialize(const void *pAddress, const u32 jointCount) override
初期化
Definition GxMotionCurvesContainer.cpp:127
static constexpr u32 MOTION_DATA_COMPONENT_COUNT
モーションデータ種類の数:スケール+回転+位置
Definition GxMotionCurvesContainer.h:94
constexpr s32 getFunctionCurveCount(void) const
カーブ数を取得
Definition GxMotionCurvesContainer.h:212
モーションの曲線関数を管理するクラス(インターフェイス)
Definition GxMotionCurvesContainer.h:20
f32 * _pMotionCurvesCurrentValuesArray
各カーブの現在の値の行列
Definition GxMotionCurvesContainer.h:67
f32 _frame
現在のフレーム
Definition GxMotionCurvesContainer.h:68
virtual f32 getMotionRotateY(void)=0
rot_y関節の回転値を取得
virtual b32 initialize(const void *pAddress, const u32 jointCount)=0
初期化
constexpr f32 getFrame(void) const
現在のフレームを取得
Definition GxMotionCurvesContainer.h:53
virtual void setFrame(f32 frame)=0
現在のフレームを設定
~GxMotionCurvesContainer(void) override
デストラクタ
Definition GxMotionCurvesContainer.h:42
virtual f32 getMotionTranslateY(void)=0
rot_y関節の移動値を取得
モーションの曲線関数を管理するクラス(クォータニオンベース)
Definition GxMotionCurvesContainer.h:297
~GxMotionCurvesContainerQuaternion(void) override
デストラクタ
Definition GxMotionCurvesContainer.cpp:503
b32 computeCurvesValues(s32 jointIndex, u32 jointCount, GxVector3 &translate, GxQuaternion &quaternion, GxVector3 &scale)
各チャンネルの現フレームの値を計算し_pMotionCurvesCurrentValuesArray行列に保存
Definition GxMotionCurvesContainer.cpp:1193
b32 initialize(const void *pAddress, const u32 jointCount) override
初期化(旧型式との互換性のため)
Definition GxMotionCurvesContainer.cpp:520
void setEnableLinearInterpolation(b32 enable)
フレーム間線形補間の有効設定
Definition GxMotionCurvesContainer.cpp:981
f32 getMotionTranslateY(void) override
rot_y関節の移動値を取得
Definition GxMotionCurvesContainer.cpp:1132
GxMotionCurvesContainerQuaternion(void)
デフォルトコンストラクタ
Definition GxMotionCurvesContainer.cpp:486
void setFrame(f32 frame) override
現在のフレームを設定
Definition GxMotionCurvesContainer.cpp:972
static constexpr u32 NUM_CHANNEL
transXYZ・rotateXYZW・scaleXYZ
Definition GxMotionCurvesContainer.h:311
static constexpr u32 NUM_CHANNEL_ROTATE
rotateXYZW
Definition GxMotionCurvesContainer.h:313
f32 getMotionRotateY(void) override
rot_y関節の回転値を取得
Definition GxMotionCurvesContainer.cpp:1044
DECODE_TYPE
モーションデータ展開のタイプ
Definition GxMotionCurvesContainer.h:317
@ INITIALIZE_WITHOUT_DECODE
INIT_NONEでのデコード用の一時バッファーを使わない実装
@ INITIALIZE_NONE
メモリ小、計算大。毎フレーム展開。
@ INITIALIZE_WITHOUT_DECODE_CACHE
INIT_NONEでのデコード用の一時バッファーを使わない実装
@ INITIALIZE_ROTATE
メモリ中、計算中。initialize()でrotateのみ展開。
@ INITIALIZE_ALL
メモリ大、計算小。initialize()ですべて展開。
キーキャッシュクラス
Definition GxMotionEncoder.h:21
モーションキャッシュクラス
Definition GxMotionCurvesContainer.h:242
void initialize(u32 jointCount)
初期化
Definition GxMotionCurvesContainer.cpp:1479
KeyCache * getKeyCache(u32 jointIndex, u32 channelIndex)
キーキャッシュを取得
Definition GxMotionCurvesContainer.cpp:1501
void release(void)
解放処理
Definition GxMotionCurvesContainer.cpp:1459
~MotionCache(void)
デストラクタ
Definition GxMotionCurvesContainer.cpp:1470
jointCache * getJointCache(u32 jointIndex)
関節キャッシュを取得
Definition GxMotionCurvesContainer.cpp:1490
void setFrame(u32 jointIndex, u32 frame)
フレームを設定
Definition GxMotionCurvesContainer.cpp:1450
u32 getFrame(u32 jointIndex)
フレームを取得
Definition GxMotionCurvesContainer.cpp:1439
MotionCache(void)
デフォルトコンストラクタ
Definition GxMotionCurvesContainer.h:257
関節情報のキャッシュ
Definition GxMotionCurvesContainer.cpp:18
モーションカーブクラス
Definition GxMotionCurvesContainer.h:121
void const * _pKeyFramesArray
キーフレームの行列 - X-values (some keyFrames might have been skipped) [if(_frameCount)<256 _pKeyFramesArray i...
Definition GxMotionCurvesContainer.h:174
f32 const * _pValuesArray
値の行列(_frameCountが256を超える場合はu16、超えない場合はu8) - Y-values - contains also slopes if _kind == FUNCTION_CURV...
Definition GxMotionCurvesContainer.h:173
void getCurveSlope(void *pValue, u32 index)
カーブスロープを取得
void setDummyCount(u32)
ダミー数を設定
Definition GxMotionCurvesContainer.h:160
void getCurveKeyFrame(void *pValue, u32 index)
カーブキーフレームを取得
u32 getCurveSlopeCount(void)
カーブスロープ数を取得
s32 _keyFramesCount
キーフレーム数(最初beginValueと最後endValueフレームを除く)
Definition GxMotionCurvesContainer.h:171
GxMotionCurve(void)
デフォルトコンストラクタ
Definition GxMotionCurvesContainer.cpp:67
FUNCTION_CURVE _kind
カーブ種類
Definition GxMotionCurvesContainer.h:170
void getCurveValue(void *pValue, u32 index)
カーブ値を取得
constexpr void setDummyValue(const void *, u32)
ダミー値を設定
Definition GxMotionCurvesContainer.h:162
s32 _currentKeyFrame
現在のキーフレーム - (reset to 0 in GxMotionCurvesContainer::initialize, used to keep track of previous value,...
Definition GxMotionCurvesContainer.h:172
u32 getCurveKeyFrameCount(void)
カーブキーフレーム数を取得
u32 getCurveValueCount(void)
カーブ値数を取得
クォータニオン
Definition GxQuaternion.h:19
3次元ベクトル
Definition GxVector.h:245
32bitブーリアン
Definition GxDefine.h:173