commit 02d80fe659804b070383e39e27c167365953c4a6
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Wed Oct 6 00:06:26 2021 +0200

    progress with off-center objects.

diff --git a/src/main/java/org/distorted/objectlib/effects/objectchange/ObjectChangeEffect.java b/src/main/java/org/distorted/objectlib/effects/objectchange/ObjectChangeEffect.java
index fee13575..b9ac16f7 100644
--- a/src/main/java/org/distorted/objectlib/effects/objectchange/ObjectChangeEffect.java
+++ b/src/main/java/org/distorted/objectlib/effects/objectchange/ObjectChangeEffect.java
@@ -67,13 +67,13 @@ public abstract class ObjectChangeEffect extends BaseEffect implements EffectLis
       }
     }
 
-  private ObjectPreRender mPre;
   private int mDuration;
   private final int[] mEffectReturned;
   private final int[] mCubeEffectNumber, mNodeEffectNumber;
   private final int[] mEffectFinished;
   private final boolean[] mPhaseActive;
 
+  ObjectPreRender mPre;
   TwistyObject[] mObject;
   DistortedScreen mScreen;
   Effect[][] mCubeEffects;
diff --git a/src/main/java/org/distorted/objectlib/effects/scramble/ScrambleEffect.java b/src/main/java/org/distorted/objectlib/effects/scramble/ScrambleEffect.java
index 01a63e57..495c832f 100644
--- a/src/main/java/org/distorted/objectlib/effects/scramble/ScrambleEffect.java
+++ b/src/main/java/org/distorted/objectlib/effects/scramble/ScrambleEffect.java
@@ -66,7 +66,7 @@ public abstract class ScrambleEffect extends BaseEffect implements EffectListene
       }
     }
 
-  private ObjectPreRender mPre;
+
   private int mEffectReturned;
   private int mNumScramblesLeft;
   private int mDurationPerDegree;
@@ -74,6 +74,7 @@ public abstract class ScrambleEffect extends BaseEffect implements EffectListene
   private int[] mBasicAngle;
   private boolean mRotReady, mPluginReady;
 
+  ObjectPreRender mPre;
   TwistyObject mObject;
   Effect[] mNodeEffects;
   int[] mNodeEffectPosition;
diff --git a/src/main/java/org/distorted/objectlib/effects/solve/SolveEffect.java b/src/main/java/org/distorted/objectlib/effects/solve/SolveEffect.java
index 197f6d17..65a3dd50 100644
--- a/src/main/java/org/distorted/objectlib/effects/solve/SolveEffect.java
+++ b/src/main/java/org/distorted/objectlib/effects/solve/SolveEffect.java
@@ -65,12 +65,12 @@ public abstract class SolveEffect extends BaseEffect implements EffectListener
       }
     }
 
-  private ObjectPreRender mPre;
   private int mDuration;
   private int mEffectReturned;
   private final int[] mCubeEffectNumber, mNodeEffectNumber;
   private int mPhase;
 
+  ObjectPreRender mPre;
   TwistyObject mObject;
   DistortedScreen mScreen;
   Effect[][] mCubeEffects;
diff --git a/src/main/java/org/distorted/objectlib/effects/win/WinEffect.java b/src/main/java/org/distorted/objectlib/effects/win/WinEffect.java
index 59340c58..5ed09f13 100644
--- a/src/main/java/org/distorted/objectlib/effects/win/WinEffect.java
+++ b/src/main/java/org/distorted/objectlib/effects/win/WinEffect.java
@@ -63,11 +63,11 @@ public abstract class WinEffect extends BaseEffect implements EffectListener
       }
     }
 
-  private ObjectPreRender mPre;
   private int mDuration;
   private int mEffectReturned;
   private int mCubeEffectNumber, mNodeEffectNumber;
 
+  ObjectPreRender mPre;
   TwistyObject mObject;
   DistortedScreen mScreen;
   Effect[] mCubeEffects;
diff --git a/src/main/java/org/distorted/objectlib/effects/win/WinEffectGlow.java b/src/main/java/org/distorted/objectlib/effects/win/WinEffectGlow.java
index 1b5ceda6..d146c2be 100644
--- a/src/main/java/org/distorted/objectlib/effects/win/WinEffectGlow.java
+++ b/src/main/java/org/distorted/objectlib/effects/win/WinEffectGlow.java
@@ -67,7 +67,15 @@ public class WinEffectGlow extends WinEffect
     degreeDyn.add(new Static1D(1.5f));
     degreeDyn.add(new Static1D(1.0f));
 
