RMGui 0.15.0
C11 retained-mode UI library: layout kernel, style schema, widget painters, fonts, software framebuffer
Loading...
Searching...
No Matches
mesh_paint.h File Reference

mesh_paint.h — allocation-free orthographic CPU cel rasterization. More...

#include "mesh.h"

Data Structures

struct  rmgui_mesh_camera_t
 Orthographic camera: world-space eye/target/up and vertical view span. More...
struct  rmgui_mesh_style_t
 Cel light points toward the light in world space. More...

Functions

rmgui_mesh_camera_t rmgui_mesh_camera_default (void)
 Return the preview camera near (3.1,2.8,8), target zero, +Y up, span 2.8.
rmgui_mesh_style_t rmgui_mesh_style_default (void)
 Return three cel bands, a dark one-pixel outline and 2x2 supersampling.
rmgui_mesh_style_t rmgui_mesh_style_start_orb (int hovered)
 Return an opt-in CPU stand-in for the GPU cloud shader: three radial cel bands from #009000 to #A6E400 and two hard white highlights, without clouds or outlines.
size_t rmgui_mesh_scratch_size (const rmgui_mesh_model_t *model, int width, int height, int supersample)
 Return complete caller scratch bytes for this model and dimensions, or zero for invalid input/size_t overflow.
rmgui_mesh_result_t rmgui_mesh_paint (rmgui_fb_t *fb, rmgui_rect_t rect, rmgui_rect_t clip, const rmgui_mesh_instance_t *instance, const rmgui_mesh_camera_t *camera, const rmgui_mesh_style_t *style, void *scratch, size_t scratch_size)
 Paint into intersection(rect,clip,fb), leaving outside pixels unchanged.
rmgui_mesh_result_t rmgui_mesh_paint_surface (rmgui_fb_t *fb, rmgui_rect_t rect, rmgui_rect_t clip, const rmgui_mesh_instance_t *instance, const rmgui_mesh_camera_t *camera, const rmgui_mesh_style_t *style, void *scratch, size_t scratch_size)
 Render the same samples as rmgui_mesh_paint into straight RGBA instead of compositing them.

Detailed Description

mesh_paint.h — allocation-free orthographic CPU cel rasterization.

Function Documentation

◆ rmgui_mesh_camera_default()

rmgui_mesh_camera_t rmgui_mesh_camera_default ( void )

Return the preview camera near (3.1,2.8,8), target zero, +Y up, span 2.8.

◆ rmgui_mesh_style_default()

rmgui_mesh_style_t rmgui_mesh_style_default ( void )

Return three cel bands, a dark one-pixel outline and 2x2 supersampling.

◆ rmgui_mesh_style_start_orb()

rmgui_mesh_style_t rmgui_mesh_style_start_orb ( int hovered)

Return an opt-in CPU stand-in for the GPU cloud shader: three radial cel bands from #009000 to #A6E400 and two hard white highlights, without clouds or outlines.

Nonzero hovered brightens the middle band and both highlights. Material RGBA is replaced with opaque fill only at paint time; models and instances remain unchanged.

◆ rmgui_mesh_scratch_size()

size_t rmgui_mesh_scratch_size ( const rmgui_mesh_model_t * model,
int width,
int height,
int supersample )

Return complete caller scratch bytes for this model and dimensions, or zero for invalid input/size_t overflow.

Sampled width and height must fit int; there is no library dimension budget. Scratch requires max_align_t alignment. Callers impose hostile-work budgets before querying or painting.

◆ rmgui_mesh_paint()

rmgui_mesh_result_t rmgui_mesh_paint ( rmgui_fb_t * fb,
rmgui_rect_t rect,
rmgui_rect_t clip,
const rmgui_mesh_instance_t * instance,
const rmgui_mesh_camera_t * camera,
const rmgui_mesh_style_t * style,
void * scratch,
size_t scratch_size )

Paint into intersection(rect,clip,fb), leaving outside pixels unchanged.

Caller owns aligned scratch of the size query; it must not overlap model, instance, or fb. No allocation. Complete preflight precedes any fb write; invalid parameters/storage/limits return their mesh result unchanged. World matrices must be finite, invertible and affine; singular scale returns INVALID. Rect dimensions must be positive; an empty clip/fb is a no-op. Transparent background preserves existing contents.

◆ rmgui_mesh_paint_surface()

rmgui_mesh_result_t rmgui_mesh_paint_surface ( rmgui_fb_t * fb,
rmgui_rect_t rect,
rmgui_rect_t clip,
const rmgui_mesh_instance_t * instance,
const rmgui_mesh_camera_t * camera,
const rmgui_mesh_style_t * style,
void * scratch,
size_t scratch_size )

Render the same samples as rmgui_mesh_paint into straight RGBA instead of compositing them.

Uncovered pixels in rect intersect clip intersect fb become transparent black; pixels outside remain unchanged. The resulting immutable caller-owned surface may be composited 1:1 with straight OVER to reproduce rmgui_mesh_paint exactly. Validation, scratch, bounds, ownership and error semantics are identical to rmgui_mesh_paint.