Skip to content

CF_Vertex

Category: draw
GitHub: cute_draw.h


The full vertex layout CF uses just before sending verts to the GPU.

Struct Members Description
CF_V2 p World space position.
CF_V2 posH "Homogenous" position transformed by the camera.
int n For internal use -- For signed-distance functions for rendering shapes.
CF_V2 shape[8] For internal use -- For signed-distance functions for rendering shapes.
CF_V2 uv For internal use -- For sprite rendering.
CF_Pixel color Color for rendering shapes (ignored for sprites).
float radius For internal use -- For applying "chubbiness" factor for shapes, or radii on circle/capsule.
float stroke For internal use -- For shape rendering for border style stroke rendering (no fill).
float aa For internal use -- Factor for the size of antialiasing.
uint8_t type For internal use -- The type of shape to be rendered, used by the signed-distance functions within CF's internal fragment shader.
uint8_t alpha Used for the alpha-component (transparency).
uint8_t fill For internal use -- Whether or not to render shapes as filled or stroked.
uint8_t unused For internal use -- Currently unused but fills needed padding space.
CF_Color attributes Four general purpose floats passed into custom user shaders.

Remarks

You may fill in vertices via callback by cf_set_vertex_callback. See CF_VertexFn. This is useful when you need to fill in unique attributes per-vertex, or modify any other bits of the vertex before rendering. This could be used to implement features like dynamically generated UV's for shape slicing, or complex lighting systems.

cf_set_vertex_callback
CF_VertexFn