shx-3d-render

main
Jan Umbach 2024-06-13 20:25:07 +02:00
parent d8c928a87f
commit 5926dc5427
1 changed files with 8 additions and 6 deletions

View File

@ -112,15 +112,17 @@
console.log('threejs loaded');
import("{{ 'three.module.min.js' | asset_url }}").then(THREE => {
// Your Three.js code goes here
const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
const renderer = new THREE.WebGLRenderer();
// calc width and height
const width = container.offsetWidth;
const height = width;
// Your Three.js code goes here
const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(75, width / height, 0.1, 1000);
const renderer = new THREE.WebGLRenderer();
renderer.setSize(width, height);
renderer.setAnimationLoop(animate);