Project

General

Profile

« Previous | Next » 

Revision 1e256a15

Added by Leszek Koltunski over 3 years ago

RubikControl: progress.

View differences:

src/main/java/org/distorted/control/RubikControlWhole.java
29 29
import org.distorted.library.main.DistortedScreen;
30 30
import org.distorted.library.main.DistortedTexture;
31 31
import org.distorted.library.mesh.MeshQuad;
32
import org.distorted.library.message.EffectListener;
33 32
import org.distorted.library.type.Dynamic;
34 33
import org.distorted.library.type.Dynamic3D;
35 34
import org.distorted.library.type.Static3D;
......
41 40

  
42 41
///////////////////////////////////////////////////////////////////////////////////////////////////
43 42

  
44
class RubikControlWhole implements EffectListener
43
class RubikControlWhole
45 44
  {
46 45
  private static final int NUM_NODE = 4;
47 46
  private static final int NUM_EFFE = 4;
......
60 59
  private DistortedEffects[] mEffects;
61 60
  private DistortedNode[] mNodes;
62 61
  private long mEffectID;
63
  private int mCurrentStage, mWidth, mHeight;
62
  private int mCurrentStage;
64 63

  
65 64
  private MeshQuad mQuad;
66 65
  private DistortedTexture mTextureShad, mTextureCirc;
......
75 74
  private MatrixEffectMove mMoveHand2, mMoveShad2;
76 75
  private MatrixEffectScale mScaleHand2, mScaleShad2;
77 76

  
78
  private Dynamic3D mDyn1, mDyn2;
79
  private Static3D mPosition1, mPosition2;
80
  private float[] mHandPosition;
77
  private Dynamic3D mDyn1, mDyn2, mDyn3, mDyn4;
78
  private Static3D mPosition1, mPosition2, mPosition3, mPosition4;
79
  private float[] tmpBuffer;
81 80
  private long mLastTime, mDiffTime;
82 81

  
83 82
///////////////////////////////////////////////////////////////////////////////////////////////////
......
163 162
    mDyn2.resetToBeginning();
164 163
    }
165 164

  
165
///////////////////////////////////////////////////////////////////////////////////////////////////
166

  
167
  private void resetDynamics4(int stage)
168
    {
169
    int dur = DUR[stage-1];
170

  
171
    mDyn3.removeAll();
172
    mDyn4.removeAll();
173
    mDyn3.setDuration(dur);
174
    mDyn4.setDuration(dur);
175
    mDyn3.resetToBeginning();
176
    mDyn4.resetToBeginning();
177
    }
178

  
166 179
///////////////////////////////////////////////////////////////////////////////////////////////////
167 180
// first finger appears and approaches the screen
168 181

  
......
170 183
    {
171 184
    resetDynamics1(1);
172 185
    resetDynamics2(1);
186
    resetDynamics3(1);
173 187

  
174 188
    Static3D point0h = new Static3D(-X0    ,-Y1    , 0);
175 189
    Static3D point1h = new Static3D(-X1    ,-Y1    , 0);
......
182 196

  
183 197
    Static3D pointSc = new Static3D(s033,s033,s033);
184 198

  
185
    mDynMoveHand1.add(point0h);
186
    mDynMoveHand1.add(point1h);
187
    mDynMoveHand1.add(point2h);
188
    mDynMoveHand1.add(point2h);
189
    mDynMoveHand1.add(point3h);
190
    mDynMoveShad1.add(point0s);
191
    mDynMoveShad1.add(point1s);
192
    mDynMoveShad1.add(point2s);
193
    mDynMoveShad1.add(point2s);
194
    mDynMoveShad1.add(point3s);
199
    mDyn1.add(point0h);
200
    mDyn1.add(point1h);
201
    mDyn1.add(point2h);
202
    mDyn1.add(point2h);
203
    mDyn1.add(point3h);
204
    mDyn2.add(point0s);
205
    mDyn2.add(point1s);
206
    mDyn2.add(point2s);
207
    mDyn2.add(point2s);
208
    mDyn2.add(point3s);
209

  
210
    mPosition1.set(point0h);
211
    mPosition2.set(point0s);
212

  
213
    mDynMoveHand1.add(mPosition1);
214
    mDynMoveShad1.add(mPosition2);
215

  
195 216
    mDynScaleHand1.add(pointSc);
196 217
    mDynScaleShad1.add(pointSc);
197 218

  
198
    mMoveHand1.notifyWhenFinished(this);
219
    setPostFrame(true);
199 220
    }
200 221

  
201 222
///////////////////////////////////////////////////////////////////////////////////////////////////
......
204 225
  private void setEffectsStage2()
