GraphicsSceneRenderer class final
Draws a world's 3-D components (Model, the shapes, Light, Environment)
from the engine's camera — the SceneRenderer a Graphics3D adds.
Each frame it brings its scene up to date with the world: the model and shape instances are looked over only when the world's structure changes or a model finishes loading — what still stands is kept, only what is new is made — and otherwise just follow their entities' transforms — a shape whose sizes or look changed takes another mesh or material from shapes. It then renders into a texture at the viewport's size in physical pixels times renderScale and draws that texture over the viewport.
Between fixed updates an entity is drawn the frame's interpolation of the way from its previous pose to its pose, when whatever moves it captured that previous pose in the last update (TransformComponent.captureCount: physics bodies and characters). Anything else is drawn where it is: a transform only gameplay writes has a previous pose that may be stale.
Without a GPU (unsupportedReason set) it still keeps the scene and the models' bounds up to date, and draws a short note instead of the image.
- Inheritance
-
- Object
- SceneRenderer
- GraphicsSceneRenderer
Constructors
- GraphicsSceneRenderer({required Engine engine, required Renderer3D renderer, required GraphicsModels models, String? unsupportedReason})
-
Draws
engine's world withrenderer, models frommodels.
Properties
- aids ↔ SceneEditorAids?
-
What an editor adds to its views; null in a game.
getter/setter pair
-
debugInstances
→ Map<
String, int> -
The models drawn, for tests: path → instance count.
no setter
-
debugModelInstances
→ List<
MeshInstance> -
The models drawn, for tests: every instance of every one.
no setter
-
debugShapeInstances
→ List<
MeshInstance?> -
The shapes drawn, for tests: each one's instance (null while it has
no triangles).
no setter
- dynamicResolution → DynamicResolution
-
Lowers the resolution while frames run slow (off by default).
final
- enabled → bool
-
Skipped while false.
no setteroverride
- engine → Engine
-
Whose world is drawn.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
lastFrame
↔ Future<
bool> ? -
Completes when the GPU has finished the last frame.
getter/setter pair
- materials → MaterialLibrary
-
The material files shapes and models are drawn with
(Primitive3D.material, ModelComponent.materials).
latefinal
- models → GraphicsModels
-
Where models come from.
final
-
modelsInUse
→ Iterable<
GpuModel> -
The GPU models in use.
no setter
- order → int
-
Draw order among scene renderers; lower first.
no setteroverride
- pixelRatio ↔ double?
-
Physical pixels per viewport pixel; null reads the screen's.
getter/setter pair
- providers → RenderProviders
-
What kits draw (terrain, scatter, tiles): read from the engine's
RenderProviders.
no setter
- renderer → Renderer3D
-
What draws it.
final
- renderScale ↔ double
-
Fraction of the physical resolution rendered (0.25..1 makes sense;
above 1 supersamples).
getter/setter pair
- renderWithoutGpu ↔ bool
-
Renders on a device with no GPU too (tests of the CPU side).
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scene → RenderScene
-
The scene as last extracted from the world.
final
- shapes → GraphicsShapes
-
The shapes' meshes and materials.
latefinal
- unsupportedReason → String?
-
Why there is no GPU to draw with, or null when there is one.
final
- visible ↔ bool
-
Drawn at all.
getter/setter pair
Methods
-
dispose(
) → void - Stops listening to models; call once it is no longer drawn.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
render(
Canvas canvas, FrameView view) → void -
Draw into
canvas, whose coordinates are viewport pixels, whatviewsees.override -
toString(
) → String -
A string representation of this object.
inherited
-
update(
FrameView view) → void -
Brings scene and the render view up to date with the world and
view. render calls it; tests may call it alone.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited