Skip to main content

Module mesh_topologies

Module mesh_topologies 

Source
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 column in row, in world units.
index_buffer 🔒
The index buffer the indexed row binds.
options_for 🔒
The options one topology draws with.
place 🔒
Place patch vertex vertex into the cell whose centre is center.