commit a1c83f28fc476fe29c82f0445ff94fd12c2fc38b
Author: Leszek Koltunski <leszek@distoretedandroid.org>
Date:   Mon Nov 14 16:05:48 2016 +0000

    Unify Effects3D and Matrix3D (still incomplete!)

diff --git a/src/main/java/org/distorted/library/EffectNames.java b/src/main/java/org/distorted/library/EffectNames.java
index 6b39a27..3d70f95 100644
--- a/src/main/java/org/distorted/library/EffectNames.java
+++ b/src/main/java/org/distorted/library/EffectNames.java
@@ -53,7 +53,7 @@ public enum EffectNames
    * <p>
    * Unity: angle==0
    */
-  ROTATE           ( EffectTypes.MATRIX  ,   new float[] {0.0f}           , 1, false ),
+  ROTATE           ( EffectTypes.MATRIX  ,   new float[] {0.0f}           , 1, false, true ),
  /**
    * Rotate the whole Object around a center point (in quaternion notation).
    * <p>
@@ -61,7 +61,7 @@ public enum EffectNames
    * <p>
    * Unity: (quatX,quatY,quatZ) = (0,0,0)
    */
-  QUATERNION       ( EffectTypes.MATRIX  ,   new float[] {0.0f,0.0f,0.0f} , 4, false ),
+  QUATERNION       ( EffectTypes.MATRIX  ,   new float[] {0.0f,0.0f,0.0f} , 4, false, true ),
  /**
    * Move the whole Object by a vector.
    * <p>
@@ -69,7 +69,7 @@ public enum EffectNames
    * <p>
    * Unity: (vectorX,vectorY,vectorZ) = (0,0,0)
    */
-  MOVE             ( EffectTypes.MATRIX  ,   new float[] {0.0f,0.0f,0.0f} , 3, false ),
+  MOVE             ( EffectTypes.MATRIX  ,   new float[] {0.0f,0.0f,0.0f} , 3, false, false ),
  /**
    * Scale the whole Object independently in all 3 dimensions.
    * <p>
@@ -77,7 +77,7 @@ public enum EffectNames
    * <p>
    * Unity: (scaleX,scaleY,scaleZ) = (1,1,1)
    */
-  SCALE            ( EffectTypes.MATRIX  ,   new float[] {1.0f,1.0f,1.0f} , 3, false ),
+  SCALE            ( EffectTypes.MATRIX  ,   new float[] {1.0f,1.0f,1.0f} , 3, false, false ),
  /**
    * Shear the whole Object in 3 dimensions around a center point.
    * <p>
@@ -85,7 +85,7 @@ public enum EffectNames
    * <p>
    * Unity:  (shearX,shearY,shearZ) = (0,0,0)
    */
-  SHEAR            ( EffectTypes.MATRIX  ,   new float[] {0.0f,0.0f,0.0f} , 3, false ),
+  SHEAR            ( EffectTypes.MATRIX  ,   new float[] {0.0f,0.0f,0.0f} , 3, false, true ),
   // add new Matrix effects here...
 
  /////////////////////////////////////////////////////////////////////////////////
@@ -101,7 +101,7 @@ public enum EffectNames
    * <p>
    * Unity: (forceX,forceY,forceZ) = (0,0,0)
    */
-  DISTORT          ( EffectTypes.VERTEX  ,   new float[] {0.0f,0.0f,0.0f} , 3, true ),
+  DISTORT          ( EffectTypes.VERTEX  ,   new float[] {0.0f,0.0f,0.0f} , 3, true, true ),
  /**
    * Deform the whole Object by applying a 2D vector of force to a center point.
    * <p>
@@ -111,7 +111,7 @@ public enum EffectNames
    * <p>
    * Unity: (forceX,forceY) = (0,0)
    */
-  DEFORM           ( EffectTypes.VERTEX  ,   new float[] {0.0f,0.0f}      , 3, false ),
+  DEFORM           ( EffectTypes.VERTEX  ,   new float[] {0.0f,0.0f}      , 3, false, true ),
  /**
    * Pull (or push away) all points around a center point to (from) it.
    * <p>
@@ -121,7 +121,7 @@ public enum EffectNames
    * <p>
    * Unity: sinkFactor = 1
    */
