loadShader(name: string | null, vert?: string | null, frag?: string | null): Asset<ShaderData>
Load a shader with vertex and fragment code.
param
name- The asset name.
param
vert- The vertex shader code. Null if not needed.
param
frag- The fragment shader code. Null if not needed.
// default shaders and custom shader format loadShader("outline", `vec4 vert(vec2 pos, vec2 uv, vec4 color) { // predefined functions to get the default value by KAPLAY return def_vert(); }`, `vec4 frag(vec2 pos, vec2 uv, vec4 color, sampler2D tex) { // turn everything blue-ish return def_frag() * vec4(0, 0, 1, 1); }`, false)
returns
The asset data.
since
v2000.0