Mercurial > hg > orthanc-stone
diff Framework/Scene2D/Internals/OpenGLFloatTextureProgram.cpp @ 860:238693c3bc51 am-dev
merge default -> am-dev
author | Alain Mazy <alain@mazy.be> |
---|---|
date | Mon, 24 Jun 2019 14:35:00 +0200 |
parents | ed783cbc92d7 |
children | 4d1f57773b5b |
line wrap: on
line diff
--- a/Framework/Scene2D/Internals/OpenGLFloatTextureProgram.cpp Wed Jun 19 17:36:33 2019 +0200 +++ b/Framework/Scene2D/Internals/OpenGLFloatTextureProgram.cpp Mon Jun 24 14:35:00 2019 +0200 @@ -29,28 +29,28 @@ static const char* FRAGMENT_SHADER = ORTHANC_STONE_OPENGL_SHADER_VERSION_DIRECTIVE - "uniform float u_offset; \n" - "uniform float u_slope; \n" - "uniform float u_windowCenter; \n" - "uniform float u_windowWidth; \n" - "uniform sampler2D u_texture; \n" - "varying vec2 v_texcoord; \n" - "void main() \n" - "{ \n" - " vec4 t = texture2D(u_texture, v_texcoord); \n" - " float v = (t.r * 256.0 + t.g) * 256.0; \n" - " v = v * u_slope + u_offset; \n" // (*) - " float a = u_windowCenter - u_windowWidth; \n" - " float dy = 1.0 / (2.0 * u_windowWidth); \n" - " if (v <= a) \n" - " v = 0.0; \n" - " else \n" - " { \n" - " v = (v - a) * dy; \n" - " if (v >= 1.0) \n" - " v = 1.0; \n" - " } \n" - " gl_FragColor = vec4(v, v, v, 1); \n" + "uniform float u_offset; \n" + "uniform float u_slope; \n" + "uniform float u_windowCenter; \n" + "uniform float u_windowWidth; \n" + "uniform sampler2D u_texture; \n" + "varying vec2 v_texcoord; \n" + "void main() \n" + "{ \n" + " vec4 t = texture2D(u_texture, v_texcoord); \n" + " float v = (t.r * 256.0 + t.g) * 256.0; \n" + " v = v * u_slope + u_offset; \n" // (*) + " float a = u_windowCenter - u_windowWidth / 2.0; \n" + " float dy = 1.0 / u_windowWidth; \n" + " if (v <= a) \n" + " v = 0.0; \n" + " else \n" + " { \n" + " v = (v - a) * dy; \n" + " if (v >= 1.0) \n" + " v = 1.0; \n" + " } \n" + " gl_FragColor = vec4(v, v, v, 1); \n" "}";