Revision 33c22e6c
Added by Leszek Koltunski over 3 years ago
src/main/java/org/distorted/control/RubikControlWhole.java | ||
---|---|---|
52 | 52 |
private static final int D5 =10000; // fingers circle |
53 | 53 |
|
54 | 54 |
private static final int[] DUR = { D1, D2, D3, D2, D1/4, 3*D1/4, D1/4, D2, D4, D5, D4, D2, D1 }; |
55 |
private static final int[] DYN = { 2, 1, 1, 1, 2, 2, 4, 2, 2, 2, 2, 2, 4}; |
|
55 | 56 |
|
56 | 57 |
private float X0, X1, X2, Y1, D, s001, s014, s033, F; |
57 | 58 |
|
... | ... | |
242 | 243 |
mDynScaleShad1.add(mPosition1); |
243 | 244 |
|
244 | 245 |
mNodes[0].changeInputSurface(mTextureCirc); |
245 |
setPostFrame(true); |
|
246 | 246 |
} |
247 | 247 |
|
248 | 248 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
281 | 281 |
|
282 | 282 |
mDynMoveHand1.add(mPosition1); |
283 | 283 |
mDynMoveShad1.add(mPosition1); |
284 |
|
|
285 |
setPostFrame(true); |
|
286 | 284 |
} |
287 | 285 |
|
288 | 286 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
306 | 304 |
mDynMoveShad1.add(point3h); |
307 | 305 |
mDynScaleHand1.add(pointH); |
308 | 306 |
mDynScaleShad1.add(mPosition1); |
309 |
|
|
310 |
setPostFrame(true); |
|
311 | 307 |
} |
312 | 308 |
|
313 | 309 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
337 | 333 |
mDynMoveShad1.add(mPosition2); |
338 | 334 |
|
339 | 335 |
mNodes[0].changeInputSurface(mTextureShad); |
340 |
setPostFrame(true); |
|
341 | 336 |
} |
342 | 337 |
|
343 | 338 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
382 | 377 |
mDynScaleShad2.add(pointSm); |
383 | 378 |
mDynMoveHand2.add(mPosition1); |
384 | 379 |
mDynMoveShad2.add(mPosition2); |
385 |
|
|
386 |
setPostFrame(true); |
|
387 | 380 |
} |
388 | 381 |
|
389 | 382 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
430 | 423 |
mPosition4.set(point2S); |
431 | 424 |
mDynMoveHand2.add(mPosition3); |
432 | 425 |
mDynMoveShad2.add(mPosition4); |
433 |
|
|
434 |
setPostFrame(true); |
|
435 | 426 |
} |
436 | 427 |
|
437 | 428 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
472 | 463 |
|
473 | 464 |
mNodes[0].changeInputSurface(mTextureCirc); |
474 | 465 |
mNodes[1].changeInputSurface(mTextureCirc); |
475 |
|
|
476 |
setPostFrame(true); |
|
477 | 466 |
} |
478 | 467 |
|
479 | 468 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
511 | 500 |
mDynMoveShad1.add(mPosition1); |
512 | 501 |
mDynMoveHand2.add(mPosition2); |
513 | 502 |
mDynMoveShad2.add(mPosition2); |
514 |
|
|
515 |
setPostFrame(true); |
|
516 | 503 |
} |
517 | 504 |
|
518 | 505 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
560 | 547 |
mDynMoveShad1.add(mPosition1); |
561 | 548 |
mDynMoveHand2.add(mPosition2); |
562 | 549 |
mDynMoveShad2.add(mPosition2); |
563 |
|
|
564 |
setPostFrame(true); |
|
565 | 550 |
} |
566 | 551 |
|
567 | 552 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
602 | 587 |
mDynMoveShad1.add(mPosition1); |
603 | 588 |
mDynMoveHand2.add(mPosition2); |
604 | 589 |
mDynMoveShad2.add(mPosition2); |
605 |
|
|
606 |
setPostFrame(true); |
|
607 | 590 |
} |
608 | 591 |
|
609 | 592 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
641 | 624 |
mDynMoveShad2.add(point2h); |
642 | 625 |
mDynScaleHand2.add(point2H); |
643 | 626 |
mDynScaleShad2.add(mPosition2); |
644 |
|
|
645 |
setPostFrame(true); |
|
646 | 627 |
} |
647 | 628 |
|
648 | 629 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
715 | 696 |
|
716 | 697 |
mNodes[0].changeInputSurface(mTextureShad); |
717 | 698 |
mNodes[1].changeInputSurface(mTextureShad); |
718 |
setPostFrame(true); |
|
719 | 699 |
} |
720 | 700 |
|
721 | 701 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
876 | 856 |
mControl = control; |
877 | 857 |
} |
878 | 858 |
|
859 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
860 |
|
|
861 |
private void stageFinished(int stage) |
|
862 |
{ |
|
863 |
switch(stage) |
|
864 |
{ |
|
865 |
case 1: setEffectsStage2(); break; |
|
866 |
case 2: setEffectsStage3(); break; |
|
867 |
case 3: setEffectsStage4(); break; |
|
868 |
case 4: setEffectsStage5(); break; |
|
869 |
case 5: setEffectsStage6(); break; |
|
870 |
case 6: setEffectsStage7(); break; |
|
871 |
case 7: setEffectsStage8(); break; |
|
872 |
case 8: setEffectsStage9(); break; |
|
873 |
case 9: setEffectsStage10(); break; |
|
874 |
case 10: setEffectsStage11(); break; |
|
875 |
case 11: setEffectsStage12(); break; |
|
876 |
case 12: setEffectsStage13(); break; |
|
877 |
default: setPostFrame(false); |
|
878 |
mEffectID = -1; |
|
879 |
mControl.effectFinished(mEffectID); |
|
880 |
} |
|
881 |
} |
|
882 |
|
|
879 | 883 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
880 | 884 |
// PUBLIC |
881 | 885 |
|
... | ... | |
885 | 889 |
else mDiffTime = time - mLastTime; |
886 | 890 |
mLastTime = time; |
887 | 891 |
|
888 |
switch( mCurrentStage )
|
|
892 |
switch(DYN[mCurrentStage-1])
|
|
889 | 893 |
{ |
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 ) |
|
1003 |
{ |
|
1004 |
setPostFrame(false); |
|
1005 |
setEffectsStage13(); |
|
1006 |
} |
|
1007 |
break; |
|
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 ) |
|
1017 |
{ |
|
1018 |
setPostFrame(false); |
|
1019 |
mEffectID = -1; |
|
1020 |
mControl.effectFinished(mEffectID); |
|
1021 |
} |
|
1022 |
break; |
|
1023 |
default: android.util.Log.e("D", "WHAT? "+mCurrentStage); |
|
894 |
case 1: boolean finished1 = mDyn1.get( tmpBuffer,0, time, mDiffTime); |
|
895 |
mPosition1.set(tmpBuffer[0], tmpBuffer[1], tmpBuffer[2]); |
|
896 |
if( finished1 ) stageFinished(mCurrentStage); |
|
897 |
break; |
|
898 |
case 2: boolean finished2_1 = mDyn1.get( tmpBuffer,0, time, mDiffTime); |
|
899 |
boolean finished2_2 = mDyn2.get( tmpBuffer,3, time, mDiffTime); |
|
900 |
mPosition1.set(tmpBuffer[0], tmpBuffer[1], tmpBuffer[2]); |
|
901 |
mPosition2.set(tmpBuffer[3], tmpBuffer[4], tmpBuffer[5]); |
|
902 |
if( finished2_1 && finished2_2 ) stageFinished(mCurrentStage); |
|
903 |
break; |
|
904 |
case 4: boolean finished4_1 = mDyn1.get( tmpBuffer,0, time, mDiffTime); |
|
905 |
boolean finished4_2 = mDyn2.get( tmpBuffer,3, time, mDiffTime); |
|
906 |
boolean finished4_3 = mDyn3.get( tmpBuffer,6, time, mDiffTime); |
|
907 |
boolean finished4_4 = mDyn4.get( tmpBuffer,9, time, mDiffTime); |
|
908 |
mPosition1.set(tmpBuffer[0], tmpBuffer[ 1], tmpBuffer[ 2]); |
|
909 |
mPosition2.set(tmpBuffer[3], tmpBuffer[ 4], tmpBuffer[ 5]); |
|
910 |
mPosition3.set(tmpBuffer[6], tmpBuffer[ 7], tmpBuffer[ 8]); |
|
911 |
mPosition4.set(tmpBuffer[9], tmpBuffer[10], tmpBuffer[11]); |
|
912 |
if( finished4_1 && finished4_2 && finished4_3 && finished4_4 ) stageFinished(mCurrentStage); |
|
913 |
break; |
|
1024 | 914 |
} |
1025 | 915 |
} |
1026 | 916 |
} |
Also available in: Unified diff
RubikControl: progress.