From 8f1c6e1a8f961ec46a233087ecb323ea92fffc72 Mon Sep 17 00:00:00 2001 From: William McMurray Date: Sun, 6 Feb 2022 15:03:27 -0500 Subject: [PATCH] Rename shader variable to avoid name conflicts --- packages/troika-three-text/src/TextDerivedMaterial.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/troika-three-text/src/TextDerivedMaterial.js b/packages/troika-three-text/src/TextDerivedMaterial.js index 6460d4dc..fd9f4843 100644 --- a/packages/troika-three-text/src/TextDerivedMaterial.js +++ b/packages/troika-three-text/src/TextDerivedMaterial.js @@ -179,10 +179,10 @@ float troikaGetEdgeAlpha(float distance, float distanceOffset, float aaDist) { // language=GLSL prefix="void main() {" suffix="}" const FRAGMENT_TRANSFORM = ` float aaDist = troikaGetAADist(); -float distance = troikaGetFragDistValue(); +float fragDistance = troikaGetFragDistValue(); float edgeAlpha = uTroikaSDFDebug ? troikaGlyphUvToSdfValue(vTroikaGlyphUV) : - troikaGetEdgeAlpha(distance, uTroikaDistanceOffset, max(aaDist, uTroikaBlurRadius)); + troikaGetEdgeAlpha(fragDistance, uTroikaDistanceOffset, max(aaDist, uTroikaBlurRadius)); #if !defined(IS_DEPTH_MATERIAL) && !defined(IS_DISTANCE_MATERIAL) vec4 fillRGBA = gl_FragColor; @@ -192,7 +192,7 @@ if (fillRGBA.a == 0.0) fillRGBA.rgb = strokeRGBA.rgb; gl_FragColor = mix(fillRGBA, strokeRGBA, smoothstep( -uTroikaStrokeWidth - aaDist, -uTroikaStrokeWidth + aaDist, - distance + fragDistance )); gl_FragColor.a *= edgeAlpha; #endif