Project

General

Profile

« Previous | Next » 

Revision 78e89fb5

Added by Leszek Koltunski about 6 years ago

Properly recreate the Atomic and LinkedList buffers onPause.
We have to discard all alpha==0.0 pixels during OIT Pass1.

View differences:

src/main/java/org/distorted/library/main/Distorted.java
133 133

  
134 134
///////////////////////////////////////////////////////////////////////////////////////////////////
135 135
/**
136
 * Call this so that the Library can release its internal data structures.
136
 * Call this so that the Library can release the OpenGL related data that needs to be recreated.
137 137
 * Must be called from Activity.onPause().
138 138
 */
139 139
  public static void onPause()
140 140
    {
141 141
    DistortedObject.onPause();
142 142
    DistortedNode.onPause();
143
    DistortedEffects.onPause();
143 144
    }
144 145

  
145 146
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/library/main/DistortedEffects.java
506 506

  
507 507
///////////////////////////////////////////////////////////////////////////////////////////////////
508 508

  
509
  static void onDestroy()
509
  static void onPause()
510 510
    {
511
    mNextID           =  0;
512 511
    mLinkedListSSBO[0]= -1;
513 512
    mAtomicCounter[0] = -1;
514 513
    }
515 514

  
515
///////////////////////////////////////////////////////////////////////////////////////////////////
516

  
517
  static void onDestroy()
518
    {
519
    mNextID =  0;
520
    }
521

  
516 522
///////////////////////////////////////////////////////////////////////////////////////////////////
517 523
// PUBLIC API
518 524
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/res/raw/blit_depth_fragment_shader.glsl
123 123
    const float S= 2147483647.0; // max signed int. Could probably be max unsigned int but this is enough.
124 124
    insert(v_Pixel, uint(S*(1.0-depth)/2.0), convert(frag) );
125 125
    }
126
  else discard;
126 127
  }
src/main/res/raw/blit_depth_render_fragment_shader.glsl
64 64
    {
65 65
    u_Records[index] = 0u;
66 66

  
67
    vec4 color= vec4(0.0,0.0,1.0,1.0);//convert(u_Records[curr+2u]);
67
    vec4 color= convert(u_Records[curr+2u]);
68 68
    curr = u_Records[curr];
69 69

  
70 70
    while (curr > 0u)
71 71
      {
72
      color= vec4(0.0,0.0,0.0,1.0);//blend( color, convert(u_Records[curr+2u]) );  // keep walking the linked list
72
      color= blend( color, convert(u_Records[curr+2u]) );  // keep walking the linked list
73 73
      curr = u_Records[curr];                              // and blending the colors in
74 74
      }
75 75

  

Also available in: Unified diff