.. | .. |
---|
5 | 5 | |
---|
6 | 6 | RandomNode() |
---|
7 | 7 | { |
---|
8 | | - this("Random"); |
---|
| 8 | + this("Switch"); |
---|
9 | 9 | } |
---|
10 | 10 | |
---|
11 | 11 | RandomNode(String name) |
---|
.. | .. |
---|
38 | 38 | return super.size(); |
---|
39 | 39 | } |
---|
40 | 40 | |
---|
41 | | - int rnd = -1; |
---|
| 41 | + int rndIndex = -1; |
---|
42 | 42 | |
---|
43 | 43 | static int globalseed = 0; |
---|
44 | 44 | static int globalseed2 = 0; // mocap frames??? |
---|
.. | .. |
---|
54 | 54 | super.ResetRandom(); |
---|
55 | 55 | } |
---|
56 | 56 | |
---|
| 57 | + int damp; |
---|
| 58 | + transient int countdamp; |
---|
| 59 | + transient int globaloffset; |
---|
| 60 | + |
---|
| 61 | + void DrawNode(iCameraPane display, Object3D /*Composite*/ root, boolean selected) |
---|
| 62 | + { |
---|
| 63 | + if (live && Globals.isLIVE() && (display.DrawMode() == display.SHADOW || !Globals.RENDERSHADOW) && |
---|
| 64 | + currentframe != Globals.framecount) |
---|
| 65 | + { |
---|
| 66 | + currentframe = Globals.framecount; |
---|
| 67 | + |
---|
| 68 | + if (countdamp <= 0) |
---|
| 69 | + { |
---|
| 70 | + countdamp = damp; |
---|
| 71 | + |
---|
| 72 | + globaloffset += 1; |
---|
| 73 | + } |
---|
| 74 | + else |
---|
| 75 | + { |
---|
| 76 | + if (CameraPane.FAST) |
---|
| 77 | + countdamp -= CameraPane.STEP; |
---|
| 78 | + else |
---|
| 79 | + countdamp--; |
---|
| 80 | + } |
---|
| 81 | + } |
---|
| 82 | + |
---|
| 83 | + super.DrawNode(display, root, selected); |
---|
| 84 | + } |
---|
| 85 | + |
---|
57 | 86 | int firstchoice = 0; |
---|
58 | 87 | // int currentpass = 0; |
---|
59 | 88 | |
---|
.. | .. |
---|
66 | 95 | // if (!link2master && rnd != -1) |
---|
67 | 96 | // new Exception().printStackTrace(); |
---|
68 | 97 | |
---|
69 | | - if (!random && rnd != -1) // freeze current value |
---|
70 | | - return super.reserve(rnd); |
---|
| 98 | + if (!random && rndIndex != -1) // freeze current value |
---|
| 99 | + return super.reserve(rndIndex); |
---|
71 | 100 | |
---|
72 | 101 | if (firstchoice == 0) |
---|
73 | 102 | firstchoice = (int)(Math.random()*super.Size()) + 1; |
---|
.. | .. |
---|
91 | 120 | } |
---|
92 | 121 | //int tabarnak = super.Size(); |
---|
93 | 122 | |
---|
94 | | - rnd = gcount%super.Size(); // |
---|
| 123 | + rndIndex = gcount%super.Size(); // |
---|
95 | 124 | |
---|
96 | 125 | //(int)(Math.random()*super.size()); |
---|
97 | 126 | //globalcount++; |
---|
98 | | - gcount += Grafreed.mix3(rnd+12345,firstchoice*12345,gcount); |
---|
| 127 | + gcount += Grafreed.mix3(rndIndex+12345,firstchoice*12345,gcount); |
---|
99 | 128 | |
---|
100 | 129 | gcount &= 0x7fffffff; |
---|
101 | 130 | |
---|
.. | .. |
---|
105 | 134 | globalseed = gcount; |
---|
106 | 135 | |
---|
107 | 136 | if (!random) // aout 2013 link2master) |
---|
108 | | - rnd = whatevercount++; |
---|
| 137 | + rndIndex = whatevercount++; |
---|
109 | 138 | |
---|
110 | | - rnd %= super.Size(); |
---|
| 139 | + if (live) // aout 2019 |
---|
| 140 | + { |
---|
| 141 | + rndIndex += globaloffset; |
---|
| 142 | + } |
---|
| 143 | + |
---|
| 144 | + rndIndex %= super.Size(); |
---|
111 | 145 | |
---|
112 | 146 | //GraphreeD.tracein("RESERVE " + this + " = ", i); |
---|
113 | | - Object3D child = super.get(rnd); |
---|
| 147 | + Object3D child = super.get(rndIndex); |
---|
114 | 148 | //Applet3D.tracein("RESERVE ", child); |
---|
115 | 149 | |
---|
116 | 150 | child.count--; |
---|
.. | .. |
---|
139 | 173 | |
---|
140 | 174 | // globalcount--; |
---|
141 | 175 | |
---|
142 | | - super.get(rnd).count++; |
---|
| 176 | + super.get(rndIndex).count++; |
---|
143 | 177 | //assert (child.count >= 0); |
---|
144 | 178 | |
---|
145 | 179 | if (random) // volatile value |
---|
146 | | - rnd = -1; |
---|
| 180 | + rndIndex = -1; |
---|
147 | 181 | } |
---|
148 | 182 | |
---|
149 | 183 | void createEditWindow(GroupEditor callee, boolean newWindow) |
---|