commit 8c893ffcdce84ebf4cbda309086bedac12b003ff
Author: Leszek Koltunski <leszek@distorted.org>
Date:   Sat Jun 18 23:58:01 2016 +0100

    Further reduce the distortedObject's API - now only 26 methods, 1/4 of the 104 before the reorganization.

diff --git a/src/main/java/org/distorted/library/Distorted.java b/src/main/java/org/distorted/library/Distorted.java
index 447ac9e..a3b261f 100644
--- a/src/main/java/org/distorted/library/Distorted.java
+++ b/src/main/java/org/distorted/library/Distorted.java
@@ -353,7 +353,7 @@ public class Distorted
     GLES20.glDepthFunc(GLES20.GL_LEQUAL);
     GLES20.glEnable(GLES20.GL_BLEND);
     GLES20.glBlendFunc(GLES20.GL_SRC_ALPHA, GLES20.GL_ONE_MINUS_SRC_ALPHA);
-    
+
     mTextureUniformH = GLES20.glGetUniformLocation(mProgramH, "u_Texture");
     
     mPositionH       = GLES20.glGetAttribLocation( mProgramH, "a_Position");
diff --git a/src/main/java/org/distorted/library/DistortedObject.java b/src/main/java/org/distorted/library/DistortedObject.java
index 1d13f3e..a8d3fba 100644
--- a/src/main/java/org/distorted/library/DistortedObject.java
+++ b/src/main/java/org/distorted/library/DistortedObject.java
@@ -587,7 +587,7 @@ public abstract class DistortedObject
  * @param smooth If true, the level of 'blend' will smoothly fade out towards the edges of the region.
  * @return       ID of the effect added, or -1 if we failed to add one.
  */
-  public long chroma(Data1D blend, Static3D color, Data4D region, boolean smooth)
+  public long chroma(Data1D blend, Data3D color, Data4D region, boolean smooth)
     {
     return mF.add( smooth? EffectNames.SMOOTH_CHROMA:EffectNames.CHROMA, blend, color, region);
     }
@@ -601,41 +601,11 @@ public abstract class DistortedObject
  * @param color  Color to mix. (1,0,0) is RED.
  * @return       ID of the effect added, or -1 if we failed to add one.
  */
-  public long chroma(Data1D blend, Static3D color)
+  public long chroma(Data1D blend, Data3D color)
     {
     return mF.add(EffectNames.CHROMA, blend, color);
     }
 
