Nikolay Suslov il y a 6 ans
Parent
commit
d82f481982
26 fichiers modifiés avec 4022 ajouts et 20822 suppressions
  1. 19 18
      package-lock.json
  2. 6 2
      support/client/lib/vwf/model/aframe.js
  3. 392 16514
      support/client/lib/vwf/model/aframe/addon/aframe-extras.controls.js
  4. 0 0
      support/client/lib/vwf/model/aframe/addon/aframe-extras.controls.min.js
  5. 630 536
      support/client/lib/vwf/model/aframe/addon/aframe-extras.loaders.js
  6. 0 0
      support/client/lib/vwf/model/aframe/addon/aframe-extras.loaders.min.js
  7. 679 856
      support/client/lib/vwf/model/aframe/aframe-master.js
  8. 1 0
      support/client/lib/vwf/model/aframe/aframe-master.js.map
  9. 0 0
      support/client/lib/vwf/model/aframe/aframe-master.min.js
  10. 0 0
      support/client/lib/vwf/model/aframe/aframe-master.min.js.map
  11. 48 29
      support/client/lib/vwf/model/aframe/extras/aframe-extras.controls.js
  12. 0 0
      support/client/lib/vwf/model/aframe/extras/aframe-extras.controls.min.js
  13. 1379 1469
      support/client/lib/vwf/model/aframe/extras/aframe-extras.js
  14. 0 0
      support/client/lib/vwf/model/aframe/extras/aframe-extras.min.js
  15. 1 1
      support/client/lib/vwf/model/aframe/extras/aframe-extras.misc.js
  16. 0 0
      support/client/lib/vwf/model/aframe/extras/aframe-extras.misc.min.js
  17. 259 242
      support/client/lib/vwf/model/aframe/extras/aframe-extras.pathfinding.js
  18. 0 0
      support/client/lib/vwf/model/aframe/extras/aframe-extras.pathfinding.min.js
  19. 0 0
      support/client/lib/vwf/model/ohm/ohm.js
  20. 0 0
      support/client/lib/vwf/model/ohm/ohm.min.js
  21. 14 3
      support/client/lib/vwf/view/aframe.js
  22. 19 37
      support/client/lib/vwf/view/editor-new.js
  23. 101 756
      support/client/lib/vwf/view/lib/mdc/dist/material-components-web.css
  24. 474 359
      support/client/lib/vwf/view/lib/mdc/dist/material-components-web.js
  25. 0 0
      support/client/lib/vwf/view/lib/mdc/dist/material-components-web.min.css
  26. 0 0
      support/client/lib/vwf/view/lib/mdc/dist/material-components-web.min.js

+ 19 - 18
package-lock.json

