Skip to content

Commit 5169b92

Browse files
committed
Improve the halo
1 parent f7ebec5 commit 5169b92

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

src/app/(main)/community/events/map/engine.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ class MapEngine implements MapHandle {
110110
private markerCount: number
111111
private markerCapacityWarned = false
112112
private readonly markerColor: Float32Array
113+
private haloColor: Float32Array
113114
private readonly markerIntensity: Float32Array
114115
private readonly markerIntensityTarget: Float32Array
115116
private readonly markerIndexById: Map<string, number>
@@ -158,6 +159,7 @@ class MapEngine implements MapHandle {
158159
this.markerData = new Float32Array(MARKER_CAPACITY * 4)
159160
this.markerCount = this.packMarkers(this.markerPoints, this.markerData)
160161
this.markerColor = new Float32Array(options.theme.marker)
162+
this.haloColor = new Float32Array(options.theme.halo)
161163
this.markerIntensity = new Float32Array(MARKER_CAPACITY)
162164
this.markerIntensityTarget = new Float32Array(MARKER_CAPACITY)
163165
this.markerIndexById = new Map()
@@ -197,6 +199,7 @@ class MapEngine implements MapHandle {
197199
this.seaColor.set(colors.sea)
198200
this.landColor.set(colors.land)
199201
this.markerColor.set(colors.marker)
202+
this.haloColor.set(colors.halo)
200203
}
201204

202205
setActiveMarker(id: string | null) {
@@ -647,6 +650,14 @@ class MapEngine implements MapHandle {
647650
this.markerColor[1],
648651
this.markerColor[2],
649652
)
653+
setUniform3f(
654+
gl,
655+
this.dotsProgram,
656+
"uHaloColor",
657+
this.haloColor[0],
658+
this.haloColor[1],
659+
this.haloColor[2],
660+
)
650661
setUniform1i(gl, this.dotsProgram, "uMarkerCount", this.markerCount)
651662
gl.activeTexture(gl.TEXTURE0)
652663
gl.bindTexture(gl.TEXTURE_2D, this.landTexture)

src/app/(main)/community/events/map/map-colors.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,21 @@ export type MapColors = {
44
sea: ColorVec3
55
land: ColorVec3
66
marker: ColorVec3
7+
halo: ColorVec3
78
}
89

910
export const MAP_COLORS = {
1011
light: {
1112
sea: [0.9804, 0.9882, 0.9569], // neu-50
1213
land: [0.8627, 0.8706, 0.8275], // neu-300
1314
marker: [0.8824, 0.0039, 0.5961], // #E10198 = pri-base
15+
halo: [1.0, 0.6, 0.8784], // hsl(318, 100%, 80%) = pri-light
1416
},
1517
dark: {
1618
sea: [0.0549, 0.0588, 0.0431], // neu-50
1719
land: [0.1647, 0.1804, 0.1373], // a shade darker than neu-800
1820
marker: [1, 0.6, 0.8745], // #FF99DF = pri-light
21+
halo: [1.0, 0.8, 0.9373], // hsl(319, 100%, 90%) = pri-lighter
1922
},
2023
} satisfies Record<string, MapColors>
2124

src/app/(main)/community/events/map/shaders.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ uniform vec3 uSeaColor;
3131
uniform vec4 uMarkers[${MARKER_CAPACITY}];
3232
uniform int uMarkerCount;
3333
uniform vec3 uMarkerColor;
34+
uniform vec3 uHaloColor;
3435
3536
vec2 markerCellCenter(vec4 marker, vec2 referencePx) {
3637
float periodX = uWorldSize.x * uZoom;
@@ -128,7 +129,7 @@ void main() {
128129
discard;
129130
}
130131
float haloAlpha = clamp(haloIntensity, 0.0, 1.0);
131-
color = mix(uSeaColor, uMarkerColor, haloAlpha);
132+
color = mix(uSeaColor, uHaloColor, haloAlpha);
132133
outColor = vec4(color, 1.0);
133134
return;
134135
}

0 commit comments

Comments
 (0)