Enhance FPS monitoring with detailed logging and switch to simple background mode on low FPS detection
This commit is contained in:
@@ -146,14 +146,16 @@
|
||||
|
||||
if (delta >= 500) { // Update FPS every 500ms
|
||||
fps = Math.round((frameCount * 1000) / delta);
|
||||
console.log(`FPS: ${fps} (threshold: ${FPS_THRESHOLD}, low samples: ${lowFpsCount}/${LOW_FPS_SAMPLES})`);
|
||||
frameCount = 0;
|
||||
lastTime = currentTime;
|
||||
|
||||
// Check if FPS is consistently low
|
||||
if (fps < FPS_THRESHOLD) {
|
||||
lowFpsCount++;
|
||||
console.warn(`⚠️ Low FPS detected! ${fps} FPS (${lowFpsCount}/${LOW_FPS_SAMPLES})`);
|
||||
if (lowFpsCount >= LOW_FPS_SAMPLES) {
|
||||
console.warn(`Low FPS detected (${fps}). Switching to simple background...`);
|
||||
console.warn(`🔄 Switching to simple background mode...`);
|
||||
switchToSimpleBackground();
|
||||
isSimpleMode = true;
|
||||
// Stop monitoring - mode persists until page refresh
|
||||
@@ -173,22 +175,28 @@
|
||||
}
|
||||
|
||||
function switchToSimpleBackground() {
|
||||
console.log('🎨 Activating simple background mode...');
|
||||
|
||||
// Stop rendering 3D scene
|
||||
const canvas = document.querySelector('#galaxy-canvas');
|
||||
canvas.style.display = 'none';
|
||||
console.log('✓ 3D canvas hidden');
|
||||
|
||||
// Create simple gradient background
|
||||
const overlay = document.querySelector('#background-overlay');
|
||||
overlay.style.background = 'linear-gradient(180deg, #0a1628 0%, #001a2d 50%, #000d1a 100%)';
|
||||
overlay.style.backdropFilter = 'none';
|
||||
console.log('✓ Gradient background applied');
|
||||
|
||||
// Disable all animations and transitions
|
||||
disableAnimations();
|
||||
console.log('✓ Animations disabled');
|
||||
|
||||
// Add simple animated stars
|
||||
createSimpleStars();
|
||||
console.log('✓ Simple stars created');
|
||||
|
||||
console.log('Simple background mode activated - animations disabled for performance');
|
||||
console.log('✅ Simple background mode activated - animations disabled for performance');
|
||||
}
|
||||
|
||||
function disableAnimations() {
|
||||
|
||||
Reference in New Issue
Block a user