commit 277eddbb9d63324f04609c7d3635886531dbc09e
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Sat May 9 00:03:33 2020 +0100

    Remove the MeshBase.{set/get}Stretch API altogether.

diff --git a/src/main/java/org/distorted/library/effectqueue/EffectQueueMatrix.java b/src/main/java/org/distorted/library/effectqueue/EffectQueueMatrix.java
index 8ee018e..2582b84 100644
--- a/src/main/java/org/distorted/library/effectqueue/EffectQueueMatrix.java
+++ b/src/main/java/org/distorted/library/effectqueue/EffectQueueMatrix.java
@@ -37,7 +37,6 @@ class EffectQueueMatrix extends EffectQueue
   private static float[] mMVPMatrix       = new float[16];
   private static float[] mModelViewMatrix = new float[16];
 
-  private static int[] mStretchH   = new int[MAIN_VARIANTS];
   private static int[] mMVPMatrixH = new int[MAIN_VARIANTS];
   private static int[] mMVMatrixH  = new int[MAIN_VARIANTS];
 
@@ -52,7 +51,6 @@ class EffectQueueMatrix extends EffectQueue
 
   static void uniforms(int mProgramH, int variant)
     {
-    mStretchH[variant]  = GLES30.glGetUniformLocation(mProgramH, "u_Stretch");
     mMVPMatrixH[variant]= GLES30.glGetUniformLocation(mProgramH, "u_MVPMatrix");
     mMVMatrixH[variant] = GLES30.glGetUniformLocation(mProgramH, "u_MVMatrix");
     }
@@ -101,7 +99,6 @@ class EffectQueueMatrix extends EffectQueue
     // combined Model-View-Projection matrix
     Matrix.multiplyMM(mMVPMatrix, 0, projection, 0, mModelViewMatrix, 0);
 
-    GLES30.glUniform3f( mStretchH[variant]  , mesh.getStretchX() , mesh.getStretchY() , mesh.getStretchZ() );
     GLES30.glUniformMatrix4fv(mMVMatrixH[variant] , 1, false, mModelViewMatrix, 0);
     GLES30.glUniformMatrix4fv(mMVPMatrixH[variant], 1, false, mMVPMatrix      , 0);
     }
diff --git a/src/main/java/org/distorted/library/mesh/MeshBase.java b/src/main/java/org/distorted/library/mesh/MeshBase.java
index e9a16bd..0fc03f4 100644
--- a/src/main/java/org/distorted/library/mesh/MeshBase.java
+++ b/src/main/java/org/distorted/library/mesh/MeshBase.java
@@ -514,59 +514,6 @@ public abstract class MeshBase
      {
      return (component>=0 && component<mComponent.size()) ? mComponent.get(component).mTextureMap : null;
      }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-/**
- * Sometimes we want to display a Mesh on a rectangular screen. Then we need to stretch it by
- * different factors in x and y (or z) directions. If we also wanted do display some vertex effects
- * done on this mesh, let's say a bulge done by a Distort effect, and wanted the bulge to be round,
- * (i.e the same in x and y directions) then doing so without this method would be impossible.
- *
- * This sets 'stretch' factors in each 3 dimensions. All vertices of this Mesh will be premultiplied
- * by those factors in the very first line of the Vertex Shader, before any Effects are done on it.
- * Using this we can thus pre-stretch the mesh to aspect ratio equal to the surface we eventually
- * want to display the Mesh on, and this way we can achieve a round Distort bulge!
- *
- * This could also be used to pre-stretch a Rectangles Mesh to a size equal (in pixels) to the bitmap
- * this mesh is textured with - and this lets us work with all Effects in natural, pixel units.
- *
- * @param sx stretch factor in x.
- * @param sy stretch factor in y.
- * @param sz stretch factor in z.
- */
-   public void setStretch(float sx, float sy, float sz)
-     {
-     mStretchX = sx;
-     mStretchY = sy;
-     mStretchZ = sz;
-     }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-/**
- * Returns the x-factor set by setStretch().
- */
-   public float getStretchX()
-     {
-     return mStretchX;
-     }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-/**
- * Returns the y-factor set by setStretch().
- */
-   public float getStretchY()
-     {
-     return mStretchY;
-     }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-/**
- * Returns the z-factor set by setStretch().
- */
-   public float getStretchZ()
-     {
-     return mStretchZ;
-     }
    }
 
 
diff --git a/src/main/res/raw/main_vertex_shader.glsl b/src/main/res/raw/main_vertex_shader.glsl
index 76d44fd..4054976 100644
--- a/src/main/res/raw/main_vertex_shader.glsl
+++ b/src/main/res/raw/main_vertex_shader.glsl
@@ -31,7 +31,6 @@ out vec3 v_endPosition;              // for Transform Feedback only
 out vec3 v_Normal;                   //
 out vec2 v_TexCoordinate;            //
 
-uniform vec3 u_Stretch;              // MeshBase.mStretch{X,Y,Z}
 uniform mat4 u_MVPMatrix;            // the combined model/view/projection matrix.
 uniform mat4 u_MVMatrix;             // the combined model/view matrix.
 uniform float u_Inflate;             // how much should we inflate (>0.0) or deflate (<0.0) the mesh.
@@ -93,11 +92,9 @@ float degree(in vec4 region, in vec3 PS)
 
 void main()
   {
-  vec3 v = u_Stretch*a_Position;
+  vec3 v = a_Position + u_Inflate*a_Inflate;
   vec3 n = a_Normal;
 
-  v += u_Inflate*u_Stretch*a_Inflate;
-
 #if NUM_VERTEX>0
   int effect=0;
 
@@ -110,7 +107,7 @@ void main()
 #endif
    
   v_Position      = v;
-  v_endPosition   = v + (0.2*u_Stretch.x)*n;
+  v_endPosition   = v + 0.4*n;
   v_TexCoordinate = a_TexCoordinate;
   v_Normal        = normalize(vec3(u_MVMatrix*vec4(n,0.0)));
   gl_Position     = u_MVPMatrix*vec4(v,1.0);
