[opengtl-commits] [680] add a checker board generator

[ Thread Index | Date Index | More lists.tuxfamily.org/opengtl-commits Archives ]


Revision: 680
Author:   cyrille
Date:     2009-03-25 11:01:47 +0100 (Wed, 25 Mar 2009)

Log Message:
-----------
add a checker board generator

Added Paths:
-----------
    trunk/shiva-collections/generators/CheckerBoard.shiva


Added: trunk/shiva-collections/generators/CheckerBoard.shiva
===================================================================
--- trunk/shiva-collections/generators/CheckerBoard.shiva	                        (rev 0)
+++ trunk/shiva-collections/generators/CheckerBoard.shiva	2009-03-25 10:01:47 UTC (rev 680)
@@ -0,0 +1,50 @@
+<
+  parameters: <
+    hcount: <
+      label: "Horizontal";
+      type: int;
+      defaultValue: 10;
+    >;
+    vcount: <
+      label: "Vertical";
+      type: int;
+      defaultValue: 10;
+    >;
+    color1: <
+      label: "Color 1";
+      type: rgba;
+      defaultValue: { 0.0, 0.0, 0.0, 1.0 };
+    >;
+    color2: <
+      label: "Color 2";
+      type: rgba;
+      defaultValue: { 1.0, 1.0, 1.0, 1.0 };
+    >;
+  >;
+>;  
+kernel Moire
+{
+  const float width = 500.0;
+  const float height = 500.0;
+  const int hsize = width / hcount;
+  const int vsize = height / vcount;
+  void evaluatePixel(out pixel4 result)
+  {
+    int ix = int(result.coord.x) / hsize & 1;
+    int iy = int(result.coord.y) / vsize & 1;
+    float4 r;
+    if( ( ix == 1 and iy  == 1 ) or ( ix == 0 and iy == 0 ) )
+    {
+      r = color1;
+    } else {
+      r = color2;
+    }
+    r.a = 1.0;
+    result = r;
+  }
+  region generated()
+  {
+    region reg = { 0, 0, width, height};
+    return reg;
+  }
+}


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/