Project

General

Profile

« Previous | Next » 

Revision 24d22f93

Added by Leszek Koltunski about 8 years ago

Progress with WindManager.

View differences:

src/main/java/org/distorted/library/EffectQueue.java
59 59
  
60 60
///////////////////////////////////////////////////////////////////////////////////////////////////
61 61
   
62
  public EffectQueue(DistortedObject obj, int numUniforms, int index)
62
  EffectQueue(DistortedObject obj, int numUniforms, int index)
63 63
    {
64 64
    mNumEffects   = 0;
65 65
    mTotalEffects = 0;
......
92 92

  
93 93
///////////////////////////////////////////////////////////////////////////////////////////////////
94 94

  
95
  @SuppressWarnings("unused")
95 96
  int getNumEffects()
96 97
    {
97 98
    return mNumEffects;  
......
294 295
    
295 296
///////////////////////////////////////////////////////////////////////////////////////////////////
296 297
// used only for debugging
297
  
298

  
299
  @SuppressWarnings("unused")
298 300
  protected String printEffects(int max)
299 301
    {
300 302
    long[] indexes = new long[mMax[mMaxIndex]];
src/main/java/org/distorted/library/type/Dynamic.java
77 77
   * Set the mode to ACCESS_SEQUENTIAL if you need to change mDuration and you would rather have the Dynamic
78 78
   * keep on smoothly interpolating.
79 79
   * On the other hand, in this mode, a Dynamic can only be accessed in sequential manner, which means one
80
   * one Dynamic can only be used in one effect at a time.
80
   * Dynamic can only be used in one effect at a time.
81 81
   */
82 82
  public static final int ACCESS_SEQUENTIAL = 1;
83 83

  
......
155 155
  private static final int NUM_NOISE = 5; // used iff mNoise>0.0. Number of intermediary points between each pair of adjacent vectors
156 156
                                          // where we randomize noise factors to make the way between the two vectors not so smooth.
157 157

  
158
//private int lastNon;
159

  
160 158
///////////////////////////////////////////////////////////////////////////////////////////////////
161 159
// hide this from Javadoc
162 160
  
......
248 246
///////////////////////////////////////////////////////////////////////////////////////////////////
249 247
// debugging only
250 248

  
249
  @SuppressWarnings("unused")
251 250
  private void checkBase()
252 251
    {
253 252
    float tmp, cosA;
......
387 386
    computeOrthonormalBase();
388 387
    }
389 388

  
390
///////////////////////////////////////////////////////////////////////////////////////////////////
391
// debugging
392
/*
393
  protected void computeOrthonormalBaseMoreDebug(float time,VectorCache vc)
394
    {
395
    for(int i=0; i<mDimension; i++)
396
      {
397
      baseV[0][i] = (3*vc.a[i]*time+2*vc.b[i])*time+vc.c[i];   // first derivative, i.e. velocity vector
398
      baseV[1][i] =  6*vc.a[i]*time+2*vc.b[i];                 // second derivative,i.e. acceleration vector
399
      }
400

  
401
    float av=0.0f, vv=0.0f;
402

  
403
    android.util.Log.e("dyn3D", " ==>  velocity     ("+baseV[0][0]+","+baseV[0][1]+","+baseV[0][2]+")");
404
    android.util.Log.e("dyn3D", " ==>  acceleration ("+baseV[1][0]+","+baseV[1][1]+","+baseV[1][2]+")");
405

  
406
    for(int k=0; k<mDimension; k++)
407
      {
408
      vv += baseV[0][k]*baseV[0][k];
409
      av += baseV[1][k]*baseV[0][k];
410
      }
411

  
412
    android.util.Log.e("dyn3D", " ==>  av: "+av+" vv="+vv);
413

  
414
    av /= vv;
415

  
416
    for(int k=0;k<mDimension; k++)
417
      {
418
      baseV[1][k] -= av*baseV[0][k];
419
      }
420

  
421
    android.util.Log.e("dyn3D", " ==>  second base ("+baseV[1][0]+","+baseV[1][1]+","+baseV[1][2]+")");
422
    }
423
*/
424 389
///////////////////////////////////////////////////////////////////////////////////////////////////
425 390
// helper function in case we are interpolating through more than 2 points
426 391

  
......
467 432
    for(int i=0; i<mDimension; i++)
468 433
      if( baseV[0][i] != 0.0f )
469 434
        last_non_zero=i;
470
/*
471
if( last_non_zero != lastNon )
472
  android.util.Log.e("dynamic", "lastNon="+lastNon+" last_non_zero="+last_non_zero);
473
*/
474 435

  
475 436
    if( last_non_zero==-1 )                                               ///
476 437
      {                                                                   //  velocity is the 0 vector -> two
......
521 482
        }                                                                 /// End Normalize
522 483
      }
523 484

  
524
//lastNon = last_non_zero;
525

  
526 485
    //printBase("end");
527 486
    //checkBase();
528 487
    }
529 488

  
530 489
///////////////////////////////////////////////////////////////////////////////////////////////////
531 490
// internal debugging only!
532
  
491

  
533 492
  public String print()
534 493
    {
535
    return "duration="+mDuration+" count="+mCount+" Noise="+mNoise+" numVectors="+numPoints+" mMode="+mMode;
494
    return "duration="+mDuration+" count="+mCount+" Noise[0]="+mNoise[0]+" numVectors="+numPoints+" mMode="+mMode;
536 495
    }
537 496

  
538 497
///////////////////////////////////////////////////////////////////////////////////////////////////
......
554 513
 * 
555 514
 * @param mode {@link Dynamic#MODE_LOOP}, {@link Dynamic#MODE_PATH} or {@link Dynamic#MODE_JUMP}.
556 515
 */
557

  
558 516
  public void setMode(int mode)
559 517
    {
560 518
    mMode = mode;  
......
594 552
 * @param duration Time, in milliseconds, it takes to do one full interpolation, i.e. go from the first 
595 553
 *                 Point to the last and back. 
596 554
 */
597
  
598 555
  public void setDuration(long duration)
599 556
    {
600 557
    mDuration = duration;
......
605 562
/**
606 563
 * Sets the access mode this Dynamic will be working in.
607 564
 *
608
 * @param mode ACCESS_RANDOM or ACCESS_SEQUENTIAL.
609
 *             see {@link Dynamic#ACCESS_RANDOM}.
610
 *             see {@link Dynamic#ACCESS_SEQUENTIAL}.
565
 * @param mode {@link Dynamic#ACCESS_RANDOM} or {@link Dynamic#ACCESS_SEQUENTIAL}.
611 566
 */
612 567
  public void setAccessMode(int mode)
613 568
    {
......
619 574
/**
620 575
 * Writes the results of interpolation between the Points at time 'time' to the passed float buffer.
621 576
 *
622
 * @param buffer Float buffer we will write the resulting Static1D to.
577
 * @param buffer Float buffer we will write the results to.
623 578
 * @param offset Offset in the buffer where to write the result.
624 579
 * @param time Time of interpolation. Time=0.0 would return the first Point, Time=0.5 - the last,
625 580
 *             time=1.0 - the first again, and time 0.1 would be 1/5 of the way between the first and the last Points.
626 581
 */
627

  
628 582
  public void interpolateMain(float[] buffer, int offset, long time)
629 583
    {
630 584
    if( mDuration<=0.0f )
......
649 603
 * This version differs from the previous in that it returns a boolean value which indicates whether
650 604
 * the interpolation is finished.
651 605
 *
652
 * @param buffer Float buffer we will write the resulting Static1D to.
606
 * @param buffer Float buffer we will write the results to.
653 607
 * @param offset Offset in the buffer where to write the result.
654 608
 * @param time Time of interpolation. Time=0.0 would return the first Point, Time=0.5 - the last,
655 609
 *             time=1.0 - the first again, and time 0.1 would be 1/5 of the way between the first and the last Points.

Also available in: Unified diff