@@ -85,11 +85,33 @@ void main() {
8585 if (uv.y < 0.0 || uv.y > 1.0) {
8686 discard;
8787 }
88- vec2 delta = abs(fragPx - center);
89- if (delta.x > 0.5 * uSquare || delta.y > 0.5 * uSquare) {
90- discard;
91- }
9288 float markerType = markerTypeAtCellCenterPx(center);
89+ float pointerHalo = 0.0;
90+ float pointerTrail = 0.0;
91+ for (int i = 0; i < 8; i++) {
92+ if (i >= uPointerTrailCount) {
93+ break;
94+ }
95+ vec4 entry = uPointerTrail[i];
96+ vec2 trailPos = entry.xy;
97+ float age = clamp(entry.z, 0.0, 1.0);
98+ float fade = 1.0 - age;
99+ float centerDist = length(center - trailPos);
100+ float centerInfluence = clamp(1.0 - centerDist / (uCell * 8.0), 0.0, 1.0);
101+ pointerTrail = max(pointerTrail, fade * centerInfluence);
102+ if (markerType > 0.5) {
103+ float haloRadius = 0.5 * uSquare + 3.5 * uCell;
104+ float haloDist = length(fragPx - trailPos);
105+ float haloInfluence = clamp(1.0 - haloDist / haloRadius, 0.0, 1.0);
106+ pointerHalo = max(pointerHalo, fade * haloInfluence * haloInfluence * 0.35);
107+ }
108+ }
109+ if (uPointerActive > 0 && markerType > 0.5) {
110+ float haloRadius = 0.5 * uSquare + 2.5 * uCell;
111+ float haloDist = length(fragPx - uPointerCenter);
112+ float haloFactor = clamp(1.0 - haloDist / haloRadius, 0.0, 1.0);
113+ pointerHalo = max(pointerHalo, haloFactor * 0.6);
114+ }
93115 vec2 landUV = vec2(uv.x, 1.0 - uv.y);
94116 float seaCoverage = sampleCoverage(landUV);
95117 float landCoverage = 1.0 - seaCoverage;
@@ -102,35 +124,22 @@ void main() {
102124 } else if (markerType > 0.5) {
103125 color = uMarkerColor;
104126 }
105- float pointerHalo = 0.0;
106- if (uPointerActive > 0 && markerType > 0.5) {
107- vec2 pointerDelta = abs(center - uPointerCenter);
108- if (pointerDelta.x < 0.5 * uCell && pointerDelta.y < 0.5 * uCell) {
109- float haloRadius = 0.5 * uSquare + 0.75 * uCell;
110- float haloDist = length(fragPx - uPointerCenter);
111- float haloFactor = clamp(1.0 - haloDist / haloRadius, 0.0, 1.0);
112- pointerHalo = haloFactor * haloFactor;
113- }
127+ float halfSquare = 0.5 * uSquare;
128+ if (pointerTrail > 0.0 && markerType <= 0.5) {
129+ float shrink = clamp(1.0 - pointerTrail * 0.12, 0.9, 1.0);
130+ halfSquare *= shrink;
114131 }
115- float pointerTrail = 0.0;
116- for (int i = 0; i < 8; i++) {
117- if (i >= uPointerTrailCount) {
118- break;
119- }
120- vec4 entry = uPointerTrail[i];
121- vec2 trailPos = entry.xy;
122- float age = clamp(entry.z, 0.0, 1.0);
123- float fade = 1.0 - age;
124- float dist = length(center - trailPos);
125- float influence = max(0.0, 1.0 - dist / (uCell * 3.0));
126- pointerTrail = max(pointerTrail, fade * influence);
132+ vec2 delta = abs(fragPx - center);
133+ if (delta.x > halfSquare || delta.y > halfSquare) {
134+ discard;
127135 }
128- if (pointerTrail > 0.0) {
129- color = mix(color, vec3(1.0), pointerTrail * 0.3);
136+ float alpha = 1.0;
137+ if (pointerTrail > 0.0 && markerType <= 0.5) {
138+ alpha = clamp(1.0 - pointerTrail * 0.08, 0.7, 1.0);
130139 }
131140 if (pointerHalo > 0.0) {
132141 color = mix(color, vec3(1.0), pointerHalo * 0.7);
133142 }
134- outColor = vec4(color, 1.0 );
143+ outColor = vec4(color, alpha );
135144}
136145`
0 commit comments