Skip to content

Commit

Permalink
Fix texture coordinates everywhere instead of in just the one place.
Browse files Browse the repository at this point in the history
  • Loading branch information
kring committed Mar 31, 2020
1 parent d631c21 commit c5ac455
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
1 change: 0 additions & 1 deletion Source/Shaders/Materials/PolylineArrowMaterial.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 6 additions & 4 deletions Source/Shaders/PolylineFS.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 3 additions & 1 deletion Source/Shaders/PolylineVS.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit c5ac455

Please sign in to comment.