Project

General

Profile

« Previous | Next » 

Revision 12f9e4bb

Added by Leszek Koltunski almost 6 years ago

a mix of two changes:

1) remove the DistortedInputSurface interface (now every Surface is Input)
2) make the OIT SSBO self-adjustable in size

View differences:

src/main/java/org/distorted/library/main/DistortedNode.java
68 68
  private DistortedOutputSurface mSurfaceParent;
69 69
  private MeshObject mMesh;
70 70
  private DistortedEffects mEffects;
71
  private DistortedInputSurface mSurface;
71
  private DistortedSurface mSurface;
72 72
  private DistortedRenderState mState;
73 73
  private NodeData mData;
74 74
  private int mFboW, mFboH, mFboDepthStencil;
......
243 243

  
244 244
  int markStencilAndDepth(long currTime, DistortedOutputSurface surface, EffectQueuePostprocess queue)
245 245
    {
246
    DistortedInputSurface input = mNumChildren[0]==0 ? mSurface : mData.mFBO;
246
    DistortedSurface input = mNumChildren[0]==0 ? mSurface : mData.mFBO;
247 247

  
248 248
    if( input.setAsInput() )
249 249
      {
......
261 261

  
262 262
  int drawNoBlend(long currTime, DistortedOutputSurface surface)
263 263
    {
264
    DistortedInputSurface input = mNumChildren[0]==0 ? mSurface : mData.mFBO;
264
    DistortedSurface input = mNumChildren[0]==0 ? mSurface : mData.mFBO;
265 265

  
266 266
    if( input.setAsInput() )
267 267
      {
......
280 280

  
281 281
  int drawOIT(long currTime, DistortedOutputSurface surface)
282 282
    {
283
    DistortedInputSurface input = mNumChildren[0]==0 ? mSurface : mData.mFBO;
283
    DistortedSurface input = mNumChildren[0]==0 ? mSurface : mData.mFBO;
284 284

  
285 285
    if( input.setAsInput() )
286 286
      {
......
297 297

  
298 298
  int draw(long currTime, DistortedOutputSurface surface)
299 299
    {
300
    DistortedInputSurface input = mNumChildren[0]==0 ? mSurface : mData.mFBO;
300
    DistortedSurface input = mNumChildren[0]==0 ? mSurface : mData.mFBO;
301 301

  
302 302
    if( input.setAsInput() )
303 303
      {
......
392 392
 * @param effects DistortedEffects to put into the new Node.
393 393
 * @param mesh MeshObject to put into the new Node.
394 394
 */
395
  public DistortedNode(DistortedInputSurface surface, DistortedEffects effects, MeshObject mesh)
395
  public DistortedNode(DistortedSurface surface, DistortedEffects effects, MeshObject mesh)
396 396
    {
397 397
    mSurface       = surface;
398 398
    mEffects       = effects;
......
526 526
    mRenderWayOIT = oit;
527 527
    }
528 528

  
529
///////////////////////////////////////////////////////////////////////////////////////////////////
530
  /**
531
   * When rendering this Node, should we use the Order Independent Transparency render more?
532
   * <p>
533
   * There are two modes of rendering: the fast 'normal' way, which however renders transparent
534
   * fragments in different ways depending on which fragments get rendered first, or the slower
535
   * 'oit' way, which renders transparent fragments correctly regardless of their order.
536
   *
537
   * @param oit True if we want to render more slowly, but in a way which accounts for transparency.
538
   * @param initialSize Initial number of transparent fragments we expect, in screenfulls.
539
   *                    I.e '1.0' means 'the scene we are going to render contains about 1 screen
540
   *                    worth of transparent fragments'. Valid values: 0.0 &lt; initialSize &lt; 10.0
541
   *                    Even if you get this wrong, the library will detect that there are more
542
   *                    transparent fragments than it has space for and readjust its internal buffers,
543
   *                    but only after a few frames during which one will probably see missing objects.
544
   */
545
  public void setOrderIndependentTransparency(boolean oit, float initialSize)
546
    {
547
    mRenderWayOIT = oit;
548

  
549
    if( initialSize>0.0f && initialSize<10.0f )
550
      DistortedEffects.setSSBOSize(initialSize);
551
    }
552

  
529 553
///////////////////////////////////////////////////////////////////////////////////////////////////
530 554
/**
531 555
 * Adds a new child to the last position in the list of our Node's children.
......
553 577
 * @param mesh MeshObject to initialize our child Node with.
554 578
 * @return the newly constructed child Node, or null if we couldn't allocate resources.
555 579
 */
556
  public DistortedNode attach(DistortedInputSurface surface, DistortedEffects effects, MeshObject mesh)
580
  public DistortedNode attach(DistortedSurface surface, DistortedEffects effects, MeshObject mesh)
557 581
    {
558 582
    DistortedNode node = new DistortedNode(surface,effects,mesh);
559 583
    mJobs.add(new Job(ATTACH,node));
......
717 741
 *
718 742
 * @return The DistortedInputSurface contained in the Node.
719 743
 */
720
  public DistortedInputSurface getSurface()
744
  public DistortedSurface getSurface()
721 745
    {
722 746
    return mSurface;
723 747
    }

Also available in: Unified diff