From 34b3484baa63dc6dc9b6e7b0137cdf33747e36c5 Mon Sep 17 00:00:00 2001 From: sindney <346567691@qq.com> Date: Tue, 16 Jun 2020 17:25:03 +0800 Subject: [PATCH] Update decode_mesh.py --- docs/python_api/examples/renderdoc/decode_mesh.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/python_api/examples/renderdoc/decode_mesh.py b/docs/python_api/examples/renderdoc/decode_mesh.py index db2005107..1f9d7d3b9 100644 --- a/docs/python_api/examples/renderdoc/decode_mesh.py +++ b/docs/python_api/examples/renderdoc/decode_mesh.py @@ -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)