changeset 273:fac0b72ee0de trunk

[svn] - add halfrender transform, and a new preset which demonstrates what it can do.
author nenolod
date Sun, 19 Nov 2006 12:06:20 -0800
parents d8cefe8ce6e6
children ebc4497b8044
files ChangeLog src/paranormal/builtins.c src/paranormal/presets/Makefile src/paranormal/presets/nenolod_-_technicolour_nightmare.pnv src/paranormal/xform.c
diffstat 5 files changed, 135 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sun Nov 19 11:27:16 2006 -0800
+++ b/ChangeLog	Sun Nov 19 12:06:20 2006 -0800
@@ -1,3 +1,12 @@
+2006-11-19 19:27:16 +0000  William Pitcock <nenolod@nenolod.net>
+  revision [572]
+  - add copy surface
+  
+  trunk/src/paranormal/builtins.c |    2 ++
+  trunk/src/paranormal/general.c  |   16 ++++++++++++++++
+  2 files changed, 18 insertions(+)
+
+
 2006-11-19 19:20:18 +0000  William Pitcock <nenolod@nenolod.net>
   revision [570]
   - add swap surface
--- a/src/paranormal/builtins.c	Sun Nov 19 11:27:16 2006 -0800
+++ b/src/paranormal/builtins.c	Sun Nov 19 12:06:20 2006 -0800
@@ -47,6 +47,7 @@
 DECLARE_ACTUATOR (xform_spin);
 DECLARE_ACTUATOR (xform_ripple);
 DECLARE_ACTUATOR (xform_bump_spin);
+DECLARE_ACTUATOR (xform_halfrender);
 
 /* **************** builtin_table **************** */
 struct pn_actuator_desc *builtin_table[] =
@@ -85,6 +86,7 @@
   &builtin_xform_spin,
   &builtin_xform_ripple,
   &builtin_xform_bump_spin,
+  &builtin_xform_halfrender,
   /* **************** the end! **************** */
   NULL
 };
--- a/src/paranormal/presets/Makefile	Sun Nov 19 11:27:16 2006 -0800
+++ b/src/paranormal/presets/Makefile	Sun Nov 19 12:06:20 2006 -0800
@@ -13,6 +13,7 @@
 	nenolod_-_beatscope.pnv:$(presetsdir)		\
 	nenolod_-_branchscope.pnv:$(presetsdir)		\
 	nenolod_-_retroscope.pnv:$(presetsdir)		\
