Jump to content

Test: Difference between revisions

From Survivalcraft Wiki
No edit summary
No edit summary
Line 50: Line 50:
     });
     });
   });
   });
</script>
</body>
</html>
<html>
<head>
  <script type="module" src="https://ajax.googleapis.com/ajax/libs/model-viewer/4.0.0/model-viewer.min.js"></script>
</head>
<body>
<model-viewer id="bearModel"
  src="https://survivalcraft.wiki/content/Models/Bear.glb"
  ar shadow-intensity="1" camera-controls touch-action="pan-y">
</model-viewer>
<script type="module">
const modelViewer = document.querySelector('#bearModel');
modelViewer.addEventListener('load', async () => {
  // Get all materials
  const materials = modelViewer.model.materials;
  // For demonstration, apply to the first material
  const material = materials[0];
  // Create Image object
  const texture = new Image();
  texture.src = 'https://survivalcraft.wiki/content/Textures/Creatures/Bear_Brown.png';
  await texture.decode(); // wait until loaded
  // Assign as baseColorTexture
  material.pbrMetallicRoughness.setBaseColorTexture(texture);
});
</script>
</script>
</body>
</body>
</html>
</html>

Revision as of 17:33, 28 July 2025


Cell 1 Cell 2
Cell 3 Cell 4