Scene3DView class
Draws scene seen from camera with renderer, every frame.
String? reason;
final renderer = await Renderer3D.tryCreate(onUnsupported: (r) => reason = r);
final scene = RenderScene();
// ... upload models with renderer.uploader and add them to scene ...
Scene3DView(
renderer: renderer,
scene: scene,
camera: RenderView()..lookAt(Vector3(0, -2, -6), Vector3.zero()),
fieldOfView: math.pi / 3,
unsupportedReason: reason,
);
It fills the space it is given. Each frame it sets camera's size in pixels from its own (times the device pixel ratio and renderScale) and, when fieldOfView is given, a perspective projection with the view's aspect ratio; otherwise the projection is left to onFrame.
Where there is no Flutter GPU renderer is null and the view shows unsupportedReason instead. If drawing fails it stops and shows why.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- Scene3DView
Constructors
-
Scene3DView({Key? key, required Renderer3D? renderer, required RenderScene scene, required RenderView camera, double? fieldOfView, double near = 0.1, double far = 500, double renderScale = 1.0, bool animate = true, Scene3DFrameCallback? onFrame, void onRendered(Future<
bool> done)?, String? unsupportedReason}) -
A view drawing
scenefromcamerawithrenderer.const
Properties
- animate → bool
-
Whether it draws every frame. False draws when rebuilt only, for a
scene that does not move.
final
- camera → RenderView
-
Where it is seen from. Its RenderView.width and RenderView.height
are set by the view.
final
- far → double
-
The far clipping distance, with fieldOfView.
final
- fieldOfView → double?
-
The vertical field of view in radians, or null to leave
camera's projection alone.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- near → double
-
The near clipping distance, with fieldOfView.
final
- onFrame → Scene3DFrameCallback?
-
Called before each frame is drawn.
final
-
onRendered
→ void Function(Future<
bool> done)? -
Called with each frame sent to the GPU: the future completes when the
GPU has drawn it (wait for it before reading pixels back).
final
- renderer → Renderer3D?
-
What draws, or null where Flutter GPU can't (see
Renderer3D.tryCreate).
final
- renderScale → double
-
Fraction of the physical resolution rendered: 0.5 draws a quarter of
the pixels, scaled up.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scene → RenderScene
-
What is drawn.
final
- unsupportedReason → String?
-
Why there is no renderer, shown in its place.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< Scene3DView> -
Creates the mutable state for this widget at a given location in the tree.
override
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited