-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path3d-object-viewer-geometric-solids.html
238 lines (203 loc) · 8.64 KB
/
3d-object-viewer-geometric-solids.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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
<!-- FCT NOVA | FCT-UNL (Faculty of Sciences and Technology of New University of Lisbon) -->
<!-- Integrated Master (BSc./MSc.) of Computer Engineering -->
<!-- Computer Graphics and Interfaces (2016-2017) -->
<!-- Lab Work 2 - 3D Object Viewer - Geometric Solids -->
<!-- Daniel Filipe Pimenta - no. 45404 - d.pimenta@campus.fct.unl.pt -->
<!-- Ruben André Barreiro - no. 42648 - r.barreiro@campus.fct.unl.pt -->
<!DOCTYPE html>
<html>
<head>
<link rel="shortcut icon" type="image/x-icon" href="https://raw.githubusercontent.com/rubenandrebarreiro/rubenandrebarreiro.github.io/master/assets/images/javascript-logo-1.png"/>
<link rel="stylesheet" type="text/css" href="3d-object-viewer-geometric-solids.css">
<script id="vertex-shader-1" type="x-shader/x-vertex">
attribute vec4 vPosition;
attribute vec4 vColor;
attribute vec3 vNormal;
uniform mat4 mProjection;
uniform mat4 mModelView;
uniform mat4 mNormals;
uniform float red;
uniform float green;
uniform float blue;
varying vec4 fColor;
void main() {
gl_Position = mProjection * mModelView * vPosition;
float r = max(red, vPosition.x);
float g = max(green, vPosition.y);
float b = max(blue, vPosition.z);
fColor = vec4(r,g,b,1.0);
}
</script>
<script id="fragment-shader-1" type="x-shader/x-fragment">
precision mediump float;
varying vec4 fColor;
void main() {
gl_FragColor = fColor;
}
</script>
<script id="vertex-shader-2" type="x-shader/x-vertex"></script>
<script id="fragment-shader-2" type="x-shader/x-fragment"></script>
<script type="text/javascript" src="common/webgl-utils.js"></script>
<script type="text/javascript" src="common/initShaders.js"></script>
<script type="text/javascript" src="common/MV.js"></script>
<script type="text/javascript" src="common/cube.js"></script>
<script type="text/javascript" src="common/sphere.js"></script>
<script type="text/javascript" src="common/quadPyramid.js"></script>
<script type="text/javascript" src="common/torus.js"></script>
<script type="text/javascript" src="common/cone.js"></script>
<script type="text/javascript" src="common/cylinder.js"></script>
<script type="text/javascript" src="3d-object-viewer-geometric-solids.js"></script>
</head>
<body>
<title>3D Object Viewer - Geometric Solids</title>
<div id="singlepagecontainer">
<div id="workDescription">
<h5>
<a href="https://www.fct.unl.pt/en/education/course/integrated-master-computer-science">
Computer Science and Engineering Integrated Master
</a>
</h5>
<h6>
@ <a href="https://www.fct.unl.pt/en"><i>FCT NOVA | FCT/UNL (Faculty of Sciences and Technology of New University of Lisbon)</i></a>
</h6>
<h6>
<a href="http://www.unl.pt/guia/2018/fct/UNLGI_getUC?uc=8150">Computer Graphics and Interfaces</a>
(2016/2017)
-
Lab Work 2 (3D Object Viewer - Geometric Solids)
</h6>
</div>
<div id="authorsInfo">
<h5>
Authors/Contributors
</h5>
<h6>
<u><i>Rúben André Barreiro</i></u> - no. 42648 (<a href="mailto:r.barreiro@campus.fct.unl.pt">r.barreiro@campus.fct.unl.pt</a>)
</br>
</br>
<u><i>Daniel Filipe Pimenta</i></u> - no. 45404 (<a href="mailto:d.pimenta@campus.fct.unl.pt">d.pimenta@campus.fct.unl.pt</a>)
</h6>
</div>
<div id="settings">
<h5>
Settings/Adjustments
</h5>
<h6>
<u><i>Visualization Options</i></u>
</br>
</br>
Wired Draw <input type="checkbox" id="wireDraw">
|
Z-Buffer / Depth Test Method <input type="checkbox" id="zBuffer" value="zBuffer">
|
Back Face Culling Method
<input type="checkbox" id="backFaceCulling" value="backFaceCulling">
</h6>
<hr/>
<h6>
<u><i>Geometric Solids Available</i></u>
</br>
</br>
<select id="obj">
<option> Cube </option>
<option> Sphere </option>
<option> Quadrangular Pyramid </option>
<option> Torus </option>
<option> Cone </option>
<option> Cylinder </option>
</select>
</h6>
<hr/>
<h6>
<u><i>Current Projection in Use</i></u>
</br>
</br>
<select id="prj">
<option> Oblique </option>
<option> Axonometric </option>
<option> Perspective </option>
</select>
</br>
</br>
</br>
<div id="obliquePrj">
Foreshorten Ratio
</br>
<input id="fRatio" type="range" min="0.0" max="1.0" step="0.05" value="1.0">
</br>
Angle
</br>
<input id="oblAngle" type="range" min="0" max="360" step="0.01" value="45">
</br>
</div>
<div id="axonometricPrj">
Gamma Angle
</br>
<input id="axoGamma" type="range" min="0" max="360" step="1" value="19.4205368891236">
</br>
Theta Angle
</br>
<input id="axoTheta" type="range" min="0" max="360" step="1" value="339.731932804673">
</br>
</div>
<div id="perspectivePrj">
Vanishing Point
</br>
<input id="persPoint" type="range" min="1.0" max="10.0" step="0.05" value="5.0">
</br>
</div>
</h6>
<hr/>
<h6>
<u><i>Current Color in Use</i></u>
</h6>
<h6>
<font color="red"><b>Red</b></font>
</br>
<input id="redFactor" type="range" min="0.0" max="1.0" step="0.05" value="0.0">
</br>
<font color="green"><b>Green</b></font>
</br>
<input id="greenFactor" type="range" min="0.0" max="1.0" step="0.05" value="0.0">
</br>
<font color="blue"><b>Blue</b></font>
</br>
<input id="blueFactor" type="range" min="0.0" max="1.0" step="0.05" value="0.0">
</h6>
<hr/>
<h6>
<u><i>Vertex/Fragment Shaders</i></u>
</h6>
<h6>
<div>
Vertex Shader
<input type="file" id="vertex">
</div>
</br>
</br>
<div>
Fragment Shader
<input type="file" id="fragment">
</div>
</br>
</br>
<div>
<input type="button" id="loadBtn" value="Load Shaders">
<input type="button" id="unloadBtn" value="Unload Shaders">
</div>
</h6>
</div>
<div id="viewarea">
<canvas id="gl-canvas">
Oops... your browser doesn't support the HTML5 canvas element"
</canvas>
</div>
</div>
</body>
</html>