Expand description
The mesh-topology scene: every primitive topology, drawn indexed and non-indexed.
The other scenes draw triangle lists, so the primitive a pipeline assembles — and the draw call that feeds it — is the one thing none of them pins. This scene draws one patch in each of the five topologies, once from an index buffer and once straight from the vertex buffer, in a 5x2 grid: the top row is indexed, the bottom row draws its vertices in order.
The indexed row stores its vertices shuffled and restores the draw order through the index buffer, so the two rows draw the same picture only if that buffer is really read: a draw that ignored it would assemble the patch from the storage order instead and show a differently-shaped patch. The rows are therefore compared against each other, and the pair is what carries the evidence.
Strips carry a second trap. A strip pipeline has to declare the index width
its draw binds, and here that width is the mesh source’s own choice — the
narrowest format the mesh’s vertex count fits, widened while baking in a
pool offset on a device without base_vertex. The top row’s strip cells
are what exercise the specializer that derives it from the mesh.
Re-exports§
use super::SceneControl;🔒use super::SceneDef;🔒use super::SceneOptions;🔒use super::TEST_SIZE;🔒use super::camera_looking_at;🔒use super::default_options;🔒use unlit_ecs::Bundle;🔒use unlit_ecs::DynamicBundle;🔒use unlit_ecs::bundle;🔒use unlit_wgpu::pipeline::LitOptions;🔒use unlit3d::prelude::*;🔒
Structs§
- Patch 🔒
- One patch of the grid: a mesh and the pipeline that assembles it.
Constants§
- CAMERA_
DISTANCE 🔒 - How far in front of the patches the camera sits, in world units.
- COLUMN_
SPACING 🔒 - The distance between neighbouring columns, in world units.
- DRAW_
ORDER 🔒 - The storage slots the non-indexed row draws, which is the draw order itself: a draw with no index buffer reads its vertices in the order they are stored.
- INDEX_
ORDER 🔒 - The draw vertex each storage slot holds in the indexed row.
- PATCH 🔒
- The patch in its own space, in draw order.
- PATCH_
HALF_ 🔒HEIGHT - Half of a patch’s height, in world units.
- PATCH_
HALF_ 🔒WIDTH - Half of a patch’s width and height, in world units.
- PATCH_
VERTICES 🔒 - How many vertices one patch has.
- ROW_
OFFSET 🔒 - How far each row’s patches sit above and below the centre, in world units.
- TOPOLOGIES 🔒
- The topologies drawn, left to right.
- VERTEX_
COLORS 🔒 - The colour of each patch vertex, in draw order.
Statics§
- SCENE
- The scene: one patch per topology, indexed and non-indexed.
Functions§
- build 🔒
- Build the topology scene’s world content.
- cell_
center 🔒 - The world position of the cell at
columninrow, in world units. - index_
buffer 🔒 - The index buffer the indexed row binds.
- options_
for 🔒 - The options one topology draws with.
- place 🔒
- Place patch vertex
vertexinto the cell whose centre iscenter.