[opengtl-commits] [543] allow to set parameters for some kernels

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


Revision: 543
Author:   cyrille
Date:     2008-12-17 00:11:29 +0100 (Wed, 17 Dec 2008)

Log Message:
-----------
allow to set parameters for some kernels

Modified Paths:
--------------
    trunk/OpenGTL/OpenShiva/examples/AntiBullify.shiva
    trunk/OpenGTL/OpenShiva/examples/Bullify.shiva
    trunk/OpenGTL/OpenShiva/examples/RadialGradient.shiva
    trunk/OpenGTL/OpenShiva/examples/Ripples.shiva


Modified: trunk/OpenGTL/OpenShiva/examples/AntiBullify.shiva
===================================================================
--- trunk/OpenGTL/OpenShiva/examples/AntiBullify.shiva	2008-12-12 18:00:58 UTC (rev 542)
+++ trunk/OpenGTL/OpenShiva/examples/AntiBullify.shiva	2008-12-16 23:11:29 UTC (rev 543)
@@ -1,7 +1,26 @@
+<
+  parameters: <
+    xcenter: <
+      label: "Center x";
+      type: float;
+    >;
+    ycenter: <
+      label: "Center y";
+      type: float;
+    >;
+    lightLengthP:  <
+      label: "Zoom";
+      type: float;
+      minValue: 0.01;
+    >;
+  >;
+>;  
 kernel AntiBullify
 {
-  const float2 center = { 400.0, 400.0 };
-  const float lightLength = 400.0;
+  const float width = 1000;
+  const float height = 800;
+  const float2 center = { xcenter * width, ycenter * height };
+  const float lightLength = lightLengthP * 0.5 * (width + height );
   
   float length( float2 v)
   {

Modified: trunk/OpenGTL/OpenShiva/examples/Bullify.shiva
===================================================================
--- trunk/OpenGTL/OpenShiva/examples/Bullify.shiva	2008-12-12 18:00:58 UTC (rev 542)
+++ trunk/OpenGTL/OpenShiva/examples/Bullify.shiva	2008-12-16 23:11:29 UTC (rev 543)
@@ -1,8 +1,26 @@
+<
+  parameters: <
+    xcenter: <
+      label: "Center x";
+      type: float;
+    >;
+    ycenter: <
+      label: "Center y";
+      type: float;
+    >;
+    lightLengthP:  <
+      label: "Zoom";
+      type: float;
+      minValue: 0.01;
+    >;
+  >;
+>;  
 kernel Bullify
 {
-  const float2 center = { 3900.0/2.0, 2613/2.0 };
-  const float lightLength = 2613/2.0;
-  
+  const float width = 1000;
+  const float height = 800;
+  const float2 center = { xcenter * width, ycenter * height };
+  const float lightLength = lightLengthP * 0.5 * (width + height );
   float length( float2 v)
   {
     v *= v;

Modified: trunk/OpenGTL/OpenShiva/examples/RadialGradient.shiva
===================================================================
--- trunk/OpenGTL/OpenShiva/examples/RadialGradient.shiva	2008-12-12 18:00:58 UTC (rev 542)
+++ trunk/OpenGTL/OpenShiva/examples/RadialGradient.shiva	2008-12-16 23:11:29 UTC (rev 543)
@@ -1,8 +1,20 @@
-kernel ColorsRay
+<
+  parameters: <
+    xcenter: <
+      label: "Center x";
+      type: float;
+    >;
+    ycenter: <
+      label: "Center y";
+      type: float;
+    >;
+  >;
+>;  
+kernel RadialGradient
 {
   const float width = 500.0;
   const float height = 500.0;
-  const float2 center = { width/2.0, height/2.0 };
+  const float2 center = { width * xcenter, height * ycenter };
   const float PI = 3.14159265;
   void evaluatePixel(out pixel4 result)
   {

Modified: trunk/OpenGTL/OpenShiva/examples/Ripples.shiva
===================================================================
--- trunk/OpenGTL/OpenShiva/examples/Ripples.shiva	2008-12-12 18:00:58 UTC (rev 542)
+++ trunk/OpenGTL/OpenShiva/examples/Ripples.shiva	2008-12-16 23:11:29 UTC (rev 543)
@@ -1,8 +1,27 @@
+<
+  parameters: <
+    xcenter: <
+      label: "Center x";
+      type: float;
+    >;
+    ycenter: <
+      label: "Center y";
+      type: float;
+    >;
+    ripplesLength: <
+      label: "Ripples length";
+      type: float;
+      minValue: 0.01;
+      maxValue: 1000.0;
+    >;
+  >;
+>;  
 kernel Ripples
 {
-  const float2 center = { 3900.0/2.0, 2613/2.0 };
-  const float ripplesLength = 100.0;
-  const float waveslength = 1.0 / 50.0;
+  const float width = 500.0;
+  const float height = 500.0;
+  const float2 center = { width * xcenter, height * ycenter };
+  const float waveslengthInv = 1.0 / 50.0;
   float length( float2 v)
   {
     v *= v;
@@ -13,7 +32,7 @@
   {
     float2 vec = result.coord - center;
     float vec_length = length( vec );
-    float displacement = cos( vec_length * waveslength ) * ripplesLength / vec_length;
+    float displacement = cos( vec_length * waveslengthInv ) * ripplesLength / vec_length;
     result = img.sampleNearest( vec * ( 1.0 + displacement  ) + center );
   }
   region changed(region changed_input_region, int input_index, region input_DOD[])


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