-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathengine-debug.html
More file actions
73 lines (62 loc) · 3.26 KB
/
Copy pathengine-debug.html
File metadata and controls
73 lines (62 loc) · 3.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Engine Creation Debug</title>
<style>body { background: #222; color: white; padding: 20px; font-family: monospace; }</style>
</head>
<body>
<h1>Engine Creation Debug</h1>
<div id="output"></div>
<script type="module">
const output = document.getElementById('output');
try {
output.innerHTML += '<p>Starting debug...</p>';
// Import modules step by step
const CameraModule = await import('../src/camera.js');
output.innerHTML += '<p>✅ Camera module imported</p>';
const EngineModule = await import('../src/engine.js');
output.innerHTML += '<p>✅ Engine module imported</p>';
// Test camera creation directly
const testCamera = new CameraModule.Camera(45, 800/600, 0.1, 1000);
output.innerHTML += '<p>✅ Direct camera creation works</p>';
// Create canvas
const canvas = document.createElement('canvas');
canvas.width = 800;
canvas.height = 600;
output.innerHTML += '<p>✅ Canvas created</p>';
// Create engine step by step
output.innerHTML += '<p>Creating engine...</p>';
const engine = new EngineModule.Engine(canvas);
output.innerHTML += '<p>✅ Engine constructor completed</p>';
// Check engine properties
output.innerHTML += '<p>Checking engine properties:</p>';
output.innerHTML += '<p>- canvas: ' + (engine.canvas ? '✅' : '❌') + '</p>';
output.innerHTML += '<p>- renderer: ' + (engine.renderer ? '✅' : '❌') + '</p>';
output.innerHTML += '<p>- scene: ' + (engine.scene ? '✅' : '❌') + '</p>';
output.innerHTML += '<p>- camera: ' + (engine.camera ? '✅' : '❌') + '</p>';
if (engine.camera) {
output.innerHTML += '<p>Camera details:</p>';
output.innerHTML += '<p>- type: ' + typeof engine.camera + '</p>';
output.innerHTML += '<p>- constructor: ' + engine.camera.constructor.name + '</p>';
output.innerHTML += '<p>- getProjectionMatrix: ' + (typeof engine.camera.getProjectionMatrix) + '</p>';
if (typeof engine.camera.getProjectionMatrix === 'function') {
try {
const matrix = engine.camera.getProjectionMatrix();
output.innerHTML += '<p>✅ getProjectionMatrix() worked!</p>';
} catch (matrixError) {
output.innerHTML += '<p>❌ getProjectionMatrix() failed: ' + matrixError.message + '</p>';
}
}
} else {
output.innerHTML += '<p>❌ Camera is: ' + engine.camera + '</p>';
}
} catch (error) {
output.innerHTML += '<p>❌ Error: ' + error.message + '</p>';
output.innerHTML += '<p>Stack: ' + error.stack + '</p>';
console.error('Debug failed:', error);
}
</script>
</body>
</html>