Simp module

immediate_vertex

procedureSource

Adds one corner to the batch. Every three corners make a triangle, and the batch is drawn when it fills or when something forces a flush.

Example
set_shader_for_color();
#import "Math";

red := Vector4.{1, 0, 0, 1};
immediate_vertex(.{100, 100, 0}, red);
immediate_vertex(.{200, 100, 0}, red);
immediate_vertex(.{150, 200, 0}, red);  // a triangle

This one is only checked to compile, not run.

immediate_vertex :: (
    position: Vector3,
    color_scale: Vector4,
    uv: Vector2 = .{},
    normal: Vector3 = .{}
)

Adds one corner to the batch. Every three corners make a triangle, and the batch is drawn when it fills or when something forces a flush.

Parameters

position: Vector3
where the corner is. With the 2D projection z is not used.
color_scale: Vector4
multiplied into the colour the shader finds: the whole colour for set_shader_for_color, the texel for images.
uv: Vector2 = .{}
which point of the texture this corner takes, from 0 to 1.
normal: Vector3 = .{}
the direction the surface faces, for shaders that light it.
Example
set_shader_for_color();
#import "Math";

red := Vector4.{1, 0, 0, 1};
immediate_vertex(.{100, 100, 0}, red);
immediate_vertex(.{200, 100, 0}, red);
immediate_vertex(.{150, 200, 0}, red);  // a triangle

This one is only checked to compile, not run.

See also