Scripting API

Scripting API

PaintVertex

Record struct in Abyss.Core, from Abyss.Core.

One vertex of a painted frame: where it is, what part of a texture it takes, and what color.

public readonly record struct PaintVertex

Remarks

The layout is the contract. Twenty bytes, sequential, mirrored by abyss_core::paint::PaintVertex — and, not by accident, byte for byte what every immediate-mode UI library in existence produces. A library's own vertex buffer can therefore be reinterpreted as a span of these and handed straight to Paint, with no per-vertex conversion between the library that laid the frame out and the engine that draws it.

Positions are in logical pixels from the top left, not in clip space. That is the space a UI lays out in and the space its clip rectangles are written in, so converting on this side would mean converting the rectangles too and comparing numbers in a space neither end thinks in. The engine does the one division.

Constructors

PaintVertex

public PaintVertex(float X, float Y, float U, float V, uint Color)

One vertex of a painted frame: where it is, what part of a texture it takes, and what color.

Parameters

  • X: Horizontal position, in logical pixels from the left of the surface.
  • Y: Vertical position, in logical pixels from the top of the surface.
  • U: Horizontal texture coordinate, zero at the left of the texture.
  • V: Vertical texture coordinate, zero at the top of the texture.
  • Color: Red, green, blue and alpha, one byte each, least significant byte first — which is what IM_COL32 and every equivalent packs. Written in sRGB, as a person writes a color; the engine converts it to the linear value a shader wants.

The layout is the contract. Twenty bytes, sequential, mirrored by abyss_core::paint::PaintVertex — and, not by accident, byte for byte what every immediate-mode UI library in existence produces. A library's own vertex buffer can therefore be reinterpreted as a span of these and handed straight to Paint, with no per-vertex conversion between the library that laid the frame out and the engine that draws it.

Positions are in logical pixels from the top left, not in clip space. That is the space a UI lays out in and the space its clip rectangles are written in, so converting on this side would mean converting the rectangles too and comparing numbers in a space neither end thinks in. The engine does the one division.

Properties

X

public float X { get; init; }

Horizontal position, in logical pixels from the left of the surface.

Y

public float Y { get; init; }

Vertical position, in logical pixels from the top of the surface.

U

public float U { get; init; }

Horizontal texture coordinate, zero at the left of the texture.

V

public float V { get; init; }

Vertical texture coordinate, zero at the top of the texture.

Color

public uint Color { get; init; }

Red, green, blue and alpha, one byte each, least significant byte first — which is what IM_COL32 and every equivalent packs. Written in sRGB, as a person writes a color; the engine converts it to the linear value a shader wants.