resize method
Resizes the render target. If a camera is set, its intrinsics are updated to preserve the current field-of-view.
Returns true
if the texture actually resized (and we updated matrices).
Implementation
Future<bool> resize(Camera nextCamera) async {
if (_isResizing) return false;
final current = _camera;
if (current != null &&
nextCamera.width == current.width &&
nextCamera.height == current.height) {
return false; // no-op
}
_isResizing = true;
try {
// Camera is the source of truth; setter may trigger depth sort, etc.
camera = nextCamera;
final desired = AngleOptions(
width: _camera!.width,
height: _camera!.height,
dpr: 1,
alpha: true,
useSurfaceProducer: true,
customRenderer: false,
);
// If _targetTexture isn't statically typed, guard and early-return.
final anyTexture = _targetTexture;
final resized = await _tryResizeAngle(anyTexture, desired);
if (!resized) return false;
_updateProjectionMatrix();
_updateViewMatrix();
return true;
} finally {
_isResizing = false;
}
}