Quantises a single RGB colour from normalised [0..1] floats into the
[0..255] byte range, returning the result in a caller-supplied dest
(allocates if omitted).
This is the conversion the WebGL renderer applies before writing into
its RGBA8UI per-view attribute texture. Centralising it here keeps
the convention in one place — both the initial-upload path
(viewing!webGLRenderer.internal.GPUMemoryBatch | GPUMemoryBatch)
and the colour-change / colorize-clear paths
(viewing!webGLRenderer.internal.RendererMesh | RendererMesh)
agree on it.
Quantises a single RGB colour from normalised
[0..1]floats into the[0..255]byte range, returning the result in a caller-supplieddest(allocates if omitted).This is the conversion the WebGL renderer applies before writing into its
RGBA8UIper-view attribute texture. Centralising it here keeps the convention in one place — both the initial-upload path (viewing!webGLRenderer.internal.GPUMemoryBatch | GPUMemoryBatch) and the colour-change / colorize-clear paths (viewing!webGLRenderer.internal.RendererMesh | RendererMesh) agree on it.Differences from compressRGBColors:
Vec3rather than a flat[r,g,b, r,g,b, …]array.destinstead of allocating a fresh typed array — safe to call from the hot render path.Math.floor, matching the original renderer convention (compressRGBColorsrounds, which would disagree at0.5-boundary values).