-  SINK             ( EffectTypes.VERTEX  ,   new float[] {1.0f}           , 1, true ),
+  SINK             ( EffectTypes.VERTEX  ,   new float[] {1.0f}           , 1, true, true ),
  /**
    * Smoothly rotate a limited area around a center point.
    * <p>
@@ -131,7 +131,7 @@ public enum EffectNames
    * <p>
    * Unity: swirlAngle = 0
    */
-  SWIRL            ( EffectTypes.VERTEX  ,   new float[] {0.0f}           , 1, true ),
+  SWIRL            ( EffectTypes.VERTEX  ,   new float[] {0.0f}           , 1, true, true ),
   /**
    * Directional sinusoidal wave effect. The direction of the wave is given by the 'angle'
    * parameters. Details: {@link DistortedObject#wave(Data5D,Data2D)}
@@ -142,7 +142,7 @@ public enum EffectNames
    * <p>
    * Unity: amplitude  = 0
    */
-  WAVE             ( EffectTypes.VERTEX  ,   new float[] {0.0f}           , 5, true ),
+  WAVE             ( EffectTypes.VERTEX  ,   new float[] {0.0f}           , 5, true, true ),
   // add new Vertex Effects here...
 
  /////////////////////////////////////////////////////////////////////////////////
@@ -155,7 +155,7 @@ public enum EffectNames
    * <p>
    * Unity: transparencyLevel = 1
    */
-  ALPHA            ( EffectTypes.FRAGMENT,   new float[] {1.0f}           , 1, true ),
+  ALPHA            ( EffectTypes.FRAGMENT,   new float[] {1.0f}           , 1, true, false ),
  /**
    * Make a given Region (partially) transparent.
    * Effect smoothly fades towards the edges of the region.
@@ -163,7 +163,7 @@ public enum EffectNames
    * Uniforms: (transparencyLevel,UNUSED,UNUSED,UNUSED, regionX, regionY, regionRX, regionRY)
    * Unity: transparencyLevel = 1
    */
-  SMOOTH_ALPHA     ( EffectTypes.FRAGMENT,   new float[] {1.0f}           , 1, true ),
+  SMOOTH_ALPHA     ( EffectTypes.FRAGMENT,   new float[] {1.0f}           , 1, true, false ),
  /**
    * Blend current color in the texture with a given color.
    * <p>
@@ -171,14 +171,14 @@ public enum EffectNames
    * <p>
    * Unity: blendLevel = 0
    */
-  CHROMA           ( EffectTypes.FRAGMENT,   new float[] {0.0f}           , 4, true ),
+  CHROMA           ( EffectTypes.FRAGMENT,   new float[] {0.0f}           , 4, true, false ),
  /**
    * Smoothly blend current color in the texture with a given color.
    * <p>
    * Uniforms: (blendLevel,colorR,colorG,colorB, regionX, regionY, regionRX, regionRY)
    * Unity: blendLevel = 0
    */
-  SMOOTH_CHROMA    ( EffectTypes.FRAGMENT,   new float[] {0.0f}           , 4, true ),
+  SMOOTH_CHROMA    ( EffectTypes.FRAGMENT,   new float[] {0.0f}           , 4, true, false ),
  /**
    * Change brightness level of a given Region.
    * <p>
@@ -186,7 +186,7 @@ public enum EffectNames
    * <p>
    * Unity: brightnessLevel = 1
    */
-  BRIGHTNESS       ( EffectTypes.FRAGMENT,   new float[] {1.0f}           , 1, true ),
+  BRIGHTNESS       ( EffectTypes.FRAGMENT,   new float[] {1.0f}           , 1, true, false ),
  /**
    * Smoothly change brightness level of a given Region.
    * <p>
@@ -194,7 +194,7 @@ public enum EffectNames
    * <p>
    * Unity: brightnessLevel = 1
    */
-  SMOOTH_BRIGHTNESS( EffectTypes.FRAGMENT,   new float[] {1.0f}           , 1, true ),
+  SMOOTH_BRIGHTNESS( EffectTypes.FRAGMENT,   new float[] {1.0f}           , 1, true, false ),
  /**
    * Change saturation level of a given Region.
    * <p>
@@ -202,7 +202,7 @@ public enum EffectNames
    * <p>
    * Unity: saturationLevel = 1
    */
