Project

General

Profile

Download (30.9 KB) Statistics
| Branch: | Tag: | Revision:

magiccube / src / main / java / org / distorted / control / RubikControlWhole.java @ 20898e6f

1 51f51f83 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2021 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Magic Cube.                                                              //
5
//                                                                                               //
6
// Magic Cube is free software: you can redistribute it and/or modify                            //
7
// it under the terms of the GNU General Public License as published by                          //
8
// the Free Software Foundation, either version 2 of the License, or                             //
9
// (at your option) any later version.                                                           //
10
//                                                                                               //
11
// Magic Cube is distributed in the hope that it will be useful,                                 //
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of                                //
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                 //
14
// GNU General Public License for more details.                                                  //
15
//                                                                                               //
16
// You should have received a copy of the GNU General Public License                             //
17
// along with Magic Cube.  If not, see <http://www.gnu.org/licenses/>.                           //
18
///////////////////////////////////////////////////////////////////////////////////////////////////
19
20
package org.distorted.control;
21
22 45ab4482 Leszek Koltunski
import android.graphics.Bitmap;
23
import android.graphics.BitmapFactory;
24
25 b7e5a0ac Leszek Koltunski
import org.distorted.library.effect.MatrixEffectMove;
26 51f51f83 Leszek Koltunski
import org.distorted.library.effect.MatrixEffectScale;
27
import org.distorted.library.main.DistortedEffects;
28
import org.distorted.library.main.DistortedNode;
29 f7f24f23 Leszek Koltunski
import org.distorted.library.main.DistortedScreen;
30 51f51f83 Leszek Koltunski
import org.distorted.library.main.DistortedTexture;
31
import org.distorted.library.mesh.MeshQuad;
32
import org.distorted.library.type.Dynamic;
33
import org.distorted.library.type.Dynamic3D;
34
import org.distorted.library.type.Static3D;
35 45ab4482 Leszek Koltunski
import org.distorted.main.R;
36
import org.distorted.main.RubikActivity;
37 8ba7aeb1 Leszek Koltunski
import org.distorted.main.RubikSurfaceView;
38 45ab4482 Leszek Koltunski
39
import java.io.IOException;
40
import java.io.InputStream;
41 51f51f83 Leszek Koltunski
42
///////////////////////////////////////////////////////////////////////////////////////////////////
43
44 1e256a15 Leszek Koltunski
class RubikControlWhole
45 51f51f83 Leszek Koltunski
  {
46 f7f24f23 Leszek Koltunski
  private static final int NUM_NODE = 4;
47
  private static final int NUM_EFFE = 4;
48 51f51f83 Leszek Koltunski
49 6968a6ef Leszek Koltunski
  private static final int D1 = 2600; // time it takes for the finger to appear
50
  private static final int D2 =  250; // finger press
51
  private static final int D3 =10000; // finger triangle
52
  private static final int D4 = 3000; // fingers approach
53 b9d4aa3b Leszek Koltunski
  private static final int D5 = 8000; // fingers circle
54 6968a6ef Leszek Koltunski
55
  private static final int[] DUR = { D1, D2, D3, D2, D1/4, 3*D1/4, D1/4, D2, D4, D5, D4, D2, D1 };
56 33c22e6c Leszek Koltunski
  private static final int[] DYN = { 2, 1, 1, 1, 2, 2, 4, 2, 2, 2, 2, 2, 4};
57 6968a6ef Leszek Koltunski
58 314bffaf Leszek Koltunski
  private float X0, X1, X2, Y1, D, s001, s014, s033, F;
59 8ba7aeb1 Leszek Koltunski
  private int mWidth, mHeight;
60 314bffaf Leszek Koltunski
61 51f51f83 Leszek Koltunski
  private final RubikControl mControl;
62
  private DistortedEffects[] mEffects;
63
  private DistortedNode[] mNodes;
64
  private long mEffectID;
65 1e256a15 Leszek Koltunski
  private int mCurrentStage;
66 ac2ee4b3 Leszek Koltunski
67 8badfe2a Leszek Koltunski
  private MeshQuad mQuad;
68 6968a6ef Leszek Koltunski
  private DistortedTexture mTextureShad, mTextureCirc;
69 ac2ee4b3 Leszek Koltunski
  private Dynamic3D mDynMoveHand1, mDynMoveShad1;
70
  private Dynamic3D mDynScaleHand1, mDynScaleShad1;
71 6968a6ef Leszek Koltunski
  private Dynamic3D mDynMoveHand2, mDynMoveShad2;
72
  private Dynamic3D mDynScaleHand2, mDynScaleShad2;
73 1e256a15 Leszek Koltunski
  private Dynamic3D mDyn1, mDyn2, mDyn3, mDyn4;
74
  private Static3D mPosition1, mPosition2, mPosition3, mPosition4;
75
  private float[] tmpBuffer;
76 314bffaf Leszek Koltunski
  private long mLastTime, mDiffTime;
77
78
///////////////////////////////////////////////////////////////////////////////////////////////////
79
80
   private void setPostFrame(boolean on)
81
     {
82
     RubikActivity act = mControl.getActivity();
83
     act.setControlState(on);
84
     mLastTime = -1;
85
     }
86
87 45ab4482 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
88
89
   private Bitmap openBitmap(RubikActivity act, int resource)
90
     {
91 8badfe2a Leszek Koltunski
     try( InputStream is = act.getResources().openRawResource(resource) )
92 45ab4482 Leszek Koltunski
       {
93
       return BitmapFactory.decodeStream(is);
94
       }
95 8badfe2a Leszek Koltunski
     catch( IOException e )
96 45ab4482 Leszek Koltunski
       {
97
       // ignore
98
       }
99
100
     return null;
101
     }
102
103 ac2ee4b3 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
104
105 6968a6ef Leszek Koltunski
  private void resetDynamics1(int stage)
106
    {
107
    int dur = DUR[stage-1];
108
109
    mDynMoveHand1.removeAll();
110
    mDynMoveShad1.removeAll();
111
    mDynScaleHand1.removeAll();
112
    mDynScaleShad1.removeAll();
113
114
    mDynMoveHand1.setDuration(dur);
115
    mDynMoveShad1.setDuration(dur);
116
    mDynScaleHand1.setDuration(dur);
117
    mDynScaleShad1.setDuration(dur);
118
    mDynMoveHand1.resetToBeginning();
119
    mDynMoveShad1.resetToBeginning();
120
    mDynScaleHand1.resetToBeginning();
121
    mDynScaleShad1.resetToBeginning();
122
123 314bffaf Leszek Koltunski
    mCurrentStage = stage;
124 6968a6ef Leszek Koltunski
    }
125
126
///////////////////////////////////////////////////////////////////////////////////////////////////
127
128
  private void resetDynamics2(int stage)
129
    {
130
    int dur = DUR[stage-1];
131
132
    mDynMoveHand2.removeAll();
133
    mDynMoveShad2.removeAll();
134
    mDynScaleHand2.removeAll();
135
    mDynScaleShad2.removeAll();
136
137
    mDynMoveHand2.setDuration(dur);
138
    mDynMoveShad2.setDuration(dur);
139
    mDynScaleHand2.setDuration(dur);
140
    mDynScaleShad2.setDuration(dur);
141
    mDynMoveHand2.resetToBeginning();
142
    mDynMoveShad2.resetToBeginning();
143
    mDynScaleHand2.resetToBeginning();
144
    mDynScaleShad2.resetToBeginning();
145
    }
146
147 314bffaf Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
148
149
  private void resetDynamics3(int stage)
150
    {
151
    int dur = DUR[stage-1];
152
153
    mDyn1.removeAll();
154
    mDyn2.removeAll();
155
    mDyn1.setDuration(dur);
156
    mDyn2.setDuration(dur);
157
    mDyn1.resetToBeginning();
158
    mDyn2.resetToBeginning();
159
    }
160
161 1e256a15 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
162
163
  private void resetDynamics4(int stage)
164
    {
165
    int dur = DUR[stage-1];
166
167
    mDyn3.removeAll();
168
    mDyn4.removeAll();
169
    mDyn3.setDuration(dur);
170
    mDyn4.setDuration(dur);
171
    mDyn3.resetToBeginning();
172
    mDyn4.resetToBeginning();
173
    }
174
175 6968a6ef Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
176
// first finger appears and approaches the screen
177
178
  private void setEffectsStage1()
179 ac2ee4b3 Leszek Koltunski
    {
180 6968a6ef Leszek Koltunski
    resetDynamics1(1);
181
    resetDynamics2(1);
182 1e256a15 Leszek Koltunski
    resetDynamics3(1);
183 6968a6ef Leszek Koltunski
184 314bffaf Leszek Koltunski
    Static3D point0h = new Static3D(-X0    ,-Y1    , 0);
185
    Static3D point1h = new Static3D(-X1    ,-Y1    , 0);
186
    Static3D point2h = new Static3D(-X2    ,-Y1    , 0);
187
    Static3D point3h = new Static3D(-X2  +D,-Y1  +D, 0);
188
    Static3D point0s = new Static3D(-X0+2*D,-Y1+2*D, 0);
189
    Static3D point1s = new Static3D(-X1+2*D,-Y1+2*D, 0);
190
    Static3D point2s = new Static3D(-X2+2*D,-Y1+2*D, 0);
191
    Static3D point3s = new Static3D(-X2  +D,-Y1  +D, 0);
192
193
    Static3D pointSc = new Static3D(s033,s033,s033);
194 ac2ee4b3 Leszek Koltunski
195 1e256a15 Leszek Koltunski
    mDyn1.add(point0h);
196
    mDyn1.add(point1h);
197
    mDyn1.add(point2h);
198
    mDyn1.add(point2h);
199
    mDyn1.add(point3h);
200
    mDyn2.add(point0s);
201
    mDyn2.add(point1s);
202
    mDyn2.add(point2s);
203
    mDyn2.add(point2s);
204
    mDyn2.add(point3s);
205
206
    mPosition1.set(point0h);
207
    mPosition2.set(point0s);
208
209
    mDynMoveHand1.add(mPosition1);
210
    mDynMoveShad1.add(mPosition2);
211
212 ac2ee4b3 Leszek Koltunski
    mDynScaleHand1.add(pointSc);
213
    mDynScaleShad1.add(pointSc);
214
215 1e256a15 Leszek Koltunski
    setPostFrame(true);
216 ac2ee4b3 Leszek Koltunski
    }
217
218
///////////////////////////////////////////////////////////////////////////////////////////////////
219 6968a6ef Leszek Koltunski
// first finger touches the screen
220 ac2ee4b3 Leszek Koltunski
221 6968a6ef Leszek Koltunski
  private void setEffectsStage2()
222 ac2ee4b3 Leszek Koltunski
    {
223 6968a6ef Leszek Koltunski
    resetDynamics1(2);
224 1e256a15 Leszek Koltunski
    resetDynamics3(2);
225 6968a6ef Leszek Koltunski
226 314bffaf Leszek Koltunski
    Static3D point3h = new Static3D(-X2  +D,-Y1  +D, 0);
227
    Static3D scaleS  = new Static3D(s001,s001,s001);
228
    Static3D scaleF  = new Static3D(s014,s014,s014);
229
    Static3D pointH  = new Static3D(s033,s033,s033);
230 ac2ee4b3 Leszek Koltunski
231 1e256a15 Leszek Koltunski
    mPosition1.set(scaleS);
232
    mDyn1.add(scaleS);
233
    mDyn1.add(scaleF);
234
235 ac2ee4b3 Leszek Koltunski
    mDynMoveHand1.add(point3h);
236
    mDynMoveShad1.add(point3h);
237 6968a6ef Leszek Koltunski
    mDynScaleHand1.add(pointH);
238 1e256a15 Leszek Koltunski
    mDynScaleShad1.add(mPosition1);
239 ac2ee4b3 Leszek Koltunski
240 6968a6ef Leszek Koltunski
    mNodes[0].changeInputSurface(mTextureCirc);
241 ac2ee4b3 Leszek Koltunski
    }
242
243
///////////////////////////////////////////////////////////////////////////////////////////////////
244 6968a6ef Leszek Koltunski
// first finger moves across the screen in a triangular fashion
245 ac2ee4b3 Leszek Koltunski
246 6968a6ef Leszek Koltunski
  private void setEffectsStage3()
247 ac2ee4b3 Leszek Koltunski
    {
248 6968a6ef Leszek Koltunski
    resetDynamics1(3);
249 314bffaf Leszek Koltunski
    resetDynamics3(3);
250 6968a6ef Leszek Koltunski
251 314bffaf Leszek Koltunski
    Static3D scaleS = new Static3D(s014,s014,s014);
252
    Static3D pointH = new Static3D(s033,s033,s033);
253
    Static3D point1 = new Static3D(-X2  +D,-Y1  +D, 0);
254
    Static3D point2 = new Static3D(     +D,-Y1  +D, 0);
255
    Static3D point3 = new Static3D(+X2  +D,-Y1  +D, 0);
256
    Static3D point4 = new Static3D(+X2  +D,     +D, 0);
257
    Static3D point5 = new Static3D(+X2  +D,+Y1  +D, 0);
258
    Static3D point6 = new Static3D(     +D,     +D, 0);
259 6968a6ef Leszek Koltunski
260
    mDynScaleHand1.add(pointH);
261
    mDynScaleShad1.add(scaleS);
262
263 314bffaf Leszek Koltunski
    mDyn1.add(point1);
264
    mDyn1.add(point1);
265
    mDyn1.add(point2);
266
    mDyn1.add(point3);
267
    mDyn1.add(point3);
268
    mDyn1.add(point4);
269
    mDyn1.add(point5);
270
    mDyn1.add(point5);
271
    mDyn1.add(point6);
272
    mDyn1.add(point1);
273
    mDyn1.add(point1);
274 6968a6ef Leszek Koltunski
275 314bffaf Leszek Koltunski
    mPosition1.set(point1);
276 6968a6ef Leszek Koltunski
277 314bffaf Leszek Koltunski
    mDynMoveHand1.add(mPosition1);
278
    mDynMoveShad1.add(mPosition1);
279 8ba7aeb1 Leszek Koltunski
280
    RubikSurfaceView view = mControl.getSurfaceView();
281
    float x = point1.get0() + mWidth*0.5f;
282
    float y = mHeight*0.5f - point1.get1();
283
    view.prepareDown();
284
    view.actionDown(x,y);
285 ac2ee4b3 Leszek Koltunski
    }
286
287 6968a6ef Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
288
// first finger un-touches the screen
289
290
  private void setEffectsStage4()
291
    {
292
    resetDynamics1(4);
293 1e256a15 Leszek Koltunski
    resetDynamics3(4);
294 6968a6ef Leszek Koltunski
295 314bffaf Leszek Koltunski
    Static3D point3h = new Static3D(-X2+D,-Y1+D, 0);
296
    Static3D scaleS  = new Static3D(s014,s014,s014);
297
    Static3D scaleF  = new Static3D(s001,s001,s001);
298
    Static3D pointH  = new Static3D(s033,s033,s033);
299 6968a6ef Leszek Koltunski
300 1e256a15 Leszek Koltunski
    mDyn1.add(scaleS);
301
    mDyn1.add(scaleF);
302
    mPosition1.set(scaleS);
303
304 6968a6ef Leszek Koltunski
    mDynMoveHand1.add(point3h);
305
    mDynMoveShad1.add(point3h);
306
    mDynScaleHand1.add(pointH);
307 1e256a15 Leszek Koltunski
    mDynScaleShad1.add(mPosition1);
308 6968a6ef Leszek Koltunski
    }
309
310
///////////////////////////////////////////////////////////////////////////////////////////////////
311
// first finger un-touches the screen (part2)
312
313
  private void setEffectsStage5()
314
    {
315
    resetDynamics1(5);
316 1e256a15 Leszek Koltunski
    resetDynamics3(5);
317 6968a6ef Leszek Koltunski
318 314bffaf Leszek Koltunski
    Static3D pointH = new Static3D(-X2    ,-Y1    , 0);
319
    Static3D point0 = new Static3D(-X2  +D,-Y1  +D, 0);
320
    Static3D pointS = new Static3D(-X2+2*D,-Y1+2*D, 0);
321
    Static3D pointSc = new Static3D(s033,s033,s033);
322 6968a6ef Leszek Koltunski
323 1e256a15 Leszek Koltunski
    mPosition1.set(point0);
324
    mPosition2.set(point0);
325
326
    mDyn1.add(point0);
327
    mDyn1.add(pointH);
328
    mDyn2.add(point0);
329
    mDyn2.add(pointS);
330
331 6968a6ef Leszek Koltunski
    mDynScaleHand1.add(pointSc);
332
    mDynScaleShad1.add(pointSc);
333 1e256a15 Leszek Koltunski
    mDynMoveHand1.add(mPosition1);
334
    mDynMoveShad1.add(mPosition2);
335 6968a6ef Leszek Koltunski
336
    mNodes[0].changeInputSurface(mTextureShad);
337
    }
338
339
///////////////////////////////////////////////////////////////////////////////////////////////////
340
// second finger appears
341
342
  private void setEffectsStage6()
343
    {
344
    resetDynamics1(6);
345
    resetDynamics2(6);
346 1e256a15 Leszek Koltunski
    resetDynamics3(6);
347 6968a6ef Leszek Koltunski
348 314bffaf Leszek Koltunski
    Static3D pointH = new Static3D(-X2    ,-Y1    , 0);
349
    Static3D pointS = new Static3D(-X2+2*D,-Y1+2*D, 0);
350
    Static3D pointSc= new Static3D(s033,s033,s033);
351 6968a6ef Leszek Koltunski
352
    mDynScaleHand1.add(pointSc);
353
    mDynScaleShad1.add(pointSc);
354
    mDynMoveHand1.add(pointH);
355
    mDynMoveShad1.add(pointS);
356
357 314bffaf Leszek Koltunski
    Static3D point0h = new Static3D( X0    , Y1    , 0);
358
    Static3D point1h = new Static3D( X1    , Y1    , 0);
359
    Static3D point2h = new Static3D( X2    , Y1    , 0);
360
    Static3D point0s = new Static3D( X0+2*D, Y1+2*D, 0);
361
    Static3D point1s = new Static3D( X1+2*D, Y1+2*D, 0);
362
    Static3D point2s = new Static3D( X2+2*D, Y1+2*D, 0);
363 1e256a15 Leszek Koltunski
    Static3D pointSm = new Static3D(-s033,s033,s033);
364
365
    mPosition1.set(point0h);
366
    mPosition2.set(point0s);
367
368
    mDyn1.add(point0h);
369
    mDyn1.add(point1h);
370
    mDyn1.add(point2h);
371
    mDyn1.add(point2h);
372
    mDyn2.add(point0s);
373
    mDyn2.add(point1s);
374
    mDyn2.add(point2s);
375
    mDyn2.add(point2s);
376 6968a6ef Leszek Koltunski
377
    mDynScaleHand2.add(pointSm);
378
    mDynScaleShad2.add(pointSm);
379 1e256a15 Leszek Koltunski
    mDynMoveHand2.add(mPosition1);
380
    mDynMoveShad2.add(mPosition2);
381 6968a6ef Leszek Koltunski
    }
382
383
///////////////////////////////////////////////////////////////////////////////////////////////////
384
// both fingers touch the screen (part1)
385
386
  private void setEffectsStage7()
387
    {
388
    resetDynamics1(7);
389
    resetDynamics2(7);
390 1e256a15 Leszek Koltunski
    resetDynamics3(7);
391
    resetDynamics4(7);
392
393
    Static3D point1Sc= new Static3D( s033,s033,s033);
394
    Static3D point2Sc= new Static3D(-s033,s033,s033);
395
    mDynScaleHand1.add(point1Sc);
396
    mDynScaleShad1.add(point1Sc);
397
    mDynScaleHand2.add(point2Sc);
398
    mDynScaleShad2.add(point2Sc);
399 6968a6ef Leszek Koltunski
400 314bffaf Leszek Koltunski
    Static3D point1H = new Static3D(-X2    ,-Y1    , 0);
401
    Static3D point1F = new Static3D(-X2  +D,-Y1  +D, 0);
402
    Static3D point1S = new Static3D(-X2+2*D,-Y1+2*D, 0);
403 6968a6ef Leszek Koltunski
404 1e256a15 Leszek Koltunski
    mDyn1.add(point1H);
405
    mDyn1.add(point1F);
406
    mDyn2.add(point1S);
407
    mDyn2.add(point1F);
408
409
    mPosition1.set(point1H);
410
    mPosition2.set(point1S);
411
    mDynMoveHand1.add(mPosition1);
412
    mDynMoveShad1.add(mPosition2);
413 6968a6ef Leszek Koltunski
414 314bffaf Leszek Koltunski
    Static3D point2H = new Static3D( X2    , Y1    , 0);
415
    Static3D point2F = new Static3D( X2  +D, Y1  +D, 0);
416
    Static3D point2S = new Static3D( X2+2*D, Y1+2*D, 0);
417 6968a6ef Leszek Koltunski
418 1e256a15 Leszek Koltunski
    mDyn3.add(point2H);
419
    mDyn3.add(point2F);
420
    mDyn4.add(point2S);
421
    mDyn4.add(point2F);
422 6968a6ef Leszek Koltunski
423 1e256a15 Leszek Koltunski
    mPosition3.set(point2H);
424
    mPosition4.set(point2S);
425
    mDynMoveHand2.add(mPosition3);
426
    mDynMoveShad2.add(mPosition4);
427 6968a6ef Leszek Koltunski
    }
428
429
///////////////////////////////////////////////////////////////////////////////////////////////////
430
// both fingers touch the screen (part2)
431
432
  private void setEffectsStage8()
433
    {
434
    resetDynamics1(8);
435
    resetDynamics2(8);
436 1e256a15 Leszek Koltunski
    resetDynamics3(8);
437 6968a6ef Leszek Koltunski
438 314bffaf Leszek Koltunski
    Static3D point1h= new Static3D(-X2  +D,-Y1  +D, 0);
439
    Static3D point2h= new Static3D( X2  +D, Y1  +D, 0);
440
    Static3D scale1S = new Static3D( s001,s001,s001);
441
    Static3D scale1F = new Static3D( s014,s014,s014);
442
    Static3D point1H = new Static3D( s033,s033,s033);
443
    Static3D scale2S = new Static3D(-s001,s001,s001);
444
    Static3D scale2F = new Static3D(-s014,s014,s014);
445
    Static3D point2H = new Static3D(-s033,s033,s033);
446 6968a6ef Leszek Koltunski
447 1e256a15 Leszek Koltunski
    mPosition1.set(scale1S);
448
    mDyn1.add(scale1S);
449
    mDyn1.add(scale1F);
450
451 6968a6ef Leszek Koltunski
    mDynMoveHand1.add(point1h);
452
    mDynMoveShad1.add(point1h);
453
    mDynScaleHand1.add(point1H);
454 1e256a15 Leszek Koltunski
    mDynScaleShad1.add(mPosition1);
455
456
    mPosition2.set(scale2S);
457
    mDyn2.add(scale2S);
458
    mDyn2.add(scale2F);
459 6968a6ef Leszek Koltunski
460
    mDynMoveHand2.add(point2h);
461
    mDynMoveShad2.add(point2h);
462
    mDynScaleHand2.add(point2H);
463 1e256a15 Leszek Koltunski
    mDynScaleShad2.add(mPosition2);
464 6968a6ef Leszek Koltunski
465
    mNodes[0].changeInputSurface(mTextureCirc);
466
    mNodes[1].changeInputSurface(mTextureCirc);
467
    }
468
469
///////////////////////////////////////////////////////////////////////////////////////////////////
470
// both fingers approach each other
471
472
  private void setEffectsStage9()
473
    {
474
    resetDynamics1(9);
475
    resetDynamics2(9);
476 314bffaf Leszek Koltunski
    resetDynamics3(9);
477 6968a6ef Leszek Koltunski
478 967b79dc Leszek Koltunski
    Static3D point1s = new Static3D(-X2+D,-Y1+D, 0);
479
    Static3D point2s = new Static3D( X2+D, Y1+D, 0);
480
    Static3D point1f = new Static3D(-Y1*F,-Y1*F, 0);
481
    Static3D point2f = new Static3D( Y1*F, Y1*F, 0);
482 314bffaf Leszek Koltunski
    Static3D scale1F = new Static3D( s014,s014,s014);
483
    Static3D point1H = new Static3D( s033,s033,s033);
484
    Static3D scale2F = new Static3D(-s014,s014,s014);
485
    Static3D point2H = new Static3D(-s033,s033,s033);
486 6968a6ef Leszek Koltunski
487
    mDynScaleHand1.add(point1H);
488
    mDynScaleShad1.add(scale1F);
489
    mDynScaleHand2.add(point2H);
490
    mDynScaleShad2.add(scale2F);
491
492 314bffaf Leszek Koltunski
    mDyn1.add(point1s);
493
    mDyn1.add(point1f);
494
    mDyn2.add(point2s);
495
    mDyn2.add(point2f);
496
497
    mPosition1.set(point1s);
498
    mPosition2.set(point2s);
499
500
    mDynMoveHand1.add(mPosition1);
501
    mDynMoveShad1.add(mPosition1);
502
    mDynMoveHand2.add(mPosition2);
503
    mDynMoveShad2.add(mPosition2);
504 a034956d Leszek Koltunski
505
    float x1 = point1s.get0() + mWidth*0.5f;
506
    float y1 = mHeight*0.5f - point1s.get1();
507
    float x2 = point2s.get0() + mWidth*0.5f;
508
    float y2 = mHeight*0.5f - point2s.get1();
509
510
    RubikSurfaceView view = mControl.getSurfaceView();
511
    view.prepareDown();
512
    view.prepareDown2();
513
    view.actionDown(x1,y1);
514
    view.actionDown2(x1,y1,x2,y2);
515 6968a6ef Leszek Koltunski
    }
516
517
///////////////////////////////////////////////////////////////////////////////////////////////////
518
// both fingers go around
519
520
  private void setEffectsStage10()
521
    {
522
    resetDynamics1(10);
523
    resetDynamics2(10);
524 1e256a15 Leszek Koltunski
    resetDynamics3(10);
525 6968a6ef Leszek Koltunski
526 314bffaf Leszek Koltunski
    Static3D scale1F = new Static3D( s014,s014,s014);
527
    Static3D point1H = new Static3D( s033,s033,s033);
528
    Static3D scale2F = new Static3D(-s014,s014,s014);
529
    Static3D point2H = new Static3D(-s033,s033,s033);
530 6968a6ef Leszek Koltunski
531 967b79dc Leszek Koltunski
    Static3D point0= new Static3D(-Y1*F,-Y1*F, 0);
532
    Static3D point1= new Static3D(-Y1*F, Y1*F, 0);
533
    Static3D point2= new Static3D( Y1*F, Y1*F, 0);
534
    Static3D point3= new Static3D( Y1*F,-Y1*F, 0);
535 6968a6ef Leszek Koltunski
536
    mDynScaleHand1.add(point1H);
537
    mDynScaleShad1.add(scale1F);
538
    mDynScaleHand2.add(point2H);
539
    mDynScaleShad2.add(scale2F);
540
541 1e256a15 Leszek Koltunski
    mDyn1.add(point0);
542
    mDyn1.add(point1);
543
    mDyn1.add(point2);
544
    mDyn1.add(point3);
545
    mDyn1.add(point0);
546 834b2618 Leszek Koltunski
547 1e256a15 Leszek Koltunski
    mDyn2.add(point2);
548
    mDyn2.add(point3);
549
    mDyn2.add(point0);
550
    mDyn2.add(point1);
551
    mDyn2.add(point2);
552
553
    mDyn1.setConvexity(1.0f);
554
    mDyn2.setConvexity(1.0f);
555
556 834b2618 Leszek Koltunski
    mDyn1.setSpeedMode(Dynamic.SPEED_MODE_SEGMENT_CONSTANT);
557
    mDyn2.setSpeedMode(Dynamic.SPEED_MODE_SEGMENT_CONSTANT);
558
559 1e256a15 Leszek Koltunski
    mPosition1.set(point0);
560
    mPosition2.set(point2);
561
562
    mDynMoveHand1.add(mPosition1);
563
    mDynMoveShad1.add(mPosition1);
564
    mDynMoveHand2.add(mPosition2);
565
    mDynMoveShad2.add(mPosition2);
566 6968a6ef Leszek Koltunski
    }
567
568
///////////////////////////////////////////////////////////////////////////////////////////////////
569
// both fingers move away from each other
570
571
  private void setEffectsStage11()
572
    {
573
    resetDynamics1(11);
574
    resetDynamics2(11);
575 1e256a15 Leszek Koltunski
    resetDynamics3(11);
576 6968a6ef Leszek Koltunski
577 967b79dc Leszek Koltunski
    Static3D point1s= new Static3D(-X2+D,-Y1+D, 0);
578
    Static3D point2s= new Static3D( X2+D, Y1+D, 0);
579
    Static3D point1f= new Static3D(-Y1*F,-Y1*F, 0);
580
    Static3D point2f= new Static3D( Y1*F, Y1*F, 0);
581 314bffaf Leszek Koltunski
    Static3D scale1F= new Static3D( s014,s014,s014);
582
    Static3D point1H= new Static3D( s033,s033,s033);
583
    Static3D scale2F= new Static3D(-s014,s014,s014);
584
    Static3D point2H= new Static3D(-s033,s033,s033);
585 6968a6ef Leszek Koltunski
586
    mDynScaleHand1.add(point1H);
587
    mDynScaleShad1.add(scale1F);
588
    mDynScaleHand2.add(point2H);
589
    mDynScaleShad2.add(scale2F);
590
591 1e256a15 Leszek Koltunski
    mDyn1.add(point1f);
592
    mDyn1.add(point1s);
593
    mDyn2.add(point2f);
594
    mDyn2.add(point2s);
595
596
    mDyn1.setConvexity(0.0f);
597
    mDyn2.setConvexity(0.0f);
598
599 834b2618 Leszek Koltunski
    mDyn1.setSpeedMode(Dynamic.SPEED_MODE_SMOOTH);
600
    mDyn2.setSpeedMode(Dynamic.SPEED_MODE_SMOOTH);
601
602 1e256a15 Leszek Koltunski
    mPosition1.set(point1f);
603
    mPosition2.set(point2f);
604
605
    mDynMoveHand1.add(mPosition1);
606
    mDynMoveShad1.add(mPosition1);
607
    mDynMoveHand2.add(mPosition2);
608
    mDynMoveShad2.add(mPosition2);
609 6968a6ef Leszek Koltunski
    }
610
611
///////////////////////////////////////////////////////////////////////////////////////////////////
612
// both fingers un-touch the screen (part1)
613
614
  private void setEffectsStage12()
615
    {
616
    resetDynamics1(12);
617
    resetDynamics2(12);
618 1e256a15 Leszek Koltunski
    resetDynamics3(12);
619 6968a6ef Leszek Koltunski
620 314bffaf Leszek Koltunski
    Static3D point1h = new Static3D(-X2+D,-Y1+D, 0);
621
    Static3D point2h = new Static3D( X2+D, Y1+D, 0);
622
    Static3D scale1S = new Static3D( s014,s014,s014);
623
    Static3D scale1F = new Static3D( s001,s001,s001);
624
    Static3D point1H = new Static3D( s033,s033,s033);
625
    Static3D scale2S = new Static3D(-s014,s014,s014);
626
    Static3D scale2F = new Static3D(-s001,s001,s001);
627
    Static3D point2H = new Static3D(-s033,s033,s033);
628 6968a6ef Leszek Koltunski
629 1e256a15 Leszek Koltunski
    mPosition1.set(scale1S);
630
    mPosition2.set(scale2S);
631
632
    mDyn1.add(scale1S);
633
    mDyn1.add(scale1F);
634
    mDyn2.add(scale2S);
635
    mDyn2.add(scale2F);
636
637 6968a6ef Leszek Koltunski
    mDynMoveHand1.add(point1h);
638
    mDynMoveShad1.add(point1h);
639
    mDynScaleHand1.add(point1H);
640 1e256a15 Leszek Koltunski
    mDynScaleShad1.add(mPosition1);
641 6968a6ef Leszek Koltunski
642
    mDynMoveHand2.add(point2h);
643
    mDynMoveShad2.add(point2h);
644
    mDynScaleHand2.add(point2H);
645 1e256a15 Leszek Koltunski
    mDynScaleShad2.add(mPosition2);
646 6968a6ef Leszek Koltunski
    }
647
648
///////////////////////////////////////////////////////////////////////////////////////////////////
649
// both fingers un-touch the screen (part2)
650
651
  private void setEffectsStage13()
652
    {
653
    resetDynamics1(13);
654
    resetDynamics2(13);
655 1e256a15 Leszek Koltunski
    resetDynamics3(13);
656
    resetDynamics4(13);
657 6968a6ef Leszek Koltunski
658 314bffaf Leszek Koltunski
    Static3D point1_0 = new Static3D(-X2  +D,-Y1  +D, 0);
659
    Static3D point11H = new Static3D(-X2    ,-Y1    , 0);
660
    Static3D point12H = new Static3D(-X1    ,-Y1    , 0);
661
    Static3D point13H = new Static3D(-X0    ,-Y1    , 0);
662
    Static3D point11S = new Static3D(-X2+2*D,-Y1+2*D, 0);
663
    Static3D point12S = new Static3D(-X1+2*D,-Y1+2*D, 0);
664
    Static3D point13S = new Static3D(-X0+2*D,-Y1+2*D, 0);
665
    Static3D point1Sc = new Static3D( s033,s033,s033);
666 6968a6ef Leszek Koltunski
667 1e256a15 Leszek Koltunski
    mPosition1.set(point1_0);
668
    mDynMoveHand1.add(mPosition1);
669
    mPosition2.set(point1_0);
670
    mDynMoveShad1.add(mPosition2);
671
672 6968a6ef Leszek Koltunski
    mDynScaleHand1.add(point1Sc);
673
    mDynScaleShad1.add(point1Sc);
674 1e256a15 Leszek Koltunski
675
    mDyn1.add(point1_0);
676
    mDyn1.add(point11H);
677
    mDyn1.add(point11H);
678
    mDyn1.add(point12H);
679
    mDyn1.add(point13H);
680
681
    mDyn2.add(point1_0);
682
    mDyn2.add(point11S);
683
    mDyn2.add(point11S);
684
    mDyn2.add(point12S);
685
    mDyn2.add(point13S);
686 6968a6ef Leszek Koltunski
687 314bffaf Leszek Koltunski
    Static3D point2_0 = new Static3D( X2  +D, Y1  +D, 0);
688
    Static3D point21H = new Static3D( X2    , Y1    , 0);
689
    Static3D point22H = new Static3D( X1    , Y1    , 0);
690
    Static3D point23H = new Static3D( X0    , Y1    , 0);
691
    Static3D point21S = new Static3D( X2+2*D, Y1+2*D, 0);
692
    Static3D point22S = new Static3D( X1+2*D, Y1+2*D, 0);
693
    Static3D point23S = new Static3D( X0+2*D, Y1+2*D, 0);
694
    Static3D point2Sc= new Static3D(-s033,s033,s033);
695 6968a6ef Leszek Koltunski
696 1e256a15 Leszek Koltunski
    mPosition3.set(point2_0);
697
    mDynMoveHand2.add(mPosition3);
698
    mPosition4.set(point2_0);
699
    mDynMoveShad2.add(mPosition4);
700
701 6968a6ef Leszek Koltunski
    mDynScaleHand2.add(point2Sc);
702
    mDynScaleShad2.add(point2Sc);
703 1e256a15 Leszek Koltunski
704
    mDyn3.add(point2_0);
705
    mDyn3.add(point21H);
706
    mDyn3.add(point21H);
707
    mDyn3.add(point22H);
708
    mDyn3.add(point23H);
709
710
    mDyn4.add(point2_0);
711
    mDyn4.add(point21S);
712
    mDyn4.add(point21S);
713
    mDyn4.add(point22S);
714
    mDyn4.add(point23S);
715 6968a6ef Leszek Koltunski
716
    mNodes[0].changeInputSurface(mTextureShad);
717
    mNodes[1].changeInputSurface(mTextureShad);
718
    }
719
720 51f51f83 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
721
722
  private void createEffects()
723
    {
724 6968a6ef Leszek Koltunski
    mEffects = new DistortedEffects[NUM_EFFE];
725
    for(int i=0; i<NUM_EFFE; i++) mEffects[i]= new DistortedEffects();
726
727
    int time = DUR[0];
728
729 314bffaf Leszek Koltunski
    mDyn1 = new Dynamic3D(time,0.5f);
730
    mDyn1.setMode(Dynamic.MODE_PATH);
731
    mDyn1.setConvexity(0.0f);
732
    mDyn2 = new Dynamic3D(time,0.5f);
733
    mDyn2.setMode(Dynamic.MODE_PATH);
734
    mDyn2.setConvexity(0.0f);
735 1e256a15 Leszek Koltunski
    mDyn3 = new Dynamic3D(time,0.5f);
736
    mDyn3.setMode(Dynamic.MODE_PATH);
737
    mDyn3.setConvexity(0.0f);
738
    mDyn4 = new Dynamic3D(time,0.5f);
739
    mDyn4.setMode(Dynamic.MODE_PATH);
740
    mDyn4.setConvexity(0.0f);
741 314bffaf Leszek Koltunski
742
    mPosition1 = new Static3D(0,0,0);
743
    mPosition2 = new Static3D(0,0,0);
744 1e256a15 Leszek Koltunski
    mPosition3 = new Static3D(0,0,0);
745
    mPosition4 = new Static3D(0,0,0);
746 314bffaf Leszek Koltunski
747 1e256a15 Leszek Koltunski
    tmpBuffer = new float[12];
748 314bffaf Leszek Koltunski
749 6968a6ef Leszek Koltunski
    mDynMoveHand1 = new Dynamic3D(time,0.5f);
750
    mDynMoveHand1.setMode(Dynamic.MODE_PATH);
751
    mDynMoveHand1.setConvexity(0.0f);
752
    mDynMoveShad1 = new Dynamic3D(time,0.5f);
753
    mDynMoveShad1.setMode(Dynamic.MODE_PATH);
754
    mDynMoveShad1.setConvexity(0.0f);
755
    mDynScaleHand1 = new Dynamic3D(time,0.5f);
756
    mDynScaleHand1.setMode(Dynamic.MODE_PATH);
757
    mDynScaleHand1.setConvexity(0.0f);
758
    mDynScaleShad1 = new Dynamic3D(time,0.5f);
759
    mDynScaleShad1.setMode(Dynamic.MODE_PATH);
760
    mDynScaleShad1.setConvexity(0.0f);
761
762 9205f15e Leszek Koltunski
    MatrixEffectMove  moveHand1 = new MatrixEffectMove(mDynMoveHand1);
763
    MatrixEffectMove  moveShad1 = new MatrixEffectMove(mDynMoveShad1);
764
    MatrixEffectScale scaleHand1= new MatrixEffectScale(mDynScaleHand1);
765
    MatrixEffectScale scaleShad1= new MatrixEffectScale(mDynScaleShad1);
766 6968a6ef Leszek Koltunski
767 9205f15e Leszek Koltunski
    mEffects[0].apply(scaleShad1);
768
    mEffects[0].apply(moveShad1);
769
    mEffects[2].apply(scaleHand1);
770
    mEffects[2].apply(moveHand1);
771 6968a6ef Leszek Koltunski
772
    mDynMoveHand2 = new Dynamic3D(time,0.5f);
773
    mDynMoveHand2.setMode(Dynamic.MODE_PATH);
774
    mDynMoveHand2.setConvexity(0.0f);
775
    mDynMoveShad2 = new Dynamic3D(time,0.5f);
776
    mDynMoveShad2.setMode(Dynamic.MODE_PATH);
777
    mDynMoveShad2.setConvexity(0.0f);
778
    mDynScaleHand2 = new Dynamic3D(time,0.5f);
779
    mDynScaleHand2.setMode(Dynamic.MODE_PATH);
780
    mDynScaleHand2.setConvexity(0.0f);
781
    mDynScaleShad2 = new Dynamic3D(time,0.5f);
782
    mDynScaleShad2.setMode(Dynamic.MODE_PATH);
783
    mDynScaleShad2.setConvexity(0.0f);
784
785 9205f15e Leszek Koltunski
    MatrixEffectMove  moveHand2 = new MatrixEffectMove(mDynMoveHand2);
786
    MatrixEffectMove  moveShad2 = new MatrixEffectMove(mDynMoveShad2);
787
    MatrixEffectScale scaleHand2= new MatrixEffectScale(mDynScaleHand2);
788
    MatrixEffectScale scaleShad2= new MatrixEffectScale(mDynScaleShad2);
789 6968a6ef Leszek Koltunski
790 9205f15e Leszek Koltunski
    mEffects[1].apply(scaleShad2);
791
    mEffects[1].apply(moveShad2);
792
    mEffects[3].apply(scaleHand2);
793
    mEffects[3].apply(moveHand2);
794 6968a6ef Leszek Koltunski
795
    DistortedScreen screen = mControl.getScreen();
796 8ba7aeb1 Leszek Koltunski
    mWidth = screen.getWidth();
797
    mHeight= screen.getHeight();
798
799
    X0   = mWidth*0.65f;
800
    X1   = mWidth*0.50f;
801
    X2   = mWidth*0.35f;
802
    Y1   = mHeight*0.28f;
803
    D    = mWidth*0.01f;
804
    s001 = mWidth*0.0001f;
805
    s014 = mWidth*0.14f;
806
    s033 = mWidth*0.33f;
807 967b79dc Leszek Koltunski
    F    = 0.50f;
808 51f51f83 Leszek Koltunski
    }
809
810
///////////////////////////////////////////////////////////////////////////////////////////////////
811
812
  private void createNodes()
813
    {
814
    if( mNodes==null )
815
      {
816
      mNodes = new DistortedNode[NUM_NODE];
817 8badfe2a Leszek Koltunski
      mQuad  = new MeshQuad();
818
      }
819
820
    RubikActivity act = mControl.getActivity();
821
822
    if( act!=null )
823
      {
824
      Bitmap bmpCirc = openBitmap(act, R.drawable.ui_fading_circle);
825 ac2ee4b3 Leszek Koltunski
      Bitmap bmpShad = openBitmap(act, R.drawable.ui_hand_shadow);
826 8badfe2a Leszek Koltunski
      Bitmap bmpHand = openBitmap(act, R.drawable.ui_hand_pointer);
827 ac2ee4b3 Leszek Koltunski
828
      mTextureCirc = new DistortedTexture();
829
      mTextureShad = new DistortedTexture();
830 6968a6ef Leszek Koltunski
      DistortedTexture textureHand = new DistortedTexture();
831 b9d4aa3b Leszek Koltunski
832
      if( bmpCirc!=null ) mTextureCirc.setTexture(bmpCirc);
833
      if( bmpShad!=null ) mTextureShad.setTexture(bmpShad);
834
      if( bmpHand!=null ) textureHand.setTexture(bmpHand);
835 ac2ee4b3 Leszek Koltunski
836
      mNodes[0]= new DistortedNode(mTextureShad,mEffects[0],mQuad);
837
      mNodes[1]= new DistortedNode(mTextureShad,mEffects[1],mQuad);
838 6968a6ef Leszek Koltunski
      mNodes[2]= new DistortedNode( textureHand,mEffects[2],mQuad);
839
      mNodes[3]= new DistortedNode( textureHand,mEffects[3],mQuad);
840 8badfe2a Leszek Koltunski
      }
841
    else
842
      {
843
      android.util.Log.e("D", "Activity NULL!!");
844 51f51f83 Leszek Koltunski
      }
845
    }
846
847
///////////////////////////////////////////////////////////////////////////////////////////////////
848
849
  long getEffectID()
850
    {
851
    return mEffectID;
852
    }
853
854
///////////////////////////////////////////////////////////////////////////////////////////////////
855
856
  DistortedNode[] getNodes()
857
    {
858 6968a6ef Leszek Koltunski
    if( mEffects==null ) createEffects();
859 51f51f83 Leszek Koltunski
    createNodes();
860 6968a6ef Leszek Koltunski
    setEffectsStage1();
861 51f51f83 Leszek Koltunski
862
    return mNodes;
863
    }
864
865
///////////////////////////////////////////////////////////////////////////////////////////////////
866
867
  DistortedNode[] returnNodes()
868
    {
869
    return mNodes;
870
    }
871
872
///////////////////////////////////////////////////////////////////////////////////////////////////
873
874
  RubikControlWhole(RubikControl control)
875
    {
876
    mControl = control;
877
    }
878 ac2ee4b3 Leszek Koltunski
879 33c22e6c Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
880
881
  private void stageFinished(int stage)
882
    {
883
    switch(stage)
884
      {
885 9205f15e Leszek Koltunski
      case  1: setEffectsStage2() ; break;
886
      case  2: setEffectsStage3() ; break;
887
      case  3: setEffectsStage4() ; break;
888
      case  4: setEffectsStage5() ; break;
889
      case  5: setEffectsStage6() ; break;
890
      case  6: setEffectsStage7() ; break;
891
      case  7: setEffectsStage8() ; break;
892
      case  8: setEffectsStage9() ; break;
893 33c22e6c Leszek Koltunski
      case  9: setEffectsStage10(); break;
894
      case 10: setEffectsStage11(); break;
895
      case 11: setEffectsStage12(); break;
896
      case 12: setEffectsStage13(); break;
897
      default: setPostFrame(false);
898
               mEffectID = -1;
899
               mControl.effectFinished(mEffectID);
900
      }
901
    }
902
903 ac2ee4b3 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
904
// PUBLIC
905
906 314bffaf Leszek Koltunski
  public void postDrawFrame(long time)
907
    {
908
    if( mLastTime<0 ) mLastTime = time;
909
    else mDiffTime = time - mLastTime;
910
    mLastTime = time;
911
912 33c22e6c Leszek Koltunski
    switch(DYN[mCurrentStage-1])
913 314bffaf Leszek Koltunski
      {
914 33c22e6c Leszek Koltunski
      case 1: boolean finished1 = mDyn1.get( tmpBuffer,0, time, mDiffTime);
915
              mPosition1.set(tmpBuffer[0], tmpBuffer[1], tmpBuffer[2]);
916 8ba7aeb1 Leszek Koltunski
917
              if( mCurrentStage==3 )
918
                {
919
                RubikSurfaceView view = mControl.getSurfaceView();
920 a034956d Leszek Koltunski
                float x1 = tmpBuffer[0]+mWidth*0.5f;
921
                float y1 = mHeight*0.5f-tmpBuffer[1];
922
                view.actionMove(x1,y1,0,0);
923 8ba7aeb1 Leszek Koltunski
                }
924
925
              if( finished1 )
926
                {
927
                if( mCurrentStage==3 )
928
                  {
929
                  RubikSurfaceView view = mControl.getSurfaceView();
930
                  view.prepareUp();
931
                  view.actionUp();
932
                  }
933
934
                stageFinished(mCurrentStage);
935
                }
936 33c22e6c Leszek Koltunski
              break;
937
      case 2: boolean finished2_1 = mDyn1.get( tmpBuffer,0, time, mDiffTime);
938
              boolean finished2_2 = mDyn2.get( tmpBuffer,3, time, mDiffTime);
939
              mPosition1.set(tmpBuffer[0], tmpBuffer[1], tmpBuffer[2]);
940
              mPosition2.set(tmpBuffer[3], tmpBuffer[4], tmpBuffer[5]);
941 a034956d Leszek Koltunski
942
              if( mCurrentStage==9 || mCurrentStage==10 || mCurrentStage==11 )
943
                {
944
                RubikSurfaceView view = mControl.getSurfaceView();
945
                float x1 = tmpBuffer[0]+mWidth*0.5f;
946
                float y1 = mHeight*0.5f-tmpBuffer[1];
947
                float x2 = tmpBuffer[3]+mWidth*0.5f;
948
                float y2 = mHeight*0.5f-tmpBuffer[4];
949
                view.prepareMove(x1,y1,x2,y2);
950
                view.actionMove(x1,y1,x2,y2);
951
                }
952
953
              if( finished2_1 && finished2_2 )
954
                {
955
                 if( mCurrentStage==11 )
956
                  {
957
                  RubikSurfaceView view = mControl.getSurfaceView();
958
                  view.prepareUp();
959
                  view.actionUp2(true,0,0,false,0,0);
960
                  view.actionUp();
961
                  }
962
963
                stageFinished(mCurrentStage);
964
                }
965 33c22e6c Leszek Koltunski
              break;
966
      case 4: boolean finished4_1 = mDyn1.get( tmpBuffer,0, time, mDiffTime);
967
              boolean finished4_2 = mDyn2.get( tmpBuffer,3, time, mDiffTime);
968
              boolean finished4_3 = mDyn3.get( tmpBuffer,6, time, mDiffTime);
969
              boolean finished4_4 = mDyn4.get( tmpBuffer,9, time, mDiffTime);
970
              mPosition1.set(tmpBuffer[0], tmpBuffer[ 1], tmpBuffer[ 2]);
971
              mPosition2.set(tmpBuffer[3], tmpBuffer[ 4], tmpBuffer[ 5]);
972
              mPosition3.set(tmpBuffer[6], tmpBuffer[ 7], tmpBuffer[ 8]);
973
              mPosition4.set(tmpBuffer[9], tmpBuffer[10], tmpBuffer[11]);
974
              if( finished4_1 && finished4_2 && finished4_3 && finished4_4 ) stageFinished(mCurrentStage);
975
              break;
976 314bffaf Leszek Koltunski
      }
977
    }
978 51f51f83 Leszek Koltunski
  }