Explorar o código

added textureFromCDB

Nicolas Cannasse hai 11 meses
pai
achega
45a4fe2130
Modificáronse 1 ficheiros con 12 adicións e 0 borrados
  1. 12 0
      hrt/impl/Gradient.hx

+ 12 - 0
hrt/impl/Gradient.hx

@@ -180,6 +180,18 @@ class Gradient {
         return hash;
         return hash;
     }
     }
 
 
+    public static function textureFromCDB( g : cdb.Types.Gradient, size : Int ) {
+        if( g == null ) return null;
+        var d : GradientData = {
+            stops : [for( i in 0...g.data.colors.length ) { position : g.data.positions[i], color : g.data.colors[i] }],
+            resolution : size,
+            isVertical : false,
+            interpolation: Linear,
+            colorMode: 0,
+        };
+        return textureFromData(d);
+    }
+
     public static function textureFromData(data : GradientData) : h3d.mat.Texture {
     public static function textureFromData(data : GradientData) : h3d.mat.Texture {
 
 
         var hash = getDataHash(data);
         var hash = getDataHash(data);