205 226
    {
206 227
    resetDynamics1(2);
228
    resetDynamics3(2);
207 229

  
208 230
    Static3D point3h = new Static3D(-X2  +D,-Y1  +D, 0);
209 231
    Static3D scaleS  = new Static3D(s001,s001,s001);
210 232
    Static3D scaleF  = new Static3D(s014,s014,s014);
211 233
    Static3D pointH  = new Static3D(s033,s033,s033);
212 234

  
235
    mPosition1.set(scaleS);
236
    mDyn1.add(scaleS);
237
    mDyn1.add(scaleF);
238

  
213 239
    mDynMoveHand1.add(point3h);
214 240
    mDynMoveShad1.add(point3h);
215 241
    mDynScaleHand1.add(pointH);
216
    mDynScaleShad1.add(scaleS);
217
    mDynScaleShad1.add(scaleF);
218

  
219
    mScaleShad1.notifyWhenFinished(this);
242
    mDynScaleShad1.add(mPosition1);
220 243

  
221 244
    mNodes[0].changeInputSurface(mTextureCirc);
245
    setPostFrame(true);
222 246
    }
223 247

  
224 248
///////////////////////////////////////////////////////////////////////////////////////////////////
......
267 291
  private void setEffectsStage4()
268 292
    {
269 293
    resetDynamics1(4);
294
    resetDynamics3(4);
270 295

  
271 296
    Static3D point3h = new Static3D(-X2+D,-Y1+D, 0);
272 297
    Static3D scaleS  = new Static3D(s014,s014,s014);
273 298
    Static3D scaleF  = new Static3D(s001,s001,s001);
274 299
    Static3D pointH  = new Static3D(s033,s033,s033);
275 300

  
301
    mDyn1.add(scaleS);
302
    mDyn1.add(scaleF);
303
    mPosition1.set(scaleS);
304

  
276 305
    mDynMoveHand1.add(point3h);
277 306
    mDynMoveShad1.add(point3h);
278 307
    mDynScaleHand1.add(pointH);
279
    mDynScaleShad1.add(scaleS);
280
    mDynScaleShad1.add(scaleF);
308
    mDynScaleShad1.add(mPosition1);
281 309

  
282
    mScaleShad1.notifyWhenFinished(this);
310
    setPostFrame(true);
283 311
    }
284 312

  
285 313
///////////////////////////////////////////////////////////////////////////////////////////////////
......
288 316
  private void setEffectsStage5()
289 317
    {
290 318
    resetDynamics1(5);
319
    resetDynamics3(5);
291 320

  
292 321
    Static3D pointH = new Static3D(-X2    ,-Y1    , 0);
293 322
    Static3D point0 = new Static3D(-X2  +D,-Y1  +D, 0);
294 323
    Static3D pointS = new Static3D(-X2+2*D,-Y1+2*D, 0);
295 324
    Static3D pointSc = new Static3D(s033,s033,s033);
296 325

  
326
    mPosition1.set(point0);
327
    mPosition2.set(point0);
328

  
329
    mDyn1.add(point0);
330
    mDyn1.add(pointH);
331
    mDyn2.add(point0);
332
    mDyn2.add(pointS);
333

  
297 334
    mDynScaleHand1.add(pointSc);
298 335
    mDynScaleShad1.add(pointSc);
299
    mDynMoveHand1.add(point0);
300
    mDynMoveHand1.add(pointH);
301
    mDynMoveShad1.add(point0);
302
    mDynMoveShad1.add(pointS);
336
    mDynMoveHand1.add(mPosition1);
337
    mDynMoveShad1.add(mPosition2);
303 338

  
304
    mMoveShad1.notifyWhenFinished(this);
305 339
    mNodes[0].changeInputSurface(mTextureShad);
340
    setPostFrame(true);
306 341
    }
