renderer library
just_graphics_engine's forward renderer: upload models
(ModelUploader), place them in a Render3DScene with lights and an
environment, and draw it from a Render3DView into a GpuSurface with
Renderer3D (Renderer3D.tryCreate picks this platform's GPU).
DynamicResolution trades pixels for frame time; Scene3DView draws a
scene every frame in a widget.
Loads on every platform; drawing needs a GpuDevice (see gpu.dart).
Classes
- BloomSettings
- The glow around bright things (HDR only).
- DefaultTextures
- 1×1 textures standing in for a material's missing maps: white (base colour, metal-rough, occlusion, emissive — so factors apply alone) and a flat normal.
- Directional3DLight
- The sun: light travelling along direction.
- DynamicResolution
- Renders fewer pixels while frames run slow, and more again when there is time to spare: a scale between minScale and maxScale on top of the renderer's own, stepped by what the last second of frames took.
- Environment
- The sky and the light that doesn't come from lights.
- GpuEnvironmentMap
-
An EnvironmentMapData on the GPU: its levels in one half-float cube
texture, its spherical harmonics beside it. Give it to
Environment.mapand lit surfaces take their ambient light and reflections from it; withEnvironment.skyboxthe sky shows it. - GpuMaterial
- A material's textures and settings, ready to bind.
- GpuModel
- A model uploaded to the GPU: its primitives' buffers, its materials' textures, and the data it came from (without its images' pixels, which live on the GPU now).
- GpuPrimitive
- One primitive's vertex and index buffers.
- InstanceBatch
- Many copies of one primitive in one material, drawn in one call: grass, rocks, tiles, a fence's posts. Unlike MeshInstances, which the renderer culls and packs one by one each frame, a batch is culled as a whole by its bounds and keeps its instances on the GPU between frames, uploaded again only when they change (setInstances).
- MeshInstance
- One primitive drawn somewhere in the world.
- ModelUploader
- Uploads ModelData to a GpuDevice.
- OverlayDraw
- Lines drawn over the scene: a primitive's edges where world puts it, in color — a selection's highlight, a wireframe.
- PosedModel
- One placed copy of a model in a pose of its own: what an animated character is to the renderer.
- Punctual3DLight
- A point or spot light.
- Render3DScene
- Everything the renderer draws in one view.
- Render3DStats
- What the last frame did.
- Render3DView
-
The camera a frame is drawn from, in the renderer's conventions: +Y
down, clip y down, depth 0..1 (
Matrix4Transforms.setPerspectiveYDown). - Renderer3D
- Forward renderer for Render3DScenes: physically based lighting from a sun (with two cascades of shadow maps), up to 8 point/spot lights and a hemisphere ambient; skinned meshes; a gradient sky; HDR with 4x MSAA and ACES tonemapping where the device can.
- Scene3DView
- Draws scene seen from camera with renderer, every frame.
- ShadowFit
- A sun shadow map's placement for one frame.
- ShadowFitter
- Places sun shadow maps (fit); its scratch is its own, so fitting allocates nothing. A renderer owns one.
- ShadowSettings
- How the sun's shadows are drawn.
- Skeleton
- A model's node tree flattened parents first, for turning a Pose into node matrices and those into the joint palettes of its skins.
- SkinPalette
- One posed skin, ready to draw: rows holds its joint palette (kPaletteFloats floats per joint), refreshed by its owner each frame.
Enums
- Render3DViewMode
- How the renderer draws the scene: as it looks, flat-lit to read shapes by, or as lines only.
- SkinningMode
- How joint matrices reach the vertex shader.
Constants
- kBatchInstanceFloats → const int
- Floats per instance in a batch's buffer: a model matrix, then a normal matrix (three columns of four) — what every lit and shadow draw reads.
- kMaxUniformJoints → const int
- The most joints the uniform-array fallback holds per draw.
- kPaletteFloats → const int
- Floats per joint in a palette: the top three rows of its 4x4 matrix.
Properties
- gltfToEngine → Matrix4
-
glTF is +Y up; the engine is +Y down with +Z into the screen. A 180°
turn about X takes one to the other. It is a rotation, not a mirror, so
triangle winding is kept.
final
-
rendererNullShaders
→ Map<
String, Map< String, NullUniformBlock> > -
The renderer's shaders' uniform blocks as reflection reports them, for a
NullGpuDevice standing in for a GPU:
NullGpuDevice(shaders: rendererNullShaders)can create aRenderer3D, which then runs its whole CPU side (culling, sorting, batching, uniform packing) and draws nothing. A GPU test checks these against the real reflection.final
Typedefs
- Scene3DFrameCallback = void Function(Duration elapsed, Size size)
-
Called before Scene3DView draws a frame: move the camera, animate the
scene.
elapsedis the time since the view started ticking;sizeis its size in logical pixels.