From 547c9203ab5d8e4bee36d1cbb453dfa36bbec4ef Mon Sep 17 00:00:00 2001 From: Normand Briere <nbriere@noware.ca> Date: Tue, 27 Aug 2019 23:45:18 -0400 Subject: [PATCH] Test has big data. --- RandomNode.java | 69 +++++++++++++++++++++++++++------- 1 files changed, 54 insertions(+), 15 deletions(-) diff --git a/RandomNode.java b/RandomNode.java index 20dd4e6..daf6231 100644 --- a/RandomNode.java +++ b/RandomNode.java @@ -5,7 +5,7 @@ RandomNode() { - this("Random"); + this("Switch"); } RandomNode(String name) @@ -25,9 +25,14 @@ // return 1; // } + boolean IsSwitch() + { + return CameraPane.SWITCH && !this.link2master; + } + public int size() { - if (CameraPane.RANDOM) + if (IsSwitch()) { if (super.size() > 0) return 1; @@ -38,7 +43,7 @@ return super.size(); } - int rnd = -1; + int rndIndex = -1; static int globalseed = 0; static int globalseed2 = 0; // mocap frames??? @@ -54,20 +59,49 @@ 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; public Object3D reserve(int i) { - if (!CameraPane.RANDOM) + if (!IsSwitch()) return super.reserve(i); //assert(rnd == -1); // if (!link2master && rnd != -1) // new Exception().printStackTrace(); - if (link2master && 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 +125,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 +139,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--; @@ -126,7 +165,7 @@ public void release(int i) { - if (!CameraPane.RANDOM) + if (!IsSwitch()) { super.release(i); return; @@ -139,11 +178,11 @@ // globalcount--; - super.get(rnd).count++; + super.get(rndIndex).count++; //assert (child.count >= 0); - if (!link2master) // volatile value - rnd = -1; + if (random) // volatile value + rndIndex = -1; } void createEditWindow(GroupEditor callee, boolean newWindow) -- Gitblit v1.6.2