307 342

  
308 343
///////////////////////////////////////////////////////////////////////////////////////////////////
......
312 347
    {
313 348
    resetDynamics1(6);
314 349
    resetDynamics2(6);
350
    resetDynamics3(6);
315 351

  
316 352
    Static3D pointH = new Static3D(-X2    ,-Y1    , 0);
317 353
    Static3D pointS = new Static3D(-X2+2*D,-Y1+2*D, 0);
......
328 364
    Static3D point0s = new Static3D( X0+2*D, Y1+2*D, 0);
329 365
    Static3D point1s = new Static3D( X1+2*D, Y1+2*D, 0);
330 366
    Static3D point2s = new Static3D( X2+2*D, Y1+2*D, 0);
331
    Static3D pointSm= new Static3D(-s033,s033,s033);
367
    Static3D pointSm = new Static3D(-s033,s033,s033);
368

  
369
    mPosition1.set(point0h);
370
    mPosition2.set(point0s);
371

  
372
    mDyn1.add(point0h);
373
    mDyn1.add(point1h);
374
    mDyn1.add(point2h);
375
    mDyn1.add(point2h);
376
    mDyn2.add(point0s);
377
    mDyn2.add(point1s);
378
    mDyn2.add(point2s);
379
    mDyn2.add(point2s);
332 380

  
333
    mDynMoveHand2.add(point0h);
334
    mDynMoveHand2.add(point1h);
335
    mDynMoveHand2.add(point2h);
336
    mDynMoveHand2.add(point2h);
337
    mDynMoveShad2.add(point0s);
338
    mDynMoveShad2.add(point1s);
339
    mDynMoveShad2.add(point2s);
340
    mDynMoveShad2.add(point2s);
341 381
    mDynScaleHand2.add(pointSm);
342 382
    mDynScaleShad2.add(pointSm);
383
    mDynMoveHand2.add(mPosition1);
384
    mDynMoveShad2.add(mPosition2);
343 385

  
344
    mMoveHand2.notifyWhenFinished(this);
386
    setPostFrame(true);
345 387
    }
346 388

  
347 389
///////////////////////////////////////////////////////////////////////////////////////////////////
......
351 393
    {
352 394
    resetDynamics1(7);
353 395
    resetDynamics2(7);
396
    resetDynamics3(7);
397
    resetDynamics4(7);
398

  
399
    Static3D point1Sc= new Static3D( s033,s033,s033);
400
    Static3D point2Sc= new Static3D(-s033,s033,s033);
401
    mDynScaleHand1.add(point1Sc);
402
    mDynScaleShad1.add(point1Sc);
403
    mDynScaleHand2.add(point2Sc);
404
    mDynScaleShad2.add(point2Sc);
354 405

  
355 406
    Static3D point1H = new Static3D(-X2    ,-Y1    , 0);
356 407
    Static3D point1F = new Static3D(-X2  +D,-Y1  +D, 0);
357 408
    Static3D point1S = new Static3D(-X2+2*D,-Y1+2*D, 0);
358
    Static3D point1Sc= new Static3D(s033,s033,s033);
359 409

  
360
    mDynScaleHand1.add(point1Sc);
361
    mDynScaleShad1.add(point1Sc);
362
    mDynMoveHand1.add(point1H);
363
    mDynMoveHand1.add(point1F);
364
    mDynMoveShad1.add(point1S);
365
    mDynMoveShad1.add(point1F);
410
    mDyn1.add(point1H);
411
    mDyn1.add(point1F);
412
    mDyn2.add(point1S);
413
    mDyn2.add(point1F);
414

  
415
    mPosition1.set(point1H);
416
    mPosition2.set(point1S);
417
    mDynMoveHand1.add(mPosition1);
418
    mDynMoveShad1.add(mPosition2);
366 419

  
367 420
    Static3D point2H = new Static3D( X2    , Y1    , 0);
368 421
    Static3D point2F = new Static3D( X2  +D, Y1  +D, 0);
369 422
    Static3D point2S = new Static3D( X2+2*D, Y1+2*D, 0);
370
    Static3D point2Sc= new Static3D(-s033,s033,s033);
371 423

  
372
    mDynScaleHand2.add(point2Sc);
373
    mDynScaleShad2.add(point2Sc);
374
    mDynMoveHand2.add(point2H);
375
    mDynMoveHand2.add(point2F);
376
    mDynMoveShad2.add(point2S);
377
    mDynMoveShad2.add(point2F);
424
    mDyn3.add(point2H);
425
    mDyn3.add(point2F);
426
    mDyn4.add(point2S);
427
    mDyn4.add(point2F);
378 428

  
379
    mMoveHand2.notifyWhenFinished(this);
429
    mPosition3.set(point2H);
430
    mPosition4.set(point2S);
431
    mDynMoveHand2.add(mPosition3);
432
    mDynMoveShad2.add(mPosition4);
433

  
434
    setPostFrame(true);
380 435
    }