-    mNodeEffects[1] = new VertexEffectSink(degreeDyn,new Static3D(0,0,0), new Static4D(0,0,0,0.5f) );
+    Static3D move = mPre.getMove();
+    float moveX = move.get0();
+    float moveY = move.get1();
+    int width = mScreen.getWidth();
+    int height= mScreen.getHeight();
+    Static3D center = new Static3D(moveX/width, moveY/height, 0);
+    float ratio = 0.5f*mObject.getRatio();
+
+    mNodeEffects[1] = new VertexEffectSink(degreeDyn, center, new Static4D(0,0,0,ratio) );
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/main/java/org/distorted/objectlib/helpers/ObjectLibInterface.java b/src/main/java/org/distorted/objectlib/helpers/ObjectLibInterface.java
index ea64ae85..3f539786 100644
--- a/src/main/java/org/distorted/objectlib/helpers/ObjectLibInterface.java
+++ b/src/main/java/org/distorted/objectlib/helpers/ObjectLibInterface.java
@@ -19,15 +19,15 @@
 
 package org.distorted.objectlib.helpers;
 
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
 import org.distorted.library.main.DistortedScreen;
 import org.distorted.objectlib.main.ObjectControl;
 import org.distorted.objectlib.main.ObjectType;
 
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
 public interface ObjectLibInterface
   {
-  // objectlib calls those in reaction to object state changing, app has to respond
+  // objectlib calls those in reaction to object state changing, app might want to know about those
   void onWinEffectFinished(String debug, int scrambleNum);
   void onScrambleEffectFinished();
   void onBeginRotation();
diff --git a/src/main/java/org/distorted/objectlib/main/ObjectControl.java b/src/main/java/org/distorted/objectlib/main/ObjectControl.java
index b0564f7d..1b3f06ed 100644
--- a/src/main/java/org/distorted/objectlib/main/ObjectControl.java
+++ b/src/main/java/org/distorted/objectlib/main/ObjectControl.java
@@ -554,6 +554,7 @@ public class ObjectControl
     public void setMove(int xmove, int ymove)
       {
       mMove = new Static3D(xmove,ymove,0);
+      mPreRender.setMove(mMove);
       }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/main/java/org/distorted/objectlib/main/ObjectPreRender.java b/src/main/java/org/distorted/objectlib/main/ObjectPreRender.java
index 6062c1b5..c207f9a7 100644
--- a/src/main/java/org/distorted/objectlib/main/ObjectPreRender.java
+++ b/src/main/java/org/distorted/objectlib/main/ObjectPreRender.java
@@ -27,6 +27,7 @@ import android.content.SharedPreferences;
 import org.distorted.library.main.DistortedScreen;
 import org.distorted.library.message.EffectListener;
 
+import org.distorted.library.type.Static3D;
 import org.distorted.objectlib.helpers.ObjectLibInterface;
 import org.distorted.objectlib.effects.BaseEffect;
 import org.distorted.objectlib.effects.scramble.ScrambleEffect;
@@ -46,6 +47,7 @@ public class ObjectPreRender implements EffectListener
   private final BlockController mBlockController;
   private final ObjectLibInterface mInterface;
   private String mDebug;
+  private Static3D mMove;
 
   private boolean mFinishRotation, mRemoveRotation, mRemovePatternRotation, mAddRotation,
                   mSetQuat, mChangeObject, mSolveObject, mScrambleObject,
@@ -85,6 +87,7 @@ public class ObjectPreRender implements EffectListener
     mNewObject = null;
 
     mDebug = "";
+    mMove = new Static3D(0,0,0);
 
     mScreenWidth = 0;
     mScrambleObjectNum = 0;
@@ -313,6 +316,13 @@ public class ObjectPreRender implements EffectListener
     mSetQuat = true;
     }
 
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  void setMove(Static3D move)
+    {
+    mMove = move;
+    }
+
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 // INTERNAL API
 ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -329,6 +339,13 @@ public class ObjectPreRender implements EffectListener
     return mOldObject;
     }
 
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  public Static3D getMove()
+    {
+    return mMove;
+    }
+
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 // PUBLIC API
 ///////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/main/java/org/distorted/objectlib/main/TwistyObject.java b/src/main/java/org/distorted/objectlib/main/TwistyObject.java
index 31dd8d01..2c92ebcb 100644
--- a/src/main/java/org/distorted/objectlib/main/TwistyObject.java
+++ b/src/main/java/org/distorted/objectlib/main/TwistyObject.java
@@ -1157,6 +1157,13 @@ public abstract class TwistyObject extends DistortedNode
     return mObjectScreenRatio*mInitScreenRatio;
     }
 
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  public float getRatio()
+    {
+    return mObjectScreenRatio;
+    }
+
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
   boolean isSolved()
