MorphTargetData class Geometry

Morph target (blend shape) deltas for one geometry.

Targets store additive deltas against the base vertex attributes; the blended result is base + sum(weight_i * delta_i) over every target, per the glTF morph semantics. Deltas are target-major ([target][vertex][xyz]) and aligned with the owning geometry's packed vertex order.

Instances are usually built by the importers. The per-instance weights live on the mesh-bearing Node (Node.setMorphWeight); this object carries only the shared deltas, targetNames, and defaultWeights.

Constructors

MorphTargetData({required int vertexCount, required int targetCount, required Float32List positionDeltas, Float32List? normalDeltas, Float32List? tangentDeltas, List<String>? targetNames, List<double>? defaultWeights})
Creates morph data covering targetCount targets of vertexCount vertices each.

Properties

defaultWeights Float32List
The mesh-default weights a fresh instance starts from. Always targetCount entries; zero for targets the asset gave no default.
final
hashCode int
The hash code for this object.
no setterinherited
normalDeltas Float32List?
Normal deltas (same shape as positionDeltas), or null when the targets carry none.
final
positionDeltas Float32List
Position deltas, target-major, targetCount * vertexCount * 3 floats.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
tangentDeltas Float32List?
Tangent deltas, xyz only, or null when absent. Stored but not applied yet. TODO(morph-tangent-deltas): blend tangents on both paths.
final
targetCount int
The number of morph targets.
final
targetNames List<String>
The target names (from the asset's extras.targetNames), empty strings for unnamed targets. Always targetCount entries.
final
vertexCount int
The number of vertices each target's deltas cover.
final

Methods

blendNormals(Float32List baseNormals, Float32List weights, {Float32List? out}) Float32List
Blends weights worth of normal deltas onto baseNormals and renormalizes each result, keeping the base normal where the weighted sum collapses to near zero. Returns the base values unchanged when the targets carry no normal deltas.
blendPositions(Float32List basePositions, Float32List weights, {Float32List? out}) Float32List
Blends weights worth of position deltas onto basePositions (vertexCount * 3 floats), writing into out when given (must match the base length) or a fresh list otherwise.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

selectActiveTargets(Float32List weights, {int cap = kMaxGpuMorphTargets}) List<({int index, double weight})>
Picks the morph targets to evaluate on the GPU: the nonzero entries of weights with the largest magnitudes, at most cap of them, ordered by descending magnitude (ties keep the lower index first).