| 76 | // --- START Execution --- |
| 77 | // Use DOMContentLoaded to ensure HTML is parsed and elements are available |
| 78 | function startExperience() { |
| 79 | // Basic check for THREE core first |
| 80 | if (typeof THREE === 'undefined') { |
| 81 | console.error("THREE.js core library not found!"); |
| 82 | alert("Error: THREE.js library failed to load."); |
| 83 | return; |
| 84 | } |
| 85 | |
| 86 | // Proceed with initialization |
| 87 | init(); |
| 88 | if (renderer) { |
| 89 | animate(); |
| 90 | } else { |
| 91 | console.error("Renderer initialization failed. Animation cannot start."); |
| 92 | } |
| 93 | } |
| 94 | |
| 95 | window.onload = startExperience; |
| 96 | |