+	nenolod_-_technicolour_nightmare.pnv:$(presetsdir) \
 	nenolod_-_value_replace_fun.pnv:$(presetsdir)	\
 	nenolod_-_rush.pnv:$(presetsdir)		\
 	nenolod_-_worms.pnv:$(presetsdir)		\
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/paranormal/presets/nenolod_-_technicolour_nightmare.pnv	Sun Nov 19 12:06:20 2006 -0800
@@ -0,0 +1,72 @@
+<?xml version="1.0"?>
+
+<paranormal_preset>
+ <container_simple>
+  <container_once>
+   <cmap_bwgradient>
+    <low_index> 0 </low_index>
+    <high_index> 255 </high_index>
+    <color> 100, 62, 191 </color>
+   </cmap_bwgradient>
+  </container_once>
+  <wave_horizontal>
+   <channels> -1 </channels>
+   <value> 157 </value>
+   <lines> TRUE </lines>
+  </wave_horizontal>
+  <xform_spin>
+   <angle> 0.03000 </angle>
+   <r_add> 0.00000 </r_add>
+   <r_scale> 1.04000 </r_scale>
+  </xform_spin>
+  <xform_halfrender>
+   <direction> 1 </direction>
+  </xform_halfrender>
+  <wave_horizontal>
+   <channels> -1 </channels>
+   <value> 151 </value>
+   <lines> TRUE </lines>
+  </wave_horizontal>
+  <container_onbeat>
+   <xform_halfrender>
+    <direction> -1 </direction>
+   </xform_halfrender>
+  </container_onbeat>
+  <container_onbeat>
+   <container_cycle>
+    <change_interval> 0 </change_interval>
+    <beat> FALSE </beat>
+    <cmap_bwgradient>
+     <low_index> 0 </low_index>
+     <high_index> 255 </high_index>
+     <color> 69, 75, 191 </color>
+    </cmap_bwgradient>
+    <cmap_bwgradient>
+     <low_index> 0 </low_index>
+     <high_index> 255 </high_index>
+     <color> 120, 191, 191 </color>
+    </cmap_bwgradient>
+    <cmap_bwgradient>
+     <low_index> 0 </low_index>
+     <high_index> 255 </high_index>
+     <color> 100, 62, 191 </color>
+    </cmap_bwgradient>
+    <cmap_bwgradient>
+     <low_index> 0 </low_index>
+     <high_index> 255 </high_index>
+     <color> 100, 191, 62 </color>
+    </cmap_bwgradient>
+    <cmap_bwgradient>
+     <low_index> 0 </low_index>
+     <high_index> 255 </high_index>
+     <color> 62, 191, 100 </color>
+    </cmap_bwgradient>
+    <cmap_bwgradient>
+     <low_index> 0 </low_index>
+     <high_index> 255 </high_index>
+     <color> 239, 123, 227 </color>
+    </cmap_bwgradient>
+   </container_cycle>
+  </container_onbeat>
+ </container_simple>
+</paranormal_preset>
\ No newline at end of file
--- a/src/paranormal/xform.c	Sun Nov 19 11:27:16 2006 -0800
+++ b/src/paranormal/xform.c	Sun Nov 19 12:06:20 2006 -0800
@@ -383,3 +383,54 @@
   xform_bump_spin_init, xform_bump_spin_cleanup, xform_bump_spin_exec
 };
 
+/* **************** xform_halfrender **************** */
+struct pn_actuator_option_desc xform_halfrender_opts[] =
+{
+  { "direction", "Negative is horizontal, positive is vertical.", 
+    OPT_TYPE_INT, { ival: 1 } },
+  { NULL }
+};
+
+static void
+xform_halfrender_exec (const struct pn_actuator_option *opts,
+		 gpointer data)
+{
+  gint x, y;
+
+  if (opts[0].val.ival < 0)
+    {
+       for (y = 0; y < pn_image_data->height; y += 2)
+         {
+            for (x = 0; x < pn_image_data->width; x++)
+              {
+                 pn_image_data->surface[1][PN_IMG_INDEX(x, y / 2)] =
+                   pn_image_data->surface[0][PN_IMG_INDEX(x, y)];
+                 pn_image_data->surface[1][PN_IMG_INDEX(x, (y / 2) + (pn_image_data->height / 2))] =
+                   pn_image_data->surface[0][PN_IMG_INDEX(x, y)];
+              }
+         }
+    }
+  else
+    {
+       for (y = 0; y < pn_image_data->height; y++)
+         {
+            for (x = 0; x < pn_image_data->width; x += 2)
+              {
+                 pn_image_data->surface[1][PN_IMG_INDEX(x / 2, y)] =
+                   pn_image_data->surface[0][PN_IMG_INDEX(x, y)];
+                 pn_image_data->surface[1][PN_IMG_INDEX((x / 2) + (pn_image_data->width / 2), y)] =
+                   pn_image_data->surface[0][PN_IMG_INDEX(x, y)];
+              }
+         }
+    }
+
+    pn_swap_surfaces ();
+}
+
+struct pn_actuator_desc builtin_xform_halfrender =
+{
+  "xform_halfrender", "Halfrender Transform",
+  "Divides the surface in half and renders it twice.",
+  0, xform_halfrender_opts,
+  NULL, NULL, xform_halfrender_exec
+};