Project

General

Profile

« Previous | Next » 

Revision ffbe7ecf

Added by Leszek Koltunski over 7 years ago

Remove old facility to correct Postprocessing buckets on new Postporcessing effects.

New facility will follow shortly....

View differences:

src/main/java/org/distorted/library/main/DistortedNode.java
48 48
    {
49 49
    int type;
50 50
    DistortedNode node;
51
    DistortedEffectsPostprocess dep;
52 51

  
53
    Job(int t, DistortedNode n, DistortedEffectsPostprocess d)
52
    Job(int t, DistortedNode n)
54 53
      {
55 54
      type = t;
56 55
      node = n;
57
      dep  = d;
58 56
      }
59 57
    }
60 58

  
......
67 65
  private DistortedOutputSurface mSurfaceParent;
68 66
  private MeshObject mMesh;
69 67
  private DistortedEffects mEffects;
70
  private DistortedEffectsPostprocess mPostprocess;
71 68
  private DistortedInputSurface mSurface;
72 69
  private DistortedRenderState mState;
73 70
  private NodeData mData;
......
330 327
    return numRenders;
331 328
    }
332 329

  
333
///////////////////////////////////////////////////////////////////////////////////////////////////
334

  
335
  private void newJob(int t, DistortedNode n, DistortedEffectsPostprocess d)
336
    {
337
    mJobs.add(new Job(t,n,d));
338
    }
339

  
340
///////////////////////////////////////////////////////////////////////////////////////////////////
341

  
342
  void setPost(DistortedEffectsPostprocess dep)
343
    {
344
    mPostprocess = dep;
345
    }
346

  
347 330
///////////////////////////////////////////////////////////////////////////////////////////////////
348 331

  
349 332
  void setSurfaceParent(DistortedOutputSurface dep)
......
366 349
    {
367 350
    mSurface       = surface;
368 351
    mEffects       = effects;
369
    mPostprocess   = null;
370 352
    mMesh          = mesh;
371 353
    mState         = new DistortedRenderState();
372 354
    mChildren      = null;
......
409 391
  public DistortedNode(DistortedNode node, int flags)
410 392
    {
411 393
    mEffects      = new DistortedEffects(node.mEffects,flags);
412
    mPostprocess  = null;
413 394
    mMesh         = node.mMesh;
414 395
    mState        = new DistortedRenderState();
415 396
    mParent       = null;
......
488 469
 */
489 470
  public void attach(DistortedNode node)
490 471
    {
491
    mJobs.add(new Job(ATTACH,node,null));
472
    mJobs.add(new Job(ATTACH,node));
492 473
    DistortedMaster.newSlave(this);
493 474
    }
494 475

  
......
507 488
  public DistortedNode attach(DistortedInputSurface surface, DistortedEffects effects, MeshObject mesh)
508 489
    {
509 490
    DistortedNode node = new DistortedNode(surface,effects,mesh);
510
    mJobs.add(new Job(ATTACH,node,null));
491
    mJobs.add(new Job(ATTACH,node));
511 492
    DistortedMaster.newSlave(this);
512 493
    return node;
513 494
    }
......
523 504
 */
524 505
  public void detach(DistortedNode node)
525 506
    {
526
    mJobs.add(new Job(DETACH,node,null));
507
    mJobs.add(new Job(DETACH,node));
527 508
    DistortedMaster.newSlave(this);
528 509
    }
529 510

  
......
552 533
      if( node.getEffects().getID()==id )
553 534
        {
554 535
        detached = true;
555
        mJobs.add(new Job(DETACH,node,null));
536
        mJobs.add(new Job(DETACH,node));
556 537
        DistortedMaster.newSlave(this);
557 538
        break;
558 539
        }
......
587 568
 */
588 569
  public void detachAll()
589 570
    {
590
    mJobs.add(new Job(DETALL,null,null));
571
    mJobs.add(new Job(DETALL,null));
591 572
    DistortedMaster.newSlave(this);
592 573
    }
593 574

  
......
642 623
                       mNumChildren[0] = 0;
643 624
                       }
644 625
                     break;
645
        case SORT  : job.node.mPostprocess = job.dep;
646
                     mChildren.remove(job.node);
626
        case SORT  : mChildren.remove(job.node);
647 627
                     DistortedMaster.addSorted(mChildren,job.node);
648 628
                     break;
649 629
        }