-///////////////////////////////////////////////////////////////////////////////////////////////////  
-/**
- * Makes a certain sub-region of the Object smoothly change all three of its RGB components.
- *        
- * @param blendcolor  4-dimensional Data returning the 4-tuple (blend,R,G,B).
- *                    Level of blend a given pixel will be mixed with the next parameter 'color':
- *                    pixel = (1-t)*pixel + t*color
- * @param region Region this Effect is limited to.
- * @param smooth If true, the level of 'blend' will smoothly fade out towards the edges of the region.
- * @return       ID of the effect added, or -1 if we failed to add one.
- */
-  public long chroma(Data4D blendcolor, Data4D region, boolean smooth )
-    {
-    return mF.add( smooth? EffectNames.SMOOTH_CHROMA:EffectNames.CHROMA, blendcolor, region );
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-/**
- * Makes the whole Object smoothly change all three of its RGB components.
- *
- * @param blendcolor  4-dimensional Data returning the 4-tuple (blend,R,G,B).
- *                    Level of blend a given pixel will be mixed with the next parameter 'color':
- *                    pixel = (1-t)*pixel + t*color
- * @return       ID of the effect added, or -1 if we failed to add one. 
- */
-  public long chroma(Data4D blendcolor)
-    {
-    return mF.add(EffectNames.CHROMA, blendcolor);
-    }
-
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 /**
  * Makes a certain sub-region of the Object smoothly change its transparency level.
diff --git a/src/main/java/org/distorted/library/EffectQueueFragment.java b/src/main/java/org/distorted/library/EffectQueueFragment.java
index 9014422..fb19694 100644
--- a/src/main/java/org/distorted/library/EffectQueueFragment.java
+++ b/src/main/java/org/distorted/library/EffectQueueFragment.java
@@ -23,8 +23,10 @@ import android.opengl.GLES20;
 
 import org.distorted.library.message.EffectMessage;
 import org.distorted.library.type.Data1D;
+import org.distorted.library.type.Data3D;
 import org.distorted.library.type.Data4D;
 import org.distorted.library.type.Dynamic1D;
+import org.distorted.library.type.Dynamic3D;
 import org.distorted.library.type.Dynamic4D;
 import org.distorted.library.type.Static1D;
 import org.distorted.library.type.Static3D;
@@ -90,7 +92,9 @@ class EffectQueueFragment extends EffectQueue
           }
         }
 
-      if( mInter[1][i]!=null ) mInter[1][i].interpolateMain(mBuf, 4*i, mCurrentDuration[i]);
+      if( mInter[1][i]!=null ) mInter[1][i].interpolateMain(     mBuf,            4*i  , mCurrentDuration[i]);
+
+      if( mInter[2][i]!=null ) mInter[2][i].interpolateMain(mUniforms, NUM_UNIFORMS*i+1, mCurrentDuration[i]);
 
       mCurrentDuration[i] += step;
       }
@@ -187,6 +191,8 @@ class EffectQueueFragment extends EffectQueue
       mBuf[4*mNumEffects+2] = 1000*mObjHalfX;
       mBuf[4*mNumEffects+3] = 1000*mObjHalfY;
 
+      mInter[2][mNumEffects] = null;
+
       return addBase(eln); 
       }
       
@@ -223,6 +229,8 @@ class EffectQueueFragment extends EffectQueue
         }
       else return -1;
 
+      mInter[2][mNumEffects] = null;
+
       return addBase(eln);
       }
       
@@ -232,7 +240,7 @@ class EffectQueueFragment extends EffectQueue
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 // chroma
 
-  synchronized long add(EffectNames eln, Data1D level, Static3D color, Data4D region)
+  synchronized long add(EffectNames eln, Data1D level, Data3D color, Data4D region)
     {
     if( mMax[INDEX]>mNumEffects )
       {
@@ -247,9 +255,18 @@ class EffectQueueFragment extends EffectQueue
         }
       else return -1;
 
-      mUniforms[NUM_UNIFORMS*mNumEffects+1] = color.getX();
-      mUniforms[NUM_UNIFORMS*mNumEffects+2] = color.getY();
-      mUniforms[NUM_UNIFORMS*mNumEffects+3] = color.getZ();
+      if( color instanceof Dynamic3D)
+        {
+        mInter[2][mNumEffects] = (Dynamic3D)color;
+        }
+      else if( color instanceof Static3D )
+        {
+        mInter[2][mNumEffects] = null;
+        mUniforms[NUM_UNIFORMS*mNumEffects+1] = ((Static3D)color).getX();
+        mUniforms[NUM_UNIFORMS*mNumEffects+2] = ((Static3D)color).getY();
+        mUniforms[NUM_UNIFORMS*mNumEffects+3] = ((Static3D)color).getZ();
+        }
+      else return -1;
 
       if( region instanceof Dynamic4D)
         mInter[1][mNumEffects] = (Dynamic4D)region;
@@ -272,7 +289,7 @@ class EffectQueueFragment extends EffectQueue
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 // chroma
 
-  synchronized long add(EffectNames eln, Data1D level, Static3D color)
+  synchronized long add(EffectNames eln, Data1D level, Data3D color)
     {
     if( mMax[INDEX]>mNumEffects )
       {
@@ -287,77 +304,16 @@ class EffectQueueFragment extends EffectQueue
         }
       else return -1;
 
-      mUniforms[NUM_UNIFORMS*mNumEffects+1] = color.getX();
-      mUniforms[NUM_UNIFORMS*mNumEffects+2] = color.getY();
-      mUniforms[NUM_UNIFORMS*mNumEffects+3] = color.getZ();
-
-      mInter[1][mNumEffects]  = null;          //
-      mBuf[4*mNumEffects+2] = 1000*mObjHalfX;  // i.e. null region
-      mBuf[4*mNumEffects+3] = 1000*mObjHalfY;  //
-
-      return addBase(eln);
-      }
-       
-    return -1;
-    }
-  
-///////////////////////////////////////////////////////////////////////////////////////////////////
-// chroma
-
-  synchronized long add(EffectNames eln, Data4D chroma, Data4D region)
-    {
-    if( mMax[INDEX]>mNumEffects )
-      {
-      EffectNames.fillWithUnities(eln.ordinal(), mUniforms, NUM_UNIFORMS*mNumEffects);
-
-      if( chroma instanceof Dynamic4D)
-        mInter[0][mNumEffects] = (Dynamic4D)chroma;
-      else if( chroma instanceof Static4D )
+      if( color instanceof Dynamic3D)
         {
-        mInter[0][mNumEffects] = null;
-        mUniforms[NUM_UNIFORMS*mNumEffects  ] = ((Static4D)chroma).getX();
-        mUniforms[NUM_UNIFORMS*mNumEffects+1] = ((Static4D)chroma).getY();
-        mUniforms[NUM_UNIFORMS*mNumEffects+2] = ((Static4D)chroma).getZ();
-        mUniforms[NUM_UNIFORMS*mNumEffects+3] = ((Static4D)chroma).getW();
+        mInter[2][mNumEffects] = (Dynamic3D)color;
         }
-      else return -1;
-
-      if( region instanceof Dynamic4D)
-        mInter[1][mNumEffects] = (Dynamic4D)region;
-      else if( region instanceof Static4D )
-        {
-        mInter[1][mNumEffects]  = null;
-        mBuf[4*mNumEffects  ] = ((Static4D)region).getX();
-        mBuf[4*mNumEffects+1] = ((Static4D)region).getY();
-        mBuf[4*mNumEffects+2] = ((Static4D)region).getZ();
-        mBuf[4*mNumEffects+3] = ((Static4D)region).getW();
-        }
-      else return -1;
-
-      return addBase(eln); 
-      }
-      
-    return -1;
-    }
-  
-///////////////////////////////////////////////////////////////////////////////////////////////////
-// chroma
-
-  synchronized long add(EffectNames eln, Data4D chroma)
-    {
-    if( mMax[INDEX]>mNumEffects )
-      {
-      EffectNames.fillWithUnities(eln.ordinal(), mUniforms, NUM_UNIFORMS*mNumEffects);
-
-      if( chroma instanceof Dynamic4D)
-        mInter[0][mNumEffects] = (Dynamic4D)chroma;
-      else if( chroma instanceof Static4D )
+      else if( color instanceof Static3D )
         {
-        mInter[0][mNumEffects] = null;
-        mUniforms[NUM_UNIFORMS*mNumEffects  ] = ((Static4D)chroma).getX();
-        mUniforms[NUM_UNIFORMS*mNumEffects+1] = ((Static4D)chroma).getY();
-        mUniforms[NUM_UNIFORMS*mNumEffects+2] = ((Static4D)chroma).getZ();
-        mUniforms[NUM_UNIFORMS*mNumEffects+3] = ((Static4D)chroma).getW();
+        mInter[2][mNumEffects] = null;
+        mUniforms[NUM_UNIFORMS*mNumEffects+1] = ((Static3D)color).getX();
+        mUniforms[NUM_UNIFORMS*mNumEffects+2] = ((Static3D)color).getY();
+        mUniforms[NUM_UNIFORMS*mNumEffects+3] = ((Static3D)color).getZ();
         }
       else return -1;
 
@@ -367,10 +323,10 @@ class EffectQueueFragment extends EffectQueue
 
       return addBase(eln);
       }
-      
+       
     return -1;
     }
-    
+
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 // end of FragmentEffect   
   }
diff --git a/src/main/java/org/distorted/library/type/Dynamic.java b/src/main/java/org/distorted/library/type/Dynamic.java
index ecbab42..1351ecf 100644
--- a/src/main/java/org/distorted/library/type/Dynamic.java
+++ b/src/main/java/org/distorted/library/type/Dynamic.java
@@ -73,7 +73,7 @@ public abstract class Dynamic
   protected int mVecCurr;    
   protected boolean cacheDirty; // VectorCache not up to date
   protected int mMode;          // LOOP, PATH or JUMP
-  protected long mDuration;     // number of miliseconds it takes to do a full loop/path from first vector to the last and back to the first 
+  protected long mDuration;     // number of milliseconds it takes to do a full loop/path from first vector to the last and back to the first
   protected float mCount;       // number of loops/paths we will do; mCount = 1.5 means we go from the first vector to the last, back to first, and to the last again. 
   protected float mNoise;       // how 'smooth' our path form each vector to the next is. mNoise = 0.0 (min) --> completely smooth; mNoise==1.0 (max) --> very uneven
   
@@ -83,7 +83,7 @@ public abstract class Dynamic
   Dynamic()
     {
     }
-  
+
 ///////////////////////////////////////////////////////////////////////////////////////////////////
   
   public void interpolateMain(float[] buffer, int offset, long currentDuration)
@@ -145,6 +145,7 @@ public abstract class Dynamic
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 // PUBLIC API
 ///////////////////////////////////////////////////////////////////////////////////////////////////
+
 /**
  * Sets the mode of the interpolation to Loop, Path or Jump.
  * <ul>
diff --git a/src/main/java/org/distorted/library/type/Dynamic1D.java b/src/main/java/org/distorted/library/type/Dynamic1D.java
index 972fed6..3064a78 100644
--- a/src/main/java/org/distorted/library/type/Dynamic1D.java
+++ b/src/main/java/org/distorted/library/type/Dynamic1D.java
@@ -212,8 +212,8 @@ public class Dynamic1D extends Dynamic implements Data1D
  */
   public Dynamic1D()
     {
-    vv = new Vector<Static1D>();
-    vc = new Vector<VectorCache>();
+    vv = new Vector<>();
+    vc = new Vector<>();
     vn = null;
     numPoints = 0;
     cacheDirty = false;
@@ -221,7 +221,29 @@ public class Dynamic1D extends Dynamic implements Data1D
     mDuration = 0;
     mCount = 0.5f;
     }
-  
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Default constructor.
+ *
+ * @param duration number of milliseconds it takes to do a full loop/path from first vector to the
+ *                 last and back to the first
+ * @param count    number of loops/paths we will do; mCount = 1.5 means we go from the first vector
+ *                 to the last, back to first, and to the last again.
+ */
+  public Dynamic1D(int duration, float count)
+    {
+    vv = new Vector<>();
+    vc = new Vector<>();
+    vn = null;
+    numPoints = 0;
+    cacheDirty = false;
+    mMode = MODE_LOOP;
+    mDuration = duration;
+    mCount = count;
+    }
+
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 /**
  * Returns the location'th Static1D.
diff --git a/src/main/java/org/distorted/library/type/Dynamic2D.java b/src/main/java/org/distorted/library/type/Dynamic2D.java
index 4a9a988..b917bf8 100644
--- a/src/main/java/org/distorted/library/type/Dynamic2D.java
+++ b/src/main/java/org/distorted/library/type/Dynamic2D.java
@@ -239,8 +239,8 @@ public class Dynamic2D extends Dynamic implements Data2D
  */
   public Dynamic2D()
     {
-    vv = new Vector<Static2D>();
-    vc = new Vector<VectorCache>();
+    vv = new Vector<>();
+    vc = new Vector<>();
     vn = null;
     numPoints = 0;
     cacheDirty = false;
@@ -249,7 +249,29 @@ public class Dynamic2D extends Dynamic implements Data2D
     mCount = 0.5f;
     mNoise = 0.0f;
     }
-  
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Default constructor.
+ *
+ * @param duration number of milliseconds it takes to do a full loop/path from first vector to the
+ *                 last and back to the first
+ * @param count    number of loops/paths we will do; mCount = 1.5 means we go from the first vector
+ *                 to the last, back to first, and to the last again.
+ */
+  public Dynamic2D(int duration, float count)
+    {
+    vv = new Vector<>();
+    vc = new Vector<>();
+    vn = null;
+    numPoints = 0;
+    cacheDirty = false;
+    mMode = MODE_LOOP;
+    mDuration = duration;
+    mCount = count;
+    }
+
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 /**
  * Returns the location'th Static2D.
diff --git a/src/main/java/org/distorted/library/type/Dynamic3D.java b/src/main/java/org/distorted/library/type/Dynamic3D.java
index 1c2e1e8..1e422f8 100644
--- a/src/main/java/org/distorted/library/type/Dynamic3D.java
+++ b/src/main/java/org/distorted/library/type/Dynamic3D.java
@@ -350,8 +350,8 @@ public class Dynamic3D extends Dynamic implements Data3D
  */
   public Dynamic3D()
     {
-    vv = new Vector<Static3D>();
-    vc = new Vector<VectorCache>();
+    vv = new Vector<>();
+    vc = new Vector<>();
     vn = null;
     numPoints = 0;
     cacheDirty = false;
@@ -360,7 +360,29 @@ public class Dynamic3D extends Dynamic implements Data3D
     mCount = 0.5f;
     mNoise = 0.0f;
     }
-  
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Default constructor.
+ *
+ * @param duration number of milliseconds it takes to do a full loop/path from first vector to the
+ *                 last and back to the first
+ * @param count    number of loops/paths we will do; mCount = 1.5 means we go from the first vector
+ *                 to the last, back to first, and to the last again.
+ */
+  public Dynamic3D(int duration, float count)
+    {
+    vv = new Vector<>();
+    vc = new Vector<>();
+    vn = null;
+    numPoints = 0;
+    cacheDirty = false;
+    mMode = MODE_LOOP;
+    mDuration = duration;
+    mCount = count;
+    }
+
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 /**
  * Returns the location'th Static3D.
diff --git a/src/main/java/org/distorted/library/type/Dynamic4D.java b/src/main/java/org/distorted/library/type/Dynamic4D.java
index d33a712..fcc86c3 100644
--- a/src/main/java/org/distorted/library/type/Dynamic4D.java
+++ b/src/main/java/org/distorted/library/type/Dynamic4D.java
@@ -446,8 +446,8 @@ public class Dynamic4D extends Dynamic implements Data4D
  */
   public Dynamic4D()
     {
-    vv = new Vector<Static4D>();
-    vc = new Vector<VectorCache>();
+    vv = new Vector<>();
+    vc = new Vector<>();
     vn = null;
     numPoints = 0;
     cacheDirty = false;
@@ -456,7 +456,29 @@ public class Dynamic4D extends Dynamic implements Data4D
     mCount = 0.5f;
     mNoise = 0.0f;
     }
-  
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Default constructor.
+ *
+ * @param duration number of milliseconds it takes to do a full loop/path from first vector to the
+ *                 last and back to the first
+ * @param count    number of loops/paths we will do; mCount = 1.5 means we go from the first vector
+ *                 to the last, back to first, and to the last again.
+ */
+  public Dynamic4D(int duration, float count)
+    {
+    vv = new Vector<>();
+    vc = new Vector<>();
+    vn = null;
+    numPoints = 0;
+    cacheDirty = false;
+    mMode = MODE_LOOP;
+    mDuration = duration;
+    mCount = count;
+    }
+
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 /**
  * Returns the location'th Static4D.
diff --git a/src/main/java/org/distorted/library/type/DynamicQuat.java b/src/main/java/org/distorted/library/type/DynamicQuat.java
index 2843b9f..5ec59ba 100644
--- a/src/main/java/org/distorted/library/type/DynamicQuat.java
+++ b/src/main/java/org/distorted/library/type/DynamicQuat.java
@@ -118,8 +118,8 @@ public class DynamicQuat extends Dynamic implements Data4D
  */
   public DynamicQuat()
     {
-    vv = new Vector<Static4D>();
-    vc = new Vector<VectorCache>();
+    vv = new Vector<>();
+    vc = new Vector<>();
     numPoints = 0;
     cacheDirty = false;
     mMode = MODE_LOOP;
@@ -127,7 +127,29 @@ public class DynamicQuat extends Dynamic implements Data4D
     mCount = 0.5f;
     mNoise = 0.0f;
     }
-  
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Default constructor.
+ *
+ * @param duration number of milliseconds it takes to do a full loop/path from first vector to the
+ *                 last and back to the first
+ * @param count    number of loops/paths we will do; mCount = 1.5 means we go from the first vector
+ *                 to the last, back to first, and to the last again.
+ */
+  public DynamicQuat(int duration, float count)
+    {
+    vv = new Vector<>();
+    vc = new Vector<>();
+    numPoints = 0;
+    cacheDirty = false;
+    mMode = MODE_LOOP;
+    mDuration = duration;
+    mCount = count;
+    mNoise = 0.0f;
+    }
+
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 /**
  * Returns the location'th Static4D.