381 436

  
382 437
///////////////////////////////////////////////////////////////////////////////////////////////////
......
386 441
    {
387 442
    resetDynamics1(8);
388 443
    resetDynamics2(8);
444
    resetDynamics3(8);
389 445

  
390 446
    Static3D point1h= new Static3D(-X2  +D,-Y1  +D, 0);
391 447
    Static3D point2h= new Static3D( X2  +D, Y1  +D, 0);
......
396 452
    Static3D scale2F = new Static3D(-s014,s014,s014);
397 453
    Static3D point2H = new Static3D(-s033,s033,s033);
398 454

  
455
    mPosition1.set(scale1S);
456
    mDyn1.add(scale1S);
457
    mDyn1.add(scale1F);
458

  
399 459
    mDynMoveHand1.add(point1h);
400 460
    mDynMoveShad1.add(point1h);
401 461
    mDynScaleHand1.add(point1H);
402
    mDynScaleShad1.add(scale1S);
403
    mDynScaleShad1.add(scale1F);
462
    mDynScaleShad1.add(mPosition1);
463

  
464
    mPosition2.set(scale2S);
465
    mDyn2.add(scale2S);
466
    mDyn2.add(scale2F);
404 467

  
405 468
    mDynMoveHand2.add(point2h);
406 469
    mDynMoveShad2.add(point2h);
407 470
    mDynScaleHand2.add(point2H);
408
    mDynScaleShad2.add(scale2S);
409
    mDynScaleShad2.add(scale2F);
410

  
411
    mScaleShad2.notifyWhenFinished(this);
471
    mDynScaleShad2.add(mPosition2);
412 472

  
413 473
    mNodes[0].changeInputSurface(mTextureCirc);
414 474
    mNodes[1].changeInputSurface(mTextureCirc);
475

  
476
    setPostFrame(true);
415 477
    }
416 478

  
417 479
///////////////////////////////////////////////////////////////////////////////////////////////////
......
460 522
    {
461 523
    resetDynamics1(10);
462 524
    resetDynamics2(10);
525
    resetDynamics3(10);
463 526

  
464 527
    Static3D scale1F = new Static3D( s014,s014,s014);
465 528
    Static3D point1H = new Static3D( s033,s033,s033);
......
471 534
    Static3D point2= new Static3D(( X2+D)*F,( Y1+D)*F, 0);
472 535
    Static3D point3= new Static3D(( X2+D)*F,(-Y1+D)*F, 0);
473 536

  
474
    mDynMoveHand1.add(point0);
475
    mDynMoveHand1.add(point1);
476
    mDynMoveHand1.add(point2);
477
    mDynMoveHand1.add(point3);
478
    mDynMoveHand1.add(point0);
479
    mDynMoveShad1.add(point0);
480
    mDynMoveShad1.add(point1);
481
    mDynMoveShad1.add(point2);
482
    mDynMoveShad1.add(point3);
483
    mDynMoveShad1.add(point0);
484 537
    mDynScaleHand1.add(point1H);
485 538
    mDynScaleShad1.add(scale1F);
486

  
487
    mDynMoveHand2.add(point2);
488
    mDynMoveHand2.add(point3);
489
    mDynMoveHand2.add(point0);
490
    mDynMoveHand2.add(point1);
491
    mDynMoveHand2.add(point2);
492
    mDynMoveShad2.add(point2);
493
    mDynMoveShad2.add(point3);
494
    mDynMoveShad2.add(point0);
495
    mDynMoveShad2.add(point1);
496
    mDynMoveShad2.add(point2);
497 539
    mDynScaleHand2.add(point2H);
498 540
    mDynScaleShad2.add(scale2F);
499 541

  
500
    mDynMoveHand1.setConvexity(1.0f);
501
    mDynMoveHand2.setConvexity(1.0f);
502
    mDynMoveShad1.setConvexity(1.0f);
503
    mDynMoveShad2.setConvexity(1.0f);
542
    mDyn1.add(point0);
543
    mDyn1.add(point1);
544
    mDyn1.add(point2);
545
    mDyn1.add(point3);
546
    mDyn1.add(point0);
547
    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
    mPosition1.set(point0);
557
    mPosition2.set(point2);
558

  
559
    mDynMoveHand1.add(mPosition1);
560
    mDynMoveShad1.add(mPosition1);
561
    mDynMoveHand2.add(mPosition2);
562
    mDynMoveShad2.add(mPosition2);
504 563

  
505
    mMoveShad1.notifyWhenFinished(this);
564
    setPostFrame(true);
506 565
    }
