-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.html
More file actions
83 lines (83 loc) · 2.33 KB
/
index.html
File metadata and controls
83 lines (83 loc) · 2.33 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
<html>
<head>
<style>
body {
margin: 0;
padding: 0;
background-color: #000;
color: #fff;
user-select: none;
}
#cont {
width: 800px;
margin: auto;
}
#inpt {
display: none;
}
#entry {
text-align: center;
text-decoration: underline;
background-color: #fff;
color: #000;
font-size: 48px;
padding: 5px;
border: 1px solid #fff;
}
#entry:hover {
cursor: pointer;
background-color: #000;
color: #fff;
}
#disp {
display: none;
font-family: monospace;
font-size: 18px;
}
#cnvs {
float: left;
cursor: -webkit-grabbing;
}
#settings {
height: 100%;
}
input[type='range'] {
display: block;
margin: auto;
}
#sliders {
text-align: center;
}
</style>
<script src='https://git.io/zengine.js'></script>
</head>
<body>
<div id='cont'>
<h style='font-size: 64; text-align: center;'>STL Viewer</h>
<p>This webapp allows you to view any stl file directly in the broswer, client-side. All the code was written by me and can be found over on <a href='https://github.com/joeiddon/stl_viewer'>GitHub</a>. Feel free to have a look - it's ownly about 200 lines long.</p>
<p>For the 3D rendering, I am using my 3D JavaScript engine - <a href='https://github.com/joeiddon/zengine'>zengine.js</a>. It is not as efficient as other libraries, but I wrote it entirely by myself and so I know exactly how it works and what is going on. However due to this, <b>large <i>.stl</i> files are slow to render.</b></p>
<p>Click the button below to load in your file.</p>
<br><br>
<label for='inpt' id='entry'>select <i>.stl</i></label>
<input id='inpt' type='file' accept='.stl'></input>
</div>
<div id='disp'>
<canvas id='cnvs'></canvas>
<div id='settings'>
<h style='font-size: 20px;text-align:middle;'>options</h>
<br><br>
<input id='wrfrm' type='checkbox' onchange='wireframe=this.checked; update();' checked></input>
<label for='wrfrm'>wireframe</label>
<br><br>
<div id='sliders'>
<label for='dst'>distance from object</label>
<br>
<input id='dst' type='range' min='0' value='128' max='400' oninput='cam.y=-this.value;update();'></input>
<br>
<a id='dwnld_a'>download json of model</input>
</div>
</div>
</div>
<script src='script.js'></script>
</body>
</html>