simvx.graphics.draw2d_vertex

Shared vertex format for the 2D drawing system.

Defines the structured numpy dtype matching the ui.vert shader layout, and

func:

norm_colour, the one place an author-space colour becomes a vertex colour. Every 2D drawing surface routes through it, so the immediate path and the retained path cannot disagree about a tint, and a new surface has one obvious function to call rather than a body to copy.

Module Contents

Functions

norm_colour

Validate a colour input and return a linear-light RGBA float tuple.

Data

API

simvx.graphics.draw2d_vertex.__all__

[‘UI2D_VERTEX_DTYPE’, ‘UI_VERTEX_DTYPE’, ‘norm_colour’]

simvx.graphics.draw2d_vertex.norm_colour(c) tuple[float, float, float, float]

Validate a colour input and return a linear-light RGBA float tuple.

Strict policy: colours are 0-1 floats (HDR may exceed 1.0). 3-tuples widen to 4-tuples, components are cast with float(), and RGB is decoded from the authored sRGB space to the linear light the vertex stream carries (see

Func:

~simvx.core.colour.srgb_channel_to_linear). Alpha is coverage, not colour, and passes through. Use Colour.from_rgb255(...) or Colour.hex(...) for 0-255 / hex input.

Accepts:

  • None -> opaque white (1.0, 1.0, 1.0, 1.0)

  • 3-tuple -> alpha defaults to 1.0

  • 4-tuple -> alpha kept

simvx.graphics.draw2d_vertex.UI_VERTEX_DTYPE

‘dtype(…)’

simvx.graphics.draw2d_vertex.UI2D_VERTEX_DTYPE

‘dtype(…)’