-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
235 lines (172 loc) · 7.28 KB
/
Copy pathindex.html
File metadata and controls
235 lines (172 loc) · 7.28 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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
<!--
Geometric Modeling: Subdivision and Decimation demo
by Adam Badke
adambadke@gmail.com
-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="./style.css" type="text/css">
<title>Geometric Modeling: Subdivision and Decimation demo</title>
<!-- Shared/global values: -->
<script type="text/javascript" src="./scripts/shared.js"></script>
<!-- Helpers: -->
<script type="text/javascript" src="./scripts/shaders.js"></script>
<script type="text/javascript" src="./scripts/mesh.js"></script>
<script type="text/javascript" src="./scripts/renderObjects.js"></script>
<script type="text/javascript" src="./scripts/sceneObjects.js"></script>
<!-- Portfolio mode: Obj files as strings: -->
<script type="text/javascript" src="./objs/cube.js"></script>
<script type="text/javascript" src="./objs/chessPiece.js"></script>
<script type="text/javascript" src="./objs/venus.js"></script>
<script type="text/javascript" src="./objs/horse.js"></script>
<script type="text/javascript" src="./objs/figureEight.js"></script>
<script type="text/javascript" src="./objs/gear.js"></script>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/gl-matrix/2.8.1/gl-matrix-min.js"
integrity="sha512-zhHQR0/H5SEBL3Wn6yYSaTTZej12z0hVZKOv3TwCUXT1z5qeqGcXJLLrbERYRScEDDpYIJhPC1fk31gqR783iQ=="
crossorigin="anonymous" defer>
</script>
<!-- Main program: -->
<script src="./scripts/mainProgram.js" defer></script>
</head>
<body style="background-color:rgb(242,242,242);" oncontextmenu="return false;"> <!-- Disable the context menu to prevent popups when dragging right mouse -->
<canvas id="glCanvas" width="640" height="480"></canvas>
<p>Please open your browser's debug console to see program output.</p>
<div class="float-container">
<h3>Mesh Configuration:</h3>
<div class="float-child">
<h4>Mesh Selection:</h4>
</div>
<div class="float-child">
<select id="meshOBJDropdown" onchange="loadOBJ()">
<!-- Portfolio mode: Load .obj files quickly from a JS string -->
<option value="cube" selected="selected">Cube</option>
<option value="chessPiece">Chess Piece</option>
<option value="venus">Venus</option>
<option value="horse">Horse</option>
<option value="figureEight">Figure Eight</option>
<option value="gear">Gear</option>
</select>
</div>
<div class="float-child">
<h4>Display Mode:</h4>
</div>
<div class="float-child">
<select id="shadingModeDropdown" onchange="setActiveShadingMode(document.getElementById('shadingModeDropdown').value)">
<option value="0">Flat Shading</option>
<option value="2">Wireframe Shading</option>
<option value="1">Smooth Shading</option>
<option value="3" selected="selected">Smooth Wireframe Shading</option>
</select>
</div>
</div>
<p style="clear:left; height: 0px;"></p>
<div class="float-container">
<h3>Mesh Subdivision:</h3>
<div class="float-child float-leftCol">
<label>Subdivision Scheme:</label>
</div>
<div class="float-child float-midCol">
<select name="subdivisionDropdown" id="subdivisionType">
<option value="0">Loop</option>
<option value="1">Butterfly</option>
</select>
</div>
<div class="float-child">
<div class="buttonGroup">
<button onclick="subdivideMesh(document.getElementById('subdivisionType').value, 1)">Subdivide!</button>
</div>
</div>
</div>
<p style="clear:left; height: 0px;"></p>
<div class="float-container">
<h3>Mesh Decimation:</h3>
<div class="float-child float-leftCol">
<div class="float-underOver">
<label for="decimationText" id="decimationTextLabel"># Edges to collapse:</label>
</div>
<div class="float-underOver">
<label for="kText" id="kTextLabel"># Edges to consider (k):</label>
<!-- <input name="numKText" id="kText" type="text" value="8"> -->
</div>
</div>
<div class="float-child float-midCol">
<div class="float-underOver">
<input name="numDecimatedEdgesText" id="decimationText" type="text" value="10" size="4">
</div>
<div class="float-underOver">
<input name="numKText" id="kText" type="text" value="8" size="4">
</div>
</div>
<div class="float-child">
<div class="buttonGroup">
<button onclick="decimateMesh(document.getElementById('decimationText').value, document.getElementById('kText').value)">Decimate!</button>
</div>
</div>
</div>
<p style="clear:left; height: 0px;"></p>
<div class="float-container">
<h3>Export Results:</h3>
<div class="float-child float-leftCol">
<label for="filenameInput" id="filenameInputLabel" >File name:</label>
</div>
<div class="float-child float-midCol">
<input type="text" id="filenameInput" value="result.obj" size="8">
</div>
<div class="float-child">
<div class="buttonGroup">
<button onclick="downloadOBJ(document.getElementById('filenameInput').value)">Download .OBJ</button>
</div>
</div>
</div>
<p style="clear:left; height: 0px;"></p>
<div>
<h3>Controls:</h3>
<style type="text/css">
.tg {border-collapse:collapse;border-spacing:0;}
.tg td{border-color:black;border-style:solid;border-width:1px;font-family:Arial, sans-serif;font-size:14px;
overflow:hidden;padding:10px 5px;word-break:normal;}
.tg th{border-color:black;border-style:solid;border-width:1px;font-family:Arial, sans-serif;font-size:14px;
font-weight:normal;overflow:hidden;padding:10px 5px;word-break:normal;}
.tg .tg-1wig{font-weight:bold;text-align:left;vertical-align:top}
.tg .tg-0lax{text-align:left;vertical-align:top}
</style>
<table class="tg">
<thead>
<tr>
<th class="tg-1wig">Left click:</th>
<th class="tg-0lax">Rotate about X/Y</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tg-1wig">Scroll wheel:</td>
<td class="tg-0lax">Uniform scale</td>
</tr>
<tr>
<td class="tg-1wig">Right/middle click:</td>
<td class="tg-0lax">Translate</td>
</tr>
</tbody>
</table>
</div>
<br>
<!-- Index values representing the transform type passed here must match the values defined in ./scripts/shared.js -->
<!-- <br>
<h4>Non-uniform Scale:</h4>
<div class="slideContainer">
<label for="mesh_scale_x" id="mesh_scale_x_label" >X:</label>
<input id="mesh_scale_x" type="range" min="0.01" max="5" step="0.1" value="1" class="slider" oninput="updateMeshTransform(6, this.value)">
</div>
<div class="slideContainer">
<label for="mesh_scale_y" id="mesh_scale_y_label" >Y:</label>
<input id="mesh_scale_y" type="range" min="0.01" max="5" step="0.1" value="1" class="slider" oninput="updateMeshTransform(7, this.value)">
</div>
<div class="slideContainer">
<label for="mesh_scale_z" id="mesh_scale_z_label" >Z:</label>
<input id="mesh_scale_z" type="range" min="0.01" max="5" step="0.1" value="1" class="slider" oninput="updateMeshTransform(8, this.value)">
</div> -->
</body>
</html>