- /** setup cloth and generate debug mesh */\r
- let cloth = new Cloth();\r
- cloth.createBasic(10, 10, 10, 10);\r
- //cloth.createDebugMesh(scene);\r
-\r
- //const material = new THREE.MeshBasicMaterial({ color: 0x0000ff, side: THREE.DoubleSide });\r
- const material = new THREE.MeshPhongMaterial({ color: 0x0000ff, side: THREE.DoubleSide });\r
- const mesh = new THREE.Mesh(cloth.geometry, material);\r
- //const mesh = new THREE.WireframeGeometry(cloth.geometry);\r
- //const line = new THREE.LineSegments(mesh);\r
- //line.material.depthTest = false;\r
- //line.material.opacity = 0.25;\r
- //line.material.transparent = true;\r
- scene.add(mesh);\r
-\r
- scene.add( new THREE.AmbientLight( 0x666666 ) );\r
-\r
- const light = new THREE.DirectionalLight( 0xffffff, 0.5 );\r
- light.position.set( 0, 1, 0.5 );\r
- scene.add( light );\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/hsrm2.png'), color: {type: "c", value: new THREE.Color(0xffffff)}, side: THREE.DoubleSide, flatShading: false, transparent: true });\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