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/DistortedOutputSurface.java
311 311

  
312 312
  private static void oitClear(DistortedOutputSurface buffer)
313 313
    {
314
    DistortedEffects.zeroOutAtomic();
315
    DistortedEffects.oitClear(buffer);
314
    int counter = DistortedEffects.zeroOutAtomic();
315
    DistortedEffects.oitClear(buffer,counter);
316 316
    GLES31.glMemoryBarrier(GLES31.GL_SHADER_STORAGE_BARRIER_BIT|GLES31.GL_ATOMIC_COUNTER_BARRIER_BIT);
317 317
    }
318 318

  
......
881 881
    mRenderWayOIT = oit;
882 882
    }
883 883

  
884
///////////////////////////////////////////////////////////////////////////////////////////////////
885
/**
886
 * When rendering this Node, should we use the Order Independent Transparency render more?
887
 * <p>
888
 * There are two modes of rendering: the fast 'normal' way, which however renders transparent
889
 * fragments in different ways depending on which fragments get rendered first, or the slower
890
 * 'oit' way, which renders transparent fragments correctly regardless of their order.
891
 *
892
 * @param oit True if we want to render more slowly, but in a way which accounts for transparency.
893
 * @param initialSize Initial number of transparent fragments we expect, in screenfuls.
894
 *                    I.e '1.0' means 'the scene we are going to render contains about 1 screen
895
 *                    worth of transparent fragments'. Valid values: 0.0 &lt; initialSize &lt; 10.0
896
 *                    Even if you get this wrong, the library will detect that there are more
897
 *                    transparent fragments than it has space for and readjust its internal buffers,
898
 *                    but only after a few frames during which one will probably see missing objects.
899
 */
900
public void setOrderIndependentTransparency(boolean oit, float initialSize)
901
  {
902
  mRenderWayOIT = oit;
903

  
904
  if( initialSize>0.0f && initialSize<10.0f )
905
    DistortedEffects.setSSBOSize(initialSize);
906
  }
907

  
884 908
///////////////////////////////////////////////////////////////////////////////////////////////////
885 909
/**
886 910
 * Adds a new child to the last position in the list of our Surface's children.
......
908 932
 * @param mesh MeshObject to initialize our child Node with.
909 933
 * @return the newly constructed child Node, or null if we couldn't allocate resources.
910 934
 */
911
  public DistortedNode attach(DistortedInputSurface surface, DistortedEffects effects, MeshObject mesh)
935
  public DistortedNode attach(DistortedSurface surface, DistortedEffects effects, MeshObject mesh)
912 936
    {
913 937
    DistortedNode node = new DistortedNode(surface,effects,mesh);
914 938
    mJobs.add(new Job(ATTACH,node));

Also available in: Unified diff