Revision 7f30ed38
Added by Leszek Koltunski over 7 years ago
| src/main/java/org/distorted/library/main/DistortedOutputSurface.java | ||
|---|---|---|
| 336 | 336 |
|
| 337 | 337 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 338 | 338 |
|
| 339 |
private int oitBuild(long currTime, DistortedOutputSurface buffer)
|
|
| 339 |
private int oitBuild(DistortedOutputSurface buffer) |
|
| 340 | 340 |
{
|
| 341 | 341 |
GLES31.glViewport(0, 0, mWidth, mHeight); |
| 342 |
setAsOutput(currTime);
|
|
| 342 |
setAsOutput(); |
|
| 343 | 343 |
GLES31.glActiveTexture(GLES31.GL_TEXTURE0); |
| 344 | 344 |
GLES31.glBindTexture(GLES31.GL_TEXTURE_2D, buffer.mColorH[0]); |
| 345 | 345 |
GLES31.glActiveTexture(GLES31.GL_TEXTURE1); |
| ... | ... | |
| 450 | 450 |
} |
| 451 | 451 |
|
| 452 | 452 |
numRenders += lastQueue.postprocess(mBuffer); |
| 453 |
numRenders += mBufferOIT.oitBuild(time, mBuffer[quality]);
|
|
| 453 |
numRenders += mBufferOIT.oitBuild(mBuffer[quality]); |
|
| 454 | 454 |
clearBuffer(mBuffer[quality]); |
| 455 | 455 |
} |
| 456 | 456 |
|
| ... | ... | |
| 471 | 471 |
} |
| 472 | 472 |
|
| 473 | 473 |
numRenders += currQueue.postprocess(mBuffer); |
| 474 |
numRenders += mBufferOIT.oitBuild(time, mBuffer[quality]);
|
|
| 474 |
numRenders += mBufferOIT.oitBuild(mBuffer[quality]); |
|
| 475 | 475 |
GLES31.glMemoryBarrier(GLES31.GL_SHADER_STORAGE_BARRIER_BIT); |
| 476 | 476 |
numRenders += oitRender(time,mBufferOIT); // merge the OIT linked list |
| 477 | 477 |
clearBuffer(mBuffer[quality]); |
| src/main/res/raw/normal_fragment_shader.glsl | ||
|---|---|---|
| 19 | 19 |
|
| 20 | 20 |
precision lowp float; |
| 21 | 21 |
|
| 22 |
#if __VERSION__ != 100 |
|
| 23 | 22 |
out vec4 fragColor; |
| 24 |
#define FRAG_COLOR fragColor |
|
| 25 |
#else |
|
| 26 |
#define FRAG_COLOR gl_FragColor |
|
| 27 |
#endif |
|
| 28 | 23 |
|
| 29 | 24 |
////////////////////////////////////////////////////////////////////////////////////////////// |
| 30 | 25 |
|
| 31 | 26 |
void main() |
| 32 | 27 |
{
|
| 33 |
FRAG_COLOR = vec4(1.0,0.0,0.0,1.0);
|
|
| 28 |
fragColor = vec4(1.0,0.0,0.0,1.0);
|
|
| 34 | 29 |
} |
| src/main/res/raw/normal_vertex_shader.glsl | ||
|---|---|---|
| 19 | 19 |
|
| 20 | 20 |
precision lowp float; |
| 21 | 21 |
|
| 22 |
#if __VERSION__ != 100 |
|
| 23 | 22 |
in vec3 a_Position; |
| 24 |
#else |
|
| 25 |
attribute vec3 a_Position; |
|
| 26 |
#endif |
|
| 27 |
|
|
| 28 | 23 |
uniform mat4 u_MVPMatrix; |
| 29 | 24 |
|
| 30 | 25 |
////////////////////////////////////////////////////////////////////////////////////////////// |
| 31 | 26 |
|
| 32 | 27 |
void main() |
| 33 | 28 |
{
|
| 34 |
gl_Position = u_MVPMatrix*vec4( a_Position, 1.0);
|
|
| 29 |
gl_Position = u_MVPMatrix * vec4(a_Position, 1.0);
|
|
| 35 | 30 |
} |
| src/main/res/raw/oit_build_fragment_shader.glsl | ||
|---|---|---|
| 80 | 80 |
curr = u_Records[prev]; |
| 81 | 81 |
} |
| 82 | 82 |
} |
| 83 |
|
|
| 84 |
discard; |
|
| 85 | 83 |
} |
| 86 | 84 |
} |
| 87 | 85 |
|
| ... | ... | |
| 97 | 95 |
|
| 98 | 96 |
void main() |
| 99 | 97 |
{
|
| 100 |
vec4 frag = texture(u_Texture , v_TexCoordinate);
|
|
| 98 |
vec4 frag = texture(u_Texture , v_TexCoordinate);
|
|
| 101 | 99 |
float depth= texture(u_DepthTexture, v_TexCoordinate).r; |
| 102 | 100 |
|
| 103 | 101 |
if( frag.a > 0.95 ) |
Also available in: Unified diff
OIT: more bugfixes