507 566

  
508 567
///////////////////////////////////////////////////////////////////////////////////////////////////
......
512 571
    {
513 572
    resetDynamics1(11);
514 573
    resetDynamics2(11);
574
    resetDynamics3(11);
515 575

  
516 576
    Static3D point1s= new Static3D( -X2+D   , -Y1+D   , 0);
517 577
    Static3D point2s= new Static3D(  X2+D   ,  Y1+D   , 0);
......
522 582
    Static3D scale2F= new Static3D(-s014,s014,s014);
523 583
    Static3D point2H= new Static3D(-s033,s033,s033);
524 584

  
525
    mDynMoveHand1.add(point1f);
526
    mDynMoveHand1.add(point1s);
527
    mDynMoveShad1.add(point1f);
528
    mDynMoveShad1.add(point1s);
529 585
    mDynScaleHand1.add(point1H);
530 586
    mDynScaleShad1.add(scale1F);
531

  
532
    mDynMoveHand2.add(point2f);
533
    mDynMoveHand2.add(point2s);
534
    mDynMoveShad2.add(point2f);
535
    mDynMoveShad2.add(point2s);
536 587
    mDynScaleHand2.add(point2H);
537 588
    mDynScaleShad2.add(scale2F);
538 589

  
539
    mDynMoveHand1.setConvexity(0.0f);
540
    mDynMoveHand2.setConvexity(0.0f);
541
    mDynMoveShad1.setConvexity(0.0f);
542
    mDynMoveShad2.setConvexity(0.0f);
590
    mDyn1.add(point1f);
591
    mDyn1.add(point1s);
592
    mDyn2.add(point2f);
593
    mDyn2.add(point2s);
594

  
595
    mDyn1.setConvexity(0.0f);
596
    mDyn2.setConvexity(0.0f);
597

  
598
    mPosition1.set(point1f);
599
    mPosition2.set(point2f);
600

  
601
    mDynMoveHand1.add(mPosition1);
602
    mDynMoveShad1.add(mPosition1);
603
    mDynMoveHand2.add(mPosition2);
604
    mDynMoveShad2.add(mPosition2);
543 605

  
544
    mMoveShad1.notifyWhenFinished(this);
606
    setPostFrame(true);
545 607
    }
546 608

  
547 609
///////////////////////////////////////////////////////////////////////////////////////////////////
......
551 613
    {
552 614
    resetDynamics1(12);
553 615
    resetDynamics2(12);
616
    resetDynamics3(12);
554 617

  
555 618
    Static3D point1h = new Static3D(-X2+D,-Y1+D, 0);
556 619
    Static3D point2h = new Static3D( X2+D, Y1+D, 0);
......
561 624
    Static3D scale2F = new Static3D(-s001,s001,s001);
562 625
    Static3D point2H = new Static3D(-s033,s033,s033);
563 626

  
627
    mPosition1.set(scale1S);
628
    mPosition2.set(scale2S);
629

  
630
    mDyn1.add(scale1S);
631
    mDyn1.add(scale1F);
632
    mDyn2.add(scale2S);
633
    mDyn2.add(scale2F);
634

  
564 635
    mDynMoveHand1.add(point1h);
565 636
    mDynMoveShad1.add(point1h);
566 637
    mDynScaleHand1.add(point1H);
567
    mDynScaleShad1.add(scale1F);
568
    mDynScaleShad1.add(scale1S);
638
    mDynScaleShad1.add(mPosition1);
569 639

  
570 640
    mDynMoveHand2.add(point2h);
571 641
    mDynMoveShad2.add(point2h);
572 642
    mDynScaleHand2.add(point2H);
573
    mDynScaleShad2.add(scale2F);
574
    mDynScaleShad2.add(scale2S);
643
    mDynScaleShad2.add(mPosition2);
575 644

  
576
    mScaleShad1.notifyWhenFinished(this);
645
    setPostFrame(true);
577 646
    }
578 647

  
579 648
///////////////////////////////////////////////////////////////////////////////////////////////////
......
583 652
    {
584 653
    resetDynamics1(13);
585 654
    resetDynamics2(13);
655
    resetDynamics3(13);
656
    resetDynamics4(13);
586 657

  
587 658
    Static3D point1_0 = new Static3D(-X2  +D,-Y1  +D, 0);
588 659
    Static3D point11H = new Static3D(-X2    ,-Y1    , 0);
......
593 664
    Static3D point13S = new Static3D(-X0+2*D,-Y1+2*D, 0);
594 665
    Static3D point1Sc = new Static3D( s033,s033,s033);
595 666

  
667
    mPosition1.set(point1_0);
668
    mDynMoveHand1.add(mPosition1);
669
    mPosition2.set(point1_0);
670
    mDynMoveShad1.add(mPosition2);
671

  
596 672
    mDynScaleHand1.add(point1Sc);
597 673
    mDynScaleShad1.add(point1Sc);
598
    mDynMoveHand1.add(point1_0);
599
    mDynMoveHand1.add(point11H);
600
    mDynMoveHand1.add(point11H);
601
    mDynMoveHand1.add(point12H);
602
    mDynMoveHand1.add(point13H);
603
    mDynMoveShad1.add(point1_0);
604
    mDynMoveShad1.add(point11S);
605
    mDynMoveShad1.add(point11S);
606
    mDynMoveShad1.add(point12S);
607
    mDynMoveShad1.add(point13S);
674

  
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);
608 686

  
609 687
    Static3D point2_0 = new Static3D( X2  +D, Y1  +D, 0);
610 688
    Static3D point21H = new Static3D( X2    , Y1    , 0);
