载入中...
搜索中...
未找到
eve::animation::DynamicBoneSolver类 参考

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]

eve::animation::DynamicBoneSolver::DynamicBoneSolver ( AnimSkeleton *  skeleton)
explicit

Construct for a borrowed skeleton, which may be null.

在文件 DynamicBoneSolver.cpp 第 46 行定义.

◆ ~DynamicBoneSolver()

eve::animation::DynamicBoneSolver::~DynamicBoneSolver ( )
default

Dynamic bone solver.

◆ DynamicBoneSolver() [2/2]

eve::animation::DynamicBoneSolver::DynamicBoneSolver ( const DynamicBoneSolver &  )
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 
)

Add a capsule whose endpoints follow bone-local offsets.

在文件 DynamicBoneSolver.cpp 第 112 行定义.

引用了 bone, radius, sx, sy , 以及 sz.

被这些函数引用 eve::animation::DynamicBoneConfig::apply().

◆ 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.

参数
rootBoneChain root index.
endBoneChain tip index.
stiffnessAnimated-pose attraction in [0, 1].
dampingMotion damping in [0, 1].
inertiaRetained motion in [0, 1].
gravityScaleGravity and external-force multiplier.
radiusParticle collision radius.
iterationsConstraint 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 行定义.

引用了 radius, sx, sy , 以及 sz.

被这些函数引用 eve::animation::DynamicBoneConfig::apply().

◆ 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 行定义.

引用了 radius, x, y , 以及 z.

被这些函数引用 eve::animation::DynamicBoneConfig::apply().

◆ clearChainEnd()

void eve::animation::DynamicBoneSolver::clearChainEnd ( int  chainIndex)

Remove a chain's virtual terminal particle.

在文件 DynamicBoneSolver.cpp 第 99 行定义.

引用了 index.

◆ 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 ( )

Remove all colliders.

在文件 DynamicBoneSolver.cpp 第 113 行定义.

被这些函数引用 setSkeleton().

◆ 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()

const DynamicBoneForceField * eve::animation::DynamicBoneSolver::getForceField ( ) const
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()

float eve::animation::DynamicBoneSolver::getGlobalGravityX ( ) const
inline

Return gravity X.

在文件 DynamicBoneSolver.h 第 114 行定义.

◆ getGlobalGravityY()

float eve::animation::DynamicBoneSolver::getGlobalGravityY ( ) const
inline

Return gravity Y.

在文件 DynamicBoneSolver.h 第 116 行定义.

◆ getGlobalGravityZ()

float eve::animation::DynamicBoneSolver::getGlobalGravityZ ( ) const
inline

Return gravity Z.

在文件 DynamicBoneSolver.h 第 118 行定义.

◆ getLastUpdateStats()

DynamicBoneUpdateStats eve::animation::DynamicBoneSolver::getLastUpdateStats ( ) const
inline

Return counters captured by the most recent update.

在文件 DynamicBoneSolver.h 第 171 行定义.

◆ getObjectMoveResponse()

float eve::animation::DynamicBoneSolver::getObjectMoveResponse ( ) const
inline

Return root translation response.

在文件 DynamicBoneSolver.h 第 134 行定义.

◆ getSkeleton()

AnimSkeleton * eve::animation::DynamicBoneSolver::getSkeleton ( ) const
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 行定义.

被这些函数引用 eve::animation::hair::addHeadCollider().

◆ getTeleportThreshold()

float eve::animation::DynamicBoneSolver::getTeleportThreshold ( ) const
inline

Return teleport reset distance; zero disables it.

在文件 DynamicBoneSolver.h 第 130 行定义.

◆ getUpdateRate()

float eve::animation::DynamicBoneSolver::getUpdateRate ( ) const
inline

Return preferred simulation frequency.

在文件 DynamicBoneSolver.h 第 126 行定义.

◆ getWeight()

float eve::animation::DynamicBoneSolver::getWeight ( ) const
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 行定义.

引用了 enabled , 以及 index.

◆ isChainSleeping()

bool eve::animation::DynamicBoneSolver::isChainSleeping ( int  chainIndex) const

Return whether a valid chain is currently distance-sleeping.

在文件 DynamicBoneSolver.cpp 第 108 行定义.

引用了 index.

◆ operator=()

DynamicBoneSolver & eve::animation::DynamicBoneSolver::operator= ( const DynamicBoneSolver &  )
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 行定义.

引用了 enabled , 以及 index.

◆ 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 行定义.

引用了 index , 以及 value.

被这些函数引用 eve::animation::hair::addChain() , 以及 eve::animation::DynamicBoneConfig::apply().