......
651 631

  
652 632
    if( numChanges>0 ) adjustIsomorphism();
653 633
    }
654
///////////////////////////////////////////////////////////////////////////////////////////////////
655
/**
656
 * Sets the Postprocessing Effects we will apply to the temporary buffer this Node - and fellow siblings
657
 * with the same Effects - will get rendered to.
658
 * <p>
659
 * For efficiency reasons, it is very important to assign the very same DistortedEffectsPostprocess
660
 * object to all the DistortedNode siblings that are supposed to be postprocessed in the same way,
661
 * because only then will the library assign all such siblings to the same 'Bucket' which gets rendered
662
 * to the same offscreen buffer which then gets postprocessed in one go and subsequently merged to the
663
 * target Surface.
664
 */
665
  public void setPostprocessEffects(DistortedEffectsPostprocess dep)
666
    {
667
    if( mParent!=null )
668
      {
669
      mParent.newJob(SORT, this, dep);
670
      DistortedMaster.newSlave(mParent);
671
      }
672
    else if( mSurfaceParent!=null )
673
      {
674
      mSurfaceParent.newJob(SORT, this, dep);
675
      DistortedMaster.newSlave(mSurfaceParent);
676
      }
677
    else
678
      {
679
      mPostprocess = dep;
680
      }
681
    }
682 634

  
683 635
///////////////////////////////////////////////////////////////////////////////////////////////////
684 636
/**
src/main/java/org/distorted/library/main/DistortedOutputSurface.java
60 60
    {
61 61
    int type;
62 62
    DistortedNode node;
63
    DistortedEffectsPostprocess dep;
64 63

  
65
    Job(int t, DistortedNode n, DistortedEffectsPostprocess d)
64
    Job(int t, DistortedNode n)
66 65
      {
67 66
      type = t;
68 67
      node = n;
69
      dep  = d;
70 68
      }
71 69
    }
72 70

  
......
319 317

  
320 318
///////////////////////////////////////////////////////////////////////////////////////////////////
321 319

  
322
  void newJob(int t, DistortedNode n, DistortedEffectsPostprocess d)
320
  void newJob(int t, DistortedNode n)
323 321
    {
324
    mJobs.add(new Job(t,n,d));
322
    mJobs.add(new Job(t,n));
325 323
    }
326 324

  
327 325
///////////////////////////////////////////////////////////////////////////////////////////////////
......
608 606
 */
609 607
  public void attach(DistortedNode node)
610 608
    {
611
    mJobs.add(new Job(ATTACH,node,null));
609
    mJobs.add(new Job(ATTACH,node));
612 610
    DistortedMaster.newSlave(this);
613 611
    }
614 612

  
......
627 625
  public DistortedNode attach(DistortedInputSurface surface, DistortedEffects effects, MeshObject mesh)
628 626
    {
629 627
    DistortedNode node = new DistortedNode(surface,effects,mesh);
630
    mJobs.add(new Job(ATTACH,node,null));
628
    mJobs.add(new Job(ATTACH,node));
631 629
    DistortedMaster.newSlave(this);
632 630
    return node;
633 631
    }
......
657 655
      if( node.getEffects().getID()==id )
658 656
        {
659 657
        detached = true;
660
        mJobs.add(new Job(DETACH,node,null));
658
        mJobs.add(new Job(DETACH,node));
661 659
        DistortedMaster.newSlave(this);
662 660
        break;
663 661
        }
......
694 692
 */
695 693
  public void detach(DistortedNode node)
696 694
    {
697
    mJobs.add(new Job(DETACH,node,null));
695
    mJobs.add(new Job(DETACH,node));
698 696
    DistortedMaster.newSlave(this);
699 697
    }
700 698

  
......
707 705
 */
708 706
  public void detachAll()
709 707
    {
710
    mJobs.add(new Job(DETALL,null,null));
708
    mJobs.add(new Job(DETALL,null));
711 709
    DistortedMaster.newSlave(this);
712 710
    }
713 711

  
......
754 752
                       mNumChildren = 0;
755 753
                       }
756 754
                     break;
757
        case SORT  : job.node.setPost(job.dep);
758
                     mChildren.remove(job.node);
755
        case SORT  : mChildren.remove(job.node);
759 756
                     DistortedMaster.addSorted(mChildren,job.node);
760 757
                     break;
761 758
        }

Also available in: Unified diff