X-Git-Url: https://gitweb.ps.run/cloth_sim/blobdiff_plain/999a549825d3de0b53e2922462ed1e120e176ec2..8bf51c36d322cb8d4f099d3475563ee4e520ab92:/Scripts/main.js diff --git a/Scripts/main.js b/Scripts/main.js index 3353f4d..5e68a4f 100644 --- a/Scripts/main.js +++ b/Scripts/main.js @@ -1,5 +1,4 @@ -//import { } from './cloth.js'; -//import { OrbitControls } from './OrbitControls.js'; + function addLights(scene){ scene.add( new THREE.AmbientLight( 0x222222 ) ); @@ -75,21 +74,26 @@ function init() { const canvasSpace = 200; /** Constant Frame Time */ - const frameTime = 1000.0 / 60.0; + const frameTime = 1000.0 / 200.0; /** Setup scene */ let [scene, camera, renderer] = setup_scene(canvasSpace); - //const loader = new THREE.TextureLoader(); + const loader = new THREE.TextureLoader(); //Red color: 0xC70039 - const cloth = new Cloth(1, 0.5, 20, 10); + const cloth = new Cloth(1, 0.5, 20, 20); const clothGeometry = cloth.generateGeometry(); - //const clothMaterial = new THREE.MeshStandardMaterial({ map: loader.load('Textures/DeutschlandFlagge.jpg'), color: 0xffffff, side: THREE.DoubleSide, flatShading: false}); - const clothMaterial = new THREE.MeshStandardMaterial({ color: 0xC70039, side: THREE.DoubleSide, flatShading: false }); + const clothMaterial = new THREE.MeshStandardMaterial({ map: loader.load('Textures/hsrm.jpg'), color: 0xffffff, side: THREE.DoubleSide, flatShading: false}); + //const clothMaterial = new THREE.MeshStandardMaterial({ color: 0xC70039, side: THREE.DoubleSide, flatShading: false }); const clothMesh = new THREE.Mesh(clothGeometry, clothMaterial); scene.add(clothMesh); + document.getElementById("windToggle").checked = options.wind; + document.getElementById("windToggle").onchange = (e) => { + options.wind = e.target.checked; + }; + let raycaster = new THREE.Raycaster(); let intersects; let rightMousePressed;