◆ setChainEndOffset()

void eve::animation::DynamicBoneSolver::setChainEndOffset ( int  chainIndex,
float  x,
float  y,
float  z 
)

Add a virtual particle at a last-bone-local offset; this replaces end length mode.

在文件 DynamicBoneSolver.cpp 第 98 行定义.

引用了 index, length, x, y , 以及 z.

被这些函数引用 eve::animation::DynamicBoneConfig::apply().

◆ setChainFreezeAxis()

void eve::animation::DynamicBoneSolver::setChainFreezeAxis ( int  chainIndex,
int  axis 
)

Restrict a chain to its animated model-space plane.

参数
chainIndexChain index.
axis0 disables; 1, 2, and 3 freeze X, Y, and Z.

在文件 DynamicBoneSolver.cpp 第 87 行定义.

引用了 index.

被这些函数引用 eve::animation::DynamicBoneConfig::apply().

◆ 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 行定义.

引用了 count , 以及 index.

被这些函数引用 eve::animation::DynamicBoneConfig::apply().

◆ setChainSelfCollision()

void eve::animation::DynamicBoneSolver::setChainSelfCollision ( int  chainIndex,
bool  enabled 
)

Enable or disable non-adjacent particle self-collision for a chain.

在文件 DynamicBoneSolver.cpp 第 88 行定义.

引用了 enabled , 以及 index.

被这些函数引用 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 行定义.

引用了 enabled , 以及 index.

被这些函数引用 eve::animation::DynamicBoneConfig::apply().

◆ setColliderInside()

void eve::animation::DynamicBoneSolver::setColliderInside ( int  index,
bool  inside 
)

Select inside containment or outside exclusion for a collider.

在文件 DynamicBoneSolver.cpp 第 117 行定义.

引用了 index , 以及 inside.

被这些函数引用 eve::animation::DynamicBoneConfig::apply().

◆ setColliderRadius()

void eve::animation::DynamicBoneSolver::setColliderRadius ( int  index,
float  radius 
)

Change a collider radius; non-positive values are ignored.

在文件 DynamicBoneSolver.cpp 第 118 行定义.

引用了 index , 以及 radius.

◆ setDistanceLimit()

void eve::animation::DynamicBoneSolver::setDistanceLimit ( float  value)

Set sleep distance; zero disables distance sleeping.

在文件 DynamicBoneSolver.cpp 第 107 行定义.

引用了 value.

被这些函数引用 eve::animation::DynamicBoneConfig::apply().

◆ 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 行定义.

引用了 x, y , 以及 z.

◆ setExternalForce()

void eve::animation::DynamicBoneSolver::setExternalForce ( float  x,
float  y,
float  z 
)

Set additional model-space acceleration such as wind.

在文件 DynamicBoneSolver.cpp 第 101 行定义.

引用了 x, y , 以及 z.

被这些函数引用 eve::animation::DynamicBoneConfig::apply().

◆ setForceField()

void eve::animation::DynamicBoneSolver::setForceField ( const DynamicBoneForceField *  forceField)
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 行定义.

引用了 x, y , 以及 z.

被这些函数引用 eve::animation::DynamicBoneConfig::apply().

◆ setObjectMoveResponse()

void eve::animation::DynamicBoneSolver::setObjectMoveResponse ( float  value)

Set how much simulated particles follow root translation, from zero to one.

在文件 DynamicBoneSolver.cpp 第 105 行定义.

引用了 value.

被这些函数引用 eve::animation::DynamicBoneConfig::apply().

◆ 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.

被这些函数引用 eve::animation::DynamicBoneConfig::apply().

◆ setUpdateRate()

void eve::animation::DynamicBoneSolver::setUpdateRate ( float  updatesPerSecond)

Set preferred simulation frequency; zero means one step per update.

在文件 DynamicBoneSolver.cpp 第 103 行定义.

引用了 value.

被这些函数引用 eve::animation::DynamicBoneConfig::apply().

◆ setWeight()

void eve::animation::DynamicBoneSolver::setWeight ( float  weight)

Set final rotation blend weight in [0, 1].

在文件 DynamicBoneSolver.cpp 第 102 行定义.

引用了 value.

被这些函数引用 eve::animation::DynamicBoneConfig::apply().

◆ update()

void eve::animation::DynamicBoneSolver::update ( AnimPose *  pose,
float  dt 
)

Simulate one frame using injected dt and update pose local rotations.

在文件 DynamicBoneSolver.cpp 第 235 行定义.

引用了 length, pose, step , 以及 steps.


该类的文档由以下文件生成: