renderer library
just_graphics_engine's forward renderer: upload models
(ModelUploader), place them in a RenderScene with lights and an
environment, and draw it from a RenderView into a GpuSurface with
Renderer3D (Renderer3D.tryCreate picks this platform's GPU).
DynamicResolution trades pixels for frame time.
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.
- DirectionalLight
- 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.
- GpuPrimitive
- One primitive's vertex and index buffers.
- MeshInstance
- One primitive drawn somewhere in the world.
- ModelUploader
- Uploads ModelData to a GpuDevice.
- PosedModel
- One placed copy of a model in a pose of its own: what an animated character is to the renderer.
- PunctualLight
- A point or spot light.
- Renderer3D
- Forward renderer for RenderScenes: 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.
- RendererPipelines
- The pipelines the renderer draws with.
- RenderScene
- Everything the renderer draws in one view.
- RenderStats
- What the last frame did.
- RenderView
-
The camera a frame is drawn from, in the renderer's conventions: +Y
down, clip y down, depth 0..1 (
JustMatrix4.setPerspectiveYDown). - ShadowFit
- A sun shadow map's placement for one frame.
- 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
- SkinningMode
- How joint matrices reach the vertex shader.
Constants
- 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.
- litLayout → const GpuVertexLayout
- The vertex layout of every lit mesh: one vertex buffer (VertexOffsets) and one per-instance buffer of a model matrix and a normal matrix.
- litSkinnedLayout → const GpuVertexLayout
- Skinned lit meshes: vertices, joints and weights, then per instance the matrices and the palette's first texel.
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
Functions
-
fitSunShadow(
RenderView view, Vector3 direction, ShadowSettings settings, ShadowFit out, {double from = 0, double? to}) → bool -
Places a shadow map for a sun shining along
directionaround whatviewsees up tosettings' distance, intoout. The box is the bounding sphere of that slice of the view (so it keeps its size as the camera turns) and moves in whole texels (so shadow edges don't crawl as the camera moves). False when there is nothing to fit.