commit ba95a70b4957a3f752582324eb6bd90490bc78f3
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Wed May 6 22:31:07 2020 +0100

    Convert AroundTheWorld to stretchless API.

diff --git a/src/main/java/org/distorted/examples/aroundtheworld/AroundTheWorldRenderer.java b/src/main/java/org/distorted/examples/aroundtheworld/AroundTheWorldRenderer.java
index 2c3b977..fa1c5ef 100644
--- a/src/main/java/org/distorted/examples/aroundtheworld/AroundTheWorldRenderer.java
+++ b/src/main/java/org/distorted/examples/aroundtheworld/AroundTheWorldRenderer.java
@@ -30,6 +30,7 @@ import org.distorted.library.effect.FragmentEffectContrast;
 import org.distorted.library.effect.MatrixEffectScale;
 import org.distorted.library.effect.VertexEffectDistort;
 import org.distorted.library.effect.VertexEffectPinch;
+import org.distorted.library.effect.VertexEffectScale;
 import org.distorted.library.effect.VertexEffectSink;
 import org.distorted.library.effect.VertexEffectSwirl;
 import org.distorted.library.main.DistortedLibrary;
@@ -55,18 +56,20 @@ class AroundTheWorldRenderer implements GLSurfaceView.Renderer
    private DistortedScreen mScreen;
    private MeshRectangles mMesh;
    private AroundTheWorldEffectsManager mManager;
-   private Static3D mScale;
+   private Static3D mScaleMatrix, mScaleVertex;
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
    AroundTheWorldRenderer(GLSurfaceView view)
       {
-      mScale= new Static3D(1,1,1);
+      mScaleMatrix= new Static3D(1,1,1);
+      mScaleVertex= new Static3D(1,1,1);
 
       mView = view;
       mManager = new AroundTheWorldEffectsManager();
       mEffects = new DistortedEffects();
-      mEffects.apply(new MatrixEffectScale(mScale));
+      mEffects.apply(new MatrixEffectScale(mScaleMatrix));
+      mEffects.apply(new VertexEffectScale(mScaleVertex));
 
       mManager.apply(mEffects);
       mScreen = new DistortedScreen();
@@ -91,11 +94,11 @@ class AroundTheWorldRenderer implements GLSurfaceView.Renderer
     
    public void onSurfaceChanged(GL10 glUnused, int width, int height) 
       {
-      float horiRatio = (float)width / mMesh.getStretchX();
-      float vertRatio = (float)height/ mMesh.getStretchY();
-      float factor    = horiRatio > vertRatio ? vertRatio : horiRatio;
+      float horiRatio = (float)width / mScaleVertex.get0();
+      float vertRatio = (float)height/ mScaleVertex.get1();
+      float factor    = Math.min(horiRatio,vertRatio);
 
-      mScale.set( factor,factor,factor );
+      mScaleMatrix.set( factor,factor,factor );
       mScreen.resize(width,height);
       }
 
@@ -122,14 +125,12 @@ class AroundTheWorldRenderer implements GLSurfaceView.Renderer
       int objWidth = bitmap.getWidth();
       int objHeight= bitmap.getHeight();
 
+      mScaleVertex.set(objWidth,objHeight,1);
+
       if( mTexture==null ) mTexture = new DistortedTexture();
       mTexture.setTexture(bitmap);
 
-      if( mMesh==null )
-        {
-        mMesh = new MeshRectangles(30,30*objHeight/objWidth);
-        mMesh.setStretch(objWidth,objHeight,0);
-        }
+      if( mMesh==null ) mMesh = new MeshRectangles(30,30*objHeight/objWidth);
 
       mScreen.detachAll();
       mScreen.attach(mTexture, mEffects, mMesh);
@@ -137,6 +138,7 @@ class AroundTheWorldRenderer implements GLSurfaceView.Renderer
       DistortedLibrary.setMax(EffectType.VERTEX  ,12);
       DistortedLibrary.setMax(EffectType.FRAGMENT, 9);
 
+      VertexEffectScale.enable();
       VertexEffectDistort.enable();
       VertexEffectSink.enable();
       VertexEffectPinch.enable();
