-
Notifications
You must be signed in to change notification settings - Fork 0
/
xemantic.html
171 lines (151 loc) · 7.52 KB
/
xemantic.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
<html>
<head>
<script src="https://aframe.io/releases/1.2.0/aframe.min.js"></script>
<script src="lib/aframe-orbit-controls.js"></script>
<script src="lib/apply-envmap.js"></script>
<script src="material-modifier.js"></script>
<script>const fuckTheAiConfig = {
useVimeo: true
};
addScript("custom.js");
addScript("https://kit.fontawesome.com/0bbdfd8b39.js", (script) => {
script.setAttribute("crossorigin", "anonymous");
});
addCss("https://fonts.googleapis.com/css2?family=Arsenal:ital,wght@0,400;0,700;1,400;1,700&display=swap");
// addPostLoadScript("analytics.js");
/* shadow settings, too much blur will make it super slow */
const MAX_SHADOW_DROP = 5.0;
const MAX_BLUR_RADIUS = .9;</script>
<style>
#UI {
position: fixed;
z-index: 1000;
}
</style>
<style>
#info {
position: fixed;
z-index: 999;
text-align: center;
width: 100%;
margin: 0 auto;
}
</style>
</head>
<body>
<div id="info">
<p>Xemantic studio<a href="https://sketchfab.com/3d-models/lowpoly-police-car-b2566e74d1574932965c1fc42e535ab0"></a>
<a href="https://creativecommons.org/licenses/by/4.0/"></a><br>
</p>
</div>
<div id="UI">
<p><b>head:</b></p>
<div>
<input id="lsirencolor" type="color" value="#0000ff"><label>Color</label>
</div>
<div>
<input id="lsirenemissive" type="color" value="#0000ff"><label>Emissive</label>
</div>
<div>
<input id="lsirenintensity" type="range" min="0" max="100" value="50"><label>Emissive intensity</label>
</div>
<div>
<input id="lsirenopacity" type="range" min="0" max="100" value="100"><label>opacity</label>
</div>
<div>
<input id="lsirenroughness" type="range" min="0" max="100" value="100"><label>roughness</label>
</div>
<div>
<input id="lsirenmetalness" type="range" min="0" max="100" value="100"><label>metalness</label>
</div>
<hr>
<p><b>screen:</b></p>
<div>
<input id="rsirencolor" type="color" value="#ff0000"><label>Color</label>
</div>
<div>
<input id="rsirenemissive" type="color" value="#ff0000"><label>Emissive</label>
</div>
<div>
<input id="rsirenintensity" type="range" min="0" max="100" value="50"><label>Emissive intensity</label>
</div>
<div>
<input id="rsirenopacity" type="range" min="0" max="100" value="100"><label>opacity</label>
</div>
<div>
<input id="rsirenroughness" type="range" min="0" max="100" value="100"><label>roughness</label>
</div>
<div>
<input id="rsirenmetalness" type="range" min="0" max="100" value="100"><label>metalness</label>
</div>
</div>
<!-- AFRAME SCENE -->
<a-scene light="defaultLightsEnabled: true" >
<a-assets>
<video id="bck" autoplay loop="true" src="assets/police_car/uroboros.mp4"></video>
</a-assets>
<a-entity id="model" position="0 1 -2" scale="0.75 0.75 0.75" gltf-model="assets/police_car/poly.glb" apply-envmap
material-modifier__Siren_Blue_light="emissive: 0x0000FF; emissiveIntensity: 0.5"
material-modifier__Car_Black_Part="roughness: 0"
material-modifier__Car_Glass="roughness: 0"
material-modifier="name: Siren_Red_light; emissive: 0xFF0000; emissiveIntensity: 0.5;">
</a-entity>
<a-entity camera look-controls orbit-controls="target: 0 1.25 -2; minDistance: 0; maxDistance: 180; initialPosition: 0 6 6"></a-entity>
<a-videosphere src="#bck"></a-videosphere>
</a-scene>
<!-- "UI" handling -->
<script>
const entity = document.querySelector("#model");
// UI CHANGES
function updateColorAttribute(componentName, property, evt) {
model.setAttribute(componentName, property, evt.target.value);
}
function updateNumberAttribute(componentName, property, evt) {
model.setAttribute(componentName, property, evt.target.value / 100);
}
// ui elements
const lSirenColor = document.getElementById("lsirencolor")
const lSirenEmissive = document.getElementById("lsirenemissive")
const lSirenIntensity = document.getElementById("lsirenintensity")
const lSirenOpacity = document.getElementById("lsirenopacity")
const lSirenRoughness = document.getElementById("lsirenroughness")
const lSirenMetalness = document.getElementById("lsirenmetalness")
const rSirenColor = document.getElementById("rsirencolor")
const rSirenEmissive = document.getElementById("rsirenemissive")
const rSirenIntensity = document.getElementById("rsirenintensity")
const rSirenOpacity = document.getElementById("rsirenopacity")
const rSirenRoughness = document.getElementById("rsirenroughness")
const rSirenMetalness = document.getElementById("rsirenmetalness")
function inputListenerWrapper(element, callback) {
element.addEventListener("input", callback, false);
element.addEventListener("change", callback, false);
}
// Left Siren
const updateLSirenColor = updateColorAttribute.bind(this, "material-modifier__Siren_Blue_light", "color")
inputListenerWrapper(lSirenColor, updateLSirenColor)
const updateLSirenEmissive = updateColorAttribute.bind(this, "material-modifier__Siren_Blue_light", "emissive")
inputListenerWrapper(lSirenEmissive, updateLSirenEmissive)
const updateLSirenEmissiveIntensity = updateNumberAttribute.bind(this, "material-modifier__Siren_Blue_light", "emissiveIntensity")
inputListenerWrapper(lSirenIntensity, updateLSirenEmissiveIntensity)
const updateLSirenOpacity = updateNumberAttribute.bind(this, "material-modifier__Siren_Blue_light", "opacity")
inputListenerWrapper(lSirenOpacity, updateLSirenOpacity)
const updateLSirenRoughness = updateNumberAttribute.bind(this, "material-modifier__Siren_Blue_light", "roughness")
inputListenerWrapper(lSirenRoughness, updateLSirenRoughness)
const updateLSirenMetalness = updateNumberAttribute.bind(this, "material-modifier__Siren_Blue_light", "metalness")
inputListenerWrapper(lSirenMetalness, updateLSirenMetalness)
// right Siren
const updateRSirenColor = updateColorAttribute.bind(this, "material-modifier", "color")
inputListenerWrapper(rSirenColor, updateRSirenColor)
const updateRSirenEmissive = updateColorAttribute.bind(this, "material-modifier", "emissive")
inputListenerWrapper(rSirenEmissive, updateRSirenEmissive)
const updateRSirenEmissiveIntensity = updateNumberAttribute.bind(this, "material-modifier", "emissiveIntensity")
inputListenerWrapper(rSirenIntensity, updateRSirenEmissiveIntensity)
const updateRSirenOpacity = updateNumberAttribute.bind(this, "material-modifier", "opacity")
inputListenerWrapper(rSirenOpacity, updateRSirenOpacity)
const updateRSirenRoughness = updateNumberAttribute.bind(this, "material-modifier", "roughness")
inputListenerWrapper(rSirenRoughness, updateRSirenRoughness)
const updateRSirenMetalness = updateNumberAttribute.bind(this, "material-modifier", "metalness")
inputListenerWrapper(rSirenMetalness, updateRSirenMetalness)
</script>
</body>
</html>