Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commit3bb1da2647

README.md

blend Module

Public Luau surface over the __blend Internal FFI namespace — record-stride blend primitives over buffer slices.

Purpose

Wrap the raw __blend.* FFI namespace in a typed Luau table that gets auto-injected as _G.blend via the prelude. A blend layout describes a record (e.g. one bone) as a list of { offset, stride, op } slots; weightedInto / lerpInto then combine N input buffers into an output buffer applying the per-slot op (lerp / slerp / sum / step) across every record.

Usage

local layout = blend.layout({
    { offset = 0,  stride = 3, op = "lerp"  },   -- translation
    { offset = 3,  stride = 4, op = "slerp" },   -- rotation (quat)
    { offset = 7,  stride = 3, op = "lerp"  },   -- scale
}, 10)

-- N-way weighted
blend.weightedInto(out, layout, {
    { buffer = a, weight = 0.4 },
    { buffer = b, weight = 0.6 },
})

-- A/B fast path
blend.lerpInto(out, layout, a, b, 0.6)
blend.destroyLayout(layout)

Exports

  • blend.layout(slots, totalStride?) -> number?
  • blend.destroyLayout(handle) -> boolean
  • blend.weightedInto(out, layout, inputs) -> boolean
  • blend.lerpInto(out, layout, a, b, t) -> boolean