Graphics3D class final
3-D graphics for an engine. Give one to the engine and its 3-D components — ModelComponent, LightComponent, EnvironmentComponent, AnimationPlayerComponent, SocketComponent and the shapes from Cube3D to Polygon3D — are saved, loaded, offered in the editor's 3-D scenes and drawn:
Engine(config: EngineConfig(graphics3D: Graphics3D()));
with Flutter GPU switched on in each platform's runner (see the README).
A game without one is 2-D only: it makes no GPU device and loads no shaders, and a scene holding 3-D components fails to load, saying so.
As the engine is made it registers the components, and how animator graphs and timelines play clips on a model's skeleton. As the engine initializes it makes the GPU device and the renderer (just_graphics_engine), loads models for the asset manager (AssetType.model), adds a GraphicsSceneRenderer to the engine's frame and an AnimationSystem3D to its world.
Where Flutter GPU can't draw — the web, Impeller turned off, Android on
OpenGL ES, a plain flutter test — the game runs anyway: scenes and
models load (models for their bounds), the 3-D view shows a short note,
unsupportedReason says why and onUnsupported hears it once.
- Implemented types
Constructors
- Graphics3D({GpuDevice? device, double renderScale = 1.0, void onUnsupported(String reason)?, bool? keepEdges})
-
3-D graphics drawn with
device, or with the platform's GPU when that is null, atrenderScaleof the physical resolution.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- id → String
-
graphics_3d: what the engine knows it by, as an extension and as a service.no setteroverride - isStarted → bool
-
Whether the engine started it: renderer, models and
sceneRenderer are there.
no setter
- isSupported → bool
-
Whether there is a GPU to draw with.
no setter
- keepEdges → bool
-
Whether meshes keep their edges for lines over the scene (an editor's
wireframe and selection outline): on in a debug build, where an
editor runs, off in a release, which never draws them.
final
- models → GraphicsModels
-
The engine's models; throws before the engine initializes.
no setter
- onUnsupported → void Function(String reason)?
-
Told once, as the engine initializes, why 3-D is not drawn here.
final
- renderer → Renderer3D
-
The renderer; throws before the engine initializes.
no setter
- renderScale → double
-
Fraction of the physical resolution rendered; see
GraphicsSceneRenderer.renderScale.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sceneRenderer → GraphicsSceneRenderer
-
What draws the engine's world; throws before the engine initializes.
no setter
- unsupportedReason → String?
-
Why 3-D is not drawn, or null when it is (or the engine has not
initialized yet).
no setter
Methods
-
install(
EngineContext context) → void -
Registers the 3-D components, and how animator graphs and timelines
play clips on a skeleton (registerSchemas).
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
refresh(
EngineContext context) → void -
Registers the 3-D components' definitions and playback again, after a
hot reload.
override
-
start(
ServiceContext context) → Future< void> -
Makes the GPU device (or, without one, a null device), the renderer
and the models; registers the model loader with the asset manager;
adds a GraphicsSceneRenderer to the engine's frame and an
AnimationSystem3D to its world.
override
-
stop(
) → Future< void> -
Takes out what start put in — the scene renderer, the animation
system, the model loader — and lets go of the renderer and the
models: isStarted is false again.
override
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
registerSchemas(
EngineContext context) → void -
Registers the 3-D components into
context, so scenes holding them load and save — for tools that read and write 3-D scenes without drawing them. Giving the engine a Graphics3D does this already.