import * as UTILS from '../../globals';

const world = new (PHYSICS.$world(WHS.World))({
  ...UTILS.$world,

  physics: {
    ammo: process.ammoPath
  },

  softbody: true,

  gravity: {
    y: -9.8
  },

  camera: {
    far: 10000,
    near: 0.01,
    position: [0, 6, 18]
  }
});

const sphere = new WHS.Icosahedron({ // Softbody.
  geometry: {
    radius: 1,
    detail: 2
  },

  mass: 2,
  softbody: true,

  physics: {
    pressure: 100,
    damping: 0.01,
    friction: 0.3,

    klst: 0.6,
    kast: 0.6,
    margin: 0.05
  },

  shadow: {
    cast: false,
    receive: false
  },

  material: {
    color: UTILS.$colors.softbody,
    wireframe: true,
    kind: 'phong'
  },

  position: {
    y: 5
  }
});

sphere.native.frustumCulled = false;
sphere.position.y = 5;

UTILS.addBoxPlane(world, 250).then(() => sphere.addTo(world)).then(function () {
  for (var i = 0; i < 30; i++) {
    let newSphere = sphere.clone();
    newSphere.position.y = 5 + 4 * (i + 1);
    newSphere.native.frustumCulled = false;
    newSphere.addTo(world);
  }
});

new WHS.DirectionalLight({
  light: {
    color: 0xffffff, // 0x00ff00,
    intensity: 1
  },

  position: {
    x: 0,
    y: 10,
    z: 30
  },

  target: {
    x: 0,
    y: 0,
    z: 0
  }
}).addTo(world);

new WHS.AmbientLight({
  light: {
    color: 0xffffff,
    intensity: 0.5
  }
}).addTo(world);

world.setControls(new WHS.OrbitControls());
world.start();

@@ -56,140 +56,289 @@
 new 
-(PHYSICS.$world(WHS.World))(%7B%0A  ...UTILS.$world,%0A%0A  physics: %7B%0A    ammo: process.ammoPath%0A  %7D,%0A%0A  softbody: true,%0A%0A  gravity
+WHS.App(%5B%0A  new WHS.app.ElementModule(),%0A  new WHS.app.SceneModule(),%0A  new WHS.app.CameraModule(%7B%0A    position: new THREE.Vector3(0, 6, 18),%0A    far: 10000%0A  %7D),%0A  new WHS.app.RenderingModule(%7B%0A    bgColor: 0x162129,%0A%0A    renderer: %7B%0A      antialias: true,%0A      shadowmap
 : %7B%0A    
 y: -
@@ -337,96 +337,253 @@
     
+  
-y: -9.8%0A  %7D,%0A%0A  camera: %7B%0A    far: 10000,%0A    near: 0.01,%0A    position: %5B0, 6, 18%5D%0A  %7D%0A%7D
+  type: THREE.PCFSoftShadowMap%0A      %7D%0A    %7D%0A  %7D),%0A  new PHYSICS.WorldModule(%7B%0A    ammo: process.ammoPath,%0A    gravity: new THREE.Vector3(0, -9.8, 0),%0A    softbody: true%0A  %7D),%0A  new WHS.OrbitControlsModule(),%0A  new WHS.app.AutoresizeModule()%0A%5D
 );%0A%0A
@@ -688,48 +688,68 @@
 %0A  m
-ass: 2,%0A  softbody: true,%0A%0A  physics: %7B%0A
+odules: %5B%0A    new PHYSICS.SoftbodyModule(%7B%0A      mass: 2,%0A  
     
@@ -767,16 +767,18 @@
 00,%0A    
+  
 damping:
@@ -788,16 +788,18 @@
 01,%0A    
+ 
+ 
 friction
@@ -805,17 +805,18 @@
 n: 0.3,%0A
-%0A
+  
     klst
@@ -826,16 +826,18 @@
 .6,%0A    
+ 
+ 
 kast: 0.
@@ -835,24 +835,26 @@
  kast: 0.6,%0A
+  
     margin: 
@@ -858,19 +858,26 @@
 n: 0.05%0A
+  
   %7D
+)%0A  %5D
 ,%0A%0A  sha
@@ -937,16 +937,44 @@
 terial: 
+new THREE.MeshPhongMaterial(
 %7B%0A    co
@@ -1025,31 +1025,13 @@
 true
-,%0A    kind: 'phong'
 %0A  %7D
+)
 ,%0A%0A 
@@ -1101,31 +1101,8 @@
 lse;
-%0Asphere.position.y = 5;
 %0A%0AUT
@@ -1170,19 +1170,13 @@
 hen(
-function ()
+() =%3E
  %7B%0A 
@@ -1185,11 +1185,11 @@
 or (
-var
+let
  i =
@@ -1211,18 +1211,20 @@
 ) %7B%0A    
-le
+cons
 t newSph
@@ -1242,16 +1242,27 @@
 e.clone(
+true, false
 );%0A    n
@@ -1525,55 +1525,8 @@
  30%0A
-  %7D,%0A%0A  target: %7B%0A    x: 0,%0A    y: 0,%0A    z: 0%0A
   %7D%0A
@@ -1643,52 +1643,8 @@
 );%0A%0A
-world.setControls(new WHS.OrbitControls());%0A
 worl

Fix performance/softbodies example