зеркало из https://github.com/mozilla/hubs.git
Migrate to newer three-mesh-bvh, tidy up
This commit is contained in:
Родитель
429d744114
Коммит
5319f9c4b5
|
@ -12743,6 +12743,10 @@
|
|||
"flatten-vertex-data": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"three-mesh-bvh": {
|
||||
"version": "github:gkjohnson/three-mesh-bvh#c8436718cb16e7acb604bf27e8ee70b32abdafdb",
|
||||
"from": "github:gkjohnson/three-mesh-bvh#master"
|
||||
},
|
||||
"three-pathfinding": {
|
||||
"version": "github:mozillareality/three-pathfinding#a52f437eaaf1b608c5f7fed046846bdbd79c75e7",
|
||||
"from": "github:mozillareality/three-pathfinding#hubs/master"
|
||||
|
@ -12752,10 +12756,6 @@
|
|||
"resolved": "https://registry.npmjs.org/three-to-cannon/-/three-to-cannon-1.3.0.tgz",
|
||||
"integrity": "sha512-M3hYf3C2LwGWqML60F3rVZq8udKjc0R6bE+E28p/NXHM+6oFVqUGrc2Ax5oyaQb7hmCNLlErMyHBQoJeF+l/OA=="
|
||||
},
|
||||
"threejs-fast-raycast": {
|
||||
"version": "github:mquander/threejs-fast-raycast#2edf20827c8f2e9333246a210a6c0b1f6d5086f0",
|
||||
"from": "github:mquander/threejs-fast-raycast#package-metadata"
|
||||
},
|
||||
"through": {
|
||||
"version": "2.3.8",
|
||||
"resolved": "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz",
|
||||
|
|
|
@ -61,9 +61,9 @@
|
|||
"screenfull": "^3.3.2",
|
||||
"super-hands": "github:mozillareality/aframe-super-hands-component#feature/drawing",
|
||||
"three": "github:mozillareality/three.js#4c144a360a073abb6c4a6fe7d1c03ba76b110573",
|
||||
"three-mesh-bvh": "github:gkjohnson/three-mesh-bvh#master",
|
||||
"three-pathfinding": "github:mozillareality/three-pathfinding#hubs/master",
|
||||
"three-to-cannon": "1.3.0",
|
||||
"threejs-fast-raycast": "github:mquander/threejs-fast-raycast#package-metadata",
|
||||
"uuid": "^3.2.1",
|
||||
"webrtc-adapter": "^6.0.2"
|
||||
},
|
||||
|
|
|
@ -8,28 +8,8 @@ import cubeMapNegY from "../assets/images/cubemap/negy.jpg";
|
|||
import cubeMapPosZ from "../assets/images/cubemap/posz.jpg";
|
||||
import cubeMapNegZ from "../assets/images/cubemap/negz.jpg";
|
||||
import { getCustomGLTFParserURLResolver } from "../utils/media-utils";
|
||||
|
||||
/* WIP: changing threejs-fast-raycast to make this easier to use */
|
||||
import MeshBVH from "../../node_modules/threejs-fast-raycast/src/MeshBVH.js";
|
||||
|
||||
const ray = new THREE.Ray();
|
||||
const inverseMatrix = new THREE.Matrix4();
|
||||
const origRaycast = THREE.Mesh.prototype.raycast;
|
||||
|
||||
THREE.Mesh.prototype.raycast = function(raycaster, intersects) {
|
||||
if (this.geometry.boundsTree) {
|
||||
inverseMatrix.getInverse(this.matrixWorld);
|
||||
ray.copy(raycaster.ray).applyMatrix4(inverseMatrix);
|
||||
if (raycaster.firstHitOnly === true) {
|
||||
const res = this.geometry.boundsTree.raycastFirst(this, raycaster, ray);
|
||||
if (res) intersects.push(res);
|
||||
} else {
|
||||
this.geometry.boundsTree.raycast(this, raycaster, ray, intersects);
|
||||
}
|
||||
} else {
|
||||
origRaycast.call(this, raycaster, intersects);
|
||||
}
|
||||
};
|
||||
import { MeshBVH, acceleratedRaycast } from "three-mesh-bvh";
|
||||
THREE.Mesh.prototype.raycast = acceleratedRaycast;
|
||||
|
||||
const GLTFCache = {};
|
||||
let CachedEnvMapTexture = null;
|
||||
|
|
Загрузка…
Ссылка в новой задаче