[opengtl-commits] [695] use hints in generators

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


Revision: 695
Author:   cyrille
Date:     2009-03-26 11:47:52 +0100 (Thu, 26 Mar 2009)

Log Message:
-----------
use hints in generators

Modified Paths:
--------------
    trunk/shiva-collections/generators/CheckerBoard.shiva
    trunk/shiva-collections/generators/Disco.shiva
    trunk/shiva-collections/generators/Moire.shiva
    trunk/shiva-collections/generators/PerlinNoise.shiva
    trunk/shiva-collections/generators/RadialGradient.shiva
    trunk/shiva-collections/generators/SunRay.shiva
    trunk/shiva-collections/generators/SuperNova.shiva


Modified: trunk/shiva-collections/generators/CheckerBoard.shiva
===================================================================
--- trunk/shiva-collections/generators/CheckerBoard.shiva	2009-03-26 10:43:34 UTC (rev 694)
+++ trunk/shiva-collections/generators/CheckerBoard.shiva	2009-03-26 10:47:52 UTC (rev 695)
@@ -24,10 +24,8 @@
 >;  
 kernel Moire
 {
-  const float width = 500.0;
-  const float height = 500.0;
-  const int hsize = width / hcount;
-  const int vsize = height / vcount;
+  const int hsize = IMAGE_WIDTH / hcount;
+  const int vsize = IMAGE_HEIGHT / vcount;
   void evaluatePixel(out pixel4 result)
   {
     int ix = int(result.coord.x) / hsize & 1;
@@ -42,9 +40,4 @@
     r.a = 1.0;
     result = r;
   }
-  region generated()
-  {
-    region reg = { 0, 0, width, height};
-    return reg;
-  }
 }

Modified: trunk/shiva-collections/generators/Disco.shiva
===================================================================
--- trunk/shiva-collections/generators/Disco.shiva	2009-03-26 10:43:34 UTC (rev 694)
+++ trunk/shiva-collections/generators/Disco.shiva	2009-03-26 10:47:52 UTC (rev 695)
@@ -46,9 +46,7 @@
 >;  
 kernel Disco
 {
-  const float width = 500.0;
-  const float height = 500.0;
-  const float2 center = { width * xcenter, height * ycenter };
+  const float2 center = { IMAGE_WIDTH * xcenter, IMAGE_HEIGHT * ycenter };
   const float PI2 = 2 * 3.14159265;
   const float q = t * PI2;
   void evaluatePixel(out pixel4 result)
@@ -62,9 +60,4 @@
                      fabs( sin( rz / gl + q ) + sin( angle * gl + q ) ),
                      fabs( sin( rz / bl + q ) + sin( angle * bl + q ) ), 2 ) * 0.5;
   }
-  region generated()
-  {
-    region reg = { 0, 0, width, height};
-    return reg;
-  }
 }

Modified: trunk/shiva-collections/generators/Moire.shiva
===================================================================
--- trunk/shiva-collections/generators/Moire.shiva	2009-03-26 10:43:34 UTC (rev 694)
+++ trunk/shiva-collections/generators/Moire.shiva	2009-03-26 10:47:52 UTC (rev 695)
@@ -16,9 +16,7 @@
 >;
 kernel Moire
 {
-  const float width = 500.0;
-  const float height = 500.0;
-  const float2 center = { width * xcenter, height * ycenter };
+  const float2 center = { IMAGE_WIDTH * xcenter, IMAGE_HEIGHT * ycenter };
   const float PI2 = 2 * 3.14159265;
   const float q = t * PI2;
   void evaluatePixel(out pixel4 result)
@@ -33,7 +31,7 @@
   }
   region generated()
   {
-    region reg = { 0, 0, width, height};
+    region reg = { 0, 0, IMAGE_WIDTH, IMAGE_HEIGHT};
     return reg;
   }
 }

Modified: trunk/shiva-collections/generators/PerlinNoise.shiva
===================================================================
--- trunk/shiva-collections/generators/PerlinNoise.shiva	2009-03-26 10:43:34 UTC (rev 694)
+++ trunk/shiva-collections/generators/PerlinNoise.shiva	2009-03-26 10:47:52 UTC (rev 695)
@@ -32,18 +32,6 @@
       defaultValue: 2;
       maxValue:10;
     >;
