From 5892f05411c3d4dce2d8a59e0966dc2e1843a971 Mon Sep 17 00:00:00 2001
From: Normand Briere <nbriere@noware.ca>
Date: Sat, 17 Aug 2019 08:33:35 -0400
Subject: [PATCH] Fix L&F nimbus too slow.

---
 RandomNode.java |   54 ++++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 44 insertions(+), 10 deletions(-)

diff --git a/RandomNode.java b/RandomNode.java
index 7d0d7b3..81b7d4e 100644
--- a/RandomNode.java
+++ b/RandomNode.java
@@ -38,7 +38,7 @@
             return super.size();
     }
     
-    int rnd = -1;
+    int rndIndex = -1;
     
     static int globalseed = 0;
     static int globalseed2 = 0; // mocap frames???
@@ -54,6 +54,35 @@
             super.ResetRandom();
         }
         
+    int damp;
+    transient int countdamp;
+    transient int globaloffset;
+    
+    void DrawNode(iCameraPane display, Object3D /*Composite*/ root, boolean selected)
+    {
+        if (live && Globals.isLIVE() && (display.DrawMode() == display.SHADOW || !Globals.RENDERSHADOW) &&
+                currentframe != Globals.framecount)
+        {
+            currentframe = Globals.framecount;
+            
+            if (countdamp <= 0)
+            {
+                countdamp = damp;
+                
+                globaloffset += 1;
+            }
+            else
+            {
+                if (CameraPane.FAST)
+                    countdamp -= CameraPane.STEP;
+                else
+                    countdamp--;
+            }
+        }
+        
+        super.DrawNode(display, root, selected);
+    }
+    
     int firstchoice = 0;
 //    int currentpass = 0;
     
@@ -66,8 +95,8 @@
 //        if (!link2master && rnd != -1)
 //            new Exception().printStackTrace();
         
-        if (!random && rnd != -1) // freeze current value
-            return super.reserve(rnd);
+        if (!random && rndIndex != -1) // freeze current value
+            return super.reserve(rndIndex);
         
         if (firstchoice == 0)
             firstchoice = (int)(Math.random()*super.Size()) + 1;
@@ -91,11 +120,11 @@
         }
         //int tabarnak = super.Size();
         
-        rnd = gcount%super.Size(); //
+        rndIndex = gcount%super.Size(); //
         
             //(int)(Math.random()*super.size());
         //globalcount++;
-        gcount += Grafreed.mix3(rnd+12345,firstchoice*12345,gcount);
+        gcount += Grafreed.mix3(rndIndex+12345,firstchoice*12345,gcount);
         
         gcount &= 0x7fffffff;
         
@@ -105,12 +134,17 @@
             globalseed = gcount;
             
         if (!random) // aout 2013 link2master)
-            rnd = whatevercount++;
+            rndIndex = whatevercount++;
         
-        rnd %= super.Size();
+        if (live) // aout 2019
+        {
+            rndIndex += globaloffset;
+        }
+        
+        rndIndex %= super.Size();
         
         //GraphreeD.tracein("RESERVE " + this + " = ", i);
-        Object3D child = super.get(rnd);
+        Object3D child = super.get(rndIndex);
         //Applet3D.tracein("RESERVE ", child);
 
         child.count--;
@@ -139,11 +173,11 @@
 
     //    globalcount--;
         
-        super.get(rnd).count++;
+        super.get(rndIndex).count++;
     //assert (child.count >= 0);
         
         if (random) // volatile value
-            rnd = -1;
+            rndIndex = -1;
     }
     
     void createEditWindow(GroupEditor callee, boolean newWindow)

--
Gitblit v1.6.2