coverage method
This volume's coverage at world-space cameraPosition, 0..1 (before
weight). Transforms the camera into the node's local space and tests the
local region, so the node transform (including rotation and scale) shapes
the volume.
Implementation
double coverage(Vector3 cameraPosition) {
final worldToLocal = Matrix4.tryInvert(node.globalTransform);
if (worldToLocal == null) return 0.0;
final local = worldToLocal.transformed3(cameraPosition);
final dist = switch (shape) {
EnvironmentVolumeShape.box => _boxDistance(local, extents),
EnvironmentVolumeShape.sphere => _sphereDistance(local, radius),
};
if (blendDistance <= 0) return dist <= 0 ? 1.0 : 0.0;
return (1.0 - dist / blendDistance).clamp(0.0, 1.0);
}