[opengtl-commits] [694] move something in generator, make filters use hints

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


Revision: 694
Author:   cyrille
Date:     2009-03-26 11:43:34 +0100 (Thu, 26 Mar 2009)

Log Message:
-----------
move something in generator, make filters use hints

Modified Paths:
--------------
    trunk/shiva-collections/filters/AntiBullify.shiva
    trunk/shiva-collections/filters/Bullify.shiva
    trunk/shiva-collections/filters/Caleidoscope.shiva
    trunk/shiva-collections/filters/MirrorImpose.shiva
    trunk/shiva-collections/filters/Ripples.shiva
    trunk/shiva-collections/filters/Roundify.shiva
    trunk/shiva-collections/filters/Sea.shiva
    trunk/shiva-collections/filters/Sectorize.shiva
    trunk/shiva-collections/filters/ZigZag.shiva
    trunk/shiva-collections/generators/Moire.shiva

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

Removed Paths:
-------------
    trunk/shiva-collections/filters/Something.shiva


Modified: trunk/shiva-collections/filters/AntiBullify.shiva
===================================================================
--- trunk/shiva-collections/filters/AntiBullify.shiva	2009-03-26 10:35:37 UTC (rev 693)
+++ trunk/shiva-collections/filters/AntiBullify.shiva	2009-03-26 10:43:34 UTC (rev 694)
@@ -17,10 +17,8 @@
 >;  
 kernel AntiBullify
 {
-  const float width = 1000;
-  const float height = 800;
-  const float2 center = { xcenter * width, ycenter * height };
-  const float lightLength = lightLengthP * 0.5 * (width + height );
+  const float2 center = { xcenter * IMAGE_WIDTH, ycenter * IMAGE_HEIGHT };
+  const float lightLength = lightLengthP * 0.5 * (IMAGE_WIDTH + IMAGE_HEIGHT );
   
   float length( float2 v)
   {

Modified: trunk/shiva-collections/filters/Bullify.shiva
===================================================================
--- trunk/shiva-collections/filters/Bullify.shiva	2009-03-26 10:35:37 UTC (rev 693)
+++ trunk/shiva-collections/filters/Bullify.shiva	2009-03-26 10:43:34 UTC (rev 694)
@@ -17,10 +17,8 @@
 >;  
 kernel Bullify
 {
-  const float width = 1000;
-  const float height = 800;
-  const float2 center = { xcenter * width, ycenter * height };
-  const float lightLength = lightLengthP * 0.5 * (width + height );
+  const float2 center = { xcenter * IMAGE_WIDTH, ycenter * IMAGE_HEIGHT };
+  const float lightLength = lightLengthP * 0.5 * (IMAGE_WIDTH + IMAGE_HEIGHT );
   float length( float2 v)
   {
     v *= v;

Modified: trunk/shiva-collections/filters/Caleidoscope.shiva
===================================================================
--- trunk/shiva-collections/filters/Caleidoscope.shiva	2009-03-26 10:35:37 UTC (rev 693)
+++ trunk/shiva-collections/filters/Caleidoscope.shiva	2009-03-26 10:43:34 UTC (rev 694)
@@ -26,9 +26,7 @@
 >;  
 kernel Caleidoscope
 {  
-  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.14159265358979323846;
   const float angle = pi / count;
   float length( float2 v)

Modified: trunk/shiva-collections/filters/MirrorImpose.shiva
===================================================================
--- trunk/shiva-collections/filters/MirrorImpose.shiva	2009-03-26 10:35:37 UTC (rev 693)
+++ trunk/shiva-collections/filters/MirrorImpose.shiva	2009-03-26 10:43:34 UTC (rev 694)
@@ -1,8 +1,6 @@
 kernel MirrorImpose
 {  
-  const float width = 1000.0;
-  const float height = 753.0;
-  const float2 imsize = { width, height };
+  const float2 imsize = { IMAGE_WIDTH, IMAGE_HEIGHT };
   float4 mix(float4 a, float4 b, float c)
   {
     return a * c + b * (1 - c);
@@ -20,8 +18,8 @@
   }
   void evaluatePixel(image img, out pixel result)
   {
-    float ax = result.coord.x / width;
-    float ay = result.coord.y / height;
+    float ax = result.coord.x / IMAGE_WIDTH;
+    float ay = result.coord.y / IMAGE_HEIGHT;
     float x1 = max(0, ax - ay);
     float y1 = max(0, ay - ax);
     float x2 = min(1, ax + (1 - ay));

Modified: trunk/shiva-collections/filters/Ripples.shiva
===================================================================
--- trunk/shiva-collections/filters/Ripples.shiva	2009-03-26 10:35:37 UTC (rev 693)
+++ trunk/shiva-collections/filters/Ripples.shiva	2009-03-26 10:43:34 UTC (rev 694)
@@ -18,9 +18,7 @@
 >;  
 kernel Ripples
 {
-  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 waveslengthInv = 1.0 / 50.0;
   float length( float2 v)
   {

Modified: trunk/shiva-collections/filters/Roundify.shiva
===================================================================
--- trunk/shiva-collections/filters/Roundify.shiva	2009-03-26 10:35:37 UTC (rev 693)
+++ trunk/shiva-collections/filters/Roundify.shiva	2009-03-26 10:43:34 UTC (rev 694)
@@ -26,9 +26,7 @@
 >;  
 kernel Roundify
 {  
-  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 };
   void evaluatePixel(image img, out pixel result)
   {
     float2 vec = result.coord - center;

Modified: trunk/shiva-collections/filters/Sea.shiva
===================================================================
--- trunk/shiva-collections/filters/Sea.shiva	2009-03-26 10:35:37 UTC (rev 693)
+++ trunk/shiva-collections/filters/Sea.shiva	2009-03-26 10:43:34 UTC (rev 694)
@@ -29,14 +29,12 @@
 >;
 kernel Sea
 {
-  const float width = 500.0;
-  const float height = 753.0;
-  const float2 center = { width * 0.5, height * 0.5 };
+  const float2 center = { IMAGE_WIDTH * 0.5, IMAGE_HEIGHT * 0.5 };
   const float PI2 = 2 * 3.14159265;
   const float q = t * PI2;
   void evaluatePixel(image img, out pixel result)
   {
-    float s = sin(q + wv * height / ( height - result.coord.y + 0.1) );
+    float s = sin(q + wv * IMAGE_HEIGHT / ( IMAGE_HEIGHT - result.coord.y + 0.1) );
     float2 displacement = float2( s * amp1, s * amp2);
     result = img.sampleNearest( result.coord + displacement );
     result[3] = 1.0;

Modified: trunk/shiva-collections/filters/Sectorize.shiva
===================================================================
--- trunk/shiva-collections/filters/Sectorize.shiva	2009-03-26 10:35:37 UTC (rev 693)
+++ trunk/shiva-collections/filters/Sectorize.shiva	2009-03-26 10:43:34 UTC (rev 694)
@@ -26,9 +26,7 @@
 >;  
 kernel Sectorize
 {  
-  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 };
   void evaluatePixel(image img, out pixel result)
   {
     float2 vec = result.coord - center;

Deleted: trunk/shiva-collections/filters/Something.shiva
===================================================================
--- trunk/shiva-collections/filters/Something.shiva	2009-03-26 10:35:37 UTC (rev 693)
+++ trunk/shiva-collections/filters/Something.shiva	2009-03-26 10:43:34 UTC (rev 694)
@@ -1,84 +0,0 @@
-<
-  parameters: <
-    colors: <
-      colorrgb: <
-        label: "Object";
-        type: rgb;
-        defaultValue: { 0.2, 0.01, 0.08 };
-      >;
-      colorcenterrgb: <
-        label: "Background";
-        type: rgb;
-        defaultValue: { 1.0, 1.0, 1.0 };
-      >;
-    >;
-    xcenter: <
-      label: "Center x";
-      type: float;
-    >;
-    ycenter: <
-      label: "Center y";
-      type: float;
-    >;
-    phase: <
-      label: "Phase";
-      type: float;
-      defaultValue: 6.0;
-      maxValue: 32.0;
-    >;
-    radiusp: <
-      label: "Radius";
-      type: float;
-      defaultValue: 0.8;
-    >;
-  >;
->;
-kernel Something
-{
-  const float width = 500.0;
-  const float height = 500.0;
-  const float2 center = { width * xcenter, height * ycenter };
-  const float PI = 3.14159265;
-  const float4 color1 = { colorrgb[0], colorrgb[1], colorrgb[2], 1.0 };
-  const float4 colorCenter = { colorcenterrgb[0], colorcenterrgb[1], colorcenterrgb[2], 1.0 };
-  const float radius = 0.2 * (width + height) * radiusp;
-  float length( float2 v)
-  {
-    v *= v;
-    return sqrt( v[0] + v[1] );
-  }
-  
-  void evaluatePixel(out pixel4 result)
-  {
-    float2 vec = result.coord - center;
-    float vec_length = length( vec );
-    float angle = atan2( vec.x, vec.y);
-    float coef = (cos( angle * phase) + cos( angle * 0.5 * phase ) + cos( angle * 0.1 * phase ) + cos( angle * 0.01 * phase )) * 0.25;
-//      float coef = (cos( angle * phase) * cos( angle * 0.5 * phase ) * cos( angle * 0.1 * phase ) * cos( angle * 0.01 * phase ));
-   if( coef < 0.0 ) coef = - coef;
-    coef = 1.0 - coef;
-    float adjRadius = radius  * ( 0.5 + 1.0 * coef );
-    if( vec_length < adjRadius )
-    {
-      if( vec_length < adjRadius )
-      {
-	coef = pow((radius - vec_length) / adjRadius , 1.0 ) * ( 1.0 - coef) + coef;
-      }
-      result = ( 1 - coef ) * color1 + coef * colorCenter;
-      
-      for( int i = 0; i < 3; ++i)
-      {
-	if(result[i] < 0) result[i] = 0.0;
-	else if(result[i] > 1) result[i] = 1.0;
-      }
-      result[3] = 1.0;
-    } else {
-      result = colorCenter;
-    }
-  }
-  region generated()
-  {
-    region reg = { 0, 0, width, height};
-    return reg;
-  }
-}

Modified: trunk/shiva-collections/filters/ZigZag.shiva
===================================================================
--- trunk/shiva-collections/filters/ZigZag.shiva	2009-03-26 10:35:37 UTC (rev 693)
+++ trunk/shiva-collections/filters/ZigZag.shiva	2009-03-26 10:43:34 UTC (rev 694)
@@ -18,9 +18,7 @@
 >;  
 kernel ZigZag
 {  
-  const float width = 500.0;
-  const float height = 500.0;
-  const float2 center = { width * 0.5, height * 0.5 };
+  const float2 center = { IMAGE_WIDTH * 0.5, IMAGE_HEIGHT * 0.5 };
   void evaluatePixel(image img, out pixel result)
   {
     float2 vec = result.coord - center;

Modified: trunk/shiva-collections/generators/Moire.shiva
===================================================================
--- trunk/shiva-collections/generators/Moire.shiva	2009-03-26 10:35:37 UTC (rev 693)
+++ trunk/shiva-collections/generators/Moire.shiva	2009-03-26 10:43:34 UTC (rev 694)
@@ -4,16 +4,16 @@
       label: "Time";
       type: float;
     >;
-    xcenter: <                                                          
-      label: "Center x";                                                
-      type: float;                                                      
-    >;                                                                  
-    ycenter: <                                                          
-      label: "Center y";                                                
-      type: float;                                                      
-    >;                                                                  
+    xcenter: <
+      label: "Center x";
+      type: float;
+    >;
+    ycenter: <
+      label: "Center y";
+      type: float;
+    >;
   >;
->;  
+>;
 kernel Moire
 {
   const float width = 500.0;

Copied: trunk/shiva-collections/generators/Something.shiva (from rev 664, trunk/shiva-collections/filters/Something.shiva)
===================================================================
--- trunk/shiva-collections/generators/Something.shiva	                        (rev 0)
+++ trunk/shiva-collections/generators/Something.shiva	2009-03-26 10:43:34 UTC (rev 694)
@@ -0,0 +1,82 @@
+<
+  parameters: <
+    colors: <
+      colorrgb: <
+        label: "Object";
+        type: rgb;
+        defaultValue: { 0.2, 0.01, 0.08 };
+      >;
+      colorcenterrgb: <
+        label: "Background";
+        type: rgb;
+        defaultValue: { 1.0, 1.0, 1.0 };
+      >;
+    >;
+    xcenter: <
+      label: "Center x";
+      type: float;
+    >;
+    ycenter: <
+      label: "Center y";
+      type: float;
+    >;
+    phase: <
+      label: "Phase";
+      type: float;
+      defaultValue: 6.0;
+      maxValue: 32.0;
+    >;
+    radiusp: <
+      label: "Radius";
+      type: float;
+      defaultValue: 0.8;
+    >;
+  >;
+>;
+kernel Something
+{
+  const float2 center = { IMAGE_WIDTH * xcenter, IMAGE_HEIGHT * ycenter };
+  const float PI = 3.14159265;
+  const float4 color1 = { colorrgb[0], colorrgb[1], colorrgb[2], 1.0 };
+  const float4 colorCenter = { colorcenterrgb[0], colorcenterrgb[1], colorcenterrgb[2], 1.0 };
+  const float radius = 0.2 * (IMAGE_WIDTH + IMAGE_HEIGHT) * radiusp;
+  float length( float2 v)
+  {
+    v *= v;
+    return sqrt( v[0] + v[1] );
+  }
+  
+  void evaluatePixel(out pixel4 result)
+  {
+    float2 vec = result.coord - center;
+    float vec_length = length( vec );
+    float angle = atan2( vec.x, vec.y);
+    float coef = (cos( angle * phase) + cos( angle * 0.5 * phase ) + cos( angle * 0.1 * phase ) + cos( angle * 0.01 * phase )) * 0.25;
+//      float coef = (cos( angle * phase) * cos( angle * 0.5 * phase ) * cos( angle * 0.1 * phase ) * cos( angle * 0.01 * phase ));
+   if( coef < 0.0 ) coef = - coef;
+    coef = 1.0 - coef;
+    float adjRadius = radius  * ( 0.5 + 1.0 * coef );
+    if( vec_length < adjRadius )
+    {
+      if( vec_length < adjRadius )
+      {
+	coef = pow((radius - vec_length) / adjRadius , 1.0 ) * ( 1.0 - coef) + coef;
+      }
+      result = ( 1 - coef ) * color1 + coef * colorCenter;
+      
+      for( int i = 0; i < 3; ++i)
+      {
+	if(result[i] < 0) result[i] = 0.0;
+	else if(result[i] > 1) result[i] = 1.0;
+      }
+      result[3] = 1.0;
+    } else {
+      result = colorCenter;
+    }
+  }
+  region generated()
+  {
+    region reg = { 0, 0, IMAGE_WIDTH, IMAGE_HEIGHT};
+    return reg;
+  }
+}


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