|
Foundation
|
A deliberately small transform-hierarchy + clip layer that drives CPU deformation. More...
Go to the source code of this file.
Classes | |
| struct | FJoint |
| One node of a transform hierarchy (a skeleton joint or an articulation node). More... | |
| struct | FSkeleton |
| A flat skeleton: the only hierarchy the animation layer retains, owned by the asset. More... | |
| struct | FAnimChannel |
| A single animated component of a single joint: sorted keyframe times + packed values. More... | |
| struct | FAnimationClip |
| A clip: a set of channels plus its total duration (seconds). More... | |
| struct | FPose |
| Reusable per-instance evaluation scratch for one skeleton (allocate once, reuse per frame). More... | |
Enumerations | |
| enum class | FAnimPath : uint8_t { Translation , Rotation , Scale } |
| Which local TRS component an animation channel drives. More... | |
| enum class | FAnimInterp : uint8_t { Step , Linear , CubicSpline } |
| Keyframe interpolation mode (mirrors glTF sampler interpolation). More... | |
Functions | |
| mat4 | JointLocalMatrix (float3 const &t, quat const &r, float3 const &s) |
| Composes a joint's local TRS into a matrix (T * R * S). | |
| void | ResetToRest (FSkeleton const &skel, FPose &pose) |
| Seeds a pose's local TRS from the skeleton rest pose (call before SampleClip). | |
| void | SampleClip (FAnimationClip const &clip, float t, FPose &pose) |
Samples a clip at time t, overwriting the seeded local TRS for every channel's joint. | |
| void | ComputeGlobals (FSkeleton const &skel, FPose &pose) |
| Walks the hierarchy, composing local TRS into world matrices in FPose::globals. | |
| void | SampleTrack (Span< const float > times, Span< const float > values, uint32_t comps, FAnimInterp interp, float t, Span< float > out) |
Samples a generic keyframed track of comps-wide values at time t into out. | |
| void | ComputeSkinningMatrices (FSkeleton const &skel, FPose const &pose, Span< mat4 > outPalette) |
Builds the skinning palette globals[j] * inverseBind[j] into outPalette. | |
| void | SkinVertices (Span< const FVertex > bind, Span< const FSkinBinding > binding, Span< const mat4 > palette, Span< FQVertex > out) |
| Linear-blend skins bind-pose vertices by the palette, packing results for the dynamic ring. | |
| void | RecomputeNormals (Span< FVertex > verts, Span< const uint32_t > indices) |
| Recomputes smooth per-vertex normals from positions over an indexed triangle list. | |
A deliberately small transform-hierarchy + clip layer that drives CPU deformation.
The whole system is one idea applied twice: a flat, topologically sorted joint hierarchy whose local TRS we sample from a clip and accumulate into world matrices (FPose::globals). Skinning then multiplies those by per-joint inverse-bind matrices to build a palette and linear-blend-skins bind-pose vertices into the GPUScene dynamic ring (SkinVertices). "Rigid articulation" is the same evaluator with the skinning step omitted: a caller reads FPose::globals directly and feeds them as per-instance transforms (inverse-bind is then unused / identity). There is intentionally no general retained scene graph - the only hierarchy is this asset-local skeleton.
|
strong |
|
strong |
Walks the hierarchy, composing local TRS into world matrices in FPose::globals.
| void ComputeSkinningMatrices | ( | FSkeleton const & | skel, |
| FPose const & | pose, | ||
| Span< mat4 > | outPalette | ||
| ) |
Builds the skinning palette globals[j] * inverseBind[j] into outPalette.
| outPalette | Must hold FSkeleton::Count matrices. |
Composes a joint's local TRS into a matrix (T * R * S).
Recomputes smooth per-vertex normals from positions over an indexed triangle list.
Area-weighted face-normal accumulation, then normalize. Needed after POSITION-only morph deformation (which moves vertices without supplying normals); run it on the morphed vertices before packing/skinning so shading matches the deformed surface. Tangents are left as-is (re-projected onto the new normal frame by FQVertex::PackTBN).
Seeds a pose's local TRS from the skeleton rest pose (call before SampleClip).
| void SampleClip | ( | FAnimationClip const & | clip, |
| float | t, | ||
| FPose & | pose | ||
| ) |
Samples a clip at time t, overwriting the seeded local TRS for every channel's joint.
t is clamped per channel to its key range. | void SampleTrack | ( | Span< const float > | times, |
| Span< const float > | values, | ||
| uint32_t | comps, | ||
| FAnimInterp | interp, | ||
| float | t, | ||
| Span< float > | out | ||
| ) |
Samples a generic keyframed track of comps-wide values at time t into out.
Same time/value packing and interpolation rules as FAnimChannel (step/linear/cubic, clamped to the key range). Used for morph-target weight tracks (comps == target count).
| out | Must be exactly comps wide. |
| void SkinVertices | ( | Span< const FVertex > | bind, |
| Span< const FSkinBinding > | binding, | ||
| Span< const mat4 > | palette, | ||
| Span< FQVertex > | out | ||
| ) |
Linear-blend skins bind-pose vertices by the palette, packing results for the dynamic ring.
| bind | Rest-pose, full-precision vertices (positions/normals/tangents in bind space). |
| binding | Per-vertex joint indices + weights (parallel to bind). |
| palette | Skinning matrices from ComputeSkinningMatrices. |
| out | Destination quantized vertices (size == bind.size()); write straight into the span returned by GPUScene::UpdateDynamicGeometry. |