16#define RESOURCE_BODY_DATA GxResRagdoll::GxRagdollBodyData
17#define RESOURCE_JOINT_DATA GxResRagdoll::GxRagdollJointData
19GX_UTILITY_NAMESPACE_BEGIN()
37class GxToolRagdoll : public GxToolResourceEditBase
52 RAGDOLL_TOOL_POSITION_X = 40,
53 RAGDOLL_TOOL_POSITION_Y = 2,
54 RAGDOLL_TOOL_WIDTH = 400,
55 RAGDOLL_TOOL_HEIGHT = 720 - RAGDOLL_TOOL_POSITION_Y * 2,
56 RAGDOLL_TOOL_SPLIT_Y = 136,
57 TOOL_DATA_FORM_SPLIT_X = 196,
58 MODEL_DATA_FORM_SPLIT_Y = 52,
59 RAGDOLL_DATA_FORM_SPLIT_X = 196,
60 RAGDOLL_DATA_FORM_TAB_H = 36,
61 BODY_FORM_SPLIT_X = TOOL_DATA_FORM_SPLIT_X,
62 BODY_FORM_SPLIT_Y = 56,
63 JOINT_FORM_SPLIT_Y = 52,
71 GTR_TOOL_FLAG_RENDER = ( 1 << 0 ),
72 GTR_TOOL_FLAG_RENDER_BODY_DATA = ( 1 << 1 ),
73 GTR_TOOL_FLAG_RENDER_ONLY_SELECTED_BODY_DATA = ( 1 << 2 ),
74 GTR_TOOL_FLAG_RENDER_JOINT_DATA = ( 1 << 3 ),
75 GTR_TOOL_FLAG_RENDER_ONLY_SELECTED_JOINT_DATA = ( 1 << 4 ),
76 GTR_TOOL_FLAG_RENDER_JOINT_CONE = ( 1 << 5 ),
77 GTR_TOOL_FLAG_RENDER_JOINT_CONE_TO_FAN = ( 1 << 6 ),
79 GTR_TOOL_FLAG_DEFAULT = ( GTR_TOOL_FLAG_RENDER | GTR_TOOL_FLAG_RENDER_BODY_DATA | GTR_TOOL_FLAG_RENDER_JOINT_DATA | GTR_TOOL_FLAG_RENDER_JOINT_CONE )
83 class GxFormRagdollData;
96 b32 initialize(
void)
override;
98 void cleanup(
void)
override;
107 void update(
void)
override;
109 void setResource(
GxResBase* pResrouce)
override;
112 void setResourceModel(
GxResModel* pResourceModel);
117 void createUnitRagdoll(
void);
119 virtual const GxRtti & getCreateModelRtti(
void);
122 void renderRagdollData(
void);
125 void resetModel(
void);
128 void createBody(
void);
130 void deleteBody(
void);
132 virtual void initializeBody(RESOURCE_BODY_DATA* pBodyData);
135 void createJoint(
void);
137 void deleteJoint(
void);
139 virtual void initializeJoint(RESOURCE_JOINT_DATA* pJointData);
148 constexpr void getPropertyResourceModel(
void*
const pValue) { *
static_cast<GxResModel**
>(pValue) = _pResourceModel; }
150 GX_FORCE_INLINE
void setPropertyResourceModel(
const void*
const pValue) {
auto* pResourceModel = *
static_cast<GxResModel**
>(
const_cast<void*
>(pValue)); setResourceModel( pResourceModel ); }
153 constexpr void getPropertyResourceMotion(
void*
const pValue) { *
static_cast<GxResMotionPackage**
>(pValue) = _pResourceMotion; }
155 GX_FORCE_INLINE
void setPropertyResourceMotion(
const void*
const pValue) {
auto* pResourceMotion = *
static_cast<GxResMotionPackage**
>(
const_cast<void*
>(pValue)); setResourceMotion( pResourceMotion ); }
166 GX_FORCE_INLINE
void getPropertyUsesDataCommon(
void*
const pValue) { *
static_cast<b32*
>(pValue) = getResourceRagdollXml() ? getResourceRagdollXml()->isUsesDataCommon() :
static_cast<const GxResRagdollXml*
>(GxResRagdollXml::GX_RTTI.getDefaultObject())->isUsesDataCommon(); }
168 void setPropertyUsesDataCommon(
const void*
const pValue);
170 void setPropertyUsesDataCommonOk(
b32 value);
173 GX_FORCE_INLINE
void getPropertyCalcsMassAuto(
void*
const pValue) { *
static_cast<b32*
>(pValue) = getResourceRagdollXml() ? getResourceRagdollXml()->isCalcsMassAuto() :
static_cast<const GxResRagdollXml*
>(GxResRagdollXml::GX_RTTI.getDefaultObject())->isCalcsMassAuto(); }
175 void setPropertyCalcsMassAuto(
const void*
const pValue);
177 void setPropertyCalcsMassAutoOk(
b32 value);
180 void setPropertyCancel(
void){}
183 constexpr void getPropertyMass(
void*
const pValue){ *
static_cast<f32*
>(pValue) = _massTotal; }
185 constexpr void getPropertyFriction(
void*
const pValue){ *
static_cast<f32*
>(pValue) = _friction; }
187 constexpr void getPropertyDeactivationTime(
void*
const pValue){ *
static_cast<f32*
>(pValue) = _deactivationTime; }
189 constexpr void getPropertyLinearDamping(
void*
const pValue){ *
static_cast<f32*
>(pValue) = _linearDamping; }
191 constexpr void getPropertyAngularDamping(
void*
const pValue){ *
static_cast<f32*
>(pValue) = _angularDamping; }
193 constexpr void getPropertyLinearVelocityThreshold(
void*
const pValue){ *
static_cast<f32*
>(pValue) = _linearVelocityThreshold; }
195 constexpr void getPropertyAngularVelocityThreshold(
void*
const pValue){ *
static_cast<f32*
>(pValue) = _angularVelocityThreshold; }
197 void setPropertyMass(
const void*
const pValue);
199 void setPropertyFriction(
const void*
const pValue);
201 void setPropertyDeactivationTime(
const void*
const pValue);
203 void setPropertyLinearDamping(
const void*
const pValue);
205 void setPropertyAngularDamping(
const void*
const pValue);
207 void setPropertyLinearVelocityThreshold(
const void*
const pValue);
209 void setPropertyAngularVelocityThreshold(
const void*
const pValue);
215 void calculateMassAuto(f32 massTotal);
217 void getMassAuto(u32 bodyCount, f32 massTotal, f32* pMass);
219 void updateMassTotal(
void);
235 constexpr GxResRagdollXml* getResourceRagdollXml(
void) {
return static_cast<GxResRagdollXml*
>(getResource()); }
237 GX_FORCE_INLINE
const GxResRagdollXml* getResourceRagdollXml(
void)
const {
return static_cast<const GxResRagdollXml*
>(getResource()); }
240 constexpr GxUnitRagdoll* getUnitRagdoll(
void)
const {
return _pUnitRagdoll; }
243 constexpr RESOURCE_BODY_DATA* getBodyDataCurrent(
void)
const {
return _pBodyDataCurrent; }
245 constexpr void setBodyDataCurrent(RESOURCE_BODY_DATA* pBodyData) { _pBodyDataCurrent = pBodyData; }
248 constexpr RESOURCE_JOINT_DATA* getJointDataCurrent(
void)
const {
return _pJointDataCurrent; }
250 constexpr void setJointDataCurrent(RESOURCE_JOINT_DATA * pJointData) { _pJointDataCurrent = pJointData; }
253 GX_FORCE_INLINE
b32 isToolDebugRendering(
void)
const {
return isDataRendering(); }
255 GX_FORCE_INLINE
void setToolDebugRendering(
b32 on) { ( _isToolDebugRendering = on) ? ( _toolFlag |= GTR_TOOL_FLAG_RENDER ) : ( _toolFlag &= ~GTR_TOOL_FLAG_RENDER ); }
258 GX_FORCE_INLINE
b32 isDataRendering(
void)
const {
return ( _toolFlag & GTR_TOOL_FLAG_RENDER ) ? true :
false; }
260 GX_FORCE_INLINE
b32 isBodyDataRendering(
void)
const {
return ( _toolFlag & GTR_TOOL_FLAG_RENDER_BODY_DATA ) ? true :
false; }
262 GX_FORCE_INLINE
b32 isSelectedBodyDataRendering(
void)
const {
return ( _toolFlag & GTR_TOOL_FLAG_RENDER_ONLY_SELECTED_BODY_DATA ) ? true :
false; }
264 GX_FORCE_INLINE
b32 isJointDataRendering(
void)
const {
return ( _toolFlag & GTR_TOOL_FLAG_RENDER_JOINT_DATA ) ? true :
false; }
266 GX_FORCE_INLINE
b32 isSelectedJointDataRendering(
void)
const {
return ( _toolFlag & GTR_TOOL_FLAG_RENDER_ONLY_SELECTED_JOINT_DATA ) ? true :
false; }
268 GX_FORCE_INLINE
b32 isJointConeRendering(
void)
const {
return ( _toolFlag & GTR_TOOL_FLAG_RENDER_JOINT_CONE ) ? true :
false; }
270 GX_FORCE_INLINE
b32 isJointConeToFanRendering(
void)
const {
return ( _toolFlag & GTR_TOOL_FLAG_RENDER_JOINT_CONE_TO_FAN ) ? true :
false; }
278 GxGuiSplitter* _pSplitter;
279 GxFormToolData* _pFormToolData;
280 GxFormRagdollData* _pFormRagdollData;
281 GxUnitRagdoll* _pUnitRagdoll;
285 RESOURCE_BODY_DATA* _pBodyDataCurrent;
286 RESOURCE_JOINT_DATA* _pJointDataCurrent;
288 b32 _isToolDebugRendering;
293 f32 _deactivationTime;
296 f32 _linearVelocityThreshold;
297 f32 _angularVelocityThreshold;
317class GxToolRagdoll::GxFormToolData :
public GxGuiForm
325 GX_RTTI_CLASS(GxToolRagdoll::GxFormToolData, GxGuiForm);
336 GxFormToolData(
void) : _pSplitter(nullptr), _pFormModelData(nullptr), _pFormMotionData(nullptr), _pFormButton(nullptr), _pTool(nullptr){}
338 GxFormToolData(GxToolRagdoll * pTool);
341 b32 initialize(
void)
override;
350 void onSize(
const GxSize& size)
override;
353 void testRagdoll(
void);
355 void testRigidBody(
void);
357 void testJoint(
void);
360 void toggleModuleDebugRendering(
void);
363 GX_FORCE_INLINE
void toggleToolDebugRendering(
void) { _pTool->setToolDebugRendering( ! _pTool->isToolDebugRendering() ); }
375 void setPropertyTableFormModelData(GxToolRagdoll::GxUnitRagdoll* pUnitRagdoll);
377 void setPropertyTableFormMotionData(GxToolRagdoll::GxUnitRagdoll* pUnitRagdoll);
379 void setPropertyTableFormButton(
b32 isRagdoll);
382 constexpr GxResRagdollXml* getResourceRagdollXml(
void) {
return static_cast<GxResRagdollXml*
>(_pTool->getResource()); }
384 GX_FORCE_INLINE
const GxResRagdollXml* getResourceRagdollXml(
void)
const {
return static_cast<GxResRagdollXml*
>(_pTool->getResource()); }
387 constexpr GxUnitRagdoll* getUnitRagdoll(
void)
const {
return _pTool->getUnitRagdoll(); }
390 constexpr RESOURCE_BODY_DATA* getBodyDataCurrent(
void)
const {
return _pTool->getBodyDataCurrent(); }
392 constexpr void setBodyDataCurrent(RESOURCE_BODY_DATA * pBodyData){
return _pTool->setBodyDataCurrent( pBodyData ); }
395 constexpr RESOURCE_JOINT_DATA* getJointDataCurrent(
void)
const {
return _pTool->getJointDataCurrent(); }
397 constexpr void setJointDataCurrent(RESOURCE_JOINT_DATA * pJointData){
return _pTool->setJointDataCurrent( pJointData ); }
405 GxGuiSplitter* _pSplitter;
406 GxGuiFormProperty* _pFormModelData;
407 GxGuiFormProperty* _pFormMotionData;
408 GxGuiFormProperty* _pFormButton;
409 GxToolRagdoll* _pTool;
430class GxToolRagdoll::GxFormRagdollData :
public GxGuiForm
438 GX_RTTI_CLASS(GxToolRagdoll::GxFormRagdollData, GxGuiForm);
452 GxFormRagdollData(
void) : _pTool(nullptr){}
454 GxFormRagdollData(GxToolRagdoll* pTool);
457 b32 initialize(
void)
override;
466 void onSize(
const GxSize& size)
override;
475 constexpr GxResRagdollXml* getResourceRagdollXml(
void) {
return static_cast<GxResRagdollXml*
>(_pTool->getResource()); }
477 GX_FORCE_INLINE
const GxResRagdollXml* getResourceRagdollXml(
void)
const {
return static_cast<GxResRagdollXml*
>(_pTool->getResource()); }
485 GxToolRagdoll* _pTool;
514class GxToolRagdoll::GxFormRagdollData::GxFormBody :
public GxGuiForm
522 GX_RTTI_CLASS(GxToolRagdoll::GxFormRagdollData::GxFormBody, GxGuiForm);
533 GxFormBody(
void) : _pSplitter(nullptr), _pFormBodyData(nullptr), _pTool(nullptr){}
535 GxFormBody(GxToolRagdoll* pTool);
538 b32 initialize(
void)
override;
547 void update(
void)
override;
549 void onSize(
const GxSize& size)
override;
558 constexpr void getBodyCount(
void*
const pValue) { *(
static_cast<u32*
>(pValue)) = getResourceRagdollXml()->getBodyDataCount(); }
560 constexpr void setBodyCount(
const void*
const ) {}
563 constexpr void getBodyIndex(
void*
const pValue) { *(
static_cast<u32*
>(pValue)) = _bodyIndex; }
569 void setBodyIndex(
const void*
const pValue);
572 void setPropertyTableFormBodyData(
void);
578 void setPropertyTableFormBodyDataDetail(
GxPropertyTable& referenceOutputPropertyTable);
580 void setPropertyTableFormBodyDataCommon(
void);
583 void getJointName(
void*
const pValue);
585 constexpr void setJointName(
const void*
const ) {}
588 constexpr GxResRagdollXml* getResourceRagdollXml(
void) {
return static_cast<GxResRagdollXml*
>(_pTool->getResource()); }
590 GX_FORCE_INLINE
const GxResRagdollXml* getResourceRagdollXml(
void)
const {
return static_cast<GxResRagdollXml*
>(_pTool->getResource()); }
593 constexpr GxUnitRagdoll* getUnitRagdoll(
void)
const {
return _pTool->getUnitRagdoll(); }
596 constexpr u32 getBodyCount(
void)
const {
return getResourceRagdollXml()->getBodyDataCount(); }
599 constexpr u32 getBodyIndex(
void)
const {
return _bodyIndex; }
601 constexpr void setBodyIndex(u32 index) { _bodyIndex = index; }
604 constexpr RESOURCE_BODY_DATA* getBodyDataCurrent(
void)
const {
return _pTool->getBodyDataCurrent(); }
606 constexpr void setBodyDataCurrent(RESOURCE_BODY_DATA* pBodyData) {
return _pTool->setBodyDataCurrent( pBodyData ); }
609 b32 reloadGuiBodyTable(
void);
617 GxGuiSplitter* _pSplitter;
618 GxGuiFormProperty* _pFormBodyData;
619 GxGuiFormProperty* _pFormBodyDataCommon;
620 GxToolRagdoll* _pTool;
622 GxGuiPropertyTable* _pGuiBodyTable;
647class GxToolRagdoll::GxFormRagdollData::GxFormJoint :
public GxGuiForm
655 GX_RTTI_CLASS(GxToolRagdoll::GxFormRagdollData::GxFormJoint, GxGuiForm);
666 GxFormJoint(
void) : _pSplitter(nullptr), _pFormJointData(nullptr), _pTool(nullptr){}
668 GxFormJoint(GxToolRagdoll* pTool);
671 b32 initialize(
void)
override;
680 void update(
void)
override;
682 void onSize(
const GxSize& size)
override;
691 constexpr void getJointCount(
void*
const pValue) { *(
static_cast<u32*
>(pValue)) = getResourceRagdollXml()->getJointDataCount(); }
693 constexpr void setJointCount(
const void*
const ) {}
696 constexpr void getJointIndex(
void*
const pValue) { *(
static_cast<u32*
>(pValue)) = _jointIndex; }
702 void setJointIndex(
const void*
const pValue);
705 void setPropertyTableFormJointData(
void);
712 void setPropertyTableFormJointDataDetail(
GxPropertyTable& referenceOutputPropertyTable);
715 void setOffsetBody0(
void);
717 void setOffsetBody1(
void);
719 void setOffsetBody(u32 bodyIndex);
722 b32 reloadGuiJointTable(
void);
731 constexpr GxResRagdollXml* getResourceRagdollXml(
void) {
return static_cast<GxResRagdollXml*
>(_pTool->getResource()); }
733 GX_FORCE_INLINE
const GxResRagdollXml* getResourceRagdollXml(
void)
const {
return static_cast<const GxResRagdollXml*
>(_pTool->getResource()); }
736 constexpr GxUnitRagdoll* getUnitRagdoll(
void)
const {
return _pTool->getUnitRagdoll(); }
739 constexpr u32 getJointCount(
void)
const {
return getResourceRagdollXml()->getJointDataCount(); }
742 constexpr u32 getJointIndex(
void)
const {
return _jointIndex; }
744 constexpr void setJointIndex(u32 index) { _jointIndex = index; }
747 constexpr RESOURCE_JOINT_DATA* getJointDataCurrent(
void)
const {
return _pTool->getJointDataCurrent(); }
749 constexpr void setJointDataCurrent(RESOURCE_JOINT_DATA* pJointData) { _pTool->setJointDataCurrent( pJointData ); }
757 GxGuiSplitter* _pSplitter;
758 GxGuiFormProperty* _pFormJointData;
759 GxToolRagdoll* _pTool;
761 b32 _isHingePropertyRendering;
762 GxGuiPropertyTable* _pGuiJointTable;
770class GxToolRagdoll::GxUnitRagdoll :
public GxUnitModel
778 GX_RTTI_CLASS(GxToolRagdoll::GxUnitRagdoll,
GxUnitModel);
789 ~GxUnitRagdoll(
void)
override;
801 void setupRagdoll(GxResRagdollXml* pResourceXml);
805 virtual void ragdollCallback(
void);
807 void developRender(
void)
override;
814 constexpr GxMotionPlayer* getMotion(
void)
const {
return _pMotion; }
831GX_UTILITY_NAMESPACE_END()
#define GX_PROHIBIT_CLASS_BASE_REFERENCE(__CLASS__)
GxClassBaseReference継承の禁止宣言(new以外の生成禁止 + コピー禁止)
Definition GxBase.h:244
void GxTypedObject
その他
Definition GxDefine.h:213
モーション再生クラス
Definition GxMotionPlayer.h:22
プロパティクラス
Definition GxProperty.h:48
プロパティテーブルクラス
Definition GxProperty.h:1641
リソース基底クラス
Definition GxResBase.h:23
モデルリソースクラス
Definition GxResModel.h:20
モーションパッケージリソース
Definition GxResMotionPackage.h:20
剛体データクラス
Definition GxResRagdoll.h:35
f32 _angularDamping
角速度の減衰
Definition GxResRagdoll.h:60
f32 _linearDamping
線形速度の減衰
Definition GxResRagdoll.h:58
f32 _friction
摩擦係数
Definition GxResRagdoll.h:56
f32 _angularVelocityThreshold
角速度の非アクティブ化閾値
Definition GxResRagdoll.h:62
f32 _linearVelocityThreshold
線形速度の非アクティブ化閾値
Definition GxResRagdoll.h:61
f32 _deactivationTime
非アクティブになるまでの時間
Definition GxResRagdoll.h:57
実行時型情報クラス
Definition GxRtti.h:154
T * getModule(void) const
モジュールを取得
Definition GxUnitBase.h:246
void asyncUpdate(void) override
並列更新
Definition GxUnitLocate.cpp:122
モデルクラス
Definition GxUnitModel.h:19
全体構造体
Definition GxModUnitRagdoll.h:61
サイズ
Definition GxStruct.h:730
32bitブーリアン
Definition GxDefine.h:173