......
615 693
    Static3D point23S = new Static3D( X0+2*D, Y1+2*D, 0);
616 694
    Static3D point2Sc= new Static3D(-s033,s033,s033);
617 695

  
696
    mPosition3.set(point2_0);
697
    mDynMoveHand2.add(mPosition3);
698
    mPosition4.set(point2_0);
699
    mDynMoveShad2.add(mPosition4);
700

  
618 701
    mDynScaleHand2.add(point2Sc);
619 702
    mDynScaleShad2.add(point2Sc);
620
    mDynMoveHand2.add(point2_0);
621
    mDynMoveHand2.add(point21H);
622
    mDynMoveHand2.add(point21H);
623
    mDynMoveHand2.add(point22H);
624
    mDynMoveHand2.add(point23H);
625
    mDynMoveShad2.add(point2_0);
626
    mDynMoveShad2.add(point21S);
627
    mDynMoveShad2.add(point21S);
628
    mDynMoveShad2.add(point22S);
629
    mDynMoveShad2.add(point23S);
630

  
631
    mMoveHand2.notifyWhenFinished(this);
703

  
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);
632 715

  
633 716
    mNodes[0].changeInputSurface(mTextureShad);
634 717
    mNodes[1].changeInputSurface(mTextureShad);
718
    setPostFrame(true);
635 719
    }
636 720

  
637 721
///////////////////////////////////////////////////////////////////////////////////////////////////
......
649 733
    mDyn2 = new Dynamic3D(time,0.5f);
650 734
    mDyn2.setMode(Dynamic.MODE_PATH);
651 735
    mDyn2.setConvexity(0.0f);
736
    mDyn3 = new Dynamic3D(time,0.5f);
737
    mDyn3.setMode(Dynamic.MODE_PATH);
738
    mDyn3.setConvexity(0.0f);
739
    mDyn4 = new Dynamic3D(time,0.5f);
740
    mDyn4.setMode(Dynamic.MODE_PATH);
741
    mDyn4.setConvexity(0.0f);
652 742

  
653 743
    mPosition1 = new Static3D(0,0,0);
654 744
    mPosition2 = new Static3D(0,0,0);
745
    mPosition3 = new Static3D(0,0,0);
746
    mPosition4 = new Static3D(0,0,0);
655 747

  
656
    mHandPosition = new float[6];
748
    tmpBuffer = new float[12];
657 749

  
658 750
    mDynMoveHand1 = new Dynamic3D(time,0.5f);
659 751
    mDynMoveHand1.setMode(Dynamic.MODE_PATH);
......
702 794
    mEffects[3].apply(mMoveHand2);
703 795

  
704 796
    DistortedScreen screen = mControl.getScreen();
705
    mWidth = screen.getWidth();
706
    mHeight= screen.getHeight();
707

  
708
    X0 = mWidth*0.55f;
709
    X1 = mWidth*0.45f;
710
    X2 = mWidth*0.35f;
711
    Y1 = mHeight*0.28f;
712
    D  = mWidth*0.01f;
713
    s001 = mWidth*0.0001f;
714
    s014 = mWidth*0.14f;
715
    s033 = mWidth*0.33f;
716
    F  = 0.60f;
797
    int wid= screen.getWidth();
798
    int hei= screen.getHeight();
799

  
800
    X0   = wid*0.55f;
801
    X1   = wid*0.45f;
802
    X2   = wid*0.35f;
803
    Y1   = hei*0.28f;
804
    D    = wid*0.01f;
805
    s001 = wid*0.0001f;
806
    s014 = wid*0.14f;
807
    s033 = wid*0.33f;
808
    F    = 0.60f;
717 809
    }
718 810

  
719 811
///////////////////////////////////////////////////////////////////////////////////////////////////
......
787 879
///////////////////////////////////////////////////////////////////////////////////////////////////
788 880
// PUBLIC
789 881

  
790
  public void effectFinished(long effectID)
791
    {
792
    switch( mCurrentStage )
793
      {
794
      case  1: setEffectsStage2(); break;
795
      case  2: setEffectsStage3(); break;
796
      case  3: setEffectsStage4(); break;
797
      case  4: setEffectsStage5(); break;
798
      case  5: setEffectsStage6(); break;
799
      case  6: setEffectsStage7(); break;
800
      case  7: setEffectsStage8(); break;
801
      case  8: setEffectsStage9(); break;
802
      case  9: setEffectsStage10();break;
803
      case 10: setEffectsStage11();break;
804
      case 11: setEffectsStage12();break;
805
      case 12: setEffectsStage13();break;
806
      default: mEffectID = -1;
807
               mControl.effectFinished(mEffectID);
808
               break;
809
      }
810
    }
