forked from BiancaGs/Pokemon-Catch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
214 lines (161 loc) · 7.41 KB
/
index.html
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
212
213
214
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Modelagem 3D em WebGL</title>
<!-- Arquivos necessários -->
<script src="node_modules/three/build/three.js"></script>
<script src="node_modules/three/examples/js/WebGL.js"></script>
<script src="node_modules/three/examples/js/loaders/OBJLoader.js"></script>
<script src="node_modules/three/examples/js/loaders/MTLLoader.js"></script>
<script src="node_modules/three/examples/js/libs/inflate.min.js"></script>
<script src="node_modules/three/examples/js/loaders/FBXLoader.js"></script>
<script src="node_modules/three/examples/js/controls/OrbitControls.js"></script>
<script src="node_modules/three/examples/js/libs/dat.gui.min.js"></script>
<!-- JQuery -->
<script src="lib/jquery/js/jquery-3.4.1.min.js"></script>
<!-- CSS -->
<link rel="stylesheet" href="index.css">
<!-- Outros -->
<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.min.css">
<script src="node_modules/countup.js/dist/countUp.min.js" type="module"></script>
<!-- Código para Manipulação -->
<script src="main.js" type="module"></script>
</head>
<body>
<!-- Canvas para exibição do modelo -->
<canvas id="modelo"></canvas>
<!-- Vertex Shader (Phong) -->
<script id="vertex-shader" type="x-shader/x-vertex">
varying vec3 normalInterp;
varying vec3 vertPos;
void main() {
vec4 vertPos4 = modelViewMatrix * vec4(position, 1.0);
vertPos = vec3(vertPos4) / vertPos4.w;
normalInterp = vec3(normalMatrix * normal);
gl_Position = projectionMatrix * vertPos4;
}
</script>
<!-- Fragment Shader (Phong) -->
<script id="fragment-shader" type="x-shader/x-fragment">
precision mediump float;
varying vec3 normalInterp; // Surface normal
varying vec3 vertPos; // Vertex position
uniform float Ka; // Coeficiente de reflexão difusa do ambiente
uniform float Kd; // Coeficiente de reflexão difusa da superfície
uniform float Ks; // Coeficiente de reflexão especular da superfície
uniform float shininess; // Brilho
uniform vec3 ambientColor; // Cor do ambiente
uniform vec3 diffuseColor; // Cor difusa
uniform vec3 specularColor; // Cor especular
uniform vec3 lightPosition; // Posição da luz
void main() {
vec3 N = normalize(normalInterp);
vec3 L = normalize(lightPosition - vertPos);
// Lambert's cosine law
float lambertian = max(dot(N, L), 0.0);
float specular = 0.0;
if (lambertian > 0.0) {
vec3 R = reflect(-L, N); // Reflected light vector
vec3 V = normalize(-vertPos); // Vector to viewer
// Compute the specular term
float specAngle = max(dot(R, V), 0.0);
specular = pow(specAngle, shininess);
}
gl_FragColor = vec4(Ka * ambientColor +
Kd * lambertian * diffuseColor +
Ks * specular * specularColor, 1.0);
}
</script>
<!-- Shaders do Sol -->
<script id="vertex-shader-sol" type="x-shader/x-vertex">
uniform vec3 viewVector;
uniform float c;
uniform float p;
varying float intensity;
void main()
{
vec3 vNormal = normalize( normalMatrix * normal );
vec3 vNormel = normalize( normalMatrix * viewVector );
intensity = pow( c - dot(vNormal, vNormel), p );
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}
</script>
<script id="fragment-shader-sol" type="x-shader/x-fragment">
uniform vec3 glowColor;
varying float intensity;
void main()
{
vec3 glow = glowColor * intensity;
gl_FragColor = vec4( glow, 1.0 );
}
</script>
<!-- Overlay de Loading -->
<div class="overlay-menu"></div>
<!-- Overlay do Tutorial -->
<div class="overlay-tutorial" style="display: none;"></div>
<button type="button" id="start" style="display: none;" class="float-effect">
<span>Vamos começar!</span>
</button>
<!-- Barra de Progresso -->
<div class="container-progress">
<input type="checkbox" id="water" class="input-progress" />
<label for="water" class="label-progress">
<div id="fill"></div>
</label>
<span class="progress">Progresso</span>
<span class="progress" id="percentage">0%</span>
</div>
<!-- Menu do Jogo -->
<div class="container-menu" style="display: none;">
<button type="button" id="play" class="float-effect">
<span>Jogar!</span>
</button>
</div>
<!-- Pontuação -->
<span class="pontuacao">0</span>
<!-- Tempo -->
<span class="tempo" style="display: none;"></span>
<!-- Botão de Mute/Unmute -->
<a href="#" class="speaker">
<span></span>
</a>
<!-- Vitória e Derrota -->
<div class="overlay-vitoria" style="display: none;">
<!-- <h1>Vitória!</h1> -->
<!-- Star Rating -->
<!-- Estrelas -->
<div class="rating" data-vote="0">
<div class="star">
<span class="full" data-value="1"></span>
<span class="selected"></span>
</div>
<div class="star">
<span class="full" data-value="2"></span>
<span class="selected"></span>
</div>
<div class="star">
<span class="full" data-value="3"></span>
<span class="selected"></span>
</div>
</div>
<!-- Pontuação Final -->
<p class="pontuacao-final" id="pontuacao-final"></p>
<a href="index.html">
<button type="button" class="restart float-effect">
<span>Jogar novamente</span>
</button>
</a>
</div>
<div class="overlay-derrota" style="display: none;">
<a href="index.html">
<button type="button" class="restart float-effect">
<span>Jogar novamente</span>
</button>
</a>
</div>
<!-- Star Rating -->
<script src="starRating.js"></script>
</body>
</html>