worldMatrix property
Matrix4
get
worldMatrix
The node-to-world transform, always current.
Implementation
Matrix4 get worldMatrix {
final parent = _parent;
if (parent == null) {
if (_localDirty || _seenParentVersion != 0) {
if (_localDirty) _recomputeLocal();
_worldMatrix.setFrom(_localMatrix);
// 0 marks "no parent", distinct from any real stamp.
_seenParentVersion = 0;
_bumpWorld();
}
return _worldMatrix;
}
// Resolving the parent first means ancestors are refreshed before we read
// their stamp, so one access repairs the whole chain.
final parentWorld = parent.worldMatrix;
if (_localDirty || parent._worldVersion != _seenParentVersion) {
if (_localDirty) _recomputeLocal();
_worldMatrix.setFrom(parentWorld);
_worldMatrix.multiply(_localMatrix);
_seenParentVersion = parent._worldVersion;
_bumpWorld();
}
return _worldMatrix;
}