OROCHI
 
Loading...
Searching...
No Matches
GxToolTong.h
Go to the documentation of this file.
1//===========================================================================
10//===========================================================================
11#pragma once
12
13#if GX_DEVELOP
14
16
17//===========================================================================
20//===========================================================================
21class GxToolTong : public GxToolBase
22{
23 //-----------------------------------------------------------
25 //-----------------------------------------------------------
27public:
28 // RTTI宣言
29 GX_RTTI_CLASS_NAME_ICON( GxToolTong, GxToolBase, "物理オブジェクト操作", GxRtti::ICON_TYPE::PHYSICS );
30 // ClassBaseReference継承クラス用禁止宣言
32
34 enum class MODE
35 {
36 FIXED = 0,
37 SPHERICAL,
38 MAX,
39 };
40#if GX_DEVELOP
42 GX_ENUM_TABLE_MAX(MODE)
43#endif //GX_DEVELOP
44
45 class GxGuiFormExplain;
46 class GxUnitTong;
47
49 //-----------------------------------------------------------
51 //-----------------------------------------------------------
53
55 GxToolTong( void );
56
58 b32 initialize(void) override;
59
61 void cleanup( void ) override;
62
64 //-----------------------------------------------------------
66 //-----------------------------------------------------------
68
70 virtual GxUnitTong* createUnitTong(void);
71
72protected:
74 void update(void) override;
75
77 //-----------------------------------------------------------
79 //-----------------------------------------------------------
81public:
83 constexpr MODE getMode( void ) const { return _mode; }
84
86 //-----------------------------------------------------------
88 //-----------------------------------------------------------
90private:
91 GxUnitTong* _pUnitTong;
92 MODE _mode;
93 GxShapePlane _movePlane;
94 GxHandle* _pHandle;
95
97};
98
99//===========================================================================
101//===========================================================================
102class GxToolTong::GxUnitTong : public GxUnitBase
103{
104 //-----------------------------------------------------------
106 //-----------------------------------------------------------
108public:
109 // RTTI宣言
110 GX_RTTI_CLASS_NAME(GxToolTong::GxUnitTong, GxUnitBase, "物理オブジェクト操作");
111
113 //-----------------------------------------------------------
115 //-----------------------------------------------------------
117
119 GxUnitTong(void);
120
122 ~GxUnitTong(void) override;
123
125 //-----------------------------------------------------------
127 //-----------------------------------------------------------
129
131 GX_FORCE_INLINE virtual GxDynamics* createModDynamics(void) { return GX_NEW GxDynamics; }
132
134 void asyncUpdate(void) override;
135
137 void render(void) override;
138
139#if GX_DEVELOP
141 static GxGuiBase* createGui(GxProperty& property, GxTypedObject* pOwner, const GxRtti& rtti, u32 index);
142#endif //GX_DEVELOP
143
145 void createDynamics( const GxVector3& position );
146
148 virtual void startGrip( GxDynamics::GxObject* pTarget, const GxVector3& gripPosition );
150 virtual void endGrip( void );
151
153 virtual void dynamicsCallback(void);
154
156 //-----------------------------------------------------------
158 //-----------------------------------------------------------
160
162 constexpr void setTool( GxToolTong* pTool ){ _pTool = pTool; }
163
165 GX_FORCE_INLINE void setTongPosition( const GxVector3& position ){ _tongPosition = position; }
167 GX_FORCE_INLINE GxVector3 getTongPosition( void ) const { return _tongPosition; }
169 GX_FORCE_INLINE GxVector3* getTongPositionAddress(void) { return &_tongPosition; }
170
172 constexpr void setTarget( GxDynamics::GxObject* pObject) { _pTarget = pObject; }
174 constexpr GxDynamics::GxObject* getTarget(void) const { return _pTarget; }
176 GX_FORCE_INLINE const b32 isGripping( void ) const { return _isGripping; }
178 GX_FORCE_INLINE const GxVector3& getGripOffset( void ){ return _gripOffset; }
179
181 //-----------------------------------------------------------
183 //-----------------------------------------------------------
185protected:
186 GxDynamics::GxWorld* _pWorld;
187 GxDynamics* _pDynamics;
188 GxDynamics::GxObject* _pTong;
189 GxDynamics::GxObject* _pTarget;
190 GxDynamics::GxConstraint* _pConstraint;
191 GxVector3 _gripOffset;
192 GxVector3 _oldCenter;
193 b32 _isGripping;
194 GxMatrixAffine _matTong;
195 GxVector3 _tongPosition;
196 GxToolTong* _pTool;
197
199};
200
201//===========================================================================
203//===========================================================================
204class GxToolTong::GxGuiFormExplain : public GxGuiForm
205{
206 //-----------------------------------------------------------
208 //-----------------------------------------------------------
210public:
211 // RTTI宣言
212 GX_RTTI_CLASS( GxToolTong::GxGuiFormExplain, GxGuiForm );
213 // ClassBaseReference継承クラス用禁止宣言
214 GX_PROHIBIT_CLASS_BASE_REFERENCE(GxGuiFormExplain);
215
217 //-----------------------------------------------------------
219 //-----------------------------------------------------------
221
223 GxGuiFormExplain( void );
224
226 //-----------------------------------------------------------
228 //-----------------------------------------------------------
230protected:
232 void onDraw( void ) override;
233
235 void onSize(const GxSize& size) override;
236
238};
239
240GX_PHYSICS_NAMESPACE_END()
241#endif // GX_DEVELOP
#define GX_PROHIBIT_CLASS_BASE_REFERENCE(__CLASS__)
GxClassBaseReference継承の禁止宣言(new以外の生成禁止 + コピー禁止)
Definition GxBase.h:244
@ MAX
定義数
void GxTypedObject
その他
Definition GxDefine.h:213
#define GX_PHYSICS_NAMESPACE_BEGIN()
ネームスペースマクロ
Definition GxPhysics.h:28
GxDynamics 拘束クラス
Definition GxDynamics.h:783
GxDynamics基本オブジェクトクラス
Definition GxDynamics.h:519
GxDynamics 基本ワールドクラス
Definition GxDynamics.h:272
物理演算クラス
Definition GxDynamics.h:27
プロパティクラス
Definition GxProperty.h:48
実行時型情報クラス
Definition GxRtti.h:154
平面形状クラス
Definition GxShape.h:1102
ユニット基礎クラス
Definition GxUnitBase.h:45
virtual void render(void)
描画
Definition GxUnitBase.cpp:166
virtual void asyncUpdate(void)
並列更新
Definition GxUnitBase.cpp:122
アフィン変換行列(行優先)
Definition GxMatrix.h:330
サイズ
Definition GxStruct.h:730
3次元ベクトル
Definition GxVector.h:245
32bitブーリアン
Definition GxDefine.h:173