OROCHI
 
Loading...
Searching...
No Matches
GxUnitClothBase.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(GxUnitClothBase, GxUnitSoftbodyBase, "布基礎")
26 // ClassBaseReference継承クラス用禁止宣言
28
29
30 static const f32 _ktDefault;
32 static const f32 _ksDefault;
34 static const f32 _kbDefault;
35
37
43 {
44 //-----------------------------------------------------------
46 //-----------------------------------------------------------
48
49 // RTTI宣言
50 GX_RTTI_STRUCT(GxUnitClothBase::GxCell);
51
53 //-----------------------------------------------------------
55 //-----------------------------------------------------------
57
59 GxCell(void) : _defW(0.0f), _defH(0.0f), _defDl(0.0f), _defDr(0.0f), _isEnableLink(true){}
60
62 //-----------------------------------------------------------
64 //-----------------------------------------------------------
66
67 f32 _defW;
68 f32 _defH;
69 f32 _defDl;
70 f32 _defDr;
72
74 };
75
77 //-----------------------------------------------------------
79 //-----------------------------------------------------------
81
83 GxUnitClothBase(void);
84
86 void cleanup(void) override;
87
89 //-----------------------------------------------------------
91 //-----------------------------------------------------------
93protected:
95 b32 setup(void) override;
96
97protected:
99 b32 isWarp(void) override;
100
102 void updateInitialize(void) override;
103
105 void updateForce(f32 updateRatio, f32 updateRatioOld) override;
106
108
112 virtual void interpolatePosition(f32 updateRatio, f32 updateRatioOld);
113
115 virtual void calculateNormalVector(void);
116
118
121 virtual void calculateExternalForce(GxVector3& windDirect);
122
124
127 virtual void calculateInternalForce(void);
128
130 void calculateHitBackForce(f32 updateRatio, f32 updateRatioOld) override;
131
133 void updateCell(void) override;
134
136
141 void updateConstraint(void) override;
142
143#if GX_DEVELOP
145 void developRender(void) override;
146#endif // GX_DEVELOP
147
149 //-----------------------------------------------------------
151 //-----------------------------------------------------------
153
155 constexpr f32 kT(f32 ks) const { return (ks < 0.0f) ? (0.5f * _kt * ks) : (_kt * ks); }
157 constexpr f32 kS(f32 ks) const { return (ks < 0.0f) ? (0.5f * _ks * ks) : (_ks * ks); }
159 constexpr f32 kB(f32 ks) const { return (ks < 0.0f) ? (0.5f * _kb * ks) : (_kb * ks); }
160
162 constexpr f32 getKT(void) const { return _kt; }
164 constexpr void setKT(f32 kt) { _kt = kt; }
165
167 constexpr f32 getKS(void) const { return _ks; }
169 constexpr void setKS(f32 ks) { _ks = ks; }
170
172 constexpr f32 getKB(void) const { return _kb; }
174 constexpr void setKB(f32 kb) { _kb = kb; }
175
177 GX_FORCE_INLINE void* getCellPointer(void) const override { return _ppCell; }
178
180 GX_FORCE_INLINE const GxVector3& getPosition(u32 pointIndex, u32 lineIndex) const { return _ppCell[lineIndex][pointIndex]._position; }
182 GX_FORCE_INLINE void setPosition(u32 pointIndex, u32 lineIndex, const GxVector3 &position) { _ppCell[lineIndex][pointIndex]._position = position; }
183
185 GX_FORCE_INLINE const GxVector3& getNormal(u32 pointIndex, u32 lineIndex) const { return _ppCell[lineIndex][pointIndex]._normal; }
187 GX_FORCE_INLINE void setNormal(u32 pointIndex, u32 lineIndex, const GxVector3 & normal) { _ppCell[lineIndex][pointIndex]._normal = normal; }
188
190 GX_FORCE_INLINE b32 isFixed(u32 pointIndex, u32 lineIndex) const { return _ppCell[lineIndex][pointIndex]._isFixed; }
192 GX_FORCE_INLINE void setFixed(u32 pointIndex, u32 lineIndex, b32 isFixed) { _ppCell[lineIndex][pointIndex]._isFixed = isFixed; }
193
195 b32 analyseEnableLink(u32 pointIndex, u32 lineIndex);
196
198 //-----------------------------------------------------------
200 //-----------------------------------------------------------
202protected:
204 f32 _kt;
205 f32 _ks;
206 f32 _kb;
208 u32 _id;
209
211};
212
213GX_UTILITY_NAMESPACE_END()
#define GX_PROHIBIT_CLASS_BASE_REFERENCE(__CLASS__)
GxClassBaseReference継承の禁止宣言(new以外の生成禁止 + コピー禁止)
Definition GxBase.h:244
基準布クラス
Definition GxUnitClothBase.h:18
constexpr f32 getKS(void) const
せん断力の取得
Definition GxUnitClothBase.h:167
GX_FORCE_INLINE b32 isFixed(u32 pointIndex, u32 lineIndex) const
質点固定情報取得
Definition GxUnitClothBase.h:190
f32 _kb
バネ定数 - 曲げにくさ係数
Definition GxUnitClothBase.h:206
GX_FORCE_INLINE const GxVector3 & getPosition(u32 pointIndex, u32 lineIndex) const
質点位置取得
Definition GxUnitClothBase.h:180
b32 _isSkirt
スカート(端と端が繋がっているか)かどうか
Definition GxUnitClothBase.h:207
constexpr f32 getKB(void) const
曲げにくさの取得
Definition GxUnitClothBase.h:172
f32 _kt
バネ定数 - 伸びにくさ係数
Definition GxUnitClothBase.h:204
constexpr f32 kT(f32 ks) const
ばね関数 - 伸びにくさ係数取得
Definition GxUnitClothBase.h:155
GX_FORCE_INLINE void setFixed(u32 pointIndex, u32 lineIndex, b32 isFixed)
質点固定情報設定
Definition GxUnitClothBase.h:192
GX_FORCE_INLINE const GxVector3 & getNormal(u32 pointIndex, u32 lineIndex) const
質点の法線取得
Definition GxUnitClothBase.h:185
GX_FORCE_INLINE void setNormal(u32 pointIndex, u32 lineIndex, const GxVector3 &normal)
質点の法線設定
Definition GxUnitClothBase.h:187
u32 _id
任意ID
Definition GxUnitClothBase.h:208
GX_FORCE_INLINE void * getCellPointer(void) const override
質点データ取得
Definition GxUnitClothBase.h:177
f32 _ks
バネ定数 - せん断力係数
Definition GxUnitClothBase.h:205
constexpr void setKS(f32 ks)
せん断力の設定
Definition GxUnitClothBase.h:169
constexpr void setKB(f32 kb)
曲げにくさの設定
Definition GxUnitClothBase.h:174
GX_FORCE_INLINE void setPosition(u32 pointIndex, u32 lineIndex, const GxVector3 &position)
質点位置設定
Definition GxUnitClothBase.h:182
GxCell ** _ppCell
質点データ
Definition GxUnitClothBase.h:203
constexpr void setKT(f32 kt)
伸びにくさの設定
Definition GxUnitClothBase.h:164
constexpr f32 getKT(void) const
伸びにくさの取得
Definition GxUnitClothBase.h:162
constexpr f32 kB(f32 ks) const
ばね関数 - 曲げにくさ係数取得
Definition GxUnitClothBase.h:159
constexpr f32 kS(f32 ks) const
ばね関数 - せん断力係数取得
Definition GxUnitClothBase.h:157
ソフトボディユニット基底クラス
Definition GxUnitSoftbodyBase.h:19
基準布型セルクラス
Definition GxUnitClothBase.h:43
f32 _defW
右のセルとの基準距離
Definition GxUnitClothBase.h:67
f32 _defH
下のセルとの基準距離
Definition GxUnitClothBase.h:68
f32 _defDl
左下セルとの基準距離
Definition GxUnitClothBase.h:69
b32 _isEnableLink
列間の質点で繋がり(拘束)があるかどうか
Definition GxUnitClothBase.h:71
f32 _defDr
右下セルとの基準距離
Definition GxUnitClothBase.h:70
GxCell(void)
デフォルトコンストラクタ
Definition GxUnitClothBase.h:59
3次元ベクトル
Definition GxVector.h:245
32bitブーリアン
Definition GxDefine.h:173