localBounds property
Aabb3?
get
localBounds
Local-space union of every primitive's Geometry.localBounds, or
null when no primitive has computable bounds.
Cached. The cache refreshes itself when a primitive's geometry reports a new Geometry.localBoundsVersion, so an updatable geometry that is mutated in place stays correct without an explicit invalidation. Call markLocalBoundsDirty after replacing a primitive's geometry.
Implementation
vm.Aabb3? get localBounds {
if (_localBoundsCached && _boundsVersionsUnchanged()) {
return _localBoundsCache;
}
vm.Aabb3? result;
for (final p in primitives) {
final b = p.geometry.localBounds;
if (b == null) continue;
if (result == null) {
result = vm.Aabb3.copy(b);
} else {
result.hull(b);
}
}
_localBoundsCache = result;
_localBoundsCached = true;
_cachedBoundsVersions = <int>[
for (final p in primitives) p.geometry.localBoundsVersion,
];
return result;
}