| 1 | #include "Library/Fluid/JointRippleGenerator.h" |
| 2 | |
| 3 | #include "Library/LiveActor/ActorModelFunction.h" |
| 4 | #include "Library/Math/MathUtil.h" |
| 5 | #include "Library/Nature/NatureUtil.h" |
| 6 | |
| 7 | namespace al { |
| 8 | JointRippleGenerator::JointRippleGenerator(const LiveActor* parentActor) : mParent(parentActor) {} |
| 9 | |
| 10 | void JointRippleGenerator::reset() { |
| 11 | sead::Vector3f jointOffset; |
| 12 | calcJointOffsetPos(&jointOffset, actor: mParent, mJoint, mOffset); |
| 13 | mLastJointOffset = jointOffset; |
| 14 | } |
| 15 | |
| 16 | void JointRippleGenerator::updateAndGenerate() { |
| 17 | sead::Vector3f jointOffset; |
| 18 | calcJointOffsetPos(&jointOffset, actor: mParent, mJoint, mOffset); |
| 19 | |
| 20 | f32 rate = |
| 21 | calcRate01((jointOffset - mLastJointOffset).length(), 0.0f, mMaxDistance) * mRateAmplitude; |
| 22 | tryAddRippleRandomBlur(mParent, jointOffset, rate * _2c, _30, 10.0f); |
| 23 | mLastJointOffset.set(jointOffset); |
| 24 | } |
| 25 | |
| 26 | } // namespace al |
| 27 | |