-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfounder.html
124 lines (96 loc) · 5.29 KB
/
founder.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device=width, initial-scale=1.0">
<title>Founder Series</title>
<script type="module" src="https://unpkg.com/@google/model-viewer/dist/model-viewer.min.js"></script><!---->
<link rel="icon" type="image/x-icon" href="https://01000001khan.github.io/AR-Speakers/assets/textures/founderFavicon.ico?">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@picocss/pico@1/css/pico.min.css">
<link rel="stylesheet" href="universal.css">
</head>
<body>
<div class="container">
<form action="https://01000001khan.github.io/AR-Speakers/index.html">
<input type="submit" value="Home Page" />
<select class="controls" ,="" id="color-controls">
<option value="assets/textures/founder/blackWalnut.jpg">Black Walnut</option>
<option value="assets/textures/founder/darkCherry.jpg">Dark Cherry</option>
<option value="assets/textures/founder/walnut.jpg" selected="selected">Walnut</option>
<option value="assets/textures/founder/pianoBlack.jpg">Piano Black</option>
<option value="assets/textures/UV.jpg">Non-existent Testing Material</option>
</select>
</form>
<p>Founder 40B</p>
<model-viewer id="speaker" ar ar-modes="webxr scene-viewer quick-look" camera-controls shadow-intensity="1" shadow-softness="1" enable-pan auto-rotate src="assets/models/founder/founder40b.glb" loading="eager">
</model-viewer>
<p>Founder 70LCR</p>
<model-viewer id="speaker" ar ar-modes="webxr scene-viewer quick-look" camera-controls shadow-intensity="1" shadow-softness="1" enable-pan auto-rotate src="assets/models/founder/founder70lcr.glb">
</model-viewer>
<p>Founder 80F</p>
<model-viewer id="speaker" ar ar-modes="webxr scene-viewer quick-look" camera-controls shadow-intensity="1" shadow-softness="1" enable-pan auto-rotate src="assets/models/founder/founder80f.glb">
</model-viewer>
<p>Founder 90C</p><br>
<model-viewer id="speaker" ar ar-modes="webxr scene-viewer quick-look" camera-controls shadow-intensity="1" shadow-softness="1" enable-pan auto-rotate src="assets/models/founder/founder90c.glb">
</model-viewer>
<p>Founder 100F</p>
<model-viewer id="speaker" ar ar-modes="webxr scene-viewer quick-look" camera-controls shadow-intensity="1" shadow-softness="1" enable-pan auto-rotate src="assets/models/founder/founder100f.glb">
</model-viewer>
<p>Founder 120H</p>
<model-viewer id="speaker" ar ar-modes="webxr scene-viewer quick-look" camera-controls shadow-intensity="1" shadow-softness="1" enable-pan auto-rotate src="assets/models/founder/founder120h.glb">
</model-viewer>
<p>Founder 120H exploded</p>
<model-viewer id="speaker" ar ar-modes="webxr scene-viewer quick-look" camera-controls shadow-intensity="1" shadow-softness="1" enable-pan auto-rotate src="assets/models/founder/founder120hExploded.glb">
</model-viewer>
<p>Founder 120H cutaway</p>
<model-viewer id="speaker" ar ar-modes="webxr scene-viewer quick-look" camera-controls shadow-intensity="1" shadow-softness="1" enable-pan auto-rotate src="assets/models/founder/founder120hCutaway.glb">
</model-viewer>
</div>
<script>
const speakers = document.querySelectorAll("#speaker");
const speaker = document.querySelector("#speaker");
const colorSelector = document.querySelector('#color-controls');
speaker.addEventListener("load", () => {
const createAndApplyTexture = async (channel, event) => {
const texture = await speaker.createTexture(colorSelector.value);
speakers.forEach(function(speaker){
const material = speaker.model.materials[0];
material.pbrMetallicRoughness[channel].setTexture(texture);
var finishName = colorSelector.options[colorSelector.selectedIndex].text;
if (finishName === "Black Walnut"){
material.pbrMetallicRoughness.setRoughnessFactor(0.8);
material.pbrMetallicRoughness.setMetallicFactor(1.0);
}
else if (finishName === "Dark Cherry"){
material.pbrMetallicRoughness.setRoughnessFactor(0.0);
material.pbrMetallicRoughness.setMetallicFactor(0.0);
}
else if (finishName === "Walnut")
{
material.pbrMetallicRoughness.setRoughnessFactor(0.8);
material.pbrMetallicRoughness.setMetallicFactor(0.1);
}
else if (finishName === "Piano Black")
{
material.pbrMetallicRoughness.setRoughnessFactor(0.0);
material.pbrMetallicRoughness.setMetallicFactor(1.0);
}
else if (finishName === "Non-existent Testing Material")
{
material.pbrMetallicRoughness.setRoughnessFactor(0.5);
material.pbrMetallicRoughness.setMetallicFactor(1.0);
}
});
}
document.querySelector('#color-controls').addEventListener('input', (event) => {
createAndApplyTexture('baseColorTexture', event);
});
speakers.forEach(function(speaker){
speaker.addEventListener('load', (event) => {
createAndApplyTexture('baseColorTexture', event);
});
});
});
</script>
</body>
</html>