From c5ac4558cd4b740f26ad22c7531b5c5c5c1c62f2 Mon Sep 17 00:00:00 2001 From: Kevin Ring Date: Tue, 31 Mar 2020 15:12:03 +1100 Subject: [PATCH] Fix texture coordinates everywhere instead of in just the one place. --- Source/Shaders/Materials/PolylineArrowMaterial.glsl | 1 - Source/Shaders/PolylineFS.glsl | 10 ++++++---- Source/Shaders/PolylineVS.glsl | 4 +++- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Source/Shaders/Materials/PolylineArrowMaterial.glsl b/Source/Shaders/Materials/PolylineArrowMaterial.glsl index 1ba94051c9e2..b01bb6e1dcad 100644 --- a/Source/Shaders/Materials/PolylineArrowMaterial.glsl +++ b/Source/Shaders/Materials/PolylineArrowMaterial.glsl @@ -12,7 +12,6 @@ float getPointOnLine(vec2 p0, vec2 p1, float x) czm_material czm_getMaterial(czm_materialInput materialInput) { - materialInput.st.t *= gl_FragCoord.w; czm_material material = czm_getDefaultMaterial(materialInput); vec2 st = materialInput.st; diff --git a/Source/Shaders/PolylineFS.glsl b/Source/Shaders/PolylineFS.glsl index a65e6753598a..471237f6172e 100644 --- a/Source/Shaders/PolylineFS.glsl +++ b/Source/Shaders/PolylineFS.glsl @@ -8,10 +8,12 @@ void main() { czm_materialInput materialInput; - vec2 stNonPerspective = czm_readNonPerspective(v_st, gl_FragCoord.w); - materialInput.s = stNonPerspective.s; - materialInput.st = stNonPerspective; - materialInput.str = vec3(stNonPerspective, 0.0); + vec2 st = v_st; + st.t *= gl_FragCoord.w; + + materialInput.s = st.s; + materialInput.st = st; + materialInput.str = vec3(st, 0.0); czm_material material = czm_getMaterial(materialInput); gl_FragColor = vec4(material.diffuse + material.emission, material.alpha); diff --git a/Source/Shaders/PolylineVS.glsl b/Source/Shaders/PolylineVS.glsl index ef21adae82d1..5d518fa0bf29 100644 --- a/Source/Shaders/PolylineVS.glsl +++ b/Source/Shaders/PolylineVS.glsl @@ -94,7 +94,9 @@ void main() vec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev, polylineAngle); gl_Position = czm_viewportOrthographic * positionWC * show; - v_st = czm_writeNonPerspective(vec2(texCoord, clamp(expandDir, 0.0, 1.0)), gl_Position.w); + v_st.s = texCoord; + v_st.t = clamp(expandDir, 0.0, 1.0) * gl_Position.w; + v_width = czm_writeNonPerspective(width, gl_Position.w); v_pickColor = czm_writeNonPerspective(pickColor, gl_Position.w); v_polylineAngle = czm_writeNonPerspective(polylineAngle, gl_Position.w);