Toast Engine
Loading...
Searching...
No Matches
assets::Skin Struct Reference

A skeleton: the joint nodes a skinned mesh binds to. More...

#include <animation.hpp>

Public Member Functions

auto jointMatrices (std::span< const glm::mat4 > joint_world_transforms) const -> std::vector< glm::mat4 >
 Builds the per-joint matrices a skinning shader multiplies vertices by.

Public Attributes

std::string name
std::string skeleton_root
 node name, empty when glTF didn't specify one
std::vector< std::string > joints
 node names, in the order joint indices refer to
std::vector< glm::mat4 > inverse_bind_matrices
 parallel to joints; empty means identity for all

Detailed Description

A skeleton: the joint nodes a skinned mesh binds to.

jointMatrices() turns a posed node tree into the matrices a shader blends between. A mesh whose joints cannot be resolved gets no posed slice and falls back to bind pose rather than dropping

Member Function Documentation

◆ jointMatrices()

auto assets::Skin::jointMatrices ( std::span< const glm::mat4 > joint_world_transforms) const -> std::vector< glm::mat4 >
nodiscard

Builds the per-joint matrices a skinning shader multiplies vertices by.

joint_world_transform * inverse_bind_matrix, so the product expresses only deformation away from bind - which is what the vertex weights blend between

Parameters
joint_world_transformsWorld transforms of joints, same order. A missing entry falls back to identity rather than being skipped, so the result always matches joints.size() and a shader can index it without bounds checks
Note
Supplied by the caller rather than walked here, so several instances can pose one skeleton asset

The documentation for this struct was generated from the following files:
  • engine/src/toast/assets/animation.hpp
  • engine/src/toast/assets/animation.cpp