diff options
author | Julien Duroure <julien.duroure@gmail.com> | 2019-01-06 20:06:12 +0300 |
---|---|---|
committer | Julien Duroure <julien.duroure@gmail.com> | 2019-01-06 20:06:12 +0300 |
commit | 2f77b4a7202fb5ae5be4fd71e73fba1e145244b7 (patch) | |
tree | 189123433958a49a391e84bfd830101670c40e57 /io_scene_gltf2 | |
parent | 6992385fafd07888521d2ea37e59f57bdd10b2dd (diff) |
glTF importer: fix normalization issue
Diffstat (limited to 'io_scene_gltf2')
-rwxr-xr-x | io_scene_gltf2/io/imp/gltf2_io_binary.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/io_scene_gltf2/io/imp/gltf2_io_binary.py b/io_scene_gltf2/io/imp/gltf2_io_binary.py index 5f51d95d..9bf04fa5 100755 --- a/io_scene_gltf2/io/imp/gltf2_io_binary.py +++ b/io_scene_gltf2/io/imp/gltf2_io_binary.py @@ -89,7 +89,16 @@ class BinaryData(): for idx, tuple in enumerate(data): new_tuple = () for i in tuple: - new_tuple += (float(i),) + if accessor.component_type == 5120: + new_tuple += (max(float(i / 127.0 ), -1.0),) + elif accessor.component_type == 5121: + new_tuple += (float(i / 255.0),) + elif accessor.component_type == 5122: + new_tuple += (max(float(i / 32767.0), -1.0),) + elif accessor.component_type == 5123: + new_tuple += (i / 65535.0,) + else: + new_tuple += (float(i),) data[idx] = new_tuple return data |