commit 1f2181778b0440d64dd4396e1a5e4c8c612e74ba
Author: Leszek Koltunski <leszek@distoretedandroid.org>
Date:   Mon Jun 12 12:08:37 2017 +0100

    Further progress with Apps: 18 (out of 30) compile now.

diff --git a/src/main/java/org/distorted/examples/effects3d/Effects3DEffect.java b/src/main/java/org/distorted/examples/effects3d/Effects3DEffect.java
index 5e1c0e8..adfccd6 100644
--- a/src/main/java/org/distorted/examples/effects3d/Effects3DEffect.java
+++ b/src/main/java/org/distorted/examples/effects3d/Effects3DEffect.java
@@ -25,8 +25,6 @@ import android.widget.TextView;
 
 import org.distorted.examples.R;
 import org.distorted.library.main.DistortedEffects;
-import org.distorted.library.EffectNames;
-import org.distorted.library.EffectTypes;
 import org.distorted.library.type.Dynamic1D;
 import org.distorted.library.type.Dynamic2D;
 import org.distorted.library.type.Dynamic3D;
diff --git a/src/main/java/org/distorted/examples/plainmonalisa/RenderThread.java b/src/main/java/org/distorted/examples/plainmonalisa/RenderThread.java
index 19ed787..1154d66 100644
--- a/src/main/java/org/distorted/examples/plainmonalisa/RenderThread.java
+++ b/src/main/java/org/distorted/examples/plainmonalisa/RenderThread.java
@@ -30,13 +30,15 @@ import android.view.Surface;
 import android.view.SurfaceHolder;
 import android.view.SurfaceView;
 
+import org.distorted.library.effect.EffectName;
+import org.distorted.library.effect.MatrixEffectMove;
+import org.distorted.library.effect.MatrixEffectScale;
+import org.distorted.library.effect.VertexEffectDistort;
 import org.distorted.library.main.Distorted;
 import org.distorted.library.main.DistortedEffects;
 import org.distorted.library.main.DistortedScreen;
-import org.distorted.library.EffectNames;
 import org.distorted.library.main.MeshFlat;
 import org.distorted.library.main.DistortedTexture;
-import org.distorted.library.EffectTypes;
 import org.distorted.library.type.Dynamic3D;
 import org.distorted.library.type.Static3D;
 import org.distorted.library.type.Static4D;
@@ -70,6 +72,7 @@ class RenderThread extends Thread
   private int bmpHeight, bmpWidth;
   private SurfaceView mView;
   private static boolean resourcesCreated = false;
+  private Static3D mMove, mScale;
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
@@ -94,8 +97,13 @@ class RenderThread extends Thread
     dRight.add( new Static3D( 20,-10,0) );
 
     mEffects = new DistortedEffects();
-    mEffects.distort( dLeft, pLeft , rLeft );
-    mEffects.distort(dRight, pRight, rRight);
+    mEffects.apply( new VertexEffectDistort(dLeft , pLeft , rLeft ) );
+    mEffects.apply( new VertexEffectDistort(dRight, pRight, rRight) );
+
+    mMove = new Static3D(0,0,0);
+    mScale= new Static3D(1,1,1);
+    mEffects.apply(new MatrixEffectMove(mMove));
+    mEffects.apply(new MatrixEffectScale(mScale));
 
     mScreen = new DistortedScreen(null);
     }
@@ -117,7 +125,7 @@ class RenderThread extends Thread
       {
       String msg = op + ": glError 0x" + Integer.toHexString(error);
       Log.e(TAG, msg);
-//      throw new RuntimeException(msg);
+//    throw new RuntimeException(msg);
       }
     }
 
