commit fe6fe99ac78d223fe1c77c5500168cd803920ec9
Author: leszek <leszek@koltunski.pl>
Date:   Wed Jun 14 22:51:59 2017 +0100

    Small API simplification.

diff --git a/src/main/java/org/distorted/library/main/DistortedEffects.java b/src/main/java/org/distorted/library/main/DistortedEffects.java
index fc40657..5079d26 100644
--- a/src/main/java/org/distorted/library/main/DistortedEffects.java
+++ b/src/main/java/org/distorted/library/main/DistortedEffects.java
@@ -150,8 +150,8 @@ public class DistortedEffects implements DistortedSlave
         }
       }
 
-    mainVertHeader += ("#define NUM_VERTEX "   + ( foundV ? getMaxVertex()   : 0 ) + "\n");
-    mainFragHeader += ("#define NUM_FRAGMENT " + ( foundF ? getMaxFragment() : 0 ) + "\n");
+    mainVertHeader += ("#define NUM_VERTEX "   + ( foundV ? getMax(EffectType.VERTEX  ) : 0 ) + "\n");
+    mainFragHeader += ("#define NUM_FRAGMENT " + ( foundF ? getMax(EffectType.FRAGMENT) : 0 ) + "\n");
 
     //android.util.Log.e("Effects", "vertHeader= "+mainVertHeader);
     //android.util.Log.e("Effects", "fragHeader= "+mainFragHeader);
@@ -629,55 +629,20 @@ public class DistortedEffects implements DistortedSlave
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 /**
- * Returns the maximum number of Matrix effects.
+ * Returns the maximum number of effects of a given type.
  *
- * @return The maximum number of Matrix effects
+ * @param type {@link EffectType}
+ * @return The maximum number of effects of a given type.
  */
   @SuppressWarnings("unused")
