Shared color-attribute helpers used by the points, lines, and gsplats
spatial-index loaders and by the mesh whole-node loader.
Color arrays carry extra structure compared to position/scalar arrays:
Native dtype matters at the GPU boundary. Uint8 colors are normalized
0–255 → 0–1 by THREE.js, Float32 colors are read as-is. Round-tripping
uint8 through float32 silently makes everything 255× too bright, so
the loaders preserve native types where possible.
Encoded color arrays (quantized / LUT / array_ref) carry an
original_dtype attribute that records what shape the GPU expects.
After decoding to Float32 we cast back to that type.
Shared by every geometry loader so the encode/decode logic doesn't drift
between Points, Lines, GSplats and Mesh. (assertColorLayout below is the
exception — it guards the three instanced-quad types; a mesh checks its
materialized lengths in its own loader instead.)
Shared color-attribute helpers used by the points, lines, and gsplats spatial-index loaders and by the mesh whole-node loader.
Color arrays carry extra structure compared to position/scalar arrays:
Native dtype matters at the GPU boundary. Uint8 colors are normalized 0–255 → 0–1 by THREE.js, Float32 colors are read as-is. Round-tripping uint8 through float32 silently makes everything 255× too bright, so the loaders preserve native types where possible.
Encoded color arrays (quantized / LUT / array_ref) carry an
original_dtypeattribute that records what shape the GPU expects. After decoding to Float32 we cast back to that type.Shared by every geometry loader so the encode/decode logic doesn't drift between Points, Lines, GSplats and Mesh. (
assertColorLayoutbelow is the exception — it guards the three instanced-quad types; a mesh checks its materialized lengths in its own loader instead.)