Add score-o mode and split game map HUD presentation
This commit is contained in:
@@ -8,6 +8,10 @@ import { GpsLayer } from '../layer/gpsLayer'
|
||||
const COURSE_COLOR: [number, number, number, number] = [0.8, 0.0, 0.42, 0.96]
|
||||
const COMPLETED_ROUTE_COLOR: [number, number, number, number] = [0.48, 0.5, 0.54, 0.82]
|
||||
const ACTIVE_CONTROL_COLOR: [number, number, number, number] = [0.22, 1, 0.95, 1]
|
||||
const MULTI_ACTIVE_CONTROL_COLOR: [number, number, number, number] = [1, 0.8, 0.2, 0.98]
|
||||
const FOCUSED_CONTROL_COLOR: [number, number, number, number] = [0.98, 0.96, 0.98, 1]
|
||||
const MULTI_ACTIVE_PULSE_COLOR: [number, number, number, number] = [0.18, 1, 0.96, 0.86]
|
||||
const FOCUSED_PULSE_COLOR: [number, number, number, number] = [1, 0.36, 0.84, 0.88]
|
||||
const ACTIVE_LEG_COLOR: [number, number, number, number] = [0.18, 1, 0.94, 0.5]
|
||||
const EARTH_CIRCUMFERENCE_METERS = 40075016.686
|
||||
const CONTROL_RING_WIDTH_RATIO = 0.2
|
||||
@@ -231,19 +235,19 @@ export class WebGLVectorRenderer {
|
||||
): void {
|
||||
const controlRadiusMeters = this.getControlRadiusMeters(scene)
|
||||
|
||||
if (scene.revealFullCourse) {
|
||||
for (let index = 0; index < course.legs.length; index += 1) {
|
||||
const leg = course.legs[index]
|
||||
this.pushCourseLeg(positions, colors, leg, controlRadiusMeters, this.getLegColor(scene, index), scene)
|
||||
if (scene.activeLegIndices.includes(index)) {
|
||||
this.pushCourseLegHighlight(positions, colors, leg, controlRadiusMeters, scene)
|
||||
if (scene.revealFullCourse && scene.showCourseLegs) {
|
||||
for (let index = 0; index < course.legs.length; index += 1) {
|
||||
const leg = course.legs[index]
|
||||
this.pushCourseLeg(positions, colors, leg, controlRadiusMeters, this.getLegColor(scene, index), scene)
|
||||
if (scene.guidanceLegAnimationEnabled && scene.activeLegIndices.includes(index)) {
|
||||
this.pushCourseLegHighlight(positions, colors, leg, controlRadiusMeters, scene)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const guideLeg = this.getGuideLeg(course, scene)
|
||||
if (guideLeg) {
|
||||
this.pushGuidanceFlow(positions, colors, guideLeg, controlRadiusMeters, scene, pulseFrame)
|
||||
}
|
||||
const guideLeg = this.getGuideLeg(course, scene)
|
||||
if (guideLeg) {
|
||||
this.pushGuidanceFlow(positions, colors, guideLeg, controlRadiusMeters, scene, pulseFrame)
|
||||
}
|
||||
}
|
||||
|
||||
for (const start of course.starts) {
|
||||
@@ -258,7 +262,12 @@ export class WebGLVectorRenderer {
|
||||
|
||||
for (const control of course.controls) {
|
||||
if (scene.activeControlSequences.includes(control.sequence)) {
|
||||
this.pushActiveControlPulse(positions, colors, control.point.x, control.point.y, controlRadiusMeters, scene, pulseFrame)
|
||||
if (scene.controlVisualMode === 'single-target') {
|
||||
this.pushActiveControlPulse(positions, colors, control.point.x, control.point.y, controlRadiusMeters, scene, pulseFrame)
|
||||
} else {
|
||||
this.pushActiveControlPulse(positions, colors, control.point.x, control.point.y, controlRadiusMeters, scene, pulseFrame, MULTI_ACTIVE_PULSE_COLOR)
|
||||
this.pushActiveControlPulse(positions, colors, control.point.x, control.point.y, controlRadiusMeters * 1.2, scene, pulseFrame + 9, [0.9, 1, 1, 0.52])
|
||||
}
|
||||
}
|
||||
|
||||
this.pushRing(
|
||||
@@ -271,12 +280,31 @@ export class WebGLVectorRenderer {
|
||||
this.getControlColor(scene, control.sequence),
|
||||
scene,
|
||||
)
|
||||
|
||||
if (scene.focusedControlSequences.includes(control.sequence)) {
|
||||
this.pushActiveControlPulse(positions, colors, control.point.x, control.point.y, controlRadiusMeters * 1.02, scene, pulseFrame, FOCUSED_PULSE_COLOR)
|
||||
this.pushActiveControlPulse(positions, colors, control.point.x, control.point.y, controlRadiusMeters * 1.32, scene, pulseFrame + 15, [1, 0.86, 0.94, 0.5])
|
||||
this.pushRing(
|
||||
positions,
|
||||
colors,
|
||||
control.point.x,
|
||||
control.point.y,
|
||||
this.getMetric(scene, controlRadiusMeters * 1.24),
|
||||
this.getMetric(scene, controlRadiusMeters * 1.06),
|
||||
FOCUSED_CONTROL_COLOR,
|
||||
scene,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
for (const finish of course.finishes) {
|
||||
if (scene.activeFinish) {
|
||||
this.pushActiveControlPulse(positions, colors, finish.point.x, finish.point.y, controlRadiusMeters, scene, pulseFrame)
|
||||
}
|
||||
if (scene.focusedFinish) {
|
||||
this.pushActiveControlPulse(positions, colors, finish.point.x, finish.point.y, controlRadiusMeters * 1.04, scene, pulseFrame, FOCUSED_PULSE_COLOR)
|
||||
this.pushActiveControlPulse(positions, colors, finish.point.x, finish.point.y, controlRadiusMeters * 1.34, scene, pulseFrame + 12, [1, 0.86, 0.94, 0.46])
|
||||
}
|
||||
|
||||
const finishColor = this.getFinishColor(scene)
|
||||
this.pushRing(
|
||||
@@ -303,6 +331,10 @@ export class WebGLVectorRenderer {
|
||||
}
|
||||
|
||||
getGuideLeg(course: ProjectedCourseLayers, scene: MapScene): ProjectedCourseLeg | null {
|
||||
if (!scene.guidanceLegAnimationEnabled) {
|
||||
return null
|
||||
}
|
||||
|
||||
const activeIndex = scene.activeLegIndices.length ? scene.activeLegIndices[0] : -1
|
||||
if (activeIndex >= 0 && activeIndex < course.legs.length) {
|
||||
return course.legs[activeIndex]
|
||||
@@ -366,12 +398,14 @@ export class WebGLVectorRenderer {
|
||||
controlRadiusMeters: number,
|
||||
scene: MapScene,
|
||||
pulseFrame: number,
|
||||
pulseColor?: RgbaColor,
|
||||
): void {
|
||||
const pulse = (Math.sin(pulseFrame * ACTIVE_CONTROL_PULSE_SPEED) + 1) / 2
|
||||
const pulseScale = ACTIVE_CONTROL_PULSE_MIN_SCALE + (ACTIVE_CONTROL_PULSE_MAX_SCALE - ACTIVE_CONTROL_PULSE_MIN_SCALE) * pulse
|
||||
const pulseWidthScale = pulseScale - ACTIVE_CONTROL_PULSE_WIDTH_RATIO
|
||||
const glowAlpha = 0.24 + pulse * 0.34
|
||||
const glowColor: RgbaColor = [0.36, 1, 0.96, glowAlpha]
|
||||
const baseColor = pulseColor || ACTIVE_CONTROL_COLOR
|
||||
const glowAlpha = Math.min(1, baseColor[3] * (0.46 + pulse * 0.5))
|
||||
const glowColor: RgbaColor = [baseColor[0], baseColor[1], baseColor[2], glowAlpha]
|
||||
|
||||
this.pushRing(
|
||||
positions,
|
||||
@@ -430,7 +464,7 @@ export class WebGLVectorRenderer {
|
||||
|
||||
getControlColor(scene: MapScene, sequence: number): RgbaColor {
|
||||
if (scene.activeControlSequences.includes(sequence)) {
|
||||
return ACTIVE_CONTROL_COLOR
|
||||
return scene.controlVisualMode === 'multi-target' ? MULTI_ACTIVE_CONTROL_COLOR : ACTIVE_CONTROL_COLOR
|
||||
}
|
||||
|
||||
if (scene.completedControlSequences.includes(sequence)) {
|
||||
@@ -442,6 +476,10 @@ export class WebGLVectorRenderer {
|
||||
|
||||
|
||||
getFinishColor(scene: MapScene): RgbaColor {
|
||||
if (scene.focusedFinish) {
|
||||
return FOCUSED_CONTROL_COLOR
|
||||
}
|
||||
|
||||
if (scene.activeFinish) {
|
||||
return ACTIVE_CONTROL_COLOR
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user