Update decode_mesh.py

This commit is contained in:
sindney
2020-06-16 17:25:03 +08:00
committed by Baldur Karlsson
parent 689f6960c0
commit 34b3484baa
@@ -56,10 +56,10 @@ def unpackData(fmt, data):
# If the format needs post-processing such as normalisation, do that now
if fmt.compType == rd.CompType.UNorm:
divisor = float((1 << fmt.compByteWidth) - 1)
divisor = float((2 ** (fmt.compByteWidth * 8)) - 1)
value = tuple(float(i) / divisor for i in value)
elif fmt.compType == rd.CompType.SNorm:
maxNeg = -(1 << (fmt.compByteWidth - 1))
maxNeg = -float(2 ** (fmt.compByteWidth * 8)) / 2
divisor = float(-(maxNeg-1))
value = tuple((float(i) if (i == maxNeg) else (float(i) / divisor)) for i in value)