-    width: <
-      label: "Image width";
-      type: int;
-      defaultValue: 800;
-      maxValue:10000;
-    >;
-    height: <
-      label: "Image height";
-      type: int;
-      defaultValue: 600;
-      maxValue:10000;
-    >;
   >;
 >;
 kernel PerlinNoise
@@ -89,8 +77,8 @@
   {
     float total = 0.0;
     int frequency = 1;
-    float x = (result.coord.x ) / float(width);
-    float y = (result.coord.y ) / float(height);
+    float x = (result.coord.x ) / IMAGE_WIDTH;
+    float y = (result.coord.y ) / IMAGE_HEIGHT;
     x *= xscale;
     y *= yscale;
     for(int oct = 0; oct < octaves; ++oct)
@@ -121,9 +109,4 @@
     result = float4(total,total,total,1.0);
   }
   
-  region generated()
-  {
-    region reg1 = { 0, 0, 800, 600 };
-    return reg1;
-  }
 }

Modified: trunk/shiva-collections/generators/RadialGradient.shiva
===================================================================
--- trunk/shiva-collections/generators/RadialGradient.shiva	2009-03-26 10:43:34 UTC (rev 694)
+++ trunk/shiva-collections/generators/RadialGradient.shiva	2009-03-26 10:47:52 UTC (rev 695)
@@ -12,9 +12,7 @@
 >;  
 kernel RadialGradient
 {
-  const float width = 500.0;
-  const float height = 500.0;
-  const float2 center = { width * xcenter, height * ycenter };
+  const float2 center = { IMAGE_WIDTH * xcenter, IMAGE_HEIGHT * ycenter };
   const float PI = 3.14159265;
   void evaluatePixel(out pixel4 result)
   {
@@ -24,9 +22,4 @@
     if( coef < 0.0 ) coef = - coef;
     result = float4(coef, coef, coef, 1.0);
   }
-  region generated()
-  {
-    region reg = { 0, 0, width, height};
-    return reg;
-  }
 }

Modified: trunk/shiva-collections/generators/SunRay.shiva
===================================================================
--- trunk/shiva-collections/generators/SunRay.shiva	2009-03-26 10:43:34 UTC (rev 694)
+++ trunk/shiva-collections/generators/SunRay.shiva	2009-03-26 10:47:52 UTC (rev 695)
@@ -29,9 +29,7 @@
 
 kernel SunRay
 {
-  const float width = 500.0;
-  const float height = 500.0;
-  const float2 center = { width * xcenter, height * ycenter };
+  const float2 center = { IMAGE_WIDTH * xcenter, IMAGE_HEIGHT * ycenter };
   const float PI = 3.14159265;
   const float4 color = { colorrgb[0], colorrgb[1], colorrgb[2], 1.0 };
   float length( float2 v)
@@ -55,9 +53,4 @@
     }
     result[3] = 1.0;
   }
-  region generated()
-  {
-    region reg = { 0, 0, width, height};
-    return reg;
-  }
 }

Modified: trunk/shiva-collections/generators/SuperNova.shiva
===================================================================
--- trunk/shiva-collections/generators/SuperNova.shiva	2009-03-26 10:43:34 UTC (rev 694)
+++ trunk/shiva-collections/generators/SuperNova.shiva	2009-03-26 10:47:52 UTC (rev 695)
@@ -45,10 +45,8 @@
 
 kernel SuperNova
 {
-  const float width = 1000.0;
-  const float height = 1000.0;
-  const float wh = 0.25 * (width + height);
-  const float2 center = { width * xcenter, height * ycenter };
+  const float wh = 0.25 * (IMAGE_WIDTH + IMAGE_HEIGHT);
+  const float2 center = { IMAGE_WIDTH * xcenter, IMAGE_HEIGHT * ycenter };
   const float PI = 3.14159265;
   const float radius = radiusp * wh;
   const float color2radius = color2radiusp * wh;
@@ -89,9 +87,4 @@
       result = colorCenter;
     }
   }
-  region generated()
-  {
-    region reg = { 0, 0, width, height};
-    return reg;
-  }
 }


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