Revision 65d5505f
Added by Leszek Koltunski almost 9 years ago
| src/main/java/org/distorted/library/EffectQueueVertex.java | ||
|---|---|---|
| 78 | 78 |
{
|
| 79 | 79 |
if( mInter[0][i].interpolateMain(mUniforms ,NUM_UNIFORMS*i, mCurrentDuration[i], step) ) |
| 80 | 80 |
{
|
| 81 |
postprocess(i); |
|
| 82 |
|
|
| 81 | 83 |
for(int j=0; j<mNumListeners; j++) |
| 82 | 84 |
EffectMessageSender.newMessage( mListeners.elementAt(j), |
| 83 | 85 |
EffectMessage.EFFECT_FINISHED, |
| src/main/java/org/distorted/library/type/Dynamic1D.java | ||
|---|---|---|
| 426 | 426 |
break; |
| 427 | 427 |
case MODE_PATH: segment = (int)(2*t*(numPoints-1)); |
| 428 | 428 |
|
| 429 |
if( t<0.5f )
|
|
| 430 |
{
|
|
| 429 |
if( t<=0.5f ) // this has to be <= (otherwise when effect ends at t=0.5, then time=1.0
|
|
| 430 |
{ // and end position is slightly not equal to the end point => might not get autodeleted!
|
|
| 431 | 431 |
time = 2*t*(numPoints-1); |
| 432 | 432 |
vecCurr = segment; |
| 433 | 433 |
} |
| ... | ... | |
| 456 | 456 |
{
|
| 457 | 457 |
case MODE_LOOP: vecNext = vecCurr==numPoints-1 ? 0:vecCurr+1; |
| 458 | 458 |
break; |
| 459 |
case MODE_PATH: if( t<0.5f ) vecNext = vecCurr==numPoints-1 ? numPoints-2: vecCurr+1; |
|
| 460 |
else vecNext = vecCurr==0 ? 1 : vecCurr-1; |
|
| 459 |
case MODE_PATH: if( t<=0.5f ) vecNext = vecCurr==numPoints-1 ? numPoints-2: vecCurr+1;
|
|
| 460 |
else vecNext = vecCurr==0 ? 1 : vecCurr-1;
|
|
| 461 | 461 |
break; |
| 462 | 462 |
case MODE_JUMP: vecNext = vecCurr==numPoints-1 ? 1:vecCurr+1; |
| 463 | 463 |
break; |
| src/main/java/org/distorted/library/type/Dynamic2D.java | ||
|---|---|---|
| 459 | 459 |
break; |
| 460 | 460 |
case MODE_PATH: segment = (int)(2*t*(numPoints-1)); |
| 461 | 461 |
|
| 462 |
if( t<0.5f )
|
|
| 463 |
{
|
|
| 462 |
if( t<=0.5f ) // this has to be <= (otherwise when effect ends at t=0.5, then time=1.0
|
|
| 463 |
{ // and end position is slightly not equal to the end point => might not get autodeleted!
|
|
| 464 | 464 |
time = 2*t*(numPoints-1); |
| 465 | 465 |
vecCurr = segment; |
| 466 | 466 |
} |
| ... | ... | |
| 489 | 489 |
{
|
| 490 | 490 |
case MODE_LOOP: vecNext = vecCurr==numPoints-1 ? 0:vecCurr+1; |
| 491 | 491 |
break; |
| 492 |
case MODE_PATH: if( t<0.5f ) vecNext = vecCurr==numPoints-1 ? numPoints-2: vecCurr+1; |
|
| 493 |
else vecNext = vecCurr==0 ? 1 : vecCurr-1; |
|
| 492 |
case MODE_PATH: if( t<=0.5f ) vecNext = vecCurr==numPoints-1 ? numPoints-2: vecCurr+1;
|
|
| 493 |
else vecNext = vecCurr==0 ? 1 : vecCurr-1;
|
|
| 494 | 494 |
break; |
| 495 | 495 |
case MODE_JUMP: vecNext = vecCurr==numPoints-1 ? 1:vecCurr+1; |
| 496 | 496 |
break; |
| src/main/java/org/distorted/library/type/Dynamic3D.java | ||
|---|---|---|
| 490 | 490 |
break; |
| 491 | 491 |
case MODE_PATH: segment = (int)(2*t*(numPoints-1)); |
| 492 | 492 |
|
| 493 |
if( t<0.5f )
|
|
| 494 |
{
|
|
| 493 |
if( t<=0.5f ) // this has to be <= (otherwise when effect ends at t=0.5, then time=1.0
|
|
| 494 |
{ // and end position is slightly not equal to the end point => might not get autodeleted!
|
|
| 495 | 495 |
time = 2*t*(numPoints-1); |
| 496 | 496 |
vecCurr = segment; |
| 497 | 497 |
} |
| ... | ... | |
| 520 | 520 |
{
|
| 521 | 521 |
case MODE_LOOP: vecNext = vecCurr==numPoints-1 ? 0:vecCurr+1; |
| 522 | 522 |
break; |
| 523 |
case MODE_PATH: if( t<0.5f ) vecNext = vecCurr==numPoints-1 ? numPoints-2: vecCurr+1; |
|
| 524 |
else vecNext = vecCurr==0 ? 1 : vecCurr-1; |
|
| 523 |
case MODE_PATH: if( t<=0.5f ) vecNext = vecCurr==numPoints-1 ? numPoints-2: vecCurr+1;
|
|
| 524 |
else vecNext = vecCurr==0 ? 1 : vecCurr-1;
|
|
| 525 | 525 |
break; |
| 526 | 526 |
case MODE_JUMP: vecNext = vecCurr==numPoints-1 ? 1:vecCurr+1; |
| 527 | 527 |
break; |
| ... | ... | |
| 541 | 541 |
time = time-vecCurr; |
| 542 | 542 |
|
| 543 | 543 |
tmp1 = vc.elementAt(vecCurr); |
| 544 |
|
|
| 544 |
|
|
| 545 | 545 |
if( vn!=null ) |
| 546 | 546 |
{
|
| 547 | 547 |
time = noise(time,vecCurr); |
| ... | ... | |
| 551 | 551 |
buffer[offset ]= ((tmp1.a[0]*time+tmp1.b[0])*time+tmp1.c[0])*time+tmp1.d[0] + (baseV[1][0]*mFactor[0] + baseV[2][0]*mFactor[1]); |
| 552 | 552 |
buffer[offset+1]= ((tmp1.a[1]*time+tmp1.b[1])*time+tmp1.c[1])*time+tmp1.d[1] + (baseV[1][1]*mFactor[0] + baseV[2][1]*mFactor[1]); |
| 553 | 553 |
buffer[offset+2]= ((tmp1.a[2]*time+tmp1.b[2])*time+tmp1.c[2])*time+tmp1.d[2] + (baseV[1][2]*mFactor[0] + baseV[2][2]*mFactor[1]); |
| 554 |
/* |
|
| 555 |
float d0 = buffer[offset+0] - a0; |
|
| 556 |
float d1 = buffer[offset+1] - a1; |
|
| 557 |
float d2 = buffer[offset+2] - a2; |
|
| 558 |
|
|
| 559 |
float distSQ = d0*d0+d1*d1+d2*d2; |
|
| 560 |
|
|
| 561 |
if( distSQ>500.0f ) |
|
| 562 |
{
|
|
| 563 |
android.util.Log.e("dyn3D", "distSQ="+distSQ);
|
|
| 564 |
android.util.Log.e("dyn3D", "factors old0="+f0+" new0="+mFactor[0]+" old1="+f1+" new1="+mFactor[1]);
|
|
| 565 |
android.util.Log.e("dyn3D", "first base: old ("+b00+","+b01+","+b02+") new ("+baseV[0][0]+","+baseV[0][1]+","+baseV[0][2]+")");
|
|
| 566 |
android.util.Log.e("dyn3D", "second base: old ("+b10+","+b11+","+b12+") new ("+baseV[1][0]+","+baseV[1][1]+","+baseV[1][2]+")");
|
|
| 567 |
android.util.Log.e("dyn3D", "third base: old ("+b20+","+b21+","+b22+") new ("+baseV[2][0]+","+baseV[2][1]+","+baseV[2][2]+")");
|
|
| 568 |
|
|
| 569 |
String s1= "velocity: old (";
|
|
| 570 |
String s2= "acceleration: old (";
|
|
| 571 |
|
|
| 572 |
for(int i=0; i<mDimension; i++) |
|
| 573 |
{
|
|
| 574 |
s1 += (((3*tmp1.a[i]*oldTime+2*tmp1.b[i])*oldTime+tmp1.c[i])+(i==mDimension-1 ? ") new (":","));
|
|
| 575 |
s2 += ( (6*tmp1.a[i]*oldTime+2*tmp1.b[i]) +(i==mDimension-1 ? ") new (":","));
|
|
| 576 |
} |
|
| 577 |
|
|
| 578 |
for(int i=0; i<mDimension; i++) |
|
| 579 |
{
|
|
| 580 |
s1 += (((3*tmp1.a[i]*time+2*tmp1.b[i])*time+tmp1.c[i])+(i==mDimension-1 ? ")":",")); |
|
| 581 |
s2 += ( (6*tmp1.a[i]*time+2*tmp1.b[i]) +(i==mDimension-1 ? ")":",")); |
|
| 582 |
} |
|
| 583 |
|
|
| 584 |
android.util.Log.e("dyn3D", s1);
|
|
| 585 |
android.util.Log.e("dyn3D", s2);
|
|
| 586 |
|
|
| 587 |
computeOrthonormalBaseMoreDebug(oldTime,tmp1); |
|
| 588 |
computeOrthonormalBaseMoreDebug( time,tmp1); |
|
| 589 |
} |
|
| 590 |
|
|
| 591 |
a0 = buffer[offset+0]; |
|
| 592 |
a1 = buffer[offset+1]; |
|
| 593 |
a2 = buffer[offset+2]; |
|
| 594 |
|
|
| 595 |
f0 = mFactor[0]; |
|
| 596 |
f1 = mFactor[1]; |
|
| 597 |
|
|
| 598 |
b00 = baseV[0][0]; |
|
| 599 |
b01 = baseV[0][1]; |
|
| 600 |
b02 = baseV[0][2]; |
|
| 601 |
|
|
| 602 |
b10 = baseV[1][0]; |
|
| 603 |
b11 = baseV[1][1]; |
|
| 604 |
b12 = baseV[1][2]; |
|
| 605 |
|
|
| 606 |
b20 = baseV[2][0]; |
|
| 607 |
b21 = baseV[2][1]; |
|
| 608 |
b22 = baseV[2][2]; |
|
| 609 |
|
|
| 610 |
oldTime = time; |
|
| 611 |
*/ |
|
| 612 | 554 |
} |
| 613 | 555 |
else |
| 614 | 556 |
{
|
| src/main/java/org/distorted/library/type/Dynamic4D.java | ||
|---|---|---|
| 506 | 506 |
break; |
| 507 | 507 |
case MODE_PATH: segment = (int)(2*t*(numPoints-1)); |
| 508 | 508 |
|
| 509 |
if( t<0.5f )
|
|
| 510 |
{
|
|
| 509 |
if( t<=0.5f ) // this has to be <= (otherwise when effect ends at t=0.5, then time=1.0
|
|
| 510 |
{ // and end position is slightly not equal to the end point => might not get autodeleted!
|
|
| 511 | 511 |
time = 2*t*(numPoints-1); |
| 512 | 512 |
vecCurr = segment; |
| 513 | 513 |
} |
| ... | ... | |
| 536 | 536 |
{
|
| 537 | 537 |
case MODE_LOOP: vecNext = vecCurr==numPoints-1 ? 0:vecCurr+1; |
| 538 | 538 |
break; |
| 539 |
case MODE_PATH: if( t<0.5f ) vecNext = vecCurr==numPoints-1 ? numPoints-2: vecCurr+1; |
|
| 540 |
else vecNext = vecCurr==0 ? 1 : vecCurr-1; |
|
| 539 |
case MODE_PATH: if( t<=0.5f ) vecNext = vecCurr==numPoints-1 ? numPoints-2: vecCurr+1;
|
|
| 540 |
else vecNext = vecCurr==0 ? 1 : vecCurr-1;
|
|
| 541 | 541 |
break; |
| 542 | 542 |
case MODE_JUMP: vecNext = vecCurr==numPoints-1 ? 1:vecCurr+1; |
| 543 | 543 |
break; |
| src/main/java/org/distorted/library/type/Dynamic5D.java | ||
|---|---|---|
| 529 | 529 |
break; |
| 530 | 530 |
case MODE_PATH: segment = (int)(2*t*(numPoints-1)); |
| 531 | 531 |
|
| 532 |
if( t<0.5f )
|
|
| 533 |
{
|
|
| 532 |
if( t<=0.5f ) // this has to be <= (otherwise when effect ends at t=0.5, then time=1.0
|
|
| 533 |
{ // and end position is slightly not equal to the end point => might not get autodeleted!
|
|
| 534 | 534 |
time = 2*t*(numPoints-1); |
| 535 | 535 |
vecCurr = segment; |
| 536 | 536 |
} |
| ... | ... | |
| 559 | 559 |
{
|
| 560 | 560 |
case MODE_LOOP: vecNext = vecCurr==numPoints-1 ? 0:vecCurr+1; |
| 561 | 561 |
break; |
| 562 |
case MODE_PATH: if( t<0.5f ) vecNext = vecCurr==numPoints-1 ? numPoints-2: vecCurr+1; |
|
| 563 |
else vecNext = vecCurr==0 ? 1 : vecCurr-1; |
|
| 562 |
case MODE_PATH: if( t<=0.5f ) vecNext = vecCurr==numPoints-1 ? numPoints-2: vecCurr+1;
|
|
| 563 |
else vecNext = vecCurr==0 ? 1 : vecCurr-1;
|
|
| 564 | 564 |
break; |
| 565 | 565 |
case MODE_JUMP: vecNext = vecCurr==numPoints-1 ? 1:vecCurr+1; |
| 566 | 566 |
break; |
Also available in: Unified diff
2 bugfixes:
- in Dynamics, it has to be t<=0.5 (rather than t<0.5) (see comment in code)
- in EffectQueueVertex, we need to postprocess() the last time, when effect is finished but not removed!