@@ -210,23 +218,21 @@ class RenderThread extends Thread
     {
     Log.d(TAG, "surfaceChanged " + width + "x" + height);
 
-    mEffects.abortEffects(EffectTypes.MATRIX);
-
     if( (float)bmpHeight/bmpWidth > (float)height/width )
       {
       int w = (height*bmpWidth)/bmpHeight;
       float factor = (float)height/bmpHeight;
 
-      mEffects.move( new Static3D((width-w)/2,0,0) );
-      mEffects.scale( factor );
+      mMove.set((width-w)/2,0,0);
+      mScale.set( factor,factor,factor );
       }
     else
       {
       int h = (width*bmpHeight)/bmpWidth;
       float factor = (float)width/bmpWidth;
 
-      mEffects.move( new Static3D(0,(height-h)/2,0) );
-      mEffects.scale( factor );
+      mMove.set(0,(height-h)/2,0);
+      mScale.set( factor,factor,factor );
       }
 
     mScreen.resize(width, height);
@@ -234,7 +240,7 @@ class RenderThread extends Thread
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  void createResources()
+  private void createResources()
     {
     resourcesCreated = true;
 
@@ -265,7 +271,7 @@ class RenderThread extends Thread
     mScreen.detachAll();
     mScreen.attach(mTexture,mEffects,mMesh);
 
-    DistortedEffects.enableEffect(EffectNames.DISTORT);
+    DistortedEffects.enableEffect(EffectName.DISTORT);
 
     try
       {
diff --git a/src/main/java/org/distorted/examples/projection/ProjectionRenderer.java b/src/main/java/org/distorted/examples/projection/ProjectionRenderer.java
index f7e941a..8034cd1 100644
--- a/src/main/java/org/distorted/examples/projection/ProjectionRenderer.java
+++ b/src/main/java/org/distorted/examples/projection/ProjectionRenderer.java
@@ -22,10 +22,11 @@ package org.distorted.examples.projection;
 import javax.microedition.khronos.egl.EGLConfig;
 import javax.microedition.khronos.opengles.GL10;
 
+import org.distorted.library.effect.EffectName;
+import org.distorted.library.effect.VertexEffectDistort;
 import org.distorted.library.main.Distorted;
 import org.distorted.library.main.DistortedEffects;
 import org.distorted.library.main.DistortedScreen;
-import org.distorted.library.EffectNames;
 import org.distorted.library.main.MeshFlat;
 import org.distorted.library.main.DistortedTexture;
 import org.distorted.library.type.Static3D;
@@ -48,6 +49,9 @@ class ProjectionRenderer implements GLSurfaceView.Renderer
    private DistortedTexture mTexture;
    private float mF, mNear;
 
+   private Static3D mVector, mPoint1, mPoint2, mPoint3, mPoint4;
+   private Static4D mRegion;
+
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
    ProjectionRenderer(GLSurfaceView view)
@@ -55,6 +59,18 @@ class ProjectionRenderer implements GLSurfaceView.Renderer
       mView   = view;
       mEffects= new DistortedEffects();
       mScreen = new DistortedScreen(mView);
+
+      mVector = new Static3D(0,0,0);
+      mPoint1 = new Static3D(0,0,0);
+      mPoint2 = new Static3D(0,0,0);
+      mPoint3 = new Static3D(0,0,0);
+      mPoint4 = new Static3D(0,0,0);
+      mRegion = new Static4D(0,0,0,0);
+
+      mEffects.apply( new VertexEffectDistort(mVector, mPoint1, mRegion) );
+      mEffects.apply( new VertexEffectDistort(mVector, mPoint2, mRegion) );
+      mEffects.apply( new VertexEffectDistort(mVector, mPoint3, mRegion) );
+      mEffects.apply( new VertexEffectDistort(mVector, mPoint4, mRegion) );
       }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -108,13 +124,13 @@ class ProjectionRenderer implements GLSurfaceView.Renderer
 
       int min = width<height ? width:height;
 
-      Static3D vector = new Static3D(0,0,min/5);
-      Static4D region = new Static4D(0,0,min/5,min/5);
+      mVector.set(0,0,min/5);
+      mRegion.set(0,0,min/5,min/5);
 
-      mEffects.distort(vector, new Static3D(  width/4,   height/4, 0), region);
-      mEffects.distort(vector, new Static3D(3*width/4,   height/4, 0), region);
-      mEffects.distort(vector, new Static3D(  width/4, 3*height/4, 0), region);
-      mEffects.distort(vector, new Static3D(3*width/4, 3*height/4, 0), region);
+      mPoint1.set(  width/4,   height/4, 0);
+      mPoint2.set(3*width/4,   height/4, 0);
+      mPoint3.set(  width/4, 3*height/4, 0);
+      mPoint4.set(3*width/4, 3*height/4, 0);
 
       // Avoid memory leaks: delete old texture if it exists (it might if we
       // got here after a brief amount of time spent in the background)
@@ -137,7 +153,7 @@ class ProjectionRenderer implements GLSurfaceView.Renderer
     
    public void onSurfaceCreated(GL10 glUnused, EGLConfig config) 
       {
-      DistortedEffects.enableEffect(EffectNames.DISTORT);
+      DistortedEffects.enableEffect(EffectName.DISTORT);
 
       try
         {
