Engine and geometry¶
Module: byteink-core. Conventions. Signatures and defaults follow the current source.
InkRuntime¶
InkRuntime¶
load() verifies that ByteInk's loader supplies the native engine; call before importing ink.
InkRuntime.load¶
InkMeshes¶
TriangleMesh¶
Geometry exports return independent snapshots; this constructor retains supplied arrays without copying or layout validation. vertexCount = positions.size / 2; triangleCount = triangles.size / 3.
public class TriangleMesh @UsedByNative constructor(public val positions: FloatArray, public val triangles: IntArray)
| Parameter | Type | Default | Meaning |
|---|---|---|---|
positions |
FloatArray |
Required |
Copied x/y pairs in stroke coordinates; two floats per vertex. |
triangles |
IntArray |
Required |
Copied vertex indices; three indices per triangle. |
TriangleMesh.vertexCount¶
Number of copied x/y vertex pairs.
TriangleMesh.triangleCount¶
Number of copied index triples.
InkMeshes¶
Read live strokes on their authoring thread. Returned geometry survives later updates/clear.
InkMeshes.outlines¶
| Parameter | Type | Default | Meaning |
|---|---|---|---|
shape |
PartitionedMesh |
Required |
Finished native mesh; retain its owner while reading. |
group |
Int |
Required |
Zero-based render-group index; less than shape.getRenderGroupCount(). |
InkMeshes.outlines¶
| Parameter | Type | Default | Meaning |
|---|---|---|---|
stroke |
InProgressStroke |
Required |
Native finished or live stroke, as specified by the type. |
coat |
Int |
Required |
Zero-based brush-coat index; less than brush.family.coats.size. |
InkMeshes.triangles¶
| Parameter | Type | Default | Meaning |
|---|---|---|---|
shape |
PartitionedMesh |
Required |
Finished native mesh; retain its owner while reading. |
group |
Int |
Required |
Zero-based render-group index; less than shape.getRenderGroupCount(). |
InkMeshes.triangles¶
| Parameter | Type | Default | Meaning |
|---|---|---|---|
stroke |
InProgressStroke |
Required |
Native finished or live stroke, as specified by the type. |
coat |
Int |
Required |
Zero-based brush-coat index; less than brush.family.coats.size. |
InkMeshes.rendering¶
| Parameter | Type | Default | Meaning |
|---|---|---|---|
shape |
PartitionedMesh |
Required |
Finished native mesh; retain its owner while reading. |
group |
Int |
Required |
Zero-based render-group index; less than shape.getRenderGroupCount(). |
InkMeshes.rendering¶
| Parameter | Type | Default | Meaning |
|---|---|---|---|
stroke |
InProgressStroke |
Required |
Native finished or live stroke, as specified by the type. |
coat |
Int |
Required |
Zero-based brush-coat index; less than brush.family.coats.size. |
StrokeMesh¶
StrokeMesh¶
Owned rendering snapshot. Vertex floats: position XY (0–1), opacity shift (2), HSL shift (3–5), side derivative XY/label (6–8), forward derivative XY/label (9–11), surface UV (12–13), animation offset (14). Missing attributes are zero; indices are unsigned native values widened to Int. Constructor retains supplied arrays.
public class StrokeMesh @UsedByNative constructor( public val vertices: FloatArray, public val triangles: IntArray, public val attributeMask: Int, )
| Parameter | Type | Default | Meaning |
|---|---|---|---|
vertices |
FloatArray |
Required |
Canonical rendering attributes in stroke coordinates; 15 floats per vertex, in StrokeMesh.VERTEX_STRIDE order. |
triangles |
IntArray |
Required |
Copied vertex indices; three indices per triangle. |
attributeMask |
Int |
Required |
Bits 0–8 identify present position, opacity, HSL, side derivative/label, forward derivative/label, surface UV and animation offset attributes; missing values are zero. |
StrokeMesh.VERTEX_STRIDE¶
StrokeMesh.vertexCount¶
Number of canonical vertices: vertices.size / VERTEX_STRIDE.
StrokeMesh.triangleCount¶
Number of copied index triples.
StrokeMesh.hasSurfaceUv¶
Whether attributeMask bit 7 is set.
StrokeMesh.hasAnimationOffset¶
Whether attributeMask bit 8 is set.
SpatialIndex¶
SpatialIndex¶
Factory construction only. Queries include touching bounds, preserve list order and require exact hit tests afterward.
SpatialIndex.size¶
Total item count, including items with no queryable bounds.
SpatialIndex.query¶
| Parameter | Type | Default | Meaning |
|---|---|---|---|
box |
Box |
Required |
Inclusive query bounds in the index's coordinate system. |
SpatialIndex.query¶
| Parameter | Type | Default | Meaning |
|---|---|---|---|
xMin |
Float |
Required |
Left query edge in index units. |
yMin |
Float |
Required |
Top query edge in index units. |
xMax |
Float |
Required |
Right query edge in index units. |
yMax |
Float |
Required |
Bottom query edge in index units. |
SpatialIndex.DEFAULT_CELL_SIZE¶
SpatialIndex.<T> of¶
public fun <T> of(items: List<T>, cellSize: Float = DEFAULT_CELL_SIZE, bounds: (T) -> Box?): SpatialIndex<T>
| Parameter | Type | Default | Meaning |
|---|---|---|---|
items |
List<T> |
Required |
Items to index; treat the list and indexed bounds as immutable. |
cellSize |
Float |
DEFAULT_CELL_SIZE |
Finite positive grid-cell size in the same units as the bounds. |
bounds |
(T) -> Box? |
Required |
Callback returning each item's immutable bounds, or null for no indexed geometry. |