add configurable dot size for zoomed-out structures

Structures collapse to a dot when zoomed out past dotsZoomThreshold.
The dot scale was hardcoded to 1.0 / 2.5 (≈0.4) in structure.vert.glsl.

Promote it to a render setting (`structure.dotScale`) so it's tunable
alongside iconSize / dotsZoomThreshold. Default 0.4 preserves current
behavior. Plumbed via uDotScale uniform on StructurePass.
This commit is contained in:
evanpelle
2026-05-16 17:22:45 -07:00
parent 7b8c950bef
commit bb619c2c44
4 changed files with 11 additions and 4 deletions
@@ -74,6 +74,7 @@ export class StructurePass {
private uZoom: WebGLUniformLocation;
private uIconSize: WebGLUniformLocation;
private uDotsThreshold: WebGLUniformLocation;
private uDotScale: WebGLUniformLocation;
private uScaleFactor: WebGLUniformLocation;
private uShapeScales: WebGLUniformLocation;
private uIconFills: WebGLUniformLocation;
@@ -140,6 +141,7 @@ export class StructurePass {
this.uCamera = gl.getUniformLocation(this.program, "uCamera")!;
this.uZoom = gl.getUniformLocation(this.program, "uZoom")!;
this.uIconSize = gl.getUniformLocation(this.program, "uIconSize")!;
this.uDotScale = gl.getUniformLocation(this.program, "uDotScale")!;
this.uDotsThreshold = gl.getUniformLocation(
this.program,
"uDotsThreshold",
@@ -330,6 +332,7 @@ export class StructurePass {
gl.uniform1f(this.uZoom, zoom);
gl.uniform1f(this.uIconSize, ss.iconSize);
gl.uniform1f(this.uDotsThreshold, ss.dotsZoomThreshold);
gl.uniform1f(this.uDotScale, ss.dotScale);
gl.uniform1f(this.uScaleFactor, ss.iconScaleFactorZoomedOut);
// Build per-structure uniform arrays from settings, ordered by atlas column
+4 -3
View File
@@ -82,9 +82,10 @@
"railAlpha": 1
},
"structure": {
"iconSize": 35,
"dotsZoomThreshold": 0.5,
"iconScaleFactorZoomedOut": 1.4,
"iconSize": 65,
"dotsZoomThreshold": 1.2,
"dotScale": 0.3,
"iconScaleFactorZoomedOut": 3.5,
"shapes": {
"City": {
"scale": 1,
+2
View File
@@ -86,6 +86,8 @@ export interface RenderSettings {
structure: {
iconSize: number;
dotsZoomThreshold: number;
/** Icon size multiplier when zoomed out past dotsZoomThreshold. */
dotScale: number;
iconScaleFactorZoomedOut: number;
shapes: Record<string, { scale: number; iconFill: number }>;
highlightOutlineWidth: number;
@@ -12,6 +12,7 @@ uniform float uZoom;
uniform float uIconSize;
uniform float uDotsThreshold;
uniform float uDotScale;
uniform float uScaleFactor;
uniform float uShapeScales[ATLAS_COLS];
uniform float uIconFills[ATLAS_COLS];
@@ -36,7 +37,7 @@ void main() {
float iconScale;
if (uZoom <= uDotsThreshold) {
iconScale = 1.0 / 2.5;
iconScale = uDotScale;
} else {
iconScale = min(1.0, uZoom / uScaleFactor);
}