ShaderUniform

Base model for shader uniform data structures. Access via the 'shader_uniform' submodule.

Inherits from BaseModel.

Methods


To Bytes

to_bytes() bytes

Serialize the uniform data into a packed binary format.

The packing order follows the model's field order, and Python's struct module determines the byte layout based on field types.

Returns

bytes : Packed binary representation of the uniform data.

Raises

  • ValueError : If a tuple or list field does not contain 2, 3, or 4 values.
  • TypeError : If a field uses an unsupported type.