[Bf-extensions-cvs] [2f77b4a7] master: glTF importer: fix normalization issue
Julien Duroure
noreply at git.blender.org
Sun Jan 6 18:06:33 CET 2019
Commit: 2f77b4a7202fb5ae5be4fd71e73fba1e145244b7
Author: Julien Duroure
Date: Sun Jan 6 18:06:12 2019 +0100
Branches: master
https://developer.blender.org/rBA2f77b4a7202fb5ae5be4fd71e73fba1e145244b7
glTF importer: fix normalization issue
===================================================================
M io_scene_gltf2/io/imp/gltf2_io_binary.py
===================================================================
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
More information about the Bf-extensions-cvs
mailing list