aaronb commited on
Commit
ef850ee
·
verified ·
1 Parent(s): 4e312e8

Update assets/modelviewer-textured-template.html

Browse files
assets/modelviewer-textured-template.html CHANGED
@@ -28,6 +28,20 @@
28
  <div class="centered-container">
29
  <model-viewer>
30
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  </body>
32
 
33
  </html>
 
28
  <div class="centered-container">
29
  <model-viewer>
30
  </div>
31
+
32
+ <script>
33
+ document.addEventListener('DOMContentLoaded', () => {
34
+ const modelViewers = document.querySelectorAll('model-viewer');
35
+
36
+ modelViewers.forEach(modelViewer => {
37
+ modelViewer.addEventListener('load', (event) => {
38
+ const [material] = modelViewer.model.materials;
39
+ material.pbrMetallicRoughness.setMetallicFactor(0.1);
40
+ material.pbrMetallicRoughness.setRoughnessFactor(0.5);
41
+ });
42
+ });
43
+ });
44
+ </script>
45
  </body>
46
 
47
  </html>