[opengtl-commits] [686] specify hints

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


Revision: 686
Author:   cyrille
Date:     2009-03-26 10:42:45 +0100 (Thu, 26 Mar 2009)

Log Message:
-----------
specify hints

Modified Paths:
--------------
    trunk/OpenGTL/OpenShiva/doc/specification/ShivaSpec.tex


Modified: trunk/OpenGTL/OpenShiva/doc/specification/ShivaSpec.tex
===================================================================
--- trunk/OpenGTL/OpenShiva/doc/specification/ShivaSpec.tex	2009-03-25 16:26:19 UTC (rev 685)
+++ trunk/OpenGTL/OpenShiva/doc/specification/ShivaSpec.tex	2009-03-26 09:42:45 UTC (rev 686)
@@ -674,6 +674,59 @@
 
 \part{Standard libray}
 
+\section{Constants}
+
+\section{Hints}
+Hints are special constants that are available to the Kernel writters (but not
+in libraries), they are called hints since they just provide an approximate
+information, since Kernels are expected to operate on an infinite plane, images
+sizes should just be used to provide a reasonnable scaling, and bounding to the
+user.
+
+\begin{tabular}{|c|c|l|}
+\hline
+Constant name & Type & Description \\
+\hline
+\verb|IMAGE_WIDTH| & \verb|float| & hint of the width of the image \\
+\hline
+\verb|IMAGE_HEIGHT| & \verb|float| & hind of the height of the image \\
+\hline
+\verb|IMAGE_SIZE| & \verb|float2| & vector containing the width and height
+of the image \\
+\hline
+\end{tabular}
+
+A typical use case of those hints is to control the center of an effect:
+
+\begin{lstlisting}
+<
+  parameters: <
+    xcenter: <
+      label: "X center";
+      type: float;
+      minValue: 0;
+      maxValue: 1;
+      defaultValue: 0.5;
+    >;
+    ycenter: <
+      label: "Y center";
+      type: float;
+      minValue: 0;
+      maxValue: 1;
+      defaultValue: 0.5;
+    >;
+>;
+kernel MyKernel
+{
+  const float2 center = { IMAGE_WIDTH * xcenter,
+                          IMAGE_HEIGHT * ycenter };
+  void evaluatePixel(output pixel result)
+  {
+    ...
+  }
+}
+\end{lstlisting}
+
 \section{Vector functions}
 \paragraph{distance}
 \paragraph{dot}


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