- /** 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.MeshStandardMaterial({ color: 0xC70039, side: THREE.DoubleSide, flatShading: false });\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( 0x222222 ) );\r
-\r
- const light1 = new THREE.PointLight( 0xffffff, 1, 50 );\r
- light1.position.set( 15, 1, 40 );\r
- scene.add( light1 );\r
- const light2 = new THREE.PointLight( 0xffffff, 1, 50 );\r
- light2.position.set( -15, 0, 40 );\r
- scene.add( light2 );\r
- const light3 = new THREE.PointLight( 0xffffff, 1, 50 );\r
- light3.position.set( 0, -1, 40 );\r
- scene.add( light3 );\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