pub fn oct_encode_normals_into(normals: &[[f32; 3]], out: &mut [u8])Expand description
Oct-encode a batch of unit normals, writing 2 bytes per normal into out.
Equivalent to calling oct_encode_normal on each normal and
concatenating the results — the output is identical on every target.
On wasm32 the batch is encoded with explicit simd128 (four normals per
f32x4 step), which benchmarked ~1.66× faster than the scalar loop under
a WebAssembly runtime. On every other target it is the plain scalar loop:
native back-ends autovectorise that form better than the hand-written
SIMD, which regressed in native benchmarks, so the SIMD path is gated to
wasm only.
§Panics
Panics if out.len() != normals.len() * 2.