Skip to content

cf_draw3d_push_shader

Category: draw3d
GitHub: cute_draw3d.h


Pushes the shader used for subsequent mesh submissions.

void cf_draw3d_push_shader(CF_Shader shader);
Parameters Description
shader A shader from cf_make_shader (the two-file path), following the shader
contract at the top of this header.

Remarks

There is no default 3d shader -- submitting a mesh without a shader pushed is an error. This is deliberate: this layer makes no assumptions about how you shade. Shaders under cf_shader_directory hot-reload automatically while you edit.

Draw-list recordings treat this stack with closure semantics: a shader pushed INSIDE cf_draw_list_begin/end is part of the recording (frozen), while the shader that was ambient at record time stays a free variable -- cf_draw_list binds whatever is pushed here then, falling back to the record-time shader when nothing is. Record a scene shaderless and draw it once per pass under each pass's shader. See the DRAW LISTS section at the top of this header.

Built-in shapes interpret the top of this stack by the shader's kind: a shape shader (cf_make_draw3d_shape_shader) post-processes the built-in stroke/solid result through its stub; a plain shader fully replaces the solid pipeline (the ordinary mesh contract) and is ignored by strokes, whose ribbon vertex stage and distance-field fragment are built in; with nothing pushed, shapes use their built-ins.

CF_Shader
cf_make_shader
cf_make_draw3d_shape_shader
cf_draw3d_mesh
cf_draw3d_pop_shader
cf_draw3d_peek_shader