-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
211 lines (196 loc) · 8.3 KB
/
index.html
File metadata and controls
211 lines (196 loc) · 8.3 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>A glimpse of city</title>
<link rel="stylesheet" href="index.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
<script src="https://cdn.tailwindcss.com"></script>
</head>
<body class="relative">
<!-- Loading Modal -->
<div id="loadingModal" wire:loading class="fixed top-0 left-0 right-0 bottom-0 w-full h-screen z-50 overflow-hidden bg-gray-700 opacity-75 flex flex-col items-center justify-center">
<div class="inline-block h-12 w-12 animate-spin rounded-full border-4 border-solid border-current border-e-transparent align-[-0.125em] text-surface motion-reduce:animate-[spin_1.5s_linear_infinite] dark:text-white"
role="status"></div>
<h2 class="text-center text-white text-lg font-semibold">Loading ...</h2>
<p class="w-1/3 text-center text-white">This may take a few seconds, please don't close this page.</p>
</div>
<!-- Canvas for WebGL -->
<canvas id="canvas" class="z-0"></canvas>
<!-- Hamburger Menu Button -->
<div class="absolute top-4 right-4">
<button id="menuToggle" class="bg-gray-800 text-white py-2 px-3 rounded">
<i class="fas fa-bars"></i>
</button>
</div>
<!-- Lateral Menu -->
<div id="menu" class="fixed top-0 right-0 w-96 h-full bg-white shadow-lg z-40 transform translate-x-full transition-transform duration-300 overflow-hidden flex flex-col">
<!-- Header -->
<div class="p-4 flex justify-between items-center bg-gray-800 text-white">
<h2 class="text-lg font-bold">Settings</h2>
<button id="menuClose" class="text-white">
<i class="fas fa-times"></i>
</button>
</div>
<!-- Main Content - Scrollable Area -->
<div class="p-4 flex-1 overflow-y-auto">
<h3 class="font-bold">Light Position</h3>
<div class="flex flex-col space-y-2">
<div class="flex items-center space-x-2">
<label for="lightX">X:</label>
<input id="lightX" type="range" min="-100" max="100" value="0" class="w-full p-2 border rounded" />
<span id="lightXValue">0</span>
</div>
<div class="flex items-center space-x-2">
<label for="lightY">Y:</label>
<input id="lightY" type="range" min="-100" max="100" value="1" class="w-full p-2 border rounded" />
<span id="lightYValue">1</span>
</div>
<div class="flex items-center space-x-2">
<label for="lightZ">Z:</label>
<input id="lightZ" type="range" min="-100" max="100" value="0" class="w-full p-2 border rounded" />
<span id="lightZValue">0</span>
</div>
</div>
<h3 class="font-bold mt-4">Enable/Disable Options</h3>
<div class="flex flex-col space-y-2">
<label><input id="normalMap" type="checkbox" class="mr-2" /> Normal Map</label>
<label><input id="transparency" type="checkbox" class="mr-2" /> Transparency</label>
<label><input id="reflections" type="checkbox" class="mr-2" /> Reflections</label>
</div>
<!-- Drop-down Content -->
<div class="bg-gray-800 text-white p-4 shadow-md space-y-4 mt-4 relative">
<h2 id="controlsHeader" class="text-lg font-bold text-left cursor-pointer flex justify-between items-center">
<span>Controls</span>
<i class="fas fa-chevron-down"></i>
</h2>
<div id="controlsContent" class="space-y-2 hidden opacity-0 transition-opacity duration-500 ease-in-out">
<h3 class="text-xl font-bold mt-4">Keyboard</h3>
<div class="flex items-center space-x-2">
<i class="fas fa-solid fa-w text-lg"></i>
<p> to move forward</p>
</div>
<div class="flex items-center space-x-2">
<i class="fas fa-solid fa-a text-lg"></i>
<p> to move left</p>
</div>
<div class="flex items-center space-x-2">
<i class="fas fa-solid fa-s text-lg"></i>
<p> to move backward</p>
</div>
<div class="flex items-center space-x-2">
<i class="fas fa-solid fa-d text-lg"></i>
<p> to move right</p>
</div>
<div class="flex items-center space-x-2">
<i class="fas fa-arrow-left text-lg"></i>
<p> to rotate the camera to the left</p>
</div>
<div class="flex items-center space-x-2">
<i class="fas fa-arrow-right text-lg"></i>
<p> to rotate the camera to the right</p>
</div>
<div class="flex items-center space-x-2">
<i class="fas fa-solid fa-r text-lg"></i>
<p> to reset lights and user's position</p>
</div>
<h3 class="text-xl font-bold mt-4">Mouse</h3>
<div class="flex items-center space-x-2">
<i class="fas fa-solid fa-computer-mouse text-lg"></i>
<p><strong>Mouse Wheel</strong> to zoom in/out</p>
</div>
<div class="flex items-center space-x-2">
<i class="fas fa-mouse-pointer text-lg"></i>
<p><strong>Click and Drag</strong> with the mouse to rotate the camera</p>
</div>
<h3 class="text-xl font-bold mt-4">Gamepad</h3>
<div class="space-y-2">
<div class="flex items-center space-x-2">
<i class="fas fa-gamepad text-lg"></i>
<p><strong>Left Stick</strong> to move the character</p>
</div>
<div class="flex items-center space-x-2">
<i class="fas fa-gamepad text-lg"></i>
<p><strong>Right Stick</strong> to rotate the camera</p>
</div>
<div class="flex items-center space-x-2">
<i class="fa-regular fa-circle-xmark"></i>
<p> to reset lights and user's position</p>
</div>
</div>
</div>
</div>
</div>
<!-- Footer with Documentation Link - Fixed to the Bottom -->
<footer class="p-4 bg-white border-t border-gray-200 mt-auto">
<a href="./doc/index.html" class="text-blue-600 hover:underline">Project Documentation</a>
</footer>
</div>
<!-- Reload Button -->
<div class="absolute top-4 left-4 lg:hidden">
<button id="r" class="bg-red-500 text-white font-bold py-2 px-3 rounded">
Reload
</button>
</div>
<!-- Controls -->
<div class="absolute bottom-0 w-full p-4 lg:hidden">
<div class="flex justify-between">
<div class="flex flex-col">
<h3 class="text-black text-center bg-white p-1 mb-2 rounded">Movement</h3>
<div class="flex flex-col justify-center items-start">
<div class="grid grid-cols-3 gap-2">
<div></div>
<button id="w" class="bg-blue-500 text-white font-bold py-2 px-3 rounded">W</button>
<div></div>
<button id="a" class="bg-blue-500 text-white font-bold py-2 px-3 rounded">A</button>
<button id="s" class="bg-blue-500 text-white font-bold py-2 px-3 rounded">S</button>
<button id="d" class="bg-blue-500 text-white font-bold py-2 px-3 rounded">D</button>
</div>
</div>
</div>
<div class="flex flex-col">
<h3 class="text-black text-center bg-white p-1 mb-2 rounded">Direction</h3>
<div class="flex flex-col justify-center items-end">
<div class="grid grid-cols-2 gap-2">
<button id="ArrowLeft" class="bg-green-500 text-white font-bold py-2 px-3 rounded">
<i class="fas fa-arrow-left"></i>
</button>
<button id="ArrowRight" class="bg-green-500 text-white font-bold py-2 px-3 rounded">
<i class="fas fa-arrow-right"></i>
</button>
</div>
</div>
</div>
</div>
</div>
<script id="skybox-vertex-shader" type="x-shader/x-vertex">
attribute vec4 a_position;
varying vec4 v_position;
void main() {
v_position = a_position;
gl_Position = a_position;
gl_Position.z = 1.0;
}
</script>
<script id="skybox-fragment-shader" type="x-shader/x-fragment">
precision mediump float;
uniform samplerCube u_skybox;
uniform mat4 u_viewDirectionProjectionInverse;
varying vec4 v_position;
void main() {
vec4 t = u_viewDirectionProjectionInverse * v_position;
gl_FragColor = textureCube(u_skybox, normalize(t.xyz / t.w));
}
</script>
<script src="js/tools/webgl-utils.js"></script>
<script src="js/tools/m4.js"></script>
<script src="js/vertexAndFragment.js"></script>
<script src="js/generalUtils.js"></script>
<script src="js/geometryUtils.js"></script>
<script src="js/objUtils.js"></script>
<script src="js/textureUtils.js"></script>
<script src="js/index.js"></script>
<script src="js/skybox.js"></script>
</body>
</html>