Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/rendering/BuildingRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { getPlayerColor, isSpectatorMode } from '@/store/gameSetupStore';
import { useUIStore } from '@/store/uiStore';
import { debugMesh } from '@/utils/debugLogger';
import { CullingService, EntityCategory } from './services/CullingService';
import { getConsoleEngineSync } from '@/engine/debug/ConsoleEngine';
import { BUILDING_RENDERER, BUILDING_SELECTION_RING, RENDER_ORDER } from '@/data/rendering.config';
import {
createConstructingMaterial,
Expand Down Expand Up @@ -648,10 +649,13 @@ export class BuildingRenderer {
const isOwned = !isSpectating && ownerId === this.playerId;
const isEnemy = !isSpectating && selectable && ownerId !== this.playerId;

// Check visibility for enemy buildings (skip in spectator mode - show all)
// Check visibility for enemy buildings (skip in spectator mode or if fog disabled - show all)
let shouldShow = true;
if (isEnemy && this.visionSystem && this.playerId) {
shouldShow = this.visionSystem.isExplored(this.playerId, transform.x, transform.y);
const fogDisabled = getConsoleEngineSync()?.getFlag('fogDisabled');
if (!fogDisabled) {
shouldShow = this.visionSystem.isExplored(this.playerId, transform.x, transform.y);
}
}

// PERF: Get cached terrain height (buildings rarely move)
Expand Down
8 changes: 6 additions & 2 deletions src/rendering/UnitRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import {

// GPU-driven rendering infrastructure
import { CullingService, EntityCategory } from './services/CullingService';
import { getConsoleEngineSync } from '@/engine/debug/ConsoleEngine';
import { LODConfig } from './compute/UnifiedCullingCompute';
import { GPUIndirectRenderer } from './compute/GPUIndirectRenderer';

Expand Down Expand Up @@ -1013,10 +1014,13 @@ export class UnitRenderer {
const isOwned = !isSpectating && ownerId === this.playerId;
const isEnemy = !isSpectating && selectable && ownerId !== this.playerId;

// Check visibility for enemy units (skip in spectator mode - show all)
// Check visibility for enemy units (skip in spectator mode or if fog disabled - show all)
let shouldShow = true;
if (isEnemy && this.visionSystem && this.playerId) {
shouldShow = this.visionSystem.isVisible(this.playerId, transform.x, transform.y);
const fogDisabled = getConsoleEngineSync()?.getFlag('fogDisabled');
if (!fogDisabled) {
shouldShow = this.visionSystem.isVisible(this.playerId, transform.x, transform.y);
}
}

// Skip dead units
Expand Down
Loading