From 536ac29c94cc9c6e89f96a8ee8fd8e834ca3aaaf Mon Sep 17 00:00:00 2001 From: Joakim Kilby Date: Fri, 21 Jul 2023 10:12:09 +0200 Subject: [PATCH] back to padd-triangles. don't fade line during rendering --- modules/globebrowsing/shaders/asdf_fs.glsl | 8 +----- modules/globebrowsing/shaders/asdf_gs.glsl | 28 ++++++++++++------- .../src/tileprovider/asdftileprovider.cpp | 2 +- 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/modules/globebrowsing/shaders/asdf_fs.glsl b/modules/globebrowsing/shaders/asdf_fs.glsl index e7402b99cd..770edfbd44 100644 --- a/modules/globebrowsing/shaders/asdf_fs.glsl +++ b/modules/globebrowsing/shaders/asdf_fs.glsl @@ -25,15 +25,9 @@ #include "fragment.glsl" uniform vec3 color; -uniform vec2 viewport; -uniform float lineWidth; - -in vec2 center; Fragment getFragment() { - float dist = 1.0 - 2 * length(gl_FragCoord.xy - center) / lineWidth; - float alpha = smoothstep(0, 1, dist); Fragment frag; - frag.color = vec4(vec3(color), alpha); + frag.color = vec4(vec3(color), 1); return frag; } diff --git a/modules/globebrowsing/shaders/asdf_gs.glsl b/modules/globebrowsing/shaders/asdf_gs.glsl index 8639291a9a..f38d581683 100644 --- a/modules/globebrowsing/shaders/asdf_gs.glsl +++ b/modules/globebrowsing/shaders/asdf_gs.glsl @@ -30,8 +30,6 @@ layout (triangle_strip, max_vertices = 6) out; uniform vec2 viewport; uniform float lineWidth; -out vec2 center; - void main() { vec4 p0 = gl_in[0].gl_Position; @@ -66,32 +64,42 @@ void main() vec4 pos; pos = p1; - pos.xy += m1 * lineWidth * 0.5; - center = p1.xy; + pos.xy += np * lineWidth * 0.5; pos.xy = 2 * pos.xy / viewport - 1; pos.xyz *= pos.w; gl_Position = pos; EmitVertex(); pos = p1; - pos.xy -= m1 * lineWidth * 0.5; - center = p1.xy; + pos.xy += nl * lineWidth * 0.5; + pos.xy = 2 * pos.xy / viewport - 1; + pos.xyz *= pos.w; + gl_Position = pos; + EmitVertex(); + + pos = p1; + pos.xy -= nl * lineWidth * 0.5; pos.xy = 2 * pos.xy / viewport - 1; pos.xyz *= pos.w; gl_Position = pos; EmitVertex(); pos = p2; - pos.xy += m2 * lineWidth * 0.5; - center = p2.xy; + pos.xy += nl * lineWidth * 0.5; pos.xy = 2 * pos.xy / viewport - 1; pos.xyz *= pos.w; gl_Position = pos; EmitVertex(); pos = p2; - pos.xy -= m2 * lineWidth * 0.5; - center = p2.xy; + pos.xy -= nl * lineWidth * 0.5; + pos.xy = 2 * pos.xy / viewport - 1; + pos.xyz *= pos.w; + gl_Position = pos; + EmitVertex(); + + pos = p2; + pos.xy -= nn * lineWidth * 0.5; pos.xy = 2 * pos.xy / viewport - 1; pos.xyz *= pos.w; gl_Position = pos; diff --git a/modules/globebrowsing/src/tileprovider/asdftileprovider.cpp b/modules/globebrowsing/src/tileprovider/asdftileprovider.cpp index a6416af9a8..b9bad3886c 100644 --- a/modules/globebrowsing/src/tileprovider/asdftileprovider.cpp +++ b/modules/globebrowsing/src/tileprovider/asdftileprovider.cpp @@ -138,7 +138,7 @@ AsdfTileProvider::AsdfTileProvider(const ghoul::Dictionary& dictionary) : _startTime(StartTimeInfo), _resolution(ResolutionInfo, 4096, 256, OpenGLCap.max2DTextureSize()), _color(ColorInfo, glm::vec3(1.f), glm::vec3(1.f), glm::vec3(1.f)), - _lineWidth(LineWidthInfo, 10.f, 1.f, 250.f), + _lineWidth(LineWidthInfo, 10.f, 1.f, 1000.f), _renderFullAsdf(RenderFullAsdfInfo, false), _renderingMode(RenderingModeInfo, openspace::properties::OptionProperty::DisplayType::Dropdown),