commit e56c371185e7ab3bc7698d85180990d92889dc56
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Wed May 8 13:47:31 2019 +0100

    2 new effects; bugfix.

diff --git a/.gitignore b/.gitignore
index 4169be3d..59b3f7e1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,45 @@
-/build
-distorted-cube.iml
+# built application files
+*.apk
+*.ap_
+
+# files for the dex VM
+*.dex
+
+# Java class files
+*.class
+
+# built native files (uncomment if you build your own)
+# *.o
+# *.so
+
+# generated files
+bin/
+gen/
+
+# Ignore gradle files
+.gradle/
+build/
+
+# Local configuration file (sdk path, etc)
+local.properties
+
+# Proguard folder generated by Eclipse
+proguard/
+
+# Eclipse Metadata
+.metadata/
+
+# Mac OS X clutter
+*.DS_Store
+
+# Windows clutter
+Thumbs.db
+
+# Intellij IDEA (see https://intellij-support.jetbrains.com/entries/23393067)
+.idea/workspace.xml
+.idea/tasks.xml
+.idea/datasources.xml
+.idea/dataSources.ids
+
+# yes, ignore the .iml
+*.iml
diff --git a/src/main/java/org/distorted/effect/TransitionEffectRound.java b/src/main/java/org/distorted/effect/TransitionEffectRound.java
new file mode 100644
index 00000000..49b70740
--- /dev/null
+++ b/src/main/java/org/distorted/effect/TransitionEffectRound.java
@@ -0,0 +1,78 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Copyright 2019 Leszek Koltunski                                                               //
+//                                                                                               //
+// This file is part of Distorted.                                                               //
+//                                                                                               //
+// Distorted is free software: you can redistribute it and/or modify                             //
+// it under the terms of the GNU General Public License as published by                          //
+// the Free Software Foundation, either version 2 of the License, or                             //
+// (at your option) any later version.                                                           //
+//                                                                                               //
+// Distorted is distributed in the hope that it will be useful,                                  //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of                                //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                 //
+// GNU General Public License for more details.                                                  //
+//                                                                                               //
+// You should have received a copy of the GNU General Public License                             //
+// along with Distorted.  If not, see <http://www.gnu.org/licenses/>.                            //
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+package org.distorted.effect;
+
+import org.distorted.library.effect.Effect;
+import org.distorted.library.effect.MatrixEffectMove;
+import org.distorted.library.effect.MatrixEffectScale;
+import org.distorted.library.type.Dynamic3D;
+import org.distorted.library.type.Static3D;
+
+import static org.distorted.magic.RubikRenderer.TEXTURE_SIZE;
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+class TransitionEffectRound extends TransitionEffect
+  {
+  TransitionEffectRound()
+    {
+    final int DURATION_IN_MILLIS = 10000;
+
+    mOldCubeEffectPosition = new int[] {2, 2};
+    mOldCubeEffects        = new Effect[mOldCubeEffectPosition.length];
+
+    Dynamic3D oldCube0 = new Dynamic3D(DURATION_IN_MILLIS, 0.5f);
+    oldCube0.add(new Static3D(0,0,0));
+    oldCube0.add(new Static3D(TEXTURE_SIZE,0,0));
+    oldCube0.add(new Static3D(0,0,0));
+    mOldCubeEffects[0] = new MatrixEffectMove(oldCube0);
+
+    Dynamic3D oldCube1 = new Dynamic3D(DURATION_IN_MILLIS, 0.5f);
+    oldCube1.add(new Static3D(1.0f, 1.0f, 1.0f));
+    oldCube1.add(new Static3D(0.01f, 0.01f, 0.01f));
+    mOldCubeEffects[1] = new MatrixEffectScale(oldCube1);
+
+
+    mNewCubeEffectPosition = new int[] {2, 2};
+    mNewCubeEffects        = new Effect[mNewCubeEffectPosition.length];
+
+    Dynamic3D newCube0 = new Dynamic3D(DURATION_IN_MILLIS, 0.5f);
+    newCube0.add(new Static3D(0,0,0));
+    newCube0.add(new Static3D(-TEXTURE_SIZE,0,0));
+    newCube0.add(new Static3D(0,0,0));
+    mNewCubeEffects[0] = new MatrixEffectMove(newCube0);
+
+    Dynamic3D newCube1 = new Dynamic3D(DURATION_IN_MILLIS, 0.5f);
+    newCube1.add(new Static3D(0.01f, 0.01f, 0.01f));
+    newCube1.add(new Static3D(1.0f, 1.0f, 1.0f));
+    mNewCubeEffects[1] = new MatrixEffectScale(newCube1);
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// enable all effects used in this Transition. Called by reflection from the parent class.
+// Matrix Effects do not have to be enabled.
+
+  @SuppressWarnings("unused")
+  static void enable()
+    {
+
+    }
+  }
+
diff --git a/src/main/java/org/distorted/effect/TransitionEffectScale.java b/src/main/java/org/distorted/effect/TransitionEffectScale.java
new file mode 100644
index 00000000..71601df9
--- /dev/null
+++ b/src/main/java/org/distorted/effect/TransitionEffectScale.java
@@ -0,0 +1,63 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Copyright 2019 Leszek Koltunski                                                               //
+//                                                                                               //
+// This file is part of Distorted.                                                               //
+//                                                                                               //
+// Distorted is free software: you can redistribute it and/or modify                             //
+// it under the terms of the GNU General Public License as published by                          //
+// the Free Software Foundation, either version 2 of the License, or                             //
+// (at your option) any later version.                                                           //
+//                                                                                               //
+// Distorted is distributed in the hope that it will be useful,                                  //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of                                //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                 //
+// GNU General Public License for more details.                                                  //
+//                                                                                               //
+// You should have received a copy of the GNU General Public License                             //
+// along with Distorted.  If not, see <http://www.gnu.org/licenses/>.                            //
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+package org.distorted.effect;
+
+import org.distorted.library.effect.Effect;
+import org.distorted.library.effect.MatrixEffectScale;
+import org.distorted.library.type.Dynamic3D;
+import org.distorted.library.type.Static3D;
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+class TransitionEffectScale extends TransitionEffect
+  {
+  TransitionEffectScale()
+    {
+    final int DURATION_IN_MILLIS = 1000;
+
+    mOldCubeEffectPosition = new int[] {5};
+    mOldCubeEffects        = new Effect[mOldCubeEffectPosition.length];
+
+    Dynamic3D oldCube0 = new Dynamic3D(DURATION_IN_MILLIS, 0.5f);
+    oldCube0.add(new Static3D(1.0f, 1.0f, 1.0f));
+    oldCube0.add(new Static3D(0.01f, 0.01f, 0.01f));
+    mOldCubeEffects[0] = new MatrixEffectScale(oldCube0);
+
+
+    mNewCubeEffectPosition = new int[] {5};
+    mNewCubeEffects        = new Effect[mNewCubeEffectPosition.length];
+
+    Dynamic3D newCube0 = new Dynamic3D(DURATION_IN_MILLIS, 0.5f);
+    newCube0.add(new Static3D(0.01f, 0.01f, 0.01f));
+    newCube0.add(new Static3D(1.0f, 1.0f, 1.0f));
+    mNewCubeEffects[0] = new MatrixEffectScale(newCube0);
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// enable all effects used in this Transition. Called by reflection from the parent class.
+// Matrix Effects do not have to be enabled.
+
+  @SuppressWarnings("unused")
+  static void enable()
+    {
+
+    }
+  }
+
diff --git a/src/main/java/org/distorted/magic/RubikRenderer.java b/src/main/java/org/distorted/magic/RubikRenderer.java
index 5fba056b..75c2843c 100644
--- a/src/main/java/org/distorted/magic/RubikRenderer.java
+++ b/src/main/java/org/distorted/magic/RubikRenderer.java
@@ -236,14 +236,12 @@ public class RubikRenderer implements GLSurfaceView.Renderer, EffectListener
 
    boolean createCube(int newSize)
      {
-     if( mCanDrag && mCanRotate )
+     if( mCanDrag && mCanRotate && newSize != mNewCube.getSize() )
        {
        mNextCubeSize = newSize;
        return true;
        }
 
-     android.util.Log.e("renderer", "cannot change, drag="+mCanDrag+" rotate="+mCanRotate);
-
      return false;
      }
 
@@ -251,23 +249,18 @@ public class RubikRenderer implements GLSurfaceView.Renderer, EffectListener
 
    void createCubeNow(int newSize)
      {
-     int oldSize = mNewCube==null ? 0 : mNewCube.getSize();
-
-     if( oldSize!=newSize )
-       {
-       if( mOldCube!=null ) mOldCube.releaseResources();
-       mOldCube = mNewCube;
+     if( mOldCube!=null ) mOldCube.releaseResources();
+     mOldCube = mNewCube;
 
-       DistortedTexture texture = new DistortedTexture(TEXTURE_SIZE,TEXTURE_SIZE);
-       DistortedEffects effects = new DistortedEffects();
+     DistortedTexture texture = new DistortedTexture(TEXTURE_SIZE,TEXTURE_SIZE);
+     DistortedEffects effects = new DistortedEffects();
 
-       mNewCube = new RubikCube(newSize, mQuatCurrent, mQuatAccumulated, texture, mMesh, effects);
-       mNewCube.createTexture();
+     mNewCube = new RubikCube(newSize, mQuatCurrent, mQuatAccumulated, texture, mMesh, effects);
+     mNewCube.createTexture();
 
-       if( mScreenWidth!=0 )
-         {
-         recomputeScaleFactor(mScreenWidth,mScreenHeight);
-         }
+     if( mScreenWidth!=0 )
+       {
+       recomputeScaleFactor(mScreenWidth,mScreenHeight);
        }
      }
 
