World-space spring-chain solver that writes results as local bone rotations. 更多...
#include <DynamicBoneSolver.h>
Public 成员函数 | |
| DynamicBoneSolver (AnimSkeleton *skeleton) | |
| Construct for a borrowed skeleton, which may be null. | |
| ~DynamicBoneSolver () | |
| Dynamic bone solver. | |
| DynamicBoneSolver (const DynamicBoneSolver &)=default | |
| Dynamic bone solver. | |
| DynamicBoneSolver & | operator= (const DynamicBoneSolver &)=default |
| Operator =. | |
| void | setSkeleton (AnimSkeleton *skeleton) |
| Rebind the borrowed skeleton; changing it clears index-dependent state. | |
| AnimSkeleton * | getSkeleton () const |
| Return the borrowed skeleton, or null. @ownership Borrowed; ownership remains with the animation source. @lifetime Valid until setSkeleton(), skeleton destruction, or solver destruction. | |
| int | addChain (int rootBone, int endBone, float stiffness, float damping, float inertia, float gravityScale=1.f, float radius=0.f, int iterations=4) |
| Add an ancestor-to-descendant spring chain. | |
| int | addChainByName (const std::string &rootBone, const std::string &endBone, float stiffness, float damping, float inertia, float gravityScale=1.f, float radius=0.f, int iterations=4) |
| Name-based addChain variant; returns -1 for invalid input. | |
| int | getChainCount () const |
| Return configured chain count. | |
| void | clearChains () |
| Remove all chains and their simulation state. | |
| void | setChainEnabled (int chainIndex, bool enabled) |
| Set a valid chain's enabled state; invalid indices are ignored. | |
| bool | isChainEnabled (int chainIndex) const |
| Return enabled state, or false for an invalid index. | |
| void | setChainFreezeAxis (int chainIndex, int axis) |
| Restrict a chain to its animated model-space plane. | |
| void | setChainSelfCollision (int chainIndex, bool enabled) |
| Enable or disable non-adjacent particle self-collision for a chain. | |
| void | setChainParticleParameters (int chainIndex, int particleIndex, float stiffness, float damping, float inertia, float gravityScale, float radius) |
| Override simulation parameters for one chain particle, where zero is the root. | |
| void | setChainEndLength (int chainIndex, float length) |
| Add a virtual particle after the last bone along the animated terminal direction. | |
| void | setChainEndOffset (int chainIndex, float x, float y, float z) |
| Add a virtual particle at a last-bone-local offset; this replaces end length mode. | |
| void | clearChainEnd (int chainIndex) |
| Remove a chain's virtual terminal particle. | |
| void | setGlobalGravity (float x, float y, float z) |
| Set model-space gravity acceleration. | |
| void | setExternalForce (float x, float y, float z) |
| Set additional model-space acceleration such as wind. | |
| void | setForceField (const DynamicBoneForceField *forceField) |
| Set an optional spatial force field sampled on the calling thread. @ownership Borrowed; ownership remains with the caller. @lifetime The provider must outlive this solver or be cleared before destruction. | |
| const DynamicBoneForceField * | getForceField () const |
| Return the borrowed spatial force field, or null. @ownership Borrowed; ownership remains with the caller. @lifetime Valid until setForceField(), provider destruction, or solver destruction. | |
| float | getGlobalGravityX () const |
| Return gravity X. | |
| float | getGlobalGravityY () const |
| Return gravity Y. | |
| float | getGlobalGravityZ () const |
| Return gravity Z. | |
| void | setWeight (float weight) |
| Set final rotation blend weight in [0, 1]. | |
| float | getWeight () const |
| Return final rotation blend weight. | |
| void | setUpdateRate (float updatesPerSecond) |
| Set preferred simulation frequency; zero means one step per update. | |
| float | getUpdateRate () const |
| Return preferred simulation frequency. | |
| void | setTeleportThreshold (float distance) |
| Set root movement distance that triggers a simulation reset. | |
| float | getTeleportThreshold () const |
| Return teleport reset distance; zero disables it. | |
| void | setObjectMoveResponse (float value) |
| Set how much simulated particles follow root translation, from zero to one. | |
| float | getObjectMoveResponse () const |
| Return root translation response. | |
| void | setDistanceReference (float x, float y, float z) |
| Set the model-space point used for distance-based sleeping. | |
| void | setDistanceLimit (float value) |
| Set sleep distance; zero disables distance sleeping. | |
| bool | isChainSleeping (int chainIndex) const |
| Return whether a valid chain is currently distance-sleeping. | |
| void | addColliderSphere (float centerX, float centerY, float centerZ, float radius) |
| Add a fixed model-space sphere collider; non-positive radii are ignored. | |
| void | addBoneColliderSphere (int boneIndex, float offsetX, float offsetY, float offsetZ, float radius) |
| Add a sphere collider following a bone-local offset. | |
| void | addColliderCapsule (float startX, float startY, float startZ, float endX, float endY, float endZ, float radius) |
| Add a fixed model-space capsule collider. | |
| void | addBoneColliderCapsule (int boneIndex, float startX, float startY, float startZ, float endX, float endY, float endZ, float radius) |
| Add a capsule whose endpoints follow bone-local offsets. | |
| void | clearColliders () |
| Remove all colliders. | |
| int | getColliderCount () const |
| Return collider count. | |
| void | removeCollider (int index) |
| Remove a valid collider index; invalid indices are ignored. | |
| void | setColliderEnabled (int index, bool enabled) |
| Enable or disable a collider without changing its index. | |
| void | setColliderInside (int index, bool inside) |
| Select inside containment or outside exclusion for a collider. | |
| void | setColliderRadius (int index, float radius) |
| Change a collider radius; non-positive values are ignored. | |
| void | reset () |
| Reset all chains to the animated pose on their next update. | |
| void | update (AnimPose *pose, float dt) |
| Simulate one frame using injected dt and update pose local rotations. | |
| DynamicBoneDebugSnapshot | debugSnapshot () const |
| Copy current particles and colliders for tooling visualization. | |
| DynamicBoneUpdateStats | getLastUpdateStats () const |
| Return counters captured by the most recent update. | |
详细描述
World-space spring-chain solver that writes results as local bone rotations.
The skeleton is borrowed and must outlive the solver. All methods are main-thread only. Simulation is tolerance-bounded, not bit-exact across floating-point platforms.
在文件 DynamicBoneSolver.h 第 37 行定义.
构造及析构函数说明
◆ DynamicBoneSolver() [1/2]
|
explicit |
Construct for a borrowed skeleton, which may be null.
在文件 DynamicBoneSolver.cpp 第 46 行定义.
◆ ~DynamicBoneSolver()
|
default |
Dynamic bone solver.
◆ DynamicBoneSolver() [2/2]
|
default |
Dynamic bone solver.
成员函数说明
◆ addBoneColliderCapsule()
| void eve::animation::DynamicBoneSolver::addBoneColliderCapsule | ( | int | boneIndex, |
| float | startX, | ||
| float | startY, | ||
| float | startZ, | ||
| float | endX, | ||
| float | endY, | ||
| float | endZ, | ||
| float | radius | ||
| ) |
◆ addBoneColliderSphere()
| void eve::animation::DynamicBoneSolver::addBoneColliderSphere | ( | int | boneIndex, |
| float | offsetX, | ||
| float | offsetY, | ||
| float | offsetZ, | ||
| float | radius | ||
| ) |
Add a sphere collider following a bone-local offset.
在文件 DynamicBoneSolver.cpp 第 110 行定义.
引用了 bone, radius, x, y , 以及 z.
被这些函数引用 eve::animation::hair::addHeadCollider() , 以及 eve::animation::DynamicBoneConfig::apply().
◆ addChain()
| int eve::animation::DynamicBoneSolver::addChain | ( | int | rootBone, |
| int | endBone, | ||
| float | stiffness, | ||
| float | damping, | ||
| float | inertia, | ||
| float | gravityScale = 1.f, |
||
| float | radius = 0.f, |
||
| int | iterations = 4 |
||
| ) |
Add an ancestor-to-descendant spring chain.
- 参数
-
rootBone Chain root index. endBone Chain tip index. stiffness Animated-pose attraction in [0, 1]. damping Motion damping in [0, 1]. inertia Retained motion in [0, 1]. gravityScale Gravity and external-force multiplier. radius Particle collision radius. iterations Constraint projection passes.
- 返回
- Chain index, or -1 for invalid input.
在文件 DynamicBoneSolver.cpp 第 71 行定义.
引用了 bones, c, inertia, iterations , 以及 radius.
被这些函数引用 addChainByName().
◆ addChainByName()
| int eve::animation::DynamicBoneSolver::addChainByName | ( | const std::string & | rootBone, |
| const std::string & | endBone, | ||
| float | stiffness, | ||
| float | damping, | ||
| float | inertia, | ||
| float | gravityScale = 1.f, |
||
| float | radius = 0.f, |
||
| int | iterations = 4 |
||
| ) |
Name-based addChain variant; returns -1 for invalid input.
在文件 DynamicBoneSolver.cpp 第 79 行定义.
引用了 addChain(), end, eve::animation::AnimSkeleton::findBone(), inertia, iterations, radius , 以及 root.
被这些函数引用 eve::animation::hair::addChain() , 以及 eve::animation::DynamicBoneConfig::apply().
◆ addColliderCapsule()
| void eve::animation::DynamicBoneSolver::addColliderCapsule | ( | float | startX, |
| float | startY, | ||
| float | startZ, | ||
| float | endX, | ||
| float | endY, | ||
| float | endZ, | ||
| float | radius | ||
| ) |
Add a fixed model-space capsule collider.
在文件 DynamicBoneSolver.cpp 第 111 行定义.
◆ addColliderSphere()
| void eve::animation::DynamicBoneSolver::addColliderSphere | ( | float | centerX, |
| float | centerY, | ||
| float | centerZ, | ||
| float | radius | ||
| ) |
Add a fixed model-space sphere collider; non-positive radii are ignored.
在文件 DynamicBoneSolver.cpp 第 109 行定义.
◆ clearChainEnd()
| void eve::animation::DynamicBoneSolver::clearChainEnd | ( | int | chainIndex | ) |
◆ clearChains()
| void eve::animation::DynamicBoneSolver::clearChains | ( | ) |
Remove all chains and their simulation state.
在文件 DynamicBoneSolver.cpp 第 84 行定义.
被这些函数引用 setSkeleton() , 以及 eve::animation::hair::setupChains().
◆ clearColliders()
| void eve::animation::DynamicBoneSolver::clearColliders | ( | ) |
◆ debugSnapshot()
| DynamicBoneDebugSnapshot eve::animation::DynamicBoneSolver::debugSnapshot | ( | ) | const |
Copy current particles and colliders for tooling visualization.
在文件 DynamicBoneSolver.cpp 第 264 行定义.
引用了 eve::animation::DynamicBoneDebugSnapshot::colliders, eve::animation::DynamicBoneDebugSnapshot::particles, point , 以及 radius.
被这些函数引用 eve::animation_editing::ProceduralBoneOverlayBuilder::build().
◆ getChainCount()
| int eve::animation::DynamicBoneSolver::getChainCount | ( | ) | const |
Return configured chain count.
在文件 DynamicBoneSolver.cpp 第 83 行定义.
◆ getColliderCount()
| int eve::animation::DynamicBoneSolver::getColliderCount | ( | ) | const |
Return collider count.
在文件 DynamicBoneSolver.cpp 第 114 行定义.
被这些函数引用 eve::animation::hair::addHeadCollider() , 以及 eve::animation::DynamicBoneConfig::apply().
◆ getForceField()
|
inline |
Return the borrowed spatial force field, or null. @ownership Borrowed; ownership remains with the caller. @lifetime Valid until setForceField(), provider destruction, or solver destruction.
在文件 DynamicBoneSolver.h 第 112 行定义.
◆ getGlobalGravityX()
|
inline |
Return gravity X.
在文件 DynamicBoneSolver.h 第 114 行定义.
◆ getGlobalGravityY()
|
inline |
Return gravity Y.
在文件 DynamicBoneSolver.h 第 116 行定义.
◆ getGlobalGravityZ()
|
inline |
Return gravity Z.
在文件 DynamicBoneSolver.h 第 118 行定义.
◆ getLastUpdateStats()
|
inline |
Return counters captured by the most recent update.
在文件 DynamicBoneSolver.h 第 171 行定义.
◆ getObjectMoveResponse()
|
inline |
Return root translation response.
在文件 DynamicBoneSolver.h 第 134 行定义.
◆ getSkeleton()
|
inline |
Return the borrowed skeleton, or null. @ownership Borrowed; ownership remains with the animation source. @lifetime Valid until setSkeleton(), skeleton destruction, or solver destruction.
在文件 DynamicBoneSolver.h 第 55 行定义.
◆ getTeleportThreshold()
|
inline |
Return teleport reset distance; zero disables it.
在文件 DynamicBoneSolver.h 第 130 行定义.
◆ getUpdateRate()
|
inline |
Return preferred simulation frequency.
在文件 DynamicBoneSolver.h 第 126 行定义.
◆ getWeight()
|
inline |
Return final rotation blend weight.
在文件 DynamicBoneSolver.h 第 122 行定义.
◆ isChainEnabled()
| bool eve::animation::DynamicBoneSolver::isChainEnabled | ( | int | chainIndex | ) | const |
Return enabled state, or false for an invalid index.
在文件 DynamicBoneSolver.cpp 第 86 行定义.
◆ isChainSleeping()
| bool eve::animation::DynamicBoneSolver::isChainSleeping | ( | int | chainIndex | ) | const |
Return whether a valid chain is currently distance-sleeping.
在文件 DynamicBoneSolver.cpp 第 108 行定义.
引用了 index.
◆ operator=()
|
default |
Operator =.
◆ removeCollider()
| void eve::animation::DynamicBoneSolver::removeCollider | ( | int | index | ) |
Remove a valid collider index; invalid indices are ignored.
在文件 DynamicBoneSolver.cpp 第 115 行定义.
引用了 index.
◆ reset()
| void eve::animation::DynamicBoneSolver::reset | ( | ) |
Reset all chains to the animated pose on their next update.
在文件 DynamicBoneSolver.cpp 第 119 行定义.
◆ setChainEnabled()
| void eve::animation::DynamicBoneSolver::setChainEnabled | ( | int | chainIndex, |
| bool | enabled | ||
| ) |
Set a valid chain's enabled state; invalid indices are ignored.
在文件 DynamicBoneSolver.cpp 第 85 行定义.
◆ setChainEndLength()
| void eve::animation::DynamicBoneSolver::setChainEndLength | ( | int | chainIndex, |
| float | length | ||
| ) |
Add a virtual particle after the last bone along the animated terminal direction.
在文件 DynamicBoneSolver.cpp 第 97 行定义.
被这些函数引用 eve::animation::hair::addChain() , 以及 eve::animation::DynamicBoneConfig::apply().
◆ setChainEndOffset()
| void eve::animation::DynamicBoneSolver::setChainEndOffset | ( | int | chainIndex, |
| float | x, | ||
| float | y, | ||
| float | z | ||
| ) |
◆ setChainFreezeAxis()
| void eve::animation::DynamicBoneSolver::setChainFreezeAxis | ( | int | chainIndex, |
| int | axis | ||
| ) |
Restrict a chain to its animated model-space plane.
- 参数
-
chainIndex Chain index. axis 0 disables; 1, 2, and 3 freeze X, Y, and Z.
在文件 DynamicBoneSolver.cpp 第 87 行定义.
引用了 index.
◆ setChainParticleParameters()
| void eve::animation::DynamicBoneSolver::setChainParticleParameters | ( | int | chainIndex, |
| int | particleIndex, | ||
| float | stiffness, | ||
| float | damping, | ||
| float | inertia, | ||
| float | gravityScale, | ||
| float | radius | ||
| ) |
Override simulation parameters for one chain particle, where zero is the root.
在文件 DynamicBoneSolver.cpp 第 89 行定义.
◆ setChainSelfCollision()
| void eve::animation::DynamicBoneSolver::setChainSelfCollision | ( | int | chainIndex, |
| bool | enabled | ||
| ) |
Enable or disable non-adjacent particle self-collision for a chain.
在文件 DynamicBoneSolver.cpp 第 88 行定义.
被这些函数引用 eve::animation::hair::addChain() , 以及 eve::animation::DynamicBoneConfig::apply().
◆ setColliderEnabled()
| void eve::animation::DynamicBoneSolver::setColliderEnabled | ( | int | index, |
| bool | enabled | ||
| ) |
Enable or disable a collider without changing its index.
在文件 DynamicBoneSolver.cpp 第 116 行定义.
◆ setColliderInside()
| void eve::animation::DynamicBoneSolver::setColliderInside | ( | int | index, |
| bool | inside | ||
| ) |
Select inside containment or outside exclusion for a collider.
在文件 DynamicBoneSolver.cpp 第 117 行定义.
◆ setColliderRadius()
| void eve::animation::DynamicBoneSolver::setColliderRadius | ( | int | index, |
| float | radius | ||
| ) |
Change a collider radius; non-positive values are ignored.
在文件 DynamicBoneSolver.cpp 第 118 行定义.
◆ setDistanceLimit()
| void eve::animation::DynamicBoneSolver::setDistanceLimit | ( | float | value | ) |
Set sleep distance; zero disables distance sleeping.
在文件 DynamicBoneSolver.cpp 第 107 行定义.
引用了 value.
◆ setDistanceReference()
| void eve::animation::DynamicBoneSolver::setDistanceReference | ( | float | x, |
| float | y, | ||
| float | z | ||
| ) |
Set the model-space point used for distance-based sleeping.
在文件 DynamicBoneSolver.cpp 第 106 行定义.
◆ setExternalForce()
| void eve::animation::DynamicBoneSolver::setExternalForce | ( | float | x, |
| float | y, | ||
| float | z | ||
| ) |
Set additional model-space acceleration such as wind.
在文件 DynamicBoneSolver.cpp 第 101 行定义.
◆ setForceField()
|
inline |
Set an optional spatial force field sampled on the calling thread. @ownership Borrowed; ownership remains with the caller. @lifetime The provider must outlive this solver or be cleared before destruction.
在文件 DynamicBoneSolver.h 第 106 行定义.
◆ setGlobalGravity()
| void eve::animation::DynamicBoneSolver::setGlobalGravity | ( | float | x, |
| float | y, | ||
| float | z | ||
| ) |
Set model-space gravity acceleration.
在文件 DynamicBoneSolver.cpp 第 100 行定义.
◆ setObjectMoveResponse()
| void eve::animation::DynamicBoneSolver::setObjectMoveResponse | ( | float | value | ) |
Set how much simulated particles follow root translation, from zero to one.
在文件 DynamicBoneSolver.cpp 第 105 行定义.
引用了 value.
◆ setSkeleton()
| void eve::animation::DynamicBoneSolver::setSkeleton | ( | AnimSkeleton * | skeleton | ) |
Rebind the borrowed skeleton; changing it clears index-dependent state.
在文件 DynamicBoneSolver.cpp 第 49 行定义.
引用了 clearChains() , 以及 clearColliders().
◆ setTeleportThreshold()
| void eve::animation::DynamicBoneSolver::setTeleportThreshold | ( | float | distance | ) |
Set root movement distance that triggers a simulation reset.
在文件 DynamicBoneSolver.cpp 第 104 行定义.
引用了 value.
◆ setUpdateRate()
| void eve::animation::DynamicBoneSolver::setUpdateRate | ( | float | updatesPerSecond | ) |
Set preferred simulation frequency; zero means one step per update.
在文件 DynamicBoneSolver.cpp 第 103 行定义.
引用了 value.
◆ setWeight()
| void eve::animation::DynamicBoneSolver::setWeight | ( | float | weight | ) |
◆ update()
| void eve::animation::DynamicBoneSolver::update | ( | AnimPose * | pose, |
| float | dt | ||
| ) |
该类的文档由以下文件生成:
- src/modules/animation/DynamicBoneSolver.h
- src/modules/animation/DynamicBoneSolver.cpp