-  SATURATION       ( EffectTypes.FRAGMENT,   new float[] {1.0f}           , 1, true ),
+  SATURATION       ( EffectTypes.FRAGMENT,   new float[] {1.0f}           , 1, true, false ),
  /**
    * Smoothly change saturation level of a given Region.
    * <p>
@@ -210,7 +210,7 @@ public enum EffectNames
    * <p>
    * Unity: saturationLevel = 1
    */
-  SMOOTH_SATURATION( EffectTypes.FRAGMENT,   new float[] {1.0f}           , 1, true ),
+  SMOOTH_SATURATION( EffectTypes.FRAGMENT,   new float[] {1.0f}           , 1, true, false ),
  /**
    * Change contrast level of a given Region.
    * <p>
@@ -218,7 +218,7 @@ public enum EffectNames
    * <p>
    * Unity: contrastLevel = 1
    */
-  CONTRAST         ( EffectTypes.FRAGMENT,   new float[] {1.0f}           , 1, true ),
+  CONTRAST         ( EffectTypes.FRAGMENT,   new float[] {1.0f}           , 1, true, false ),
  /**
    * Smoothly change contrast level of a given Region.
    * <p>
@@ -226,7 +226,7 @@ public enum EffectNames
    * <p>
    * Unity: contrastLevel = 1
    */
-  SMOOTH_CONTRAST  ( EffectTypes.FRAGMENT,   new float[] {1.0f}           , 1, true );
+  SMOOTH_CONTRAST  ( EffectTypes.FRAGMENT,   new float[] {1.0f}           , 1, true, false );
   // add new Fragment effects here...
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -236,12 +236,14 @@ public enum EffectNames
   private final EffectTypes type;
   private final float[] unity;
   private final int dimension;
-  private final boolean supportsRegion;
-  
+  private final boolean supportsR;
+  private final boolean supportsC;
+
   private static final float[] unities;
   private static final int[] unityDimensions;
   private static final int[] dimensions;
-  private static final boolean[] supports;
+  private static final boolean[] supportsRegion;
+  private static final boolean[] supportsCenter;
   private static final EffectNames[] names;
 
   static
@@ -251,7 +253,8 @@ public enum EffectNames
     
     unityDimensions = new int[len];
     dimensions      = new int[len];
-    supports        = new boolean[len];
+    supportsRegion  = new boolean[len];
+    supportsCenter  = new boolean[len];
     unities         = new float[MAXDIM*len];
     names           = new EffectNames[len];
 
@@ -259,7 +262,8 @@ public enum EffectNames
       {
       unityDimensions[i] = (name.unity==null ? 0 : name.unity.length);
       dimensions[i]      = name.dimension;
-      supports[i]        = name.supportsRegion;
+      supportsRegion[i]  = name.supportsR;
+      supportsCenter[i]  = name.supportsC;
       names[i]           = name;
 
       switch(unityDimensions[i])
@@ -277,12 +281,13 @@ public enum EffectNames
   
 ///////////////////////////////////////////////////////////////////////////////////////////////////
   
-  EffectNames(EffectTypes type, float[] unity, int dimension, boolean supportsRegion)
+  EffectNames(EffectTypes type, float[] unity, int dimension, boolean supportsR, boolean supportsC)
     {
-    this.type           = type;
-    this.unity          = unity;
-    this.dimension      = dimension;
-    this.supportsRegion = supportsRegion;
+    this.type      = type;
+    this.unity     = unity;
+    this.dimension = dimension;
+    this.supportsR = supportsR;
+    this.supportsC = supportsC;
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -372,6 +377,14 @@ public enum EffectNames
  * Do we support being masked by a Region?
  * @return true if the Effect supports being masked with a Region.
  */
-  public boolean supportsRegion() { return supports[ordinal()]; }
+  public boolean supportsRegion() { return supportsRegion[ordinal()]; }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Does this Effect have a center?
+ * @return true if the Effect has a center.
+ */
+  public boolean supportsCenter() { return supportsCenter[ordinal()]; }
 
   }
