ShaderArgsBuilder
- class ShaderArgsBuilder(**kwargs)
An object to build the uniforms data for a GskGLShader
.
Constructors
- class ShaderArgsBuilder
- classmethod new(shader: GLShader, initial_values: Bytes | None = None) ShaderArgsBuilder
Allocates a builder that can be used to construct a new uniform data chunk.
- Parameters:
shader – a
GskGLShader
initial_values – optional
GBytes
with initial values
Methods
- class ShaderArgsBuilder
- set_bool(idx: int, value: bool) None
Sets the value of the uniform
idx
.The uniform must be of bool type.
- Parameters:
idx – index of the uniform
value – value to set the uniform to
- set_float(idx: int, value: float) None
Sets the value of the uniform
idx
.The uniform must be of float type.
- Parameters:
idx – index of the uniform
value – value to set the uniform to
- set_int(idx: int, value: int) None
Sets the value of the uniform
idx
.The uniform must be of int type.
- Parameters:
idx – index of the uniform
value – value to set the uniform to
- set_uint(idx: int, value: int) None
Sets the value of the uniform
idx
.The uniform must be of uint type.
- Parameters:
idx – index of the uniform
value – value to set the uniform to
- set_vec2(idx: int, value: Vec2) None
Sets the value of the uniform
idx
.The uniform must be of vec2 type.
- Parameters:
idx – index of the uniform
value – value to set the uniform too
- set_vec3(idx: int, value: Vec3) None
Sets the value of the uniform
idx
.The uniform must be of vec3 type.
- Parameters:
idx – index of the uniform
value – value to set the uniform too
- set_vec4(idx: int, value: Vec4) None
Sets the value of the uniform
idx
.The uniform must be of vec4 type.
- Parameters:
idx – index of the uniform
value – value to set the uniform too
- to_args() Bytes
Creates a new
GBytes
args from the current state of the givenbuilder
.Any uniforms of the shader that have not been explicitly set on the
builder
are zero-initialized.The given
GskShaderArgsBuilder
is reset once this function returns; you cannot call this function multiple times on the samebuilder
instance.This function is intended primarily for bindings. C code should use
free_to_args
.