Expand description
The exampleโs own scene: a spinning, textured cube with two egui panels.
This is the scene the windowed example always showed. Its snapshot test
is the workspaceโs CI check against spin_cube.webp: 30 frames at the
default window size, so a rendering regression fails the build.
Re-exportsยง
use super::BASELINE_SIZE;๐use super::SceneControl;๐use super::SceneDef;๐use super::SceneOptions;๐use unlit_ecs::Bundle;๐use unlit_ecs::DynamicBundle;๐use unlit_ecs::bundle;๐use unlit_wgpu::pipeline::LitOptions;๐use unlit3d::ui::UiSource;๐use unlit3d::ui::egui;๐use unlit3d::prelude::*;๐
Structsยง
- Camera
Orbit ๐ - How far the camera has been dragged around the cube, in radians.
- Drag
From ๐ - The pointer the drag is following, and where it was at the previous move.
- Frame
Count ๐ - Counts the frames drawn, for the panelโs readout.
- Spin ๐
- A behaviour component: the cube turns by
radians_per_second. - Spin
Reset ๐ - Set by the panelโs button, read once by the frame loop.
- Spin
State ๐ - The state of the spin, shared between the panel, the pointer behaviour and the frame loop.
- Textured
Cube ๐ - The sceneโs one visible object: a textured cube turned by the frame loop.
Constantsยง
- ORBIT_
ELEVATION ๐ - How high above the horizon the camera starts, in radians.
- ORBIT_
RADIUS ๐ - How far from the target the camera orbits, in world units.
- ORBIT_
TARGET ๐ - The point the camera looks at, in world units.
- SAMPLE_
COUNT - The number of samples every frame is rendered with.
- SPIN ๐
- How fast the cube spins, in radians per second.
Staticsยง
- SCENE
- The scene: a spinning cube at the exampleโs default window size, whose
snapshot test verifies
spin_cube.webp.
Functionsยง
- build ๐
- Build the cube sceneโs world content.
- checkerboard ๐
- A
sizexsizecheckerboard base-color texture. - orbit_
camera ๐ - A camera orbiting
ORBIT_TARGETatazimuthandelevation, in radians.