WVT alpha
[convexer.git] / __init__.py
index c8fbad983495b7a3f434666bba8aa79b79cee504..3ce19bdce4b7eb645e855d44fbcde0b1f9250d88 100644 (file)
@@ -258,7 +258,8 @@ class cxr_edge(Structure):
 class cxr_static_loop(Structure):
    _fields_ = [("index",c_int32),
                ("edge_index",c_int32),
-               ("uv",c_double * 2)]
+               ("uv",c_double * 2),
+               ("alpha",c_double)]
 
 class cxr_polygon(Structure):
    _fields_ =  [("loop_start",c_int32),
@@ -351,6 +352,14 @@ def mesh_cxr_format(obj):
          else:
              loop_data[loop_index].uv[0] = c_double(0.0)
              loop_data[loop_index].uv[1] = c_double(0.0)
+
+         if data.vertex_colors:
+            alpha = data.vertex_colors.active.data[loop_index].color[0]
+         else:
+            alpha = 0.0
+
+         loop_data[loop_index].alpha = alpha
+
       center = obj.matrix_world @ poly.center
       normal = mtx_rot @ poly.normal