SIGN IN SIGN UP

fix(MeshHandler): Fix `weightsData` dequantization error (#338)

fix(MeshHandler): fix `weightsData` dequantization error
In the Editor's serialization code, normalized weights are quantized as 5-bit UNORM values then packed as ints. This implies flooring - while the sum of the quantized values are guaranteed to be `31` this can lead to a loss of precision where the _de_quantized sum (div by 31 then sum) of weights is less than 1.0.
Such cases can be trivally reproduced by search, for example a tuple of (1,25,5) summed as (1/31+25/31+5/31) in _that exact order_ will yield 0.9999999999999999 instead of 1.0, and ((1/31+25/31+5/31) >= 1.0) will be falsey.
This PR implements the sum of weight with ints instead. Alternatively an epsilon value could be chosen, but this is what the player code does.
M
mos9527 committed
1f6372d6d0b178368b98e6ac180bb2730460d816
Parent: 0957f72
Committed by Rudolf Kolbe <rkolbe96@gmail.com> on 8/11/2025, 8:02:39 PM