811

  
812
///////////////////////////////////////////////////////////////////////////////////////////////////
813

  
814 882
  public void postDrawFrame(long time)
815 883
    {
816 884
    if( mLastTime<0 ) mLastTime = time;
......
819 887

  
820 888
    switch( mCurrentStage )
821 889
      {
822
      case  3:
823

  
824
      mDyn1.setDebug(true);
825
      boolean finished = mDyn1.get( mHandPosition,0, time, mDiffTime);
826
               mPosition1.set(mHandPosition[0], mHandPosition[1], mHandPosition[2]);
827
               if( finished )
890
      case  1: boolean finished1_1 = mDyn1.get( tmpBuffer,0, time, mDiffTime);
891
               boolean finished1_2 = mDyn2.get( tmpBuffer,3, time, mDiffTime);
892
               mPosition1.set(tmpBuffer[0], tmpBuffer[1], tmpBuffer[2]);
893
               mPosition2.set(tmpBuffer[3], tmpBuffer[4], tmpBuffer[5]);
894
               if( finished1_1 && finished1_2 )
895
                 {
896
                 setPostFrame(false);
897
                 setEffectsStage2();
898
                 }
899
               break;
900
      case  2: boolean finished2_1 = mDyn1.get( tmpBuffer,0, time, mDiffTime);
901
               mPosition1.set(tmpBuffer[0], tmpBuffer[1], tmpBuffer[2]);
902
               if( finished2_1 )
903
                 {
904
                 setPostFrame(false);
905
                 setEffectsStage3();
906
                 }
907
               break;
908
      case  3: boolean finished3_1 = mDyn1.get( tmpBuffer,0, time, mDiffTime);
909
               mPosition1.set(tmpBuffer[0], tmpBuffer[1], tmpBuffer[2]);
910
               if( finished3_1 )
911
                 {
912
                 setPostFrame(false);
913
                 setEffectsStage4();
914
                 }
915
               break;
916
      case  4: boolean finished4_1 = mDyn1.get( tmpBuffer,0, time, mDiffTime);
917
               mPosition1.set(tmpBuffer[0], tmpBuffer[1], tmpBuffer[2]);
918
               if( finished4_1 )
919
                 {
920
                 setPostFrame(false);
921
                 setEffectsStage5();
922
                 }
923
               break;
924
      case  5: boolean finished5_1 = mDyn1.get( tmpBuffer,0, time, mDiffTime);
925
               boolean finished5_2 = mDyn2.get( tmpBuffer,3, time, mDiffTime);
926
               mPosition1.set(tmpBuffer[0], tmpBuffer[1], tmpBuffer[2]);
927
               mPosition2.set(tmpBuffer[3], tmpBuffer[4], tmpBuffer[5]);
928
               if( finished5_1 && finished5_2 )
929
                 {
930
                 setPostFrame(false);
931
                 setEffectsStage6();
932
                 }
933
               break;
934
      case  6: boolean finished6_1 = mDyn1.get( tmpBuffer,0, time, mDiffTime);
935
               boolean finished6_2 = mDyn2.get( tmpBuffer,3, time, mDiffTime);
936
               mPosition1.set(tmpBuffer[0], tmpBuffer[1], tmpBuffer[2]);
937
               mPosition2.set(tmpBuffer[3], tmpBuffer[4], tmpBuffer[5]);
938
               if( finished6_1 && finished6_2 )
939
                 {
940
                 setPostFrame(false);
941
                 setEffectsStage7();
942
                 }
943
               break;
944
      case  7: boolean finished7_1 = mDyn1.get( tmpBuffer,0, time, mDiffTime);
945
               boolean finished7_2 = mDyn2.get( tmpBuffer,3, time, mDiffTime);
946
               boolean finished7_3 = mDyn3.get( tmpBuffer,6, time, mDiffTime);
947
               boolean finished7_4 = mDyn4.get( tmpBuffer,9, time, mDiffTime);
948
               mPosition1.set(tmpBuffer[0], tmpBuffer[ 1], tmpBuffer[ 2]);
949
               mPosition2.set(tmpBuffer[3], tmpBuffer[ 4], tmpBuffer[ 5]);
950
               mPosition3.set(tmpBuffer[6], tmpBuffer[ 7], tmpBuffer[ 8]);
951
               mPosition4.set(tmpBuffer[9], tmpBuffer[10], tmpBuffer[11]);
952
               if( finished7_1 && finished7_2 && finished7_3 && finished7_4 )
953
                 {
954
                 setPostFrame(false);
955
                 setEffectsStage8();
956
                 }
957
               break;
958
      case  8: boolean finished8_1 = mDyn1.get( tmpBuffer,0, time, mDiffTime);
959
               boolean finished8_2 = mDyn2.get( tmpBuffer,3, time, mDiffTime);
960
               mPosition1.set(tmpBuffer[0], tmpBuffer[1], tmpBuffer[2]);
961
               mPosition2.set(tmpBuffer[3], tmpBuffer[4], tmpBuffer[5]);
962
               if( finished8_1 && finished8_2 )
963
                 {
964
                 setPostFrame(false);
965
                 setEffectsStage9();
966
                 }
967
               break;
968
      case  9: boolean finished9_1 = mDyn1.get( tmpBuffer,0, time, mDiffTime);
969
               boolean finished9_2 = mDyn2.get( tmpBuffer,3, time, mDiffTime);
970
               mPosition1.set(tmpBuffer[0], tmpBuffer[1], tmpBuffer[2]);
971
               mPosition2.set(tmpBuffer[3], tmpBuffer[4], tmpBuffer[5]);
972
               if( finished9_1 && finished9_2 )
973
                 {
974
                 setPostFrame(false);
975
                 setEffectsStage10();
976
                 }
977
               break;
978
      case 10: boolean finished10_1 = mDyn1.get( tmpBuffer,0, time, mDiffTime);
979
               boolean finished10_2 = mDyn2.get( tmpBuffer,3, time, mDiffTime);
980
               mPosition1.set(tmpBuffer[0], tmpBuffer[1], tmpBuffer[2]);
981
               mPosition2.set(tmpBuffer[3], tmpBuffer[4], tmpBuffer[5]);
982
               if( finished10_1 && finished10_2 )
983
                 {
984
                 setPostFrame(false);
985
                 setEffectsStage11();
986
                 }
987
               break;
988
      case 11: boolean finished11_1 = mDyn1.get( tmpBuffer,0, time, mDiffTime);
989
               boolean finished11_2 = mDyn2.get( tmpBuffer,3, time, mDiffTime);
990
               mPosition1.set(tmpBuffer[0], tmpBuffer[1], tmpBuffer[2]);
991
               mPosition2.set(tmpBuffer[3], tmpBuffer[4], tmpBuffer[5]);
992
               if( finished11_1 && finished11_2 )
993
                 {
994
                 setPostFrame(false);
995
                 setEffectsStage12();
996
                 }
997
               break;
998
      case 12: boolean finished12_1 = mDyn1.get( tmpBuffer,0, time, mDiffTime);
999
               boolean finished12_2 = mDyn2.get( tmpBuffer,3, time, mDiffTime);
1000
               mPosition1.set(tmpBuffer[0], tmpBuffer[1], tmpBuffer[2]);
1001
               mPosition2.set(tmpBuffer[3], tmpBuffer[4], tmpBuffer[5]);
1002
               if( finished12_1 && finished12_2 )
828 1003
                 {
829 1004
                 setPostFrame(false);
830
                 effectFinished(0);
1005
                 setEffectsStage13();
831 1006
                 }
832 1007
               break;
833
      case  9: boolean finished1 = mDyn1.get( mHandPosition,0, time, mDiffTime);
834
               boolean finished2 = mDyn2.get( mHandPosition,3, time, mDiffTime);
835
               mPosition1.set(mHandPosition[0], mHandPosition[1], mHandPosition[2]);
836
               mPosition2.set(mHandPosition[3], mHandPosition[4], mHandPosition[5]);
837
               if( finished1 && finished2 )
1008
      case 13: boolean finished13_1 = mDyn1.get( tmpBuffer,0, time, mDiffTime);
1009
               boolean finished13_2 = mDyn2.get( tmpBuffer,3, time, mDiffTime);
1010
               boolean finished13_3 = mDyn3.get( tmpBuffer,6, time, mDiffTime);
1011
               boolean finished13_4 = mDyn4.get( tmpBuffer,9, time, mDiffTime);
1012
               mPosition1.set(tmpBuffer[0], tmpBuffer[ 1], tmpBuffer[ 2]);
1013
               mPosition2.set(tmpBuffer[3], tmpBuffer[ 4], tmpBuffer[ 5]);
1014
               mPosition3.set(tmpBuffer[6], tmpBuffer[ 7], tmpBuffer[ 8]);
1015
               mPosition4.set(tmpBuffer[9], tmpBuffer[10], tmpBuffer[11]);
1016
               if( finished13_1 && finished13_2 && finished13_3 && finished13_4 )
838 1017
                 {
839 1018
                 setPostFrame(false);
840
                 effectFinished(0);
1019
                 mEffectID = -1;
1020
                 mControl.effectFinished(mEffectID);
841 1021
                 }
842 1022
               break;
843 1023
      default: android.util.Log.e("D", "WHAT? "+mCurrentStage);

Also available in: Unified diff