render method
Draw into canvas, whose coordinates are viewport pixels, what
view sees.
Implementation
@override
void render(Canvas canvas, FrameView view) {
final size = view.viewportSize;
if (size.isEmpty) return;
if (aids?.skippedViews.contains(view) ?? false) return;
if (!_gpu && !renderWithoutGpu) {
// Nothing to draw with: only the models' bounds are kept up to date.
_refresh(world());
_drawNote(canvas, size, _failure?.toString() ?? unsupportedReason!);
return;
}
final frame = this.frame?.call();
final surface = _surfaceFor(view);
if (_gpuBehind(frame)) {
// The GPU is behind: this view's last image again, so frames don't
// queue up on it.
_drawImage(canvas, surface, size);
return;
}
update(view);
try {
final done = renderer.render(scene, _view, surface, frame: frame);
lastFrame = done;
unawaited(done.then((_) {}, onError: _fail));
} on Object catch (error) {
_fail(error);
return;
} finally {
// The renderer is shared (a model's thumbnail, say): an editor's view
// settings stay with its views.
renderer
..viewMode = Render3DViewMode.lit
..clipPlane = null;
}
_drawImage(canvas, surface, size);
}