scenePrePass method
Walks this node's subtree once per frame to prepare it for
rendering: ticks components and animation players and refreshes the
RenderItems the render passes iterate.
Called by Scene.update and Scene.render; not normally called
directly. deltaSeconds is the elapsed time since the previous
tick. ancestorsVisible is whether every ancestor of this node is
visible, and defaults to true for the root.
Implementation
void scenePrePass(double deltaSeconds, [bool ancestorsVisible = true]) {
_effectiveVisible = ancestorsVisible && visible;
// Components tick whenever the node is mounted, independent of visibility.
_visitMutable(_components, (component) => component.tick(deltaSeconds));
if (_effectiveVisible) {
_animationPlayer?.update(deltaSeconds);
for (final meshComponent in _meshComponents) {
meshComponent.refreshRenderItems();
}
for (final instancedMeshComponent in _instancedMeshComponents) {
instancedMeshComponent.refreshRenderItem();
}
} else {
// Keep a hidden subtree's items out of the render passes.
for (final meshComponent in _meshComponents) {
meshComponent.hideRenderItems();
}
for (final instancedMeshComponent in _instancedMeshComponents) {
instancedMeshComponent.hideRenderItem();
}
}
_visitMutable(
children,
(child) => child.scenePrePass(deltaSeconds, _effectiveVisible),
);
}