+function init() {\r
+ let mousePos = new THREE.Vector2();\r
+ \r
+ /**\r
+ * Space left empty under canvas\r
+ * for UI elements\r
+ */\r
+ const canvasSpace = 200;\r
+\r
+ /** Constant Frame Time */\r
+ const frameTime = 1000.0 / 200.0;\r
+\r
+ /** Setup scene */\r
+ let [scene, camera, renderer] = setup_scene(canvasSpace);\r
+ \r
+ const loader = new THREE.TextureLoader();\r
+ //Red color: 0xC70039\r
+\r
+ const cloth = new Cloth(1, 0.5, 20, 20);\r
+ const clothGeometry = cloth.generateGeometry();\r
+ const clothMaterial = new THREE.MeshStandardMaterial({ map: loader.load('Textures/hsrm.jpg'), color: 0xffffff, side: THREE.DoubleSide, flatShading: false});\r
+ //const clothMaterial = new THREE.MeshStandardMaterial({ color: 0xC70039, side: THREE.DoubleSide, flatShading: false });\r
+ const clothMesh = new THREE.Mesh(clothGeometry, clothMaterial);\r
+ scene.add(clothMesh);\r
+ \r
+ document.getElementById("windToggle").checked = options.wind;\r
+ document.getElementById("windToggle").onchange = (e) => {\r
+ options.wind = e.target.checked;\r
+ };\r
+\r
+ let raycaster = new THREE.Raycaster();\r
+ let intersects;\r
+ let rightMousePressed;\r
+ /**\r
+ * function called every frame\r
+ * @param {number} dt - time passed since last frame in ms\r
+ */\r