UniformWriter class final
Fills one uniform block's bytes: 32-bit floats and ints in host byte order, at member offsets taken from shader reflection.
The engine's math is 64-bit (Matrix4 stores doubles); the GPU reads
32-bit floats. Writing converts, so no 32-bit copy of a matrix is kept.
Reuse one writer per block and clear it each frame: writing allocates
nothing.
Constructors
- UniformWriter(int sizeInBytes)
-
A writer for a block of
sizeInBytes.
Properties
- bytes → ByteData
-
The block's bytes, ready to upload.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sizeInBytes → int
-
The block's size in bytes.
no setter
Methods
-
clear(
) → void - Zeroes every byte.
-
float(
int offset, double value) → void -
Writes a
floatatoffset. -
floats(
int offset, List< double> values) → void -
Writes 32-bit floats from
valuesstarting atoffset. -
int32(
int offset, int value) → void -
Writes an
intatoffset. -
matrix4(
int offset, Matrix4 m) → void -
Writes a 4×4 matrix (column-major, as both the engine and GLSL store
it) at
offset. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
vec4(
int offset, double x, double y, double z, double w) → void -
Writes a
vec4atoffset. -
vector3(
int offset, Vector3 v, [double w = 0]) → void -
Writes
vas avec4withwatoffset. Uniform blocks pad avec3to 16 bytes anyway, so blocks declarevec4s and this fills one.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited