diff options
author | Arisotura <thetotalworm@gmail.com> | 2019-06-12 02:23:40 +0200 |
---|---|---|
committer | Arisotura <thetotalworm@gmail.com> | 2019-06-12 02:23:40 +0200 |
commit | a3fed77da315fa957e13bc13092087e1dfe91079 (patch) | |
tree | 57d0a2ae5f5a9ff1649f167b6086e5571c9cea15 | |
parent | 711fda469e4dc33903f1e0911ec665a06122e53b (diff) |
somewhat better edge marking
-rw-r--r-- | src/GPU3D_OpenGL.cpp | 4 | ||||
-rw-r--r-- | src/GPU3D_OpenGL_shaders.h | 24 |
2 files changed, 23 insertions, 5 deletions
diff --git a/src/GPU3D_OpenGL.cpp b/src/GPU3D_OpenGL.cpp index cb62e33..94ef079 100644 --- a/src/GPU3D_OpenGL.cpp +++ b/src/GPU3D_OpenGL.cpp @@ -447,6 +447,7 @@ void UpdateDisplaySettings() glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); glBindTexture(GL_TEXTURE_2D, FramebufferTex[4]); glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH24_STENCIL8, ScreenW, ScreenH, 0, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, NULL); + //glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH32F_STENCIL8, ScreenW, ScreenH, 0, GL_DEPTH_STENCIL, GL_FLOAT_32_UNSIGNED_INT_24_8_REV, NULL); glBindTexture(GL_TEXTURE_2D, FramebufferTex[5]); //glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8UI, ScreenW, ScreenH, 0, GL_RGB_INTEGER, GL_UNSIGNED_BYTE, NULL); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, ScreenW, ScreenH, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL); @@ -476,7 +477,8 @@ void UpdateDisplaySettings() glBindBuffer(GL_PIXEL_PACK_BUFFER, PixelbufferID); glBufferData(GL_PIXEL_PACK_BUFFER, 256*192*4, NULL, GL_DYNAMIC_READ); - glLineWidth(scale); + //glLineWidth(scale); + glLineWidth(1.5); } diff --git a/src/GPU3D_OpenGL_shaders.h b/src/GPU3D_OpenGL_shaders.h index 3a3c69c..964981e 100644 --- a/src/GPU3D_OpenGL_shaders.h +++ b/src/GPU3D_OpenGL_shaders.h @@ -88,16 +88,28 @@ out vec4 oColor; // make up for crapo zbuffer precision bool isless(float a, float b) -{return true; +{ + return a < b; + // a < b float diff = a - b; return diff < (256.0 / 16777216.0); } +bool isgood(vec4 attr, float depth, int refPolyID, float refDepth) +{ + int polyid = int(attr.r * 63.0); + + if (polyid != refPolyID && isless(refDepth, depth)) + return true; + + return false; +} + void main() { ivec2 coord = ivec2(gl_FragCoord.xy); - int scale = int(uScreenSize.x / 256); + int scale = 1;//int(uScreenSize.x / 256); vec4 ret = vec4(0,0,0,0); vec4 depth = texelFetch(DepthBuffer, coord, 0); @@ -116,10 +128,14 @@ void main() vec4 depthR = texelFetch(DepthBuffer, coord + ivec2(scale,0), 0); vec4 attrR = texelFetch(AttrBuffer, coord + ivec2(scale,0), 0); - if ((polyid != int(attrU.r * 63.0) && isless(depth.r, depthU.r)) || + /*if ((polyid != int(attrU.r * 63.0) && isless(depth.r, depthU.r)) || (polyid != int(attrD.r * 63.0) && isless(depth.r, depthD.r)) || (polyid != int(attrL.r * 63.0) && isless(depth.r, depthL.r)) || - (polyid != int(attrR.r * 63.0) && isless(depth.r, depthR.r))) + (polyid != int(attrR.r * 63.0) && isless(depth.r, depthR.r)))*/ + if (isgood(attrU, depthU.r, polyid, depth.r) || + isgood(attrD, depthD.r, polyid, depth.r) || + isgood(attrL, depthL.r, polyid, depth.r) || + isgood(attrR, depthR.r, polyid, depth.r)) { // mark this pixel! |