commit 5590877146d5dfd4f1fa87063870373ebb81c547
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Thu May 7 00:30:27 2020 +0100

    Convert Rubik app to stretchless API.

diff --git a/src/main/java/org/distorted/examples/rubik/RubikCube.java b/src/main/java/org/distorted/examples/rubik/RubikCube.java
index faad495..e7983b0 100644
--- a/src/main/java/org/distorted/examples/rubik/RubikCube.java
+++ b/src/main/java/org/distorted/examples/rubik/RubikCube.java
@@ -50,7 +50,6 @@ class RubikCube
     private static final int VECTZ = 2;
 
     private static final int ROTATION_MILLISEC = 1500;
-    private static final int STRETCH_SIZE = 100;
 
     private static final Static3D VectX = new Static3D(1,0,0);
     private static final Static3D VectY = new Static3D(0,1,0);
@@ -85,7 +84,7 @@ class RubikCube
       Static3D[][][] cubeVectors = new Static3D[mSize][mSize][mSize];
 
       Static3D center = new Static3D(0,0,0);
-      Static4D region = new Static4D(0,0,0, STRETCH_SIZE*0.72f);
+      Static4D region = new Static4D(0,0,0, 0.72f);
 
       VertexEffectSink        sinkEffect = new VertexEffectSink( new Static1D(getSinkStrength()), center, region );
       MatrixEffectScale      scaleEffect = new MatrixEffectScale(scale);
@@ -129,9 +128,8 @@ class RubikCube
               tmpBottom= (y==       0 ? mapBottom:mapBlack);
 
               mCubes[x][y][z]           = new MeshCubes(vertices,vertices,vertices, tmpFront, tmpBack, tmpLeft, tmpRight, tmpTop, tmpBottom);
-              mCubes[x][y][z].setStretch(STRETCH_SIZE,STRETCH_SIZE,STRETCH_SIZE);
 
-              cubeVectors[x][y][z]      = new Static3D( STRETCH_SIZE*(x-nc), STRETCH_SIZE*(y-nc), STRETCH_SIZE*(z-nc) );
+              cubeVectors[x][y][z]      = new Static3D( x-nc, y-nc, z-nc );
               mRotationAngle[x][y][z]   = new Dynamic1D();
               mRotationAxis[x][y][z]    = new Static3D(1,0,0);
 
@@ -306,13 +304,6 @@ class RubikCube
      mTexture.setTexture(bitmap);
      }
 
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-   float getStretchSize()
-     {
-     return STRETCH_SIZE;
-     }
-
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
    int getSize()
diff --git a/src/main/java/org/distorted/examples/rubik/RubikRenderer.java b/src/main/java/org/distorted/examples/rubik/RubikRenderer.java
index 3e5f1c2..94f81fa 100644
--- a/src/main/java/org/distorted/examples/rubik/RubikRenderer.java
+++ b/src/main/java/org/distorted/examples/rubik/RubikRenderer.java
@@ -153,10 +153,7 @@ class RubikRenderer implements GLSurfaceView.Renderer, EffectListener
 
    private void recomputeScaleFactor(int screenWidth, int screenHeight)
      {
-     float cubeSizeInScreenSpace = CUBE_SCREEN_RATIO*(screenWidth>screenHeight ? screenHeight:screenWidth);
-     float texSize = mCube.getStretchSize();
-     float scaleFactor = cubeSizeInScreenSpace/(texSize*mCube.getSize());
-
+     float scaleFactor = CUBE_SCREEN_RATIO * Math.min(screenWidth,screenHeight) / mCube.getSize();
      mScale.set(scaleFactor,scaleFactor,scaleFactor);
      }
 }
