commit f7f24f232fe9e83296fa95f619aa62ff1ddd2701
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Fri May 7 23:37:08 2021 +0200

    Progress with RubikControl.

diff --git a/src/main/java/org/distorted/control/RubikControl.java b/src/main/java/org/distorted/control/RubikControl.java
index 9206f4b4..7d913d80 100644
--- a/src/main/java/org/distorted/control/RubikControl.java
+++ b/src/main/java/org/distorted/control/RubikControl.java
@@ -38,7 +38,7 @@ public class RubikControl implements EffectListener
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  private DistortedScreen getScreen()
+  DistortedScreen getScreen()
     {
     RubikActivity act = mRefAct.get();
     return act!=null ? act.getScreen() : null;
@@ -139,16 +139,8 @@ public class RubikControl implements EffectListener
 
   public void effectFinished(long effectID)
     {
-    if( effectID==mWhole.getEffectID()  )
-      {
-      android.util.Log.e("D", "whole finished");
-      finishWhole();
-      }
-    if( effectID==mRotate.getEffectID() )
-      {
-      android.util.Log.e("D", "rotate finished");
-      finishRotate();
-      }
+    if( effectID==mWhole.getEffectID()  ) finishWhole();
+    if( effectID==mRotate.getEffectID() ) finishRotate();
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/main/java/org/distorted/control/RubikControlWhole.java b/src/main/java/org/distorted/control/RubikControlWhole.java
index 5bfd823d..1ab50251 100644
--- a/src/main/java/org/distorted/control/RubikControlWhole.java
+++ b/src/main/java/org/distorted/control/RubikControlWhole.java
@@ -26,6 +26,7 @@ import org.distorted.library.effect.MatrixEffectMove;
 import org.distorted.library.effect.MatrixEffectScale;
 import org.distorted.library.main.DistortedEffects;
 import org.distorted.library.main.DistortedNode;
+import org.distorted.library.main.DistortedScreen;
 import org.distorted.library.main.DistortedTexture;
 import org.distorted.library.mesh.MeshQuad;
 import org.distorted.library.type.Dynamic;
@@ -41,16 +42,16 @@ import java.io.InputStream;
 
 class RubikControlWhole
   {
-  private static final int NUM_NODE = 2;
-  private static final int NUM_EFFE = 2;
+  private static final int NUM_NODE = 4;
+  private static final int NUM_EFFE = 4;
 
   private final RubikControl mControl;
   private DistortedEffects[] mEffects;
   private DistortedNode[] mNodes;
   private long mEffectID;
 
-  private Dynamic3D mDynamic;
-  private MatrixEffectMove mMove;
+  private Dynamic3D mDynamicHand1;
+  private MatrixEffectMove mMoveHand1;
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
@@ -74,37 +75,52 @@ class RubikControlWhole
     {
     if( mEffects==null )
       {
-      mEffects   = new DistortedEffects[NUM_EFFE];
-      mEffects[0]= new DistortedEffects();
-      mEffects[1]= new DistortedEffects();
+      mEffects = new DistortedEffects[NUM_EFFE];
+      for(int i=0; i<NUM_EFFE; i++) mEffects[i]= new DistortedEffects();
 
-      float x1 = 200;
-      float y1 = 300;
+      DistortedScreen screen = mControl.getScreen();
+      int wid = screen.getWidth();
+      int hei = screen.getHeight();
+
+      float x1 = wid*0.35f;
+      float y1 = hei*0.28f;
       float z  = 0;
 
       Static3D point0 = new Static3D(-x1,-y1,z);
-      Static3D point1 = new Static3D(+x1,-y1,z);
-      Static3D point2 = new Static3D(+x1,+y1,z);
-
-      mDynamic = new Dynamic3D(10000,0.5f);
-      mDynamic.add(point0);
-      mDynamic.add(point1);
-      mDynamic.add(point2);
-      mDynamic.setMode(Dynamic.MODE_PATH);
-
-      mMove = new MatrixEffectMove(mDynamic);
-      mMove.notifyWhenFinished(mControl);
-      mEffectID = mMove.getID();
+      Static3D point1 = new Static3D(  0,-y1,z);
+      Static3D point2 = new Static3D(+x1,-y1,z);
+      Static3D point3 = new Static3D(+x1,  0,z);
+      Static3D point4 = new Static3D(+x1,+y1,z);
+      Static3D point5 = new Static3D(  0,  0,z);
+
+      mDynamicHand1 = new Dynamic3D(15000,0.5f);
+      mDynamicHand1.add(point0);
+      mDynamicHand1.add(point0);
+      mDynamicHand1.add(point1);
+      mDynamicHand1.add(point2);
+      mDynamicHand1.add(point2);
+      mDynamicHand1.add(point3);
+      mDynamicHand1.add(point4);
+      mDynamicHand1.add(point4);
+      mDynamicHand1.add(point5);
+      mDynamicHand1.add(point0);
+      mDynamicHand1.add(point0);
+      mDynamicHand1.setMode(Dynamic.MODE_PATH);
+      mDynamicHand1.setConvexity(0.0f);
+
+      mMoveHand1 = new MatrixEffectMove(mDynamicHand1);
+      mMoveHand1.notifyWhenFinished(mControl);
+      mEffectID = mMoveHand1.getID();
 
       mEffects[0].apply( new MatrixEffectScale(150));
-      mEffects[0].apply(mMove);
-      mEffects[1].apply( new MatrixEffectScale(300));
-      mEffects[1].apply(mMove);
+      mEffects[0].apply(mMoveHand1);
+      mEffects[2].apply( new MatrixEffectScale(300));
+      mEffects[2].apply(mMoveHand1);
       }
     else
       {
-      mDynamic.resetToBeginning();
-      mMove.notifyWhenFinished(mControl);
+      mDynamicHand1.resetToBeginning();
+      mMoveHand1.notifyWhenFinished(mControl);
       }
     }
 
@@ -125,11 +141,13 @@ class RubikControlWhole
         DistortedTexture textureCirc = new DistortedTexture();
         textureCirc.setTexture(bmpCirc);
         mNodes[0]= new DistortedNode(textureCirc,mEffects[0],mesh);
+        mNodes[1]= new DistortedNode(textureCirc,mEffects[1],mesh);
 
         Bitmap bmpHand = openBitmap(act, R.drawable.ui_hand_pointer);
         DistortedTexture textureHand = new DistortedTexture();
         textureHand.setTexture(bmpHand);
-        mNodes[1]= new DistortedNode(textureHand,mEffects[1],mesh);
+        mNodes[2]= new DistortedNode(textureHand,mEffects[2],mesh);
+        mNodes[3]= new DistortedNode(textureHand,mEffects[3],mesh);
         }
       else
         {
