Skip to main content

Module geometry

Module geometry 

Source

Structs§

NineSliceLines
The four slice lines of a Nine-Slice part — SsNines::updatePoints.

Enums§

NinesFillMode
Fill mode of a Nine-Slice part (PartTypeNines.nines_fill_mode), mirroring SsNines::m_eFillMode in the SpriteStudio SDK.
ShapeType
Primitive shape types supported by Shape Parts.

Constants§

NINES_MAX_TILE_DIV
Runaway guard for emit_nines_geometry: repeats per axis are clamped to this, and a centre whose repeat count exceeds NINES_MAX_TILE_QUADS falls back to a single stretched quad. Authored content never reaches either — a 4096 px part filled by a 16 px source slice needs 256 repeats — they only stop degenerate data (a near-zero source slice) from exhausting memory.
NINES_MAX_TILE_QUADS
Companion to NINES_MAX_TILE_DIV for the two-axis centre region.

Functions§

bilinear_box_deform
Spreads the four box-corner vertex-deform offsets across an arbitrary point inside the part’s bounding box by bilinear interpolation.
compute_local_uvs
Computes the local UV coordinates for a part, including UV animation (translate, rotate, scale) and flipping. Returns a tuple containing the u and v coordinates for the 5 vertices.
compute_local_vertices
Computes the local vertices for a part, including pivot calculation and deformations. Utilizes SIMD via the wide crate for maximum performance. Returns a tuple containing the x and y coordinates of the 5 vertices.
compute_nineslice_lines
Computes the slice lines for a Nine-Slice part. size: (width, height) of the part — must be non-zero. cell_rect: (left, top, right, bottom) of the source cell, in texture pixels. margins: (left, top, right, bottom) authored margins, in source pixels.
compute_rigid_mesh_vertices
Rigidly transforms a Deform-only mesh’s rest vertices by the part’s world matrix — out = W · rest for every vertex. SoA layout in and out, computed four vertices at a time with f32x4; the contiguous SoA loads keep the input gather vectorizable. The per-frame deform delta is a sparse scatter and is applied separately (scalar) by the caller.
compute_shape_vertices
Computes local vertices for a primitive shape. Returns the number of vertices and the coordinates.
compute_skinned_mesh_vertices
Computes skinned (bone-weighted) mesh vertex positions in world space.
emit_nines_geometry
Appends one Nine-Slice part’s geometry to the output buffers, ported from SsNines::createStretchPolygon / createTilePolygon.
is_point_in_quad
Performs a hit test for a point against a 4-point quadrilateral in world space. Uses the even-odd rule (ray casting) algorithm and SIMD via the wide crate to support both convex and concave quadrilaterals efficiently.
is_point_in_rect
Performs a hit test for a point against a rectangle in local space. The point is expected to be already transformed into local space (using inverse matrix).
nines_safe_margins
Clamps a part’s authored margins against the source cell so opposing margins never overlap. Margins are (left, top, right, bottom).
skew_local_tans
Some((tan(skew_x), tan(skew_y))) when a part’s Skew must be applied as a local-vertex shear, or None when there is no skew or when Skew runs in propagate mode (folded into the world matrix instead). See crate::eval::SKEW_PROPAGATES. Angles are in degrees.
skew_point_yup
Shears one local-space vertex about the pivot origin, in the part’s Y-up authored space — callers apply the Y-down flip afterwards, exactly as they do for the 4-corner Vertex deform, so the sign matches that path. tan_x / tan_y come from skew_local_tans. This is the same shear the world matrix applies in propagate mode: (x, y) -> (x + tan_x·y, y + tan_y·x).

Type Aliases§

SkinnedMeshDeform
Optional per-frame deform delta passed to compute_skinned_mesh_vertices.