[opengtl-commits] [676] add a Moire generator

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


Revision: 676
Author:   cyrille
Date:     2009-03-25 09:56:43 +0100 (Wed, 25 Mar 2009)

Log Message:
-----------
add a Moire generator

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


Added: trunk/shiva-collections/generators/Moire.shiva
===================================================================
--- trunk/shiva-collections/generators/Moire.shiva	                        (rev 0)
+++ trunk/shiva-collections/generators/Moire.shiva	2009-03-25 08:56:43 UTC (rev 676)
@@ -0,0 +1,39 @@
+<
+  parameters: <
+    t: <
+      label: "Time";
+      type: float;
+    >;
+    xcenter: <                                                          
+      label: "Center x";                                                
+      type: float;                                                      
+    >;                                                                  
+    ycenter: <                                                          
+      label: "Center y";                                                
+      type: float;                                                      
+    >;                                                                  
+  >;
+>;  
+kernel Moire
+{
+  const float width = 500.0;
+  const float height = 500.0;
+  const float2 center = { width * xcenter, height * ycenter };
+  const float PI2 = 2 * 3.14159265;
+  const float q = t * PI2;
+  void evaluatePixel(out pixel4 result)
+  {
+    float2 vec = result.coord - center;
+    float angle = atan2( vec.x, vec.y);
+    float r = length(vec);
+    
+    result = float4(sin( r * 0.25 + q) + sin(15 * angle +q),
+                    sin( r / 3.5 + q) + sin(17 * angle + q),
+                    sin(r / 3+q) + sin(19*angle + q), 2.0 ) * 0.5;
+  }
+  region generated()
+  {
+    region reg = { 0, 0, width, height};
+    return reg;
+  }
+}


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