Skip to main content

Module animated

Module animated 

Source
Expand description

The animated-grid scene: meshes allocated, recycled and moved across eight frames.

Ported from the ecs_animated_scene_matches_snapshots test. One world is evolved over several frames: meshes are allocated, some are recycled, the moving ones translate and rotate, and the camera orbits the grid. Every frame is stored as its own snapshot, so the sequence shows what a wrong pooled range, a stale metadata entry or a mispacked instance looks like from frame to frame.

Re-exportsΒ§

use super::SEQUENCE_STEP; πŸ”’
use super::SceneControl; πŸ”’
use super::SceneDef; πŸ”’
use super::SceneOptions; πŸ”’
use super::TEST_SIZE; πŸ”’
use unlit_ecs::Bundle; πŸ”’
use unlit_ecs::DynamicBundle; πŸ”’
use unlit_ecs::bundle; πŸ”’
use unlit3d::prelude::*; πŸ”’

StructsΒ§

CellCube πŸ”’
One cell of the grid: a cube placed at the cell this frame fills.
Step πŸ”’
What a frame changes structurally, on top of the motion every frame applies.

ConstantsΒ§

CELLS πŸ”’
CELL_SPACING πŸ”’
COLUMNS πŸ”’
The grid of cells a cube can occupy, in the XZ plane.
GRID_TARGET πŸ”’
The point the orbiting camera looks at.
ORBIT_HEIGHT πŸ”’
ORBIT_RADIUS πŸ”’
Where the camera orbits, and how high above the grid it sits.
ORBIT_STEP πŸ”’
Radians the camera advances per frame.
ROWS πŸ”’
STEPS πŸ”’
The structural change of each frame, as the snapshot test froze it.
TINTS πŸ”’
The per-instance base colors the allocations cycle through.

StaticsΒ§

SCENE
The scene: a 3x3 grid of cubes that fills, moves and recycles over eight frames, each stored as its own snapshot.

FunctionsΒ§

build πŸ”’
Build the animated-grid scene’s world content.
cell_center πŸ”’
The world-space centre of cell.
cell_transform πŸ”’
The placement a cell’s mesh has in frame.
orbit_camera πŸ”’
The camera of frame, orbiting the grid once over the whole sequence.
orbit_eye πŸ”’
Where the camera of frame orbits.