| 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 |
/**
|
Remove old facility to correct Postprocessing buckets on new Postporcessing effects.
New facility will follow shortly....