-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
81 lines (66 loc) · 3.11 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
<!DOCTYPE html>
<html>
<head>
<title>3D Model Viwer</title>
<meta charset="UTF-8" />
<link rel="stylesheet" href="./css/style.css" />
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
<script type="importmap">
{
"imports": {
"three": "https://unpkg.com/[email protected]/build/three.module.js",
"three/addons/": "https://unpkg.com/[email protected]/examples/jsm/"
}
}
</script>
<script type="module" src="./js/viewer.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"
integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL"
crossorigin="anonymous"></script>
</head>
<body>
<div class='h-100 w-100 d-flex align-items-center justify-content-center' style='position: absolute;'
id="spinnerParent">
<div style='position: absolute;' class='spinner-border text-primary' role='status' id="spinnerChild">
</div>
<span class='sr-only' style='position: absolute; padding-top: 90px; color: white;'>Loading, Please wait...</span>
</div>
<button id="load" class="btn btn-dark" style="position: absolute; top:15px; left:15px;"
onclick="openFileManager()"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor"
class="bi bi-upload" viewBox="0 0 16 16">
<path
d="M.5 9.9a.5.5 0 0 1 .5.5v2.5a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-2.5a.5.5 0 0 1 1 0v2.5a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2v-2.5a.5.5 0 0 1 .5-.5z" />
<path
d="M7.646 1.146a.5.5 0 0 1 .708 0l3 3a.5.5 0 0 1-.708.708L8.5 2.707V11.5a.5.5 0 0 1-1 0V2.707L5.354 4.854a.5.5 0 1 1-.708-.708l3-3z" />
</svg><span> Upload Model</span></i></button>
<label style="position: absolute; top:100px; left:30px; color: white;">Select Model:</label>
<img id="abutment" src="./assets/Abutments.png"
style="position: absolute; top:150px; left:50px; width: 60px; height: 60px;"
onclick="import('./js/viewer.js').then(module => module.loadSTLModel('Abutments_0.1.stl'))" />
<img id="maxilla" src="./assets/Maxilla.png"
style="position: absolute; top:240px; left:50px; width: 60px; height: 60px;"
onclick="import('./js/viewer.js').then(module => module.loadSTLModel('Maxilla_0.1.stl'))" />
<canvas id="c">
</canvas>
<input id="model-input" type="file" name="name" style="display: none;" accept=".stl" />
</body>
<script>
function openFileManager() {
var fileInput = document.getElementById('model-input');
fileInput.addEventListener('change', function () {
var modelInput = document.querySelector("#model-input");
var stlModel = modelInput.files[0];
if (stlModel) {
const reader = new FileReader();
reader.onload = function (event) {
const dataURL = event.target.result;
import('./js/viewer.js').then(module => module.loadSTLModel(dataURL));
};
reader.readAsDataURL(stlModel);
}
});
fileInput.click();
}
</script>
</html>