@@ -251,19 +251,20 @@
       }
     },
     "mocha": {
-      "version": "4.1.0",
-      "resolved": "https://registry.npmjs.org/mocha/-/mocha-4.1.0.tgz",
-      "integrity": "sha512-0RVnjg1HJsXY2YFDoTNzcc1NKhYuXKRrBAG2gDygmJJA136Cs2QlRliZG1mA0ap7cuaT30mw16luAeln+4RiNA==",
+      "version": "5.1.1",
+      "resolved": "https://registry.npmjs.org/mocha/-/mocha-5.1.1.tgz",
+      "integrity": "sha512-kKKs/H1KrMMQIEsWNxGmb4/BGsmj0dkeyotEvbrAuQ01FcWRLssUNXCEUZk6SZtyJBi6EE7SL0zDDtItw1rGhw==",
       "dev": true,
       "requires": {
-        "browser-stdout": "1.3.0",
+        "browser-stdout": "1.3.1",
         "commander": "2.11.0",
         "debug": "3.1.0",
-        "diff": "3.3.1",
+        "diff": "3.5.0",
         "escape-string-regexp": "1.0.5",
         "glob": "7.1.2",
         "growl": "1.10.3",
         "he": "1.1.1",
+        "minimatch": "3.0.4",
         "mkdirp": "0.5.1",
         "supports-color": "4.4.0"
       },
@@ -275,9 +276,9 @@
           "dev": true
         },
         "brace-expansion": {
-          "version": "1.1.8",
-          "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz",
-          "integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=",
+          "version": "1.1.11",
+          "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
+          "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
           "dev": true,
           "requires": {
             "balanced-match": "1.0.0",
@@ -285,9 +286,9 @@
           }
         },
         "browser-stdout": {
-          "version": "1.3.0",
-          "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.0.tgz",
-          "integrity": "sha1-81HTKWnTL6XXpVZxVCY9korjvR8=",
+          "version": "1.3.1",
+          "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz",
+          "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==",
           "dev": true
         },
         "commander": {
@@ -312,9 +313,9 @@
           }
         },
         "diff": {
-          "version": "3.3.1",
-          "resolved": "https://registry.npmjs.org/diff/-/diff-3.3.1.tgz",
-          "integrity": "sha512-MKPHZDMB0o6yHyDryUOScqZibp914ksXwAMYMTHj6KO8UeKsRYNJD3oNCKjTqZon+V488P7N/HzXF8t7ZR95ww==",
+          "version": "3.5.0",
+          "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz",
+          "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==",
           "dev": true
         },
         "escape-string-regexp": {
@@ -377,7 +378,7 @@
           "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
           "dev": true,
           "requires": {
-            "brace-expansion": "1.1.8"
+            "brace-expansion": "1.1.11"
           }
         },
         "minimist": {
@@ -486,9 +487,9 @@
       "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg=="
     },
     "should": {
-      "version": "13.2.0",
-      "resolved": "https://registry.npmjs.org/should/-/should-13.2.0.tgz",
-      "integrity": "sha512-DWrmYTHzvfaIRZhgVqEjGwzuYgowiiFxsvRViNv2HviAlRofWvGnkaDITLu6omAq5cBjZ9dk/Sn4tI06vE/+iw==",
+      "version": "13.2.1",
+      "resolved": "https://registry.npmjs.org/should/-/should-13.2.1.tgz",
+      "integrity": "sha512-l+/NwEMO+DcstsHEwPHRHzC9j4UOE3VQwJGcMWSsD/vqpqHbnQ+1iSHy64Ihmmjx1uiRPD9pFadTSc3MJtXAgw==",
       "dev": true,
       "requires": {
         "should-equal": "2.0.0",

+ 6 - 2
support/client/lib/vwf/model/aframe.js

@@ -268,7 +268,9 @@ define(["module", "vwf/model", "vwf/utility"], function (module, model, utility)
 
                 if (methodName == 'worldRotation') {
 
-                    let worldQuat = node.aframeObj.object3D.getWorldQuaternion(); 
+                    var worldQuat =  new THREE.Quaternion();
+                    node.aframeObj.object3D.getWorldQuaternion(worldQuat); 
+
                     let angle = (new THREE.Euler()).setFromQuaternion(worldQuat, 'YXZ');
                     let rotation = (new THREE.Vector3(THREE.Math.radToDeg(angle.x),
                     THREE.Math.radToDeg(angle.y), THREE.Math.radToDeg(angle.z) ));
@@ -278,7 +280,9 @@ define(["module", "vwf/model", "vwf/utility"], function (module, model, utility)
 
                 if (methodName == 'worldPosition') {
 
-                    let position = node.aframeObj.object3D.getWorldPosition();
+                    var position = new THREE.Vector3();
+
+                    node.aframeObj.object3D.getWorldPosition(position);
                     return position
 
                 }

Fichier diff supprimé car celui-ci est trop grand
+ 392 - 16514
support/client/lib/vwf/model/aframe/addon/aframe-extras.controls.js


Fichier diff supprimé car celui-ci est trop grand
+ 0 - 0
support/client/lib/vwf/model/aframe/addon/aframe-extras.controls.min.js


Fichier diff supprimé car celui-ci est trop grand
+ 630 - 536
support/client/lib/vwf/model/aframe/addon/aframe-extras.loaders.js


Fichier diff supprimé car celui-ci est trop grand
+ 0 - 0
support/client/lib/vwf/model/aframe/addon/aframe-extras.loaders.min.js


Fichier diff supprimé car celui-ci est trop grand
+ 679 - 856
support/client/lib/vwf/model/aframe/aframe-master.js


Fichier diff supprimé car celui-ci est trop grand
+ 1 - 0
support/client/lib/vwf/model/aframe/aframe-master.js.map


Fichier diff supprimé car celui-ci est trop grand
+ 0 - 0
support/client/lib/vwf/model/aframe/aframe-master.min.js


Fichier diff supprimé car celui-ci est trop grand
+ 0 - 0
support/client/lib/vwf/model/aframe/aframe-master.min.js.map


+ 48 - 29
support/client/lib/vwf/model/aframe/extras/aframe-extras.controls.js

@@ -842,7 +842,7 @@ module.exports = AFRAME.registerComponent('checkpoint-controls', {
       this.el.setAttribute('position', this.targetPosition);
       this.checkpoint = null;
       el.emit('navigation-end', { checkpoint: checkpoint });
-      el.components['movement-controls'].updateNavNode();
+      el.components['movement-controls'].updateNavLocation();
     }
   },
 
@@ -924,8 +924,8 @@ module.exports = AFRAME.registerComponent('gamepad-controls', {
     camera: { default: '[camera]', type: 'selector' },
 
     // Rotation sensitivity
-    rotationSensitivity: { default: 0.05 // radians/frame, ish
-    } },
+    rotationSensitivity: { default: 2.0 }
+  },
 
   /*******************************************************************
    * Core
@@ -1022,20 +1022,34 @@ module.exports = AFRAME.registerComponent('gamepad-controls', {
   updateRotation: function updateRotation(dt) {
     if (!this.isRotationActive()) return;
 
+    var data = this.data;
+    var yaw = this.yaw;
+    var pitch = this.pitch;
+    var lookControls = data.camera.components['look-controls'];
+    var hasLookControls = lookControls && lookControls.pitchObject && lookControls.yawObject;
+
+    // Sync with look-controls pitch/yaw if available.
+    if (hasLookControls) {
+      pitch.rotation.copy(lookControls.pitchObject.rotation);
+      yaw.rotation.copy(lookControls.yawObject.rotation);
+    }
+
     var lookVector = this.getJoystick(1);
 
     if (Math.abs(lookVector.x) <= JOYSTICK_EPS) lookVector.x = 0;
     if (Math.abs(lookVector.y) <= JOYSTICK_EPS) lookVector.y = 0;
 
-    var data = this.data;
-    var yaw = this.yaw;
-    var pitch = this.pitch;
-
     lookVector.multiplyScalar(data.rotationSensitivity * dt / 1000);
     yaw.rotation.y -= lookVector.x;
     pitch.rotation.x -= lookVector.y;
     pitch.rotation.x = Math.max(-Math.PI / 2, Math.min(Math.PI / 2, pitch.rotation.x));
-    data.camera.object3D.rotation.set(THREE.Math.radToDeg(pitch.rotation.x), THREE.Math.radToDeg(yaw.rotation.y), 0);
+    data.camera.object3D.rotation.set(pitch.rotation.x, yaw.rotation.y, 0);
+
+    // Sync with look-controls pitch/yaw if available.
+    if (hasLookControls) {
+      lookControls.pitchObject.rotation.copy(pitch.rotation);
+      lookControls.yawObject.rotation.copy(yaw.rotation);
+    }
   },
 
   /*******************************************************************
@@ -1355,9 +1369,7 @@ module.exports = AFRAME.registerComponent('movement-controls', {
   schema: {
     enabled: { default: true },
     controls: { default: ['gamepad', 'trackpad', 'keyboard', 'touch'] },
-    easing: { default: 15 }, // m/s2
-    easingY: { default: 0 }, // m/s2
-    acceleration: { default: 80 }, // m/s2
+    speed: { default: 0.3, min: 0 },
     fly: { default: false },
     constrainToNavMesh: { default: false },
     camera: { default: '[camera]', type: 'selector' }
@@ -1386,10 +1398,16 @@ module.exports = AFRAME.registerComponent('movement-controls', {
     }
   },
 
-  update: function update() {
-    if (this.el.sceneEl.hasLoaded) {
+  update: function update(prevData) {
+    var el = this.el;
+    var data = this.data;
+    if (el.sceneEl.hasLoaded) {
       this.injectControls();
     }
+    if (data.constrainToNavMesh !== prevData.constrainToNavMesh) {
+      var nav = el.sceneEl.systems.nav;
+      data.constrainToNavMesh ? nav.addAgent(this) : nav.removeAgent(this);
+    }
   },
 
   injectControls: function injectControls() {
@@ -1404,7 +1422,8 @@ module.exports = AFRAME.registerComponent('movement-controls', {
     }
   },
 
-  updateNavNode: function updateNavNode() {
+  updateNavLocation: function updateNavLocation() {
+    this.navGroup = null;
     this.navNode = null;
   },
 
@@ -1446,7 +1465,7 @@ module.exports = AFRAME.registerComponent('movement-controls', {
         end.copy(velocity).multiplyScalar(dt / 1000).add(start);
 
         var nav = el.sceneEl.systems.nav;
-        this.navGroup = this.navGroup || nav.getGroup(start);
+        this.navGroup = this.navGroup === null ? nav.getGroup(start) : this.navGroup;
         this.navNode = this.navNode || nav.getNode(start, this.navGroup);
         this.navNode = nav.clampStep(start, end, this.navGroup, this.navNode, clampedEnd);
         el.object3D.position.copy(clampedEnd);
@@ -1479,6 +1498,7 @@ module.exports = AFRAME.registerComponent('movement-controls', {
   },
 
   updateVelocity: function () {
+    var vector2 = new THREE.Vector2();
     // var matrix = new THREE.Matrix4();
     // var matrix2 = new THREE.Matrix4();
     // var position = new THREE.Vector3();
@@ -1506,19 +1526,11 @@ module.exports = AFRAME.registerComponent('movement-controls', {
         }
       }
 
-      if (AFRAME.components.velocity && !data.constrainToNavMesh) velocity.copy(this.el.getAttribute('velocity'));
-      velocity.x -= velocity.x * data.easing * dt / 1000;
-      velocity.y -= velocity.y * data.easingY * dt / 1000;
-      velocity.z -= velocity.z * data.easing * dt / 1000;
+      if (el.hasAttribute('velocity') && !data.constrainToNavMesh) {
+        velocity.copy(this.el.getAttribute('velocity'));
+      }
 
       if (dVelocity && data.enabled) {
-        // Set acceleration
-        if (dVelocity.length() > 1) {
-          dVelocity.setLength(this.data.acceleration * dt / 1000);
-        } else {
-          dVelocity.multiplyScalar(this.data.acceleration * dt / 1000);
-        }
-
         // TODO: Handle rotated rig.
         var cameraEl = data.camera;
         // matrix.copy(cameraEl.object3D.matrixWorld);
@@ -1530,9 +1542,16 @@ module.exports = AFRAME.registerComponent('movement-controls', {
         // Rotate to heading
         dVelocity.applyQuaternion(cameraEl.object3D.quaternion);
 
-        if (!data.fly) dVelocity.y = 0;
-
-        velocity.add(dVelocity);
+        var factor = dVelocity.length();
+        if (data.fly) {
+          velocity.copy(dVelocity);
+          velocity.multiplyScalar(this.data.speed * dt);
+        } else {
+          vector2.set(dVelocity.x, dVelocity.z);
+          vector2.setLength(factor * this.data.speed * dt);
+          velocity.x = vector2.x;
+          velocity.z = vector2.y;
+        }
       }
     };
   }()

Fichier diff supprimé car celui-ci est trop grand
+ 0 - 0
support/client/lib/vwf/model/aframe/extras/aframe-extras.controls.min.js


Fichier diff supprimé car celui-ci est trop grand
+ 1379 - 1469
support/client/lib/vwf/model/aframe/extras/aframe-extras.js


Fichier diff supprimé car celui-ci est trop grand
+ 0 - 0
support/client/lib/vwf/model/aframe/extras/aframe-extras.min.js


+ 1 - 1
support/client/lib/vwf/model/aframe/extras/aframe-extras.misc.js

@@ -397,7 +397,7 @@ module.exports = AFRAME.registerComponent('kinematic-body', {
         position = new CANNON.Vec3().copy(el.getAttribute('position'));
 
     this.body = new CANNON.Body({
-      material: this.system.material,
+      material: this.system.getMaterial('staticMaterial'),
       position: position,
       mass: data.mass,
       linearDamping: data.linearDamping,

Fichier diff supprimé car celui-ci est trop grand
+ 0 - 0
support/client/lib/vwf/model/aframe/extras/aframe-extras.misc.min.js


+ 259 - 242
support/client/lib/vwf/model/aframe/extras/aframe-extras.pathfinding.js

@@ -3,7 +3,259 @@
 
 require('./src/pathfinding');
 
-},{"./src/pathfinding":8}],2:[function(require,module,exports){
+},{"./src/pathfinding":2}],2:[function(require,module,exports){
+'use strict';
+
+require('./nav-mesh');
+require('./nav-agent');
+require('./system');
+
+},{"./nav-agent":3,"./nav-mesh":4,"./system":5}],3:[function(require,module,exports){
+'use strict';
+
+module.exports = AFRAME.registerComponent('nav-agent', {
+  schema: {
+    destination: { type: 'vec3' },
+    active: { default: false },
+    speed: { default: 2 }
+  },
+  init: function init() {
+    this.system = this.el.sceneEl.systems.nav;
+    this.system.addAgent(this);
+    this.group = null;
+    this.path = [];
+    this.raycaster = new THREE.Raycaster();
+  },
+  remove: function remove() {
+    this.system.removeAgent(this);
+  },
+  update: function update() {
+    this.path.length = 0;
+  },
+  updateNavLocation: function updateNavLocation() {
+    this.group = null;
+    this.path = [];
+  },
+  tick: function () {
+    var vDest = new THREE.Vector3();
+    var vDelta = new THREE.Vector3();
+    var vNext = new THREE.Vector3();
+
+    return function (t, dt) {
+      var el = this.el;
+      var data = this.data;
+      var raycaster = this.raycaster;
+      var speed = data.speed * dt / 1000;
+
+      if (!data.active) return;
+
+      // Use PatrolJS pathfinding system to get shortest path to target.
+      if (!this.path.length) {
+        var position = this.el.object3D.position;
+        this.group = this.group || this.system.getGroup(position);
+        this.path = this.system.getPath(position, vDest.copy(data.destination), this.group) || [];
+        el.emit('nav-start');
+      }
+
+      // If no path is found, exit.
+      if (!this.path.length) {
+        console.warn('[nav] Unable to find path to %o.', data.destination);
+        this.el.setAttribute('nav-agent', { active: false });
+        el.emit('nav-end');
+        return;
+      }
+
+      // Current segment is a vector from current position to next waypoint.
+      var vCurrent = el.object3D.position;
+      var vWaypoint = this.path[0];
+      vDelta.subVectors(vWaypoint, vCurrent);
+
+      var distance = vDelta.length();
+      var gazeTarget = void 0;
+
+      if (distance < speed) {
+        // If <1 step from current waypoint, discard it and move toward next.
+        this.path.shift();
+
+        // After discarding the last waypoint, exit pathfinding.
+        if (!this.path.length) {
+          this.el.setAttribute('nav-agent', { active: false });
+          el.emit('nav-end');
+          return;
+        }
+
+        vNext.copy(vCurrent);
+        gazeTarget = this.path[0];
+      } else {
+        // If still far away from next waypoint, find next position for
+        // the current frame.
+        vNext.copy(vDelta.setLength(speed)).add(vCurrent);
+        gazeTarget = vWaypoint;
+      }
+
+      // Look at the next waypoint.
+      gazeTarget.y = vCurrent.y;
+      el.object3D.lookAt(gazeTarget);
+
+      // Raycast against the nav mesh, to keep the agent moving along the
+      // ground, not traveling in a straight line from higher to lower waypoints.
+      raycaster.ray.origin.copy(vNext);
+      raycaster.ray.origin.y += 1.5;
+      raycaster.ray.direction.y = -1;
+      var intersections = raycaster.intersectObject(this.system.getNavMesh());
+
+      if (!intersections.length) {
+        // Raycasting failed. Step toward the waypoint and hope for the best.
+        vCurrent.copy(vNext);
+      } else {
+        // Re-project next position onto nav mesh.
+        vDelta.subVectors(intersections[0].point, vCurrent);
+        vCurrent.add(vDelta.setLength(speed));
+      }
+    };
+  }()
+});
+
+},{}],4:[function(require,module,exports){
+'use strict';
+
+/**
+ * nav-mesh
+ *
+ * Waits for a mesh to be loaded on the current entity, then sets it as the
+ * nav mesh in the pathfinding system.
+ */
+
+module.exports = AFRAME.registerComponent('nav-mesh', {
+  init: function init() {
+    this.system = this.el.sceneEl.systems.nav;
+    this.hasLoadedNavMesh = false;
+    this.el.addEventListener('model-loaded', this.loadNavMesh.bind(this));
+  },
+
+  play: function play() {
+    if (!this.hasLoadedNavMesh) this.loadNavMesh();
+  },
+
+  loadNavMesh: function loadNavMesh() {
+    var object = this.el.getObject3D('mesh');
+    var scene = this.el.sceneEl.object3D;
+
+    if (!object) return;
+
+    var navMesh = void 0;
+    object.traverse(function (node) {
+      if (node.isMesh) navMesh = node;
+    });
+
+    if (!navMesh) return;
+
+    var navMeshGeometry = navMesh.geometry.isBufferGeometry ? new THREE.Geometry().fromBufferGeometry(navMesh.geometry) : navMesh.geometry.clone();
+
+    scene.updateMatrixWorld();
+    navMeshGeometry.applyMatrix(navMesh.matrixWorld);
+    this.system.setNavMeshGeometry(navMeshGeometry);
+
+    this.hasLoadedNavMesh = true;
+  }
+});
+
+},{}],5:[function(require,module,exports){
+'use strict';
+
+var Path = require('three-pathfinding');
+
+var pathfinder = new Path();
+var ZONE = 'level';
+
+/**
+ * nav
+ *
+ * Pathfinding system, using PatrolJS.
+ */
+module.exports = AFRAME.registerSystem('nav', {
+  init: function init() {
+    this.navMesh = null;
+    this.agents = new Set();
+  },
+
+  /**
+   * @param {THREE.Geometry} geometry
+   */
+  setNavMeshGeometry: function setNavMeshGeometry(geometry) {
+    this.navMesh = new THREE.Mesh(geometry);
+    pathfinder.setZoneData(ZONE, Path.createZone(geometry));
+    Array.from(this.agents).forEach(function (agent) {
+      return agent.updateNavLocation();
+    });
+  },
+
+  /**
+   * @return {THREE.Mesh}
+   */
+  getNavMesh: function getNavMesh() {
+    return this.navMesh;
+  },
+
+  /**
+   * @param {NavAgent} ctrl
+   */
+  addAgent: function addAgent(ctrl) {
+    this.agents.add(ctrl);
+  },
+
+  /**
+   * @param {NavAgent} ctrl
+   */
+  removeAgent: function removeAgent(ctrl) {
+    this.agents.delete(ctrl);
+  },
+
+  /**
+   * @param  {THREE.Vector3} start
+   * @param  {THREE.Vector3} end
+   * @param  {number} groupID
+   * @return {Array<THREE.Vector3>}
+   */
+  getPath: function getPath(start, end, groupID) {
+    return pathfinder.findPath(start, end, ZONE, groupID);
+  },
+
+  /**
+   * @param {THREE.Vector3} position
+   * @return {number}
+   */
+  getGroup: function getGroup(position) {
+    return pathfinder.getGroup(ZONE, position);
+  },
+
+  /**
+   * @param  {THREE.Vector3} position
+   * @param  {number} groupID
+   * @return {Node}
+   */
+  getNode: function getNode(position, groupID) {
+    return pathfinder.getClosestNode(position, ZONE, groupID, true);
+  },
+
+  /**
+   * @param  {THREE.Vector3} start Starting position.
+   * @param  {THREE.Vector3} end Desired ending position.
+   * @param  {number} groupID
+   * @param  {Node} node
+   * @param  {THREE.Vector3} endTarget (Output) Adjusted step end position.
+   * @return {Node} Current node, after step is taken.
+   */
+  clampStep: function clampStep(start, end, groupID, node, endTarget) {
+    if (!this.navMesh || !node) {
+      endTarget.copy(end);
+      return this.navMesh ? this.getNode(end, groupID) : null;
+    }
+    return pathfinder.clampStep(start, end, node, ZONE, groupID, endTarget);
+  }
+});
+
+},{"three-pathfinding":10}],6:[function(require,module,exports){
 'use strict';
 
 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
@@ -148,7 +400,7 @@ var AStar = function () {
 
 module.exports = AStar;
 
-},{"./BinaryHeap":3,"./utils.js":7}],3:[function(require,module,exports){
+},{"./BinaryHeap":7,"./utils.js":11}],7:[function(require,module,exports){
 "use strict";
 
 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
@@ -302,7 +554,7 @@ var BinaryHeap = function () {
 
 module.exports = BinaryHeap;
 
-},{}],4:[function(require,module,exports){
+},{}],8:[function(require,module,exports){
 'use strict';
 
 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
@@ -528,7 +780,7 @@ var Builder = function () {
 
 module.exports = Builder;
 
-},{"./utils":7}],5:[function(require,module,exports){
+},{"./utils":11}],9:[function(require,module,exports){
 'use strict';
 
 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
@@ -639,7 +891,7 @@ var Channel = function () {
 
 module.exports = Channel;
 
-},{"./utils":7}],6:[function(require,module,exports){
+},{"./utils":11}],10:[function(require,module,exports){
 'use strict';
 
 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
@@ -944,7 +1196,7 @@ var Node = {}; // jshint ignore:line
 
 module.exports = Path;
 
-},{"./AStar":2,"./Builder":4,"./Channel":5,"./utils":7}],7:[function(require,module,exports){
+},{"./AStar":6,"./Builder":8,"./Channel":9,"./utils":11}],11:[function(require,module,exports){
 'use strict';
 
 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
@@ -1278,239 +1530,4 @@ var Utils = function () {
 
 module.exports = Utils;
 
-},{}],8:[function(require,module,exports){
-'use strict';
-
-require('./nav-mesh');
-require('./nav-agent');
-require('./system');
-
-},{"./nav-agent":9,"./nav-mesh":10,"./system":11}],9:[function(require,module,exports){
-'use strict';
-
-module.exports = AFRAME.registerComponent('nav-agent', {
-  schema: {
-    destination: { type: 'vec3' },
-    active: { default: false },
-    speed: { default: 2 }
-  },
-  init: function init() {
-    this.system = this.el.sceneEl.systems.nav;
-    this.system.addAgent(this);
-    this.group = null;
-    this.path = [];
-    this.raycaster = new THREE.Raycaster();
-  },
-  remove: function remove() {
-    this.system.removeAgent(this);
-  },
-  update: function update() {
-    this.path.length = 0;
-  },
-  tick: function () {
-    var vDest = new THREE.Vector3();
-    var vDelta = new THREE.Vector3();
-    var vNext = new THREE.Vector3();
-
-    return function (t, dt) {
-      var el = this.el;
-      var data = this.data;
-      var raycaster = this.raycaster;
-      var speed = data.speed * dt / 1000;
-
-      if (!data.active) return;
-
-      // Use PatrolJS pathfinding system to get shortest path to target.
-      if (!this.path.length) {
-        var position = this.el.object3D.position;
-        this.group = this.group || this.system.getGroup(position);
-        this.path = this.system.getPath(position, vDest.copy(data.destination), this.group);
-        this.path = this.path || [];
-        el.emit('nav-start');
-      }
-
-      // If no path is found, exit.
-      if (!this.path.length) {
-        console.warn('[nav] Unable to find path to %o.', data.destination);
-        this.el.setAttribute('nav-agent', { active: false });
-        el.emit('nav-end');
-        return;
-      }
-
-      // Current segment is a vector from current position to next waypoint.
-      var vCurrent = el.object3D.position;
-      var vWaypoint = this.path[0];
-      vDelta.subVectors(vWaypoint, vCurrent);
-
-      var distance = vDelta.length();
-      var gazeTarget = void 0;
-
-      if (distance < speed) {
-        // If <1 step from current waypoint, discard it and move toward next.
-        this.path.shift();
-
-        // After discarding the last waypoint, exit pathfinding.
-        if (!this.path.length) {
-          this.el.setAttribute('nav-agent', { active: false });
-          el.emit('nav-end');
-          return;
-        } else {
-          gazeTarget = this.path[0];
-        }
-      } else {
-        // If still far away from next waypoint, find next position for
-        // the current frame.
-        vNext.copy(vDelta.setLength(speed)).add(vCurrent);
-        gazeTarget = vWaypoint;
-      }
-
-      // Look at the next waypoint.
-      gazeTarget.y = vCurrent.y;
-      el.object3D.lookAt(gazeTarget);
-
-      // Raycast against the nav mesh, to keep the agent moving along the
-      // ground, not traveling in a straight line from higher to lower waypoints.
-      raycaster.ray.origin.copy(vNext);
-      raycaster.ray.origin.y += 1.5;
-      raycaster.ray.direction.y = -1;
-      var intersections = raycaster.intersectObject(this.system.getNavMesh());
-
-      if (!intersections.length) {
-        // Raycasting failed. Step toward the waypoint and hope for the best.
-        vCurrent.copy(vNext);
-      } else {
-        // Re-project next position onto nav mesh.
-        vDelta.subVectors(intersections[0].point, vCurrent);
-        vCurrent.add(vDelta.setLength(speed));
-      }
-    };
-  }()
-});
-
-},{}],10:[function(require,module,exports){
-'use strict';
-
-/**
- * nav-mesh
- *
- * Waits for a mesh to be loaded on the current entity, then sets it as the
- * nav mesh in the pathfinding system.
- */
-
-module.exports = AFRAME.registerComponent('nav-mesh', {
-  init: function init() {
-    this.system = this.el.sceneEl.systems.nav;
-    this.loadNavMesh();
-    this.el.addEventListener('model-loaded', this.loadNavMesh.bind(this));
-  },
-
-  loadNavMesh: function loadNavMesh() {
-    var object = this.el.getObject3D('mesh');
-
-    if (!object) return;
-
-    var navMesh = void 0;
-    object.traverse(function (node) {
-      if (node.isMesh) navMesh = node;
-    });
-
-    if (!navMesh) return;
-
-    this.system.setNavMesh(navMesh);
-  }
-});
-
-},{}],11:[function(require,module,exports){
-'use strict';
-
-var Path = require('three-pathfinding');
-
-var pathfinder = new Path();
-var ZONE = 'level';
-
-/**
- * nav
- *
- * Pathfinding system, using PatrolJS.
- */
-module.exports = AFRAME.registerSystem('nav', {
-  init: function init() {
-    this.navMesh = null;
-    this.agents = new Set();
-  },
-
-  /**
-   * @param {THREE.Mesh} mesh
-   */
-  setNavMesh: function setNavMesh(mesh) {
-    var geometry = mesh.geometry.isBufferGeometry ? new THREE.Geometry().fromBufferGeometry(mesh.geometry) : mesh.geometry;
-    this.navMesh = new THREE.Mesh(geometry);
-    pathfinder.setZoneData(ZONE, Path.createZone(this.navMesh.geometry));
-  },
-
-  /**
-   * @return {THREE.Mesh}
-   */
-  getNavMesh: function getNavMesh() {
-    return this.navMesh;
-  },
-
-  /**
-   * @param {NavAgent} ctrl
-   */
-  addAgent: function addAgent(ctrl) {
-    this.agents.add(ctrl);
-  },
-
-  /**
-   * @param {NavAgent} ctrl
-   */
-  removeAgent: function removeAgent(ctrl) {
-    this.agents.remove(ctrl);
-  },
-
-  /**
-   * @param  {THREE.Vector3} start
-   * @param  {THREE.Vector3} end
-   * @param  {number} groupID
-   * @return {Array<THREE.Vector3>}
-   */
-  getPath: function getPath(start, end, groupID) {
-    return pathfinder.findPath(start, end, ZONE, groupID);
-  },
-
-  /**
-   * @param {THREE.Vector3} position
-   * @return {number}
-   */
-  getGroup: function getGroup(position) {
-    return pathfinder.getGroup(ZONE, position);
-  },
-
-  /**
-   * @param  {THREE.Vector3} position
-   * @param  {number} groupID
-   * @return {Node}
-   */
-  getNode: function getNode(position, groupID) {
-    return pathfinder.getClosestNode(position, ZONE, groupID, true);
-  },
-
-  /**
-   * @param  {THREE.Vector3} start Starting position.
-   * @param  {THREE.Vector3} end Desired ending position.
-   * @param  {number} groupID
-   * @param  {Node} node
-   * @param  {THREE.Vector3} endTarget (Output) Adjusted step end position.
-   * @return {Node} Current node, after step is taken.
-   */
-  clampStep: function clampStep(start, end, groupID, node, endTarget) {
-    if (!this.navMesh || !node) {
-      endTarget.copy(end);
-      return this.navMesh ? this.getNode(end, groupID) : null;
-    }
-    return pathfinder.clampStep(start, end, node, ZONE, groupID, endTarget);
-  }
-});
-
-},{"three-pathfinding":6}]},{},[1]);
+},{}]},{},[1]);

Fichier diff supprimé car celui-ci est trop grand
+ 0 - 0
support/client/lib/vwf/model/aframe/extras/aframe-extras.pathfinding.min.js


Fichier diff supprimé car celui-ci est trop grand
+ 0 - 0
support/client/lib/vwf/model/ohm/ohm.js


Fichier diff supprimé car celui-ci est trop grand
+ 0 - 0
support/client/lib/vwf/model/ohm/ohm.min.js


+ 14 - 3
support/client/lib/vwf/view/aframe.js

@@ -444,7 +444,10 @@ define(["module", "vwf/view"], function (module, view) {
 
     function getWorldRotation(el) {
 
-        let worldQuat = el.object3D.getWorldQuaternion(); 
+
+        var worldQuat =  new THREE.Quaternion();
+        el.object3D.getWorldQuaternion(worldQuat);
+         
         //console.log(worldQuat);
         let angle = (new THREE.Euler()).setFromQuaternion(worldQuat, 'YXZ');
         let rotation = (new THREE.Vector3(THREE.Math.radToDeg(angle.x),
@@ -464,7 +467,11 @@ define(["module", "vwf/view"], function (module, view) {
 
         let el = document.querySelector('#avatarControl');
         if (el) {
-            let position = el.object3D.getWorldPosition(); //el.getAttribute('position');
+            //let position = el.object3D.getWorldPosition(); //el.getAttribute('position');
+
+            let position = new THREE.Vector3();
+            el.object3D.getWorldPosition(position);
+
             let rotation = getWorldRotation(el);
            
            // console.log(rotation);
@@ -501,7 +508,11 @@ define(["module", "vwf/view"], function (module, view) {
 
         let el = document.querySelector(aSelector);
         if (el) {
-            let position = el.object3D.getWorldPosition() //el.getAttribute('position');
+            //let position = el.object3D.getWorldPosition() //el.getAttribute('position');
+            
+            let position = new THREE.Vector3();
+            el.object3D.getWorldPosition(position);
+
             let rotation = getWorldRotation(el);
 
             //let rotation = el.getAttribute('rotation');

+ 19 - 37
support/client/lib/vwf/view/editor-new.js

@@ -745,12 +745,10 @@ define([
             let stateListElement = function (item) {
 
                 let liEl = {
-                    $type: "li",
-                    class: "mdc-list-item",
-                    role: "option",
+                    $type: "option",
                     id: "",
-                    tabindex: "0",
                     applicationpath: "",
+                    value: "no_saves",
                     $components: [
                         {
                             $text: "no saves"
@@ -775,11 +773,9 @@ define([
 
                 if (item.latestsave) {
                     liEl = {
-                        $type: "li",
-                        class: "mdc-list-item",
-                        role: "option",
-                        tabindex: "0",
+                        $type: "option",
                         id: item.savename,
+                        value: item.savename,
                         applicationpath: item.applicationpath,
                         $components: [
                             {
@@ -791,11 +787,9 @@ define([
                 }
                 else {
                     liEl = {
-                        $type: "li",
-                        class: "mdc-list-item",
-                        role: "option",
-                        tabindex: "0",
+                        $type: "option",
                         id: item.savename,
+                        value: item.savename,
                         revision: item.revision,
                         applicationpath: item.applicationpath,
                         $components: [
@@ -1050,8 +1044,6 @@ define([
                                                     
                                                     $type: "div",
                                                     class: "mdc-select",
-                                                    tabindex: "0",
-                                                    role: "listbox",
                                                     id: "loadselect",
                                                     $init: function () {
 
@@ -1060,9 +1052,9 @@ define([
                                                       // var MDCSelect = mdc.select.MDCSelect;
                                                       let selector = document.querySelector('#loadselect');
                                                         let select = new mdc.select.MDCSelect(document.querySelector('#loadselect'));
-                                                        this.addEventListener('MDCSelect:change', () => {
+                                                        select.listen('change', () => {
                                                             //this._selectedState = select.value;
-                                                            document.querySelector('#loadStateButton')._selectedState = select.selectedOptions[0];
+                                                            document.querySelector('#loadStateButton')._selectedState = select.nativeControl_[select.selectedIndex];
                                                             //console.log(select.value);
                                                             //.selectedOptions[0]
                                                         });
@@ -1073,37 +1065,27 @@ define([
 
                                                     },
                                                     $components: [
+                                                        {
+                                                            $type: "select",
+                                                            class: "mdc-select__native-control",
+                                                            $components: this._saveStates.map(stateListElement)
+                                                        },
+
                                                         {   
-                                                            $type: "div",
-                                                            class: "mdc-select__surface",
+                                                            $type: "label",
+                                                            class: "mdc-floating-label",
                                                             $components: [
                                                                 {
-                                                                    $type: "div",
-                                                                    class: "mdc-select__label",
                                                                     $text: "Select..."
-                                                                },
-                                                                {
-                                                                    $type: "div",
-                                                                    class: "mdc-select__selected-text"
-                                                                },
-                                                                {
-                                                                    $type: "div",
-                                                                    class: "mdc-select__bottom-line"
                                                                 }
                                                             ]
                                                         },
-                                                       
                                                         {
                                                             $type: "div",
-                                                            class: "mdc-menu mdc-select__menu",
-                                                            $components: [
-                                                                {
-                                                                    $type: "ul",
-                                                                    class: "mdc-list mdc-menu__items",
-                                                                    $components: this._saveStates.map(stateListElement)
-                                                                }
-                                                            ]
+                                                            class: "mdc-line-ripple"
                                                         }
+                                                       
+                                                       
 
                                                     ]
                                                 }

Fichier diff supprimé car celui-ci est trop grand
+ 101 - 756
support/client/lib/vwf/view/lib/mdc/dist/material-components-web.css


Fichier diff supprimé car celui-ci est trop grand
+ 474 - 359
support/client/lib/vwf/view/lib/mdc/dist/material-components-web.js


Fichier diff supprimé car celui-ci est trop grand
+ 0 - 0
support/client/lib/vwf/view/lib/mdc/dist/material-components-web.min.css


Fichier diff supprimé car celui-ci est trop grand
+ 0 - 0
support/client/lib/vwf/view/lib/mdc/dist/material-components-web.min.js


Certains fichiers n'ont pas été affichés car il y a eu trop de fichiers modifiés dans ce diff