commit c279ea6dd475ba7bd9499497b028cc253b0ae841
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Tue Mar 22 14:54:08 2022 +0100

    Progress with BandagedCreator.

diff --git a/src/main/java/org/distorted/bandaged/BandagedCreatorActivity.java b/src/main/java/org/distorted/bandaged/BandagedCreatorActivity.java
index 8b9b8894..2d5fefea 100644
--- a/src/main/java/org/distorted/bandaged/BandagedCreatorActivity.java
+++ b/src/main/java/org/distorted/bandaged/BandagedCreatorActivity.java
@@ -41,8 +41,8 @@ import org.distorted.main.RubikActivity;
 public class BandagedCreatorActivity extends AppCompatActivity
 {
     private static final int ACTIVITY_NUMBER = 3;
-    private static final float RATIO_BAR   = 0.10f;
-    private static final float RATIO_SCROLL= 0.30f;
+    static final float RATIO_BAR   = 0.10f;
+    static final float RATIO_SCROLL= 0.30f;
 
     public static final float DIALOG_BUTTON_SIZE  = 0.06f;
     public static final float MENU_BIG_TEXT_SIZE  = 0.05f;
diff --git a/src/main/java/org/distorted/bandaged/BandagedCreatorRenderer.java b/src/main/java/org/distorted/bandaged/BandagedCreatorRenderer.java
index c8974f26..d1f31b1c 100644
--- a/src/main/java/org/distorted/bandaged/BandagedCreatorRenderer.java
+++ b/src/main/java/org/distorted/bandaged/BandagedCreatorRenderer.java
@@ -38,7 +38,12 @@ public class BandagedCreatorRenderer implements GLSurfaceView.Renderer, Distorte
    private final GLSurfaceView mView;
    private final DistortedScreen mScreen;
    private final Static3D mScale;
+   private final Static3D mMoveWhole;
    private final Static3D[] mMove;
+   private final Static3D[] mMoveUnscaled;
+   private final BandagedCubit[] mCubits;
+
+   private final int COLOR_DEFAULT = 0xffffff55;
 
    private final float[][] POSITIONS = new float[][]
         {
@@ -80,20 +85,26 @@ public class BandagedCreatorRenderer implements GLSurfaceView.Renderer, Distorte
      final float BRIGHTNESS = 0.333f;
 
      mQuat1 = new Static4D(0,0,0,1);
-     mQuat2 = new Static4D(0,0,0,1);
+     mQuat2 = new Static4D(-0.25189602f,0.3546389f,0.009657208f,0.90038127f);
 
      mView = v;
 
      mScreen = new DistortedScreen();
      mScreen.glClearColor(BRIGHTNESS, BRIGHTNESS, BRIGHTNESS, 1.0f);
      mScale= new Static3D(1,1,1);
+     mMoveWhole = new Static3D(0,0,0);
 
      int len = POSITIONS.length;
-     mMove = new Static3D[len];
+     mMove         = new Static3D[len];
+     mMoveUnscaled = new Static3D[len];
 
-     for(int i=0; i<len; i++) mMove[i] = new Static3D(0,0,0);
+     for(int i=0; i<len; i++)
+       {
+       mMove[i] = new Static3D(0,0,0);
+       mMoveUnscaled[i] = new Static3D(0,0,0);
+       }
 
-     BandagedCubit[] cubits = createCubits();
+     mCubits = createCubits();
      }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -105,10 +116,8 @@ public class BandagedCreatorRenderer implements GLSurfaceView.Renderer, Distorte
 
      for(int c=0; c<len; c++)
        {
-       computeMove(mMove[c],POSITIONS[c]);
-       cubits[c] = new BandagedCubit(POSITIONS[c],mQuat1,mQuat2,mMove[c],mScale);
-       DistortedNode node = cubits[c].getNode();
-       mScreen.attach(node);
+       computeMove(mMoveUnscaled[c],POSITIONS[c]);
+       cubits[c] = new BandagedCubit(POSITIONS[c],mQuat1,mQuat2,mMove[c],mMoveWhole,mScale, COLOR_DEFAULT);
        }
 
      return cubits;
@@ -152,17 +161,27 @@ public class BandagedCreatorRenderer implements GLSurfaceView.Renderer, Distorte
       final float Q = 0.15f;
       float scale = width<height ? Q*width : Q*height;
 
+      mScreen.detachAll();
       int len = POSITIONS.length;
 
       for(int i=0; i<len; i++)
         {
-        float x = mMove[i].get0();
-        float y = mMove[i].get1();
-        float z = mMove[i].get2();
+        float x = mMoveUnscaled[i].get0();
+        float y = mMoveUnscaled[i].get1();
+        float z = mMoveUnscaled[i].get2();
 
         mMove[i].set(x*scale,y*scale,z*scale);
+
+        mCubits[i].setTexture(COLOR_DEFAULT);
+        DistortedNode node = mCubits[i].getNode();
+        mScreen.attach(node);
         }
 
+      float RB = BandagedCreatorActivity.RATIO_BAR;
+      float RS = BandagedCreatorActivity.RATIO_SCROLL;
+      float yOffset = (0.5f*RB/(1-RS))*height;
+      mMoveWhole.set1(yOffset);
+
       mScale.set( scale,scale,scale );
       mScreenMin = Math.min(width, height);
       mScreen.resize(width,height);
diff --git a/src/main/java/org/distorted/bandaged/BandagedCubit.java b/src/main/java/org/distorted/bandaged/BandagedCubit.java
index 2783a2e8..2911ef61 100644
--- a/src/main/java/org/distorted/bandaged/BandagedCubit.java
+++ b/src/main/java/org/distorted/bandaged/BandagedCubit.java
@@ -46,7 +46,7 @@ public class BandagedCubit
 // PUBLIC API
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-    public BandagedCubit(float[] position, Static4D quat1, Static4D quat2, Static3D move, Static3D scale)
+    public BandagedCubit(float[] position, Static4D quat1, Static4D quat2, Static3D move1, Static3D move2, Static3D scale, int color)
       {
       mPosition = position;
 
@@ -54,22 +54,31 @@ public class BandagedCubit
       mMesh = factory.createMesh(position);
 
       mTexture = new DistortedTexture();
-      mTexture.setColorARGB(0xffffff55);
+      mTexture.setColorARGB(color);
 
       MatrixEffectScale scaleEffect = new MatrixEffectScale(scale);
       MatrixEffectQuaternion quat1Effect = new MatrixEffectQuaternion(quat1, CENTER);
       MatrixEffectQuaternion quat2Effect = new MatrixEffectQuaternion(quat2, CENTER);
-      MatrixEffectMove moveEffect = new MatrixEffectMove(move);
+      MatrixEffectMove move1Effect = new MatrixEffectMove(move1);
+      MatrixEffectMove move2Effect = new MatrixEffectMove(move2);
 
       mEffects = new DistortedEffects();
       mEffects.apply(scaleEffect);
-      mEffects.apply(moveEffect);
+      mEffects.apply(move1Effect);
       mEffects.apply(quat2Effect);
       mEffects.apply(quat1Effect);
+      mEffects.apply(move2Effect);
 
       mNode = new DistortedNode(mTexture,mEffects,mMesh);
       }
 
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+    public void setTexture(int color)
+      {
+      mTexture.setColorARGB(color);
+      }
+
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
     public DistortedNode getNode()
