mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-18 18:32:46 +00:00
add subtle player-tile highlight on nation hover
The hover wiring already pushed setHighlightOwner into the border pass, but the WebGL canvas has pointer-events: none (post-migration to the inputOverlay div) so MapInteraction's pointermove listener never fired. Forward pointermove from the input overlay to view.handlePointerMove so hover actually triggers. While there, brighten every tile owned by the hovered player — the territory frag shader now reads uHighlightOwner / uHighlightBrighten and mixes toward white when the tile owner matches. Wired through territory-pass.ts; renderer.setHighlightOwner forwards to both border and territory passes. New highlightFillBrighten setting (0.15) keeps the fill tint tunable independently of the existing highlightBrighten border setting, which is dropped from 0.6 → 0.25 so neither effect blows out.
This commit is contained in:
@@ -19,6 +19,10 @@ const PALETTE_SIZE = 4096;
|
||||
export class WebGLFrameBuilder {
|
||||
private readonly palette: Float32Array;
|
||||
private readonly knownSmallIDs = new Set<number>();
|
||||
// The renderer needs to know which player is "me" so affiliation tint,
|
||||
// unit colors, and SAM-radius perspective work. Push it once the local
|
||||
// player's update arrives (may take several ticks during join).
|
||||
private localPlayerSmallID = 0;
|
||||
|
||||
constructor(private readonly view: WebGLGameView) {
|
||||
this.palette = new Float32Array(PALETTE_SIZE * 2 * 4);
|
||||
@@ -26,9 +30,17 @@ export class WebGLFrameBuilder {
|
||||
|
||||
update(gameView: GameView): void {
|
||||
this.syncPlayers(gameView);
|
||||
this.syncLocalPlayer(gameView);
|
||||
uploadFrameData(this.view, gameView.frameData());
|
||||
}
|
||||
|
||||
private syncLocalPlayer(gameView: GameView): void {
|
||||
const sid = gameView.myPlayer()?.smallID() ?? 0;
|
||||
if (sid === this.localPlayerSmallID) return;
|
||||
this.localPlayerSmallID = sid;
|
||||
this.view.setLocalPlayerID(sid);
|
||||
}
|
||||
|
||||
private syncPlayers(gameView: GameView): void {
|
||||
const newPlayers: PlayerStatic[] = [];
|
||||
for (const p of gameView.players()) {
|
||||
|
||||
Reference in New Issue
Block a user