-  public static int getMaxMatrix()
+  public static int getMax(EffectType type)
     {
-    return EffectQueue.getMax(EffectType.MATRIX.ordinal());
+    return EffectQueue.getMax(type.ordinal());
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 /**
- * Returns the maximum number of Vertex effects.
- *
- * @return The maximum number of Vertex effects
- */
-  @SuppressWarnings("unused")
-  public static int getMaxVertex()
-    {
-    return EffectQueue.getMax(EffectType.VERTEX.ordinal());
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-/**
- * Returns the maximum number of Fragment effects.
- *
- * @return The maximum number of Fragment effects
- */
-  @SuppressWarnings("unused")
-  public static int getMaxFragment()
-    {
-    return EffectQueue.getMax(EffectType.FRAGMENT.ordinal());
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-/**
- * Returns the maximum number of Postprocess effects.
- *
- * @return The maximum number of Postprocess effects
- */
-  @SuppressWarnings("unused")
-  public static int getMaxPostprocess()
-    {
-    return EffectQueue.getMax(EffectType.POSTPROCESS.ordinal());
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-/**
- * Sets the maximum number of Matrix effects that can be stored in a single EffectQueue at one time.
+ * Sets the maximum number of effects that can be stored in a single EffectQueue at one time.
  * This can fail if:
  * <ul>
  * <li>the value of 'max' is outside permitted range (0 &le; max &le; Byte.MAX_VALUE)
@@ -687,80 +652,15 @@ public class DistortedEffects implements DistortedSlave
  * <li>Furthermore, this needs to be called before any instances of the DistortedEffects class get created.
  * </ul>
  *
- * @param max new maximum number of simultaneous Matrix Effects. Has to be a non-negative number not greater
- *            than Byte.MAX_VALUE
- * @return <code>true</code> if operation was successful, <code>false</code> otherwise.
- */
-  @SuppressWarnings("unused")
-  public static boolean setMaxMatrix(int max)
-    {
-    return EffectQueue.setMax(EffectType.MATRIX.ordinal(),max);
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-/**
- * Sets the maximum number of Vertex effects that can be stored in a single EffectQueue at one time.
- * This can fail if:
- * <ul>
- * <li>the value of 'max' is outside permitted range (0 &le; max &le; Byte.MAX_VALUE)
- * <li>We try to increase the value of 'max' when it is too late to do so already. It needs to be called
- *     before the Vertex Shader gets compiled, i.e. before the call to {@link Distorted#onCreate}. After this
- *     time only decreasing the value of 'max' is permitted.
-* <li>Furthermore, this needs to be called before any instances of the DistortedEffects class get created.
- * </ul>
- *
- * @param max new maximum number of simultaneous Vertex Effects. Has to be a non-negative number not greater
- *            than Byte.MAX_VALUE
- * @return <code>true</code> if operation was successful, <code>false</code> otherwise.
- */
-  @SuppressWarnings("unused")
-  public static boolean setMaxVertex(int max)
-    {
-    return EffectQueue.setMax(EffectType.VERTEX.ordinal(),max);
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-/**
- * Sets the maximum number of Fragment effects that can be stored in a single EffectQueue at one time.
- * This can fail if:
- * <ul>
- * <li>the value of 'max' is outside permitted range (0 &le; max &le; Byte.MAX_VALUE)
- * <li>We try to increase the value of 'max' when it is too late to do so already. It needs to be called
- *     before the Fragment Shader gets compiled, i.e. before the call to {@link Distorted#onCreate}. After this
- *     time only decreasing the value of 'max' is permitted.
- * <li>Furthermore, this needs to be called before any instances of the DistortedEffects class get created.
- * </ul>
- *
- * @param max new maximum number of simultaneous Fragment Effects. Has to be a non-negative number not greater
- *            than Byte.MAX_VALUE
- * @return <code>true</code> if operation was successful, <code>false</code> otherwise.
- */
-  @SuppressWarnings("unused")
-  public static boolean setMaxFragment(int max)
-    {
-    return EffectQueue.setMax(EffectType.FRAGMENT.ordinal(),max);
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-/**
- * Sets the maximum number of Postprocess effects that can be stored in a single EffectQueue at one time.
- * This can fail if:
- * <ul>
- * <li>the value of 'max' is outside permitted range (0 &le; max &le; Byte.MAX_VALUE)
- * <li>We try to increase the value of 'max' when it is too late to do so already. It needs to be called
- *     before the Fragment Shader gets compiled, i.e. before the call to {@link Distorted#onCreate}. After this
- *     time only decreasing the value of 'max' is permitted.
- * <li>Furthermore, this needs to be called before any instances of the DistortedEffects class get created.
- * </ul>
- *
- * @param max new maximum number of simultaneous Postprocess Effects. Has to be a non-negative number not greater
+ * @param type {@link EffectType}
+ * @param max new maximum number of simultaneous effects. Has to be a non-negative number not greater
  *            than Byte.MAX_VALUE
  * @return <code>true</code> if operation was successful, <code>false</code> otherwise.
  */
   @SuppressWarnings("unused")
-  public static boolean setMaxPostprocess(int max)
+  public static boolean setMax(EffectType type, int max)
     {
-    return EffectQueue.setMax(EffectType.POSTPROCESS.ordinal(),max);
+    return EffectQueue.setMax(type.ordinal(),max);
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/main/java/org/distorted/library/main/DistortedObject.java b/src/main/java/org/distorted/library/main/DistortedObject.java
index c18b5f5..a9bc8b4 100644
--- a/src/main/java/org/distorted/library/main/DistortedObject.java
+++ b/src/main/java/org/distorted/library/main/DistortedObject.java
@@ -91,7 +91,7 @@ abstract class DistortedObject
         object = job.object;
 
         //android.util.Log.d("Object", object.getClass().getSimpleName()+"  ---> need to "
-        //                  +(job.action==JOB_CREATE ? "create":"delete")+" objectID="+object.mID );
+        //                  +(job.action==JOB_CREATE ? "create":"delete")+" objectID="+object.mDistortedEffectsID );
 
         if( job.action==JOB_CREATE )
           {
diff --git a/src/main/java/org/distorted/library/main/EffectQueue.java b/src/main/java/org/distorted/library/main/EffectQueue.java
index 7bfcd34..992ca7b 100644
--- a/src/main/java/org/distorted/library/main/EffectQueue.java
+++ b/src/main/java/org/distorted/library/main/EffectQueue.java
@@ -40,7 +40,7 @@ abstract class EffectQueue
   protected static int[] mMax = new int[EffectType.LENGTH];
   protected Vector<EffectListener> mListeners =null;
   protected int mNumListeners=0;  // ==mListeners.length(), but we only create mListeners if the first one gets added
-  protected long mID;
+  protected long mDistortedEffectsID;
 
   private static boolean mCreated;
   private int mIndex;
@@ -55,10 +55,10 @@ abstract class EffectQueue
    
   EffectQueue(long id, int numUniforms, int index)
     {
-    mNumEffects  = 0;
-    mID          = id;
-    mIndex       = index;
-    mNumUniforms = numUniforms;
+    mNumEffects         = 0;
+    mDistortedEffectsID = id;
+    mIndex              = index;
+    mNumUniforms        = numUniforms;
 
     int max = mMax[mIndex];
 
@@ -208,7 +208,7 @@ abstract class EffectQueue
       if( notify )
         {
         for(int j=0; j<mNumListeners; j++)
-          EffectMessageSender.newMessage( mListeners.elementAt(j), EffectMessage.EFFECT_REMOVED, mEffects[i].getID(), mID);
+          EffectMessageSender.newMessage( mListeners.elementAt(j), EffectMessage.EFFECT_REMOVED, mEffects[i].getID(), mDistortedEffectsID);
         }
 
       mEffects[i] = null;
@@ -241,7 +241,7 @@ abstract class EffectQueue
     mEffects[mNumEffects] = null;
 
     for(int i=0; i<mNumListeners; i++) 
-      EffectMessageSender.newMessage( mListeners.elementAt(i), EffectMessage.EFFECT_REMOVED, removedID, mID);
+      EffectMessageSender.newMessage( mListeners.elementAt(i), EffectMessage.EFFECT_REMOVED, removedID, mDistortedEffectsID);
     }
   
 ///////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/main/java/org/distorted/library/main/EffectQueueFragment.java b/src/main/java/org/distorted/library/main/EffectQueueFragment.java
index a1e9248..f8fb229 100644
--- a/src/main/java/org/distorted/library/main/EffectQueueFragment.java
+++ b/src/main/java/org/distorted/library/main/EffectQueueFragment.java
@@ -66,7 +66,7 @@ class EffectQueueFragment extends EffectQueue
       if( mEffects[i].compute(mUniforms, NUM_UNIFORMS*i, mCurrentDuration[i], step) )
         {
         for(int j=0; j<mNumListeners; j++)
-          EffectMessageSender.newMessage( mListeners.elementAt(j), EffectMessage.EFFECT_FINISHED, mEffects[i].getID(), mID);
+          EffectMessageSender.newMessage( mListeners.elementAt(j), EffectMessage.EFFECT_FINISHED, mEffects[i].getID(), mDistortedEffectsID);
 
         if( mEffects[i].isUnity( mUniforms, NUM_UNIFORMS*i) )
           {
diff --git a/src/main/java/org/distorted/library/main/EffectQueueMatrix.java b/src/main/java/org/distorted/library/main/EffectQueueMatrix.java
index 15a270f..873330d 100644
--- a/src/main/java/org/distorted/library/main/EffectQueueMatrix.java
+++ b/src/main/java/org/distorted/library/main/EffectQueueMatrix.java
@@ -299,7 +299,7 @@ class EffectQueueMatrix extends EffectQueue
       if( mEffects[i].compute(mUniforms, NUM_UNIFORMS*i, mCurrentDuration[i], step) )
         {
         for(int j=0; j<mNumListeners; j++)
-          EffectMessageSender.newMessage( mListeners.elementAt(j), EffectMessage.EFFECT_FINISHED, mEffects[i].getID(), mID);
+          EffectMessageSender.newMessage( mListeners.elementAt(j), EffectMessage.EFFECT_FINISHED, mEffects[i].getID(), mDistortedEffectsID);
 
         if( mEffects[i].isUnity( mUniforms, NUM_UNIFORMS*i) )
           remove(i--);
diff --git a/src/main/java/org/distorted/library/main/EffectQueuePostprocess.java b/src/main/java/org/distorted/library/main/EffectQueuePostprocess.java
index caf85a3..86fe7ab 100644
--- a/src/main/java/org/distorted/library/main/EffectQueuePostprocess.java
+++ b/src/main/java/org/distorted/library/main/EffectQueuePostprocess.java
@@ -187,7 +187,7 @@ class EffectQueuePostprocess extends EffectQueue
       if( mEffects[i].compute(mUniforms, NUM_UNIFORMS*i, mCurrentDuration[i], step) )
         {
         for(int j=0; j<mNumListeners; j++)
-          EffectMessageSender.newMessage( mListeners.elementAt(j), EffectMessage.EFFECT_FINISHED, mEffects[i].getID(), mID);
+          EffectMessageSender.newMessage( mListeners.elementAt(j), EffectMessage.EFFECT_FINISHED, mEffects[i].getID(), mDistortedEffectsID);
 
         if( mEffects[i].isUnity( mUniforms, NUM_UNIFORMS*i) )
           {
diff --git a/src/main/java/org/distorted/library/main/EffectQueueVertex.java b/src/main/java/org/distorted/library/main/EffectQueueVertex.java
index 1018b37..19504d4 100644
--- a/src/main/java/org/distorted/library/main/EffectQueueVertex.java
+++ b/src/main/java/org/distorted/library/main/EffectQueueVertex.java
@@ -66,7 +66,7 @@ class EffectQueueVertex extends EffectQueue
       if( mEffects[i].compute(mUniforms, NUM_UNIFORMS*i, mCurrentDuration[i], step) )
         {
         for(int j=0; j<mNumListeners; j++)
-          EffectMessageSender.newMessage( mListeners.elementAt(j), EffectMessage.EFFECT_FINISHED, mEffects[i].getID(), mID);
+          EffectMessageSender.newMessage( mListeners.elementAt(j), EffectMessage.EFFECT_FINISHED, mEffects[i].getID(), mDistortedEffectsID);
 
         if( mEffects[i].isUnity( mUniforms, NUM_UNIFORMS*i) )
           {
diff --git a/src/main/java/org/distorted/library/program/DistortedProgram.java b/src/main/java/org/distorted/library/program/DistortedProgram.java
index a89f02c..1d2af6f 100644
--- a/src/main/java/org/distorted/library/program/DistortedProgram.java
+++ b/src/main/java/org/distorted/library/program/DistortedProgram.java
@@ -22,6 +22,7 @@ package org.distorted.library.program;
 import android.opengl.GLES30;
 import android.os.Build;
 
+import org.distorted.library.effect.EffectType;
 import org.distorted.library.main.DistortedEffects;
 
 import java.io.BufferedReader;
@@ -201,11 +202,11 @@ public class DistortedProgram
       int realMaxV = (maxV-11)/4;   // adjust this in case of changes to the shaders...
       int realMaxF = (maxF- 2)/4;   //
 
-      if( DistortedEffects.getMaxVertex()   > realMaxV )
+      if( DistortedEffects.getMax(EffectType.VERTEX)   > realMaxV )
         {
         throw new VertexUniformsException("Too many effects in the vertex shader, max is "+realMaxV, realMaxV);
         }
-      if( DistortedEffects.getMaxFragment() > realMaxF )
+      if( DistortedEffects.getMax(EffectType.FRAGMENT) > realMaxF )
         {
         throw new FragmentUniformsException("Too many effects in the fragment shader, max is "+realMaxF, realMaxF);
         }
