isVisibleTo method

bool isVisibleTo(
  1. Camera camera,
  2. Size dimensions
)

Whether this node's subtree would survive frustum culling against camera for a render target of the given dimensions.

Returns true when the node is configured to opt out of culling (frustumCulled is false), when the subtree is unbounded (skinned content, or geometry without computable bounds, both of which the renderer conservatively treats as always visible), or when the world-space AABB intersects the camera frustum. Returns false only when there is a sound bound and it lies entirely outside the frustum.

Uses globalTransform to place the subtree's local-space AABB into world space.

Implementation

bool isVisibleTo(Camera camera, Size dimensions) {
  if (!frustumCulled) return true;
  final bounds = combinedLocalBounds;
  if (bounds == null) return true;
  final worldAabb = vm.Aabb3.copy(bounds)..transform(globalTransform);
  return camera.getFrustum(dimensions).intersectsWithAabb3(worldAabb);
}