Expand description
The shapes the scene cycles through: their meshes, colliders and textures.
A shape kind decides three things at once โ what the render world draws, what physics simulates, and what pattern the material wears โ so the three live together and a new kind is one match arm per function.
Re-exportsยง
use glam::Vec3;๐use crate::render::OwnedLitMeshDesc;๐use crate::render::WHITE_COLOR;๐use crate::render::cuboid_mesh;๐use crate::render::uv_sphere;๐use unlit3dx::prelude::*;๐
Enumsยง
- Shape
Kind - One body shape of the scene: the mesh it draws, the collider physics simulates, and the texture pattern its material wears.
Constantsยง
- BALL_
COLORS - The base colors the balls cycle through, as sRGB bytes.
- BALL_
RADIUS - Every ballโs radius, in metres.
- PATTERN_
SIZE - The pattern textures the shape materials draw from, in pixels per side: big enough that a pattern reads across a metre-wide body, small enough that sixteen of them stay cheap.
- SHAPE_
KINDS - Every shape the scene cycles through, in spawn order.
Functionsยง
- into_
desc ๐ - Lift a raw meshโs arrays into the owned description the render server takes.
- lathe ๐
- A lathe along the y axis: the side wall walks the rings top to bottom, and the caps close whichever ends ask for it, so a cylinder and a cone share one winding story.
- pattern_
texture - The texture pattern one shape kind wears, tinted with a base color: dots for the ball, a checker for the cube, stripes for the cylinder and rings for the cone. Every pattern puts the accents where the bodyโs silhouette bends, so the tumbling reads as motion.
- shape_
body - The collider physics simulates for one shape kind, sized to match its mesh.
- shape_
kind - The shape kind an index draws from the palette.
- shape_
mesh - The mesh one shape kind draws. Every kind is about
BALL_RADIUSacross, so every shape shares one visual weight. - tinted ๐
- Scale a colorโs bytes by a factor, for the pattern accents.
- uv_cone
- A cone pointing up the y axis: an apex ring collapsed to a point on top, a flat base cap below.
- uv_
cylinder - A cylinder along the y axis: flat caps top and bottom, uvs mapped so a texture wraps the wall and spots the caps.
Type Aliasesยง
- RawMesh
- A mesh as raw arrays: positions, uvs, colors, indices.