Revision e029600f
Added by Leszek Koltunski about 6 years ago
src/main/java/org/distorted/library/main/DistortedEffects.java | ||
---|---|---|
70 | 70 |
|
71 | 71 |
/// BLIT DEPTH PROGRAM /// |
72 | 72 |
private static DistortedProgram mBlitDepthProgram; |
73 |
private static int mBlitDepthTextureH; |
|
74 |
private static int mBlitDepthDepthTextureH; |
|
75 |
private static int mBlitDepthDepthH; |
|
76 |
private static int mBlitDepthTexCorrH; |
|
77 | 73 |
private static int mBlitDepthSizeH; |
78 |
private static int mBlitDepthNumRecordsH; |
|
79 | 74 |
|
80 | 75 |
private static int[] mLinkedListSSBO = new int[1]; |
81 | 76 |
private static int[] mAtomicCounter = new int[1]; |
... | ... | |
95 | 90 |
|
96 | 91 |
/// BLIT DEPTH RENDER PROGRAM /// |
97 | 92 |
private static DistortedProgram mBlitDepthRenderProgram; |
98 |
private static int mBlitDepthRenderDepthTextureH; |
|
99 |
private static int mBlitDepthRenderDepthH; |
|
100 |
private static int mBlitDepthRenderTexCorrH; |
|
101 | 93 |
private static int mBlitDepthRenderSizeH; |
102 | 94 |
|
103 | 95 |
/// NORMAL PROGRAM ///// |
... | ... | |
192 | 184 |
} |
193 | 185 |
|
194 | 186 |
int blitDepthProgramH = mBlitDepthProgram.getProgramHandle(); |
195 |
mBlitDepthTextureH = GLES31.glGetUniformLocation( blitDepthProgramH, "u_Texture"); |
|
196 |
mBlitDepthDepthTextureH = GLES31.glGetUniformLocation( blitDepthProgramH, "u_DepthTexture"); |
|
197 |
mBlitDepthDepthH = GLES31.glGetUniformLocation( blitDepthProgramH, "u_Depth"); |
|
198 |
mBlitDepthTexCorrH = GLES31.glGetUniformLocation( blitDepthProgramH, "u_TexCorr"); |
|
199 | 187 |
mBlitDepthSizeH = GLES31.glGetUniformLocation( blitDepthProgramH, "u_Size"); |
200 |
mBlitDepthNumRecordsH = GLES31.glGetUniformLocation( blitDepthProgramH, "u_numRecords"); |
|
201 | 188 |
|
202 | 189 |
mIntBuffer = ByteBuffer.allocateDirect(4).order(ByteOrder.nativeOrder()).asIntBuffer(); |
203 | 190 |
mIntBuffer.put(0,0); |
... | ... | |
237 | 224 |
} |
238 | 225 |
|
239 | 226 |
int blitDepthRenderProgramH = mBlitDepthRenderProgram.getProgramHandle(); |
240 |
mBlitDepthRenderDepthTextureH = GLES31.glGetUniformLocation( blitDepthRenderProgramH, "u_DepthTexture"); |
|
241 |
mBlitDepthRenderDepthH = GLES31.glGetUniformLocation( blitDepthRenderProgramH, "u_Depth"); |
|
242 |
mBlitDepthRenderTexCorrH = GLES31.glGetUniformLocation( blitDepthRenderProgramH, "u_TexCorr"); |
|
243 | 227 |
mBlitDepthRenderSizeH = GLES31.glGetUniformLocation( blitDepthRenderProgramH, "u_Size"); |
244 | 228 |
|
245 | 229 |
// NORMAL PROGRAM ////////////////////////////////////// |
... | ... | |
402 | 386 |
mBlitDepthProgram.useProgram(); |
403 | 387 |
|
404 | 388 |
GLES31.glViewport(0, 0, surface.mWidth, surface.mHeight ); |
405 |
GLES31.glUniform1i(mBlitDepthTextureH, 0); |
|
406 |
GLES31.glUniform1i(mBlitDepthDepthTextureH, 1); |
|
407 |
GLES31.glUniform2f(mBlitDepthTexCorrH, corrW, corrH ); |
|
408 |
GLES31.glUniform2i(mBlitDepthSizeH, surface.mWidth, surface.mHeight); |
|
409 |
GLES31.glUniform1ui(mBlitDepthNumRecordsH, (mBufferSize-surface.mWidth*surface.mHeight)/3 ); // see the fragment shader |
|
410 |
GLES31.glUniform1f(mBlitDepthDepthH , 1.0f-surface.mNear); |
|
389 |
GLES31.glUniform2f(mBlitDepthSizeH, surface.mWidth, surface.mHeight); |
|
411 | 390 |
GLES31.glVertexAttribPointer(mBlitDepthProgram.mAttribute[0], 2, GLES31.GL_FLOAT, false, 0, mQuadPositions); |
412 | 391 |
GLES31.glDrawArrays(GLES31.GL_TRIANGLE_STRIP, 0, 4); |
413 | 392 |
} |
... | ... | |
420 | 399 |
{ |
421 | 400 |
mBlitDepthRenderProgram.useProgram(); |
422 | 401 |
|
423 |
analyzeBuffer(surface.mWidth, surface.mHeight); |
|
402 |
//analyzeBuffer(surface.mWidth, surface.mHeight);
|
|
424 | 403 |
|
425 | 404 |
GLES31.glViewport(0, 0, surface.mWidth, surface.mHeight ); |
426 |
GLES31.glUniform1i(mBlitDepthRenderDepthTextureH, 1); |
|
427 |
GLES31.glUniform2f(mBlitDepthRenderTexCorrH, corrW, corrH ); |
|
428 |
GLES31.glUniform2i(mBlitDepthRenderSizeH, surface.mWidth, surface.mHeight); |
|
429 |
GLES31.glUniform1f( mBlitDepthRenderDepthH , 1.0f-surface.mNear); |
|
405 |
GLES31.glUniform2f(mBlitDepthRenderSizeH, surface.mWidth, surface.mHeight); |
|
430 | 406 |
GLES31.glVertexAttribPointer(mBlitDepthRenderProgram.mAttribute[0], 2, GLES31.GL_FLOAT, false, 0, mQuadPositions); |
431 | 407 |
GLES31.glDrawArrays(GLES31.GL_TRIANGLE_STRIP, 0, 4); |
432 | 408 |
|
... | ... | |
442 | 418 |
private static void analyzeBuffer(int w, int h) |
443 | 419 |
{ |
444 | 420 |
int ptr; |
445 |
final int GREEN = (255<<16) + 255;
|
|
446 |
final int RED = (255<<24) + 255;
|
|
421 |
final int GREEN = 1;
|
|
422 |
final int RED = 2;
|
|
447 | 423 |
|
448 | 424 |
int left1=0, left2=0; |
449 | 425 |
int right1=0, right2=0; |
Also available in: Unified diff
still debugging the OIT