.. | .. |
---|
5 | 5 | |
---|
6 | 6 | RandomNode() |
---|
7 | 7 | { |
---|
8 | | - this("Random"); |
---|
| 8 | + this("Switch"); |
---|
9 | 9 | } |
---|
10 | 10 | |
---|
11 | 11 | RandomNode(String name) |
---|
.. | .. |
---|
25 | 25 | // return 1; |
---|
26 | 26 | // } |
---|
27 | 27 | |
---|
| 28 | + boolean IsSwitch() |
---|
| 29 | + { |
---|
| 30 | + return CameraPane.SWITCH && !this.link2master; |
---|
| 31 | + } |
---|
| 32 | + |
---|
28 | 33 | public int size() |
---|
29 | 34 | { |
---|
30 | | - if (CameraPane.SWITCH) |
---|
| 35 | + if (IsSwitch()) |
---|
31 | 36 | { |
---|
32 | 37 | if (super.size() > 0) |
---|
33 | 38 | return 1; |
---|
.. | .. |
---|
38 | 43 | return super.size(); |
---|
39 | 44 | } |
---|
40 | 45 | |
---|
41 | | - int rnd = -1; |
---|
| 46 | + int rndIndex = -1; |
---|
42 | 47 | |
---|
43 | 48 | static int globalseed = 0; |
---|
44 | 49 | static int globalseed2 = 0; // mocap frames??? |
---|
.. | .. |
---|
54 | 59 | super.ResetRandom(); |
---|
55 | 60 | } |
---|
56 | 61 | |
---|
| 62 | + int damp; |
---|
| 63 | + transient int countdamp; |
---|
| 64 | + transient int globaloffset; |
---|
| 65 | + |
---|
| 66 | + void DrawNode(iCameraPane display, Object3D /*Composite*/ root, boolean selected) |
---|
| 67 | + { |
---|
| 68 | + if (live && Globals.isLIVE() && (display.DrawMode() == display.SHADOW || !Globals.RENDERSHADOW) && |
---|
| 69 | + currentframe != Globals.framecount) |
---|
| 70 | + { |
---|
| 71 | + currentframe = Globals.framecount; |
---|
| 72 | + |
---|
| 73 | + if (countdamp <= 0) |
---|
| 74 | + { |
---|
| 75 | + countdamp = damp; |
---|
| 76 | + |
---|
| 77 | + globaloffset += 1; |
---|
| 78 | + } |
---|
| 79 | + else |
---|
| 80 | + { |
---|
| 81 | + if (CameraPane.FAST) |
---|
| 82 | + countdamp -= CameraPane.STEP; |
---|
| 83 | + else |
---|
| 84 | + countdamp--; |
---|
| 85 | + } |
---|
| 86 | + } |
---|
| 87 | + |
---|
| 88 | + super.DrawNode(display, root, selected); |
---|
| 89 | + } |
---|
| 90 | + |
---|
57 | 91 | int firstchoice = 0; |
---|
58 | 92 | // int currentpass = 0; |
---|
59 | 93 | |
---|
60 | 94 | public Object3D reserve(int i) |
---|
61 | 95 | { |
---|
62 | | - if (!CameraPane.SWITCH) |
---|
| 96 | + if (!IsSwitch()) |
---|
63 | 97 | return super.reserve(i); |
---|
64 | 98 | |
---|
65 | 99 | //assert(rnd == -1); |
---|
66 | 100 | // if (!link2master && rnd != -1) |
---|
67 | 101 | // new Exception().printStackTrace(); |
---|
68 | 102 | |
---|
69 | | - if (!random && rnd != -1) // freeze current value |
---|
70 | | - return super.reserve(rnd); |
---|
| 103 | + if (!random && rndIndex != -1) // freeze current value |
---|
| 104 | + return super.reserve(rndIndex); |
---|
71 | 105 | |
---|
72 | 106 | if (firstchoice == 0) |
---|
73 | 107 | firstchoice = (int)(Math.random()*super.Size()) + 1; |
---|
.. | .. |
---|
91 | 125 | } |
---|
92 | 126 | //int tabarnak = super.Size(); |
---|
93 | 127 | |
---|
94 | | - rnd = gcount%super.Size(); // |
---|
| 128 | + rndIndex = gcount%super.Size(); // |
---|
95 | 129 | |
---|
96 | 130 | //(int)(Math.random()*super.size()); |
---|
97 | 131 | //globalcount++; |
---|
98 | | - gcount += GrafreeD.mix3(rnd+12345,firstchoice*12345,gcount); |
---|
| 132 | + gcount += Grafreed.mix3(rndIndex+12345,firstchoice*12345,gcount); |
---|
99 | 133 | |
---|
100 | 134 | gcount &= 0x7fffffff; |
---|
101 | 135 | |
---|
.. | .. |
---|
105 | 139 | globalseed = gcount; |
---|
106 | 140 | |
---|
107 | 141 | if (!random) // aout 2013 link2master) |
---|
108 | | - rnd = whatevercount++; |
---|
| 142 | + rndIndex = whatevercount++; |
---|
109 | 143 | |
---|
110 | | - rnd %= super.Size(); |
---|
| 144 | + if (live) // aout 2019 |
---|
| 145 | + { |
---|
| 146 | + rndIndex += globaloffset; |
---|
| 147 | + } |
---|
| 148 | + |
---|
| 149 | + rndIndex %= super.Size(); |
---|
111 | 150 | |
---|
112 | 151 | //GraphreeD.tracein("RESERVE " + this + " = ", i); |
---|
113 | | - Object3D child = super.get(rnd); |
---|
| 152 | + Object3D child = super.get(rndIndex); |
---|
114 | 153 | //Applet3D.tracein("RESERVE ", child); |
---|
115 | 154 | |
---|
116 | 155 | child.count--; |
---|
.. | .. |
---|
126 | 165 | |
---|
127 | 166 | public void release(int i) |
---|
128 | 167 | { |
---|
129 | | - if (!CameraPane.SWITCH) |
---|
| 168 | + if (!IsSwitch()) |
---|
130 | 169 | { |
---|
131 | 170 | super.release(i); |
---|
132 | 171 | return; |
---|
.. | .. |
---|
139 | 178 | |
---|
140 | 179 | // globalcount--; |
---|
141 | 180 | |
---|
142 | | - super.get(rnd).count++; |
---|
| 181 | + super.get(rndIndex).count++; |
---|
143 | 182 | //assert (child.count >= 0); |
---|
144 | 183 | |
---|
145 | 184 | if (random) // volatile value |
---|
146 | | - rnd = -1; |
---|
| 185 | + rndIndex = -1; |
---|
147 | 186 | } |
---|
148 | 187 | |
---|
149 | 188 | void createEditWindow(GroupEditor callee, boolean newWindow) |
---|