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 (in_pos_uv.xy). |
CF_V2 uv |
For internal use -- For sprite rendering (in_pos_uv.zw). |
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_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 (in_shape.x). |
float stroke |
For internal use -- For shape rendering for border style stroke rendering (in_shape.y). |
float aa |
For internal use -- Factor for the size of antialiasing (in_shape.z). |
float type |
For internal use -- Shape type for SDF fragment shader (in_shape.w). Stored as float (0-6). |
float alpha |
Used for the alpha-component, transparency (in_blend_posH.x). Stored as float 0.0-1.0. |
float fill |
For internal use -- Whether or not to render shapes as filled or stroked (in_blend_posH.y). 0.0 or 1.0. |
CF_V2 posH |
"Homogenous" position transformed by the camera (in_blend_posH.zw). |
CF_Color attributes |
Four general purpose floats passed into custom user shaders. |
float uv_bounds[4] |
UV bounds for sprite/text glyphs. Zero for shapes. Packed as (uv_min.x, uv_min.y, uv_max.x, uv_max.y). |
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.