commit 8c1caf83add78df568c6d10b978df0d13b4e1846
Author: leszek <leszek@koltunski.pl>
Date:   Wed Apr 26 00:07:07 2017 +0100

    Revert "Convert next 4 APPs to the new Matrix effects."
    
    This reverts commit 39a0d81b7482f2925808d661e526aeaa980fb079.

diff --git a/src/main/java/org/distorted/examples/cubes/CubesRenderer.java b/src/main/java/org/distorted/examples/cubes/CubesRenderer.java
index 056a167..49a52b2 100644
--- a/src/main/java/org/distorted/examples/cubes/CubesRenderer.java
+++ b/src/main/java/org/distorted/examples/cubes/CubesRenderer.java
@@ -96,16 +96,26 @@ class CubesRenderer implements GLSurfaceView.Renderer
     public void onSurfaceChanged(GL10 glUnused, int width, int height) 
       {
       mScreenMin = width<height ? width:height;
+    	
+      mEffects.abortEffects(EffectTypes.MATRIX);
+      float factor;
+
+      if( width*mObjHeight > height*mObjWidth ) // screen is more 'horizontal' than the Object
+        {
+        factor = (0.75f*height)/mObjHeight;
+        }
+      else
+        {
+        factor = (0.75f*width)/mObjWidth;
+        }
 
-    	float q= ((float)width/height)*((float)mObjHeight/mObjWidth);
-      float scale = 0.7f;
-      Static3D center = new Static3D(0,0,0);
+      mEffects.move( new Static3D( (width-factor*mObjWidth)/2 , (height-factor*mObjHeight)/2 , 0) );
+      mEffects.scale(factor);
+      Static3D center = new Static3D( (float)mObjWidth/2, (float)mObjHeight/2, 0.0f );
 
-      mEffects.abortEffects(EffectTypes.MATRIX);
       mEffects.quaternion(mQuatInt1, center);
       mEffects.quaternion(mQuatInt2, center);
-      mEffects.scale(  q<1 ? (new Static3D(scale,scale*q,scale)) : (new Static3D(scale/q,scale,scale/q)) );
-
+       
       mScreen.resize(width, height);
       }
 
diff --git a/src/main/java/org/distorted/examples/flag/FlagRenderer.java b/src/main/java/org/distorted/examples/flag/FlagRenderer.java
index 3700bb8..d378581 100644
--- a/src/main/java/org/distorted/examples/flag/FlagRenderer.java
+++ b/src/main/java/org/distorted/examples/flag/FlagRenderer.java
@@ -150,16 +150,26 @@ class FlagRenderer implements GLSurfaceView.Renderer
     public void onSurfaceChanged(GL10 glUnused, int width, int height) 
       {
       mScreenMin = width<height ? width:height;
+    	
+      mEffects.abortEffects(EffectTypes.MATRIX);
+      float factor;
+
+      if( width*mObjHeight > height*mObjWidth ) // screen is more 'horizontal' than the Object
+        {
+        factor = (0.8f*height)/mObjHeight;
+        }
+      else
+        {
+        factor = (0.8f*width)/mObjWidth;
+        }
 
-    	float q= ((float)width/height)*((float)mObjHeight/mObjWidth);
-      float scale = 0.8f;
-      Static3D center = new Static3D(0,0,0);
+      mEffects.move( new Static3D( (width-factor*mObjWidth)/2 , (height-factor*mObjHeight)/2 , 0) );
+      mEffects.scale(factor);
+      Static3D center = new Static3D(mObjWidth/2,mObjHeight/2, 0);
 
-      mEffects.abortEffects(EffectTypes.MATRIX);
       mEffects.quaternion(mQuatInt1, center);
       mEffects.quaternion(mQuatInt2, center);
-      mEffects.scale(  q<1 ? (new Static3D(scale,scale*q,scale)) : (new Static3D(scale/q,scale,scale/q)) );
-
+       
       mScreen.resize(width, height);
       }
 
diff --git a/src/main/java/org/distorted/examples/multiblur/MultiblurActivity.java b/src/main/java/org/distorted/examples/multiblur/MultiblurActivity.java
index 6307507..f6d8998 100644
--- a/src/main/java/org/distorted/examples/multiblur/MultiblurActivity.java
+++ b/src/main/java/org/distorted/examples/multiblur/MultiblurActivity.java
@@ -50,7 +50,7 @@ public class MultiblurActivity extends Activity implements SeekBar.OnSeekBarChan
       if( savedState==null )
         {
         distanceBar.setProgress(50);
-        rangeBar.setProgress(50);
+        rangeBar.setProgress(10);
         }
       }
 
diff --git a/src/main/java/org/distorted/examples/multiblur/MultiblurRenderer.java b/src/main/java/org/distorted/examples/multiblur/MultiblurRenderer.java
index dbddc31..e2ef1c2 100644
--- a/src/main/java/org/distorted/examples/multiblur/MultiblurRenderer.java
+++ b/src/main/java/org/distorted/examples/multiblur/MultiblurRenderer.java
@@ -68,6 +68,7 @@ class MultiblurRenderer implements GLSurfaceView.Renderer
         };
 
     private static final int NUM_OBJECTS = MOVE_VEC.length/3;
+    private static final int OBJ_SIZE    = 100;
 
     private GLSurfaceView mView;
     private DistortedTexture mTex1, mTex2;
@@ -82,7 +83,6 @@ class MultiblurRenderer implements GLSurfaceView.Renderer
     private DynamicQuat mQuatInt1, mQuatInt2;
     private int mDistance;
     private boolean[] mBlurStatus;
-    private int mScreenW, mScreenH;
 
     Static4D mQuat1, mQuat2;
     int mScreenMin;
@@ -114,6 +114,7 @@ class MultiblurRenderer implements GLSurfaceView.Renderer
       fpsTexture.setTexture(fpsBitmap);
       fpsCanvas = new Canvas(fpsBitmap);
       fpsEffects = new DistortedEffects();
+      fpsEffects.move( new Static3D(5,5,0) );
       durations = new long[NUM_FRAMES+1];
       currDuration = 0;
 
@@ -148,8 +149,8 @@ class MultiblurRenderer implements GLSurfaceView.Renderer
 
       MeshCubes mesh = new MeshCubes(1,1,false);
 
-      mTex1 = new DistortedTexture(1,1);
-      mTex2 = new DistortedTexture(1,1);
+      mTex1 = new DistortedTexture(OBJ_SIZE,OBJ_SIZE);
+      mTex2 = new DistortedTexture(OBJ_SIZE,OBJ_SIZE);
 
       mQuat1 = new Static4D(0,0,0,1);  // unity
       mQuat2 = new Static4D(0,0,0,1);  // quaternions
@@ -195,26 +196,20 @@ class MultiblurRenderer implements GLSurfaceView.Renderer
     public void onSurfaceChanged(GL10 glUnused, int width, int height) 
       {
       mScreenMin = width<height ? width:height;
-      mScreenW = width;
-      mScreenH = height;
 
-      fpsEffects.abortAllEffects();
-      fpsEffects.move(  new Static3D( -0.5f + (fpsW/2 + 5.0f)/width, -0.5f + (fpsH/2 + 5.0f)/height,0.0f) );
-      fpsEffects.scale( new Static3D( (float)fpsW/width, (float)fpsH/height, 1.0f) );
-
-      float q= (float)width/height;
-      float scale = 0.15f;
-      Static3D center = new Static3D(0,0,0);
-      Static3D factor = (q<1 ? (new Static3D(scale,scale*q,scale)) : (new Static3D(scale/q,scale,scale/q)));
+    	float factor    = 0.15f*mScreenMin/OBJ_SIZE;
+      Static3D center = new Static3D( (float)OBJ_SIZE/2, (float)OBJ_SIZE/2, 0.0f );
+      Static3D moveVec= new Static3D( (width -factor*OBJ_SIZE)/2 ,(height-factor*OBJ_SIZE)/2 ,0);
 
       for(int i=0; i<NUM_OBJECTS; i++)
         {
         mEffects[i].abortEffects(EffectTypes.MATRIX);
 
+        mEffects[i].move(moveVec);
+        mEffects[i].scale(factor);
         mEffects[i].quaternion(mQuatInt1, center);
         mEffects[i].quaternion(mQuatInt2, center);
         mEffects[i].move(mMoveDynamic[i]);
-        mEffects[i].scale(factor);
         }
 
       computeMoveVectors();
@@ -280,13 +275,11 @@ class MultiblurRenderer implements GLSurfaceView.Renderer
 
     private void computeMoveVectors()
       {
-      float size = 2.6f*mDistance;
-      float sizeX= size/mScreenW;
-      float sizeY= size/mScreenH;
+      float size= 0.026f*OBJ_SIZE*mDistance;
 
       for(int i=0; i<NUM_OBJECTS; i++)
         {
-        mMoveVector[i].set(sizeX*MOVE_VEC[3*i], sizeY*MOVE_VEC[3*i+1], sizeX*MOVE_VEC[3*i+2]);
+        mMoveVector[i].set(size*MOVE_VEC[3*i], size*MOVE_VEC[3*i+1], size*MOVE_VEC[3*i+2]);
         }
       }
 
diff --git a/src/main/java/org/distorted/examples/quaternion/QuaternionRenderer.java b/src/main/java/org/distorted/examples/quaternion/QuaternionRenderer.java
index bb3308b..2db3f0c 100644
--- a/src/main/java/org/distorted/examples/quaternion/QuaternionRenderer.java
+++ b/src/main/java/org/distorted/examples/quaternion/QuaternionRenderer.java
@@ -98,12 +98,13 @@ class QuaternionRenderer implements GLSurfaceView.Renderer
     
   public void onSurfaceChanged(GL10 glUnused, int width, int height) 
     {
-    float q= (float)width/height;
+    float qx = (float)width ;
+    float qy = (float)height;
     float scale = 0.5f;
 
     mEffects.abortEffects(EffectTypes.MATRIX);
     mEffects.quaternion( mRot, new Static3D(0,0,0) );
-    mEffects.scale(  q<1 ? (new Static3D(scale,scale*q,scale)) : (new Static3D(scale/q,scale,scale/q)) );
+    mEffects.scale(  qx<qy ? (new Static3D(scale,scale*qx/qy,scale)) : (new Static3D(scale*qy/qx,scale,scale)) );
 
     mScreen.resize(width, height);
     }
