vkmEngine 1.0.0
A C++ game engine · vkmengine.com
Loading...
Searching...
No Matches
Vkm::Engine::PoseBuffer Class Reference

Every rig's pose for one frame, published on FrameContext::poses. More...

#include <pose_buffer.h>

Public Member Functions

void clear ()
 Drop last frame's slices and mapping, keeping the capacity.
uint32_t addSlice (uint32_t boneCount)
 Reserve boneCount consecutive bones for one rig.
void mapEntity (EntityId entity, uint32_t slice)
 Record that entity is driven by slice.
PoseWrite writeTo (uint32_t slice)
 Writable view of slice, for composing its pose.
const PoseSlice * sliceOf (EntityId entity) const
 The slice driving entity.

Detailed Description

Every rig's pose for one frame, published on FrameContext::poses.

A per-frame product, not a component: rebuilt whenever the rigs are posed, authored by no one, and read by several mesh entities per rig. global is the pose in rig model space; palette is global[b] * inverseBind[b] for the vertex stage, kept beside the pose rather than overwriting it.

Member Function Documentation

◆ addSlice()

uint32_t Vkm::Engine::PoseBuffer::addSlice ( uint32_t boneCount)

Reserve boneCount consecutive bones for one rig.

Invalidates every PoseWrite handed out earlier: allocate every slice before composing any.

Parameters
boneCountBones the rig has.
Returns
Index of the new slice, for writeTo() and mapEntity().

◆ mapEntity()

void Vkm::Engine::PoseBuffer::mapEntity ( EntityId entity,
uint32_t slice )

Record that entity is driven by slice.

Parameters
entityEntity the slice poses, generation included.
sliceSlice index returned by addSlice().

◆ writeTo()

PoseWrite Vkm::Engine::PoseBuffer::writeTo ( uint32_t slice)

Writable view of slice, for composing its pose.

Writes nothing, so distinct slices may be filled from several threads at once.

Parameters
sliceSlice index returned by addSlice().
Returns
Pointers into this buffer's arrays, valid until the next addSlice().

◆ sliceOf()

const PoseSlice * Vkm::Engine::PoseBuffer::sliceOf ( EntityId entity) const

The slice driving entity.

Keyed on the whole id, not the slot: the map is read every frame until the next tick, and a slot reused in between must not skin a new entity from another rig's matrices.

Parameters
entityEntity to look up.
Returns
The slice, or nullptr when nothing poses that entity.

The documentation for this class was generated from the following file: