Преглед изворни кода

export textures from blender with correct clip/repeat mode

Matt Hirsch пре 9 година
родитељ
комит
736729fc38
1 измењених фајлова са 14 додато и 6 уклоњено
  1. 14 6
      utils/exporters/blender/addons/io_three/exporter/api/texture.py

+ 14 - 6
utils/exporters/blender/addons/io_three/exporter/api/texture.py

@@ -155,12 +155,20 @@ def wrap(texture):
 
     """
     logger.debug("texture.wrap(%s)", texture)
-    wrapping = {
-        True: constants.WRAPPING.MIRROR,
-        False: constants.WRAPPING.REPEAT
-    }
-    return (wrapping[texture.use_mirror_x],
-            wrapping[texture.use_mirror_y])
+
+    if(texture.extension == "REPEAT"):
+        wrapping = {
+            True: constants.WRAPPING.MIRROR,
+            False: constants.WRAPPING.REPEAT
+        }
+        return (wrapping[texture.use_mirror_x],
+                wrapping[texture.use_mirror_y])
+
+    # provide closest available three.js behavior.
+    # other possible values: "CLIP", "EXTEND", "CLIP_CUBE", "CHECKER",
+    # best match CLAMP behavior
+    else:
+        return (constants.WRAPPING.CLAMP, constants.WRAPPING.CLAMP);
 
 
 def textures():