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. An index loop tolerates a component adding or removing
// a sibling component during its own update.
for (int i = 0; i < _components.length; i++) {
_components[i].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();
}
}
for (final child in children) {
child.scenePrePass(deltaSeconds, _effectiveVisible);
}
}