]> git.tdb.fi Git - libs/gl.git/commitdiff
Export texture extension modes from Blender
authorMikko Rasa <tdb@tdb.fi>
Sun, 28 Mar 2021 12:02:23 +0000 (15:02 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sun, 28 Mar 2021 12:02:23 +0000 (15:02 +0300)
blender/io_mspgl/export_texture.py

index f75d8f93ff3623100642f8d6418ab4c3d44a3e88..2ffb5246cf448839c9a594e1accd1397c018da79 100644 (file)
@@ -64,6 +64,14 @@ class SamplerExporter:
                        else:
                                samp_res.statements.append(Statement("filter", Token('NEAREST')))
 
+               if tex_node.extension=="REPEAT":
+                       samp_res.statements.append(Statement("wrap", Token('REPEAT')))
+               elif tex_node.extension=="EXTEND":
+                       samp_res.statements.append(Statement("wrap", Token('CLAMP_TO_EDGE')))
+               elif tex_node.extension=="CLIP":
+                       samp_res.statements.append(Statement("wrap", Token('CLAMP_TO_BORDER')))
+                       samp_res.statements.append(Statement("border_color", 0.0, 0.0, 0.0, 0.0))
+
                return samp_res
 
        def get_sampler_name(self, tex_node):
@@ -75,5 +83,7 @@ class SamplerExporter:
                        name_parts.append("mip")
                if use_interpolation and tex_node.max_anisotropy>1:
                        name_parts.append("aniso{:g}x".format(tex_node.max_anisotropy))
+               if tex_node.extension!="REPEAT":
+                       name_parts.append("clip" if tex_node.extension=="CLIP" else "clamp")
 
                return "_".join(name_parts)+".samp"