OROCHI
 
Loading...
Searching...
No Matches
GxUnitChainBase.h
Go to the documentation of this file.
1//===========================================================================
10//===========================================================================
11#pragma once
12
13GX_UTILITY_NAMESPACE_BEGIN()
14//===========================================================================
16//===========================================================================
18{
19 //-----------------------------------------------------------
21 //-----------------------------------------------------------
23public:
24 // RTTI宣言
25 GX_RTTI_ABSTRACT_CLASS_NAME(GxUnitChainBase, GxUnitSoftbodyBase, "鎖基礎")
26 // ClassBaseReference継承クラス用禁止宣言
28
29
30 static const f32 _ktDefault;
32 static const f32 _kbDefault;
33
35
41 {
42 //-----------------------------------------------------------
44 //-----------------------------------------------------------
46
47 // RTTI宣言
48 GX_RTTI_STRUCT(GxUnitChainBase::GxCell);
49
51 //-----------------------------------------------------------
53 //-----------------------------------------------------------
55
57 GxCell(void) : _def(0.0f) {}
58
60 //-----------------------------------------------------------
62 //-----------------------------------------------------------
64
65 f32 _def;
66
68 };
69
71 //-----------------------------------------------------------
73 //-----------------------------------------------------------
75
77 GxUnitChainBase(void);
78
80 void cleanup(void) override;
81
83 //-----------------------------------------------------------
85 //-----------------------------------------------------------
87protected:
89 b32 setup(void) override;
90
92 b32 isWarp(void) override;
93
95 void updateInitialize(void) override;
96
98 void updateForce(f32 updateRatio, f32 updateRatioOld) override;
99
101
105 virtual void interpolatePosition(f32 updateRatio, f32 updateRatioOld);
106
108
112 virtual void calculateBaseVector(void);
113
115
118 virtual void calculateExternalForce(GxVector3& windDirect);
119
121
124 virtual void calculateInternalForce(void);
125
127 void calculateHitBackForce(f32 updateRatio, f32 updateRatioOld) override;
128
130 void updateCell(void) override;
131
133
137 void updateConstraint(void) override;
138
139#if GX_DEVELOP
140public:
142 void developRender(void) override;
143#endif // GX_DEVELOP
144
146 //-----------------------------------------------------------
148 //-----------------------------------------------------------
150
152 constexpr f32 kT(f32 ks) const { return (ks < 0.0f) ? (0.5f * _kt * ks) : (_kt * ks); }
154 constexpr f32 kB(f32 ks) const { return (ks < 0.0f) ? (0.5f * _kb * ks) : (_kb * ks); }
155
157 constexpr f32 getKT(void) const { return _kt; }
159 constexpr void setKT(f32 kt) { _kt = kt; }
160
162 constexpr f32 getKB(void) const { return _kb; }
164 constexpr void setKB(f32 kb) { _kb = kb; }
165
167 GX_FORCE_INLINE void* getCellPointer(void) const override { return _pCell; }
168
170 GX_FORCE_INLINE const GxVector3& getPosition(u32 index) const { return _pCell[index]._position; }
172 GX_FORCE_INLINE void setPosition(u32 index, const GxVector3& position) { _pCell[index]._position = position; }
173
175 GX_FORCE_INLINE b32 isFixed(u32 index) const { return _pCell[index]._isFixed; }
177 GX_FORCE_INLINE void setFixed(u32 index, b32 isFix) { _pCell[index]._isFixed = isFix; }
178
180 //-----------------------------------------------------------
182 //-----------------------------------------------------------
184protected:
186 f32 _kt;
187 f32 _kb;
188 u32 _id;
189
191};
192
193GX_UTILITY_NAMESPACE_END()
#define GX_PROHIBIT_CLASS_BASE_REFERENCE(__CLASS__)
GxClassBaseReference継承の禁止宣言(new以外の生成禁止 + コピー禁止)
Definition GxBase.h:244
鎖基底ユニット
Definition GxUnitChainBase.h:18
GxCell * _pCell
質点データ
Definition GxUnitChainBase.h:185
constexpr void setKB(f32 kb)
曲げにくさの設定
Definition GxUnitChainBase.h:164
constexpr f32 getKT(void) const
伸びにくさの取得
Definition GxUnitChainBase.h:157
u32 _id
任意ID
Definition GxUnitChainBase.h:188
GX_FORCE_INLINE void setFixed(u32 index, b32 isFix)
質点固定情報設定
Definition GxUnitChainBase.h:177
GX_FORCE_INLINE const GxVector3 & getPosition(u32 index) const
質点位置取得
Definition GxUnitChainBase.h:170
constexpr f32 kB(f32 ks) const
バネ定数 - 曲げにくさ係数を取得
Definition GxUnitChainBase.h:154
constexpr f32 getKB(void) const
曲げにくさの取得
Definition GxUnitChainBase.h:162
f32 _kb
バネ定数 - 曲げにくさ係数
Definition GxUnitChainBase.h:187
GX_FORCE_INLINE b32 isFixed(u32 index) const
質点固定情報取得
Definition GxUnitChainBase.h:175
GX_FORCE_INLINE void setPosition(u32 index, const GxVector3 &position)
質点位置設定
Definition GxUnitChainBase.h:172
constexpr f32 kT(f32 ks) const
バネ定数 - 伸びにくさ係数を取得
Definition GxUnitChainBase.h:152
f32 _kt
バネ定数 - 伸びにくさ係数
Definition GxUnitChainBase.h:186
GX_FORCE_INLINE void * getCellPointer(void) const override
質点データ取得
Definition GxUnitChainBase.h:167
constexpr void setKT(f32 kt)
伸びにくさの設定
Definition GxUnitChainBase.h:159
ソフトボディユニット基底クラス
Definition GxUnitSoftbodyBase.h:19
基準鎖型セルクラス
Definition GxUnitChainBase.h:41
GxCell(void)
デフォルトコンストラクタ
Definition GxUnitChainBase.h:57
f32 _def
下のセルとの基準距離
Definition GxUnitChainBase.h:65
3次元ベクトル
Definition GxVector.h:245
32bitブーリアン
Definition GxDefine.h:173