]> gitweb.ps.run Git - cloth_sim/blobdiff - Scripts/main.js
change material
[cloth_sim] / Scripts / main.js
index 8c61f82566a2653bc8f890435f7a41a30f098186..4e7c2ef7bb32e51f874a950f2697f75586f547e4 100644 (file)
@@ -84,7 +84,8 @@ function init() {
   cloth.createBasic(10, 10, 10, 10);\r
   //cloth.createDebugMesh(scene);\r
 \r
   cloth.createBasic(10, 10, 10, 10);\r
   //cloth.createDebugMesh(scene);\r
 \r
-  const material = new THREE.MeshBasicMaterial({ color: 0x0000ff });\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
   const mesh = new THREE.Mesh(cloth.geometry, material);\r
   //const mesh = new THREE.WireframeGeometry(cloth.geometry);\r
   //const line = new THREE.LineSegments(mesh);\r
@@ -93,6 +94,12 @@ function init() {
   //line.material.transparent = true;\r
   scene.add(mesh);\r
 \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
+\r
   /**\r
    * function called every frame\r
    * @param {number} dt - time passed since last frame in ms\r
   /**\r
    * function called every frame\r
    * @param {number} dt - time passed since last frame in ms\r