Skip to content

Commit

Permalink
refactor(PointCloud): supp instanciation of bboxMesh that is not used
Browse files Browse the repository at this point in the history
  • Loading branch information
ftoromanoff committed May 7, 2024
1 parent e9786da commit 048cb87
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions src/Layer/EntwinePointTileLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import Extent from 'Core/Geographic/Extent';
import Coordinates from 'Core/Geographic/Coordinates';
import proj4 from 'proj4';

const bboxMesh = new THREE.Mesh();
const box3 = new THREE.Box3();
bboxMesh.geometry.boundingBox = box3;
// const bboxMesh = new THREE.Mesh();
// const box3 = new THREE.Box3();
// bboxMesh.geometry.boundingBox = box3;

/**
* @property {boolean} isEntwinePointTileLayer - Used to checkout whether this
Expand Down
14 changes: 7 additions & 7 deletions src/Layer/PointCloudLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import OBBHelper from 'Utils/OBBHelper';

const _vector = /* @__PURE__ */ new THREE.Vector3();

const point = new THREE.Vector3();
const bboxMesh = new THREE.Mesh();
const box3 = new THREE.Box3();
bboxMesh.geometry.boundingBox = box3;
const _point = new THREE.Vector3();
// const bboxMesh = new THREE.Mesh();
// const box3 = new THREE.Box3();
// bboxMesh.geometry.boundingBox = box3;

function clamp(number, min, max) {
return Math.max(min, Math.min(number, max));
Expand Down Expand Up @@ -308,7 +308,7 @@ class PointCloudLayer extends GeometryLayer {
}

elt.notVisibleSince = undefined;
point.copy(context.camera.camera3D.position).sub(this.object3d.position);
_point.copy(context.camera.camera3D.position).sub(this.object3d.position);

// only load geometry if this elements has points
if (elt.numPoints !== 0) {
Expand Down Expand Up @@ -346,7 +346,7 @@ class PointCloudLayer extends GeometryLayer {
} else if (!elt.promise) {
const obbWorld = obb.clone();
obbWorld.center = obb.center.clone().applyMatrix3(obb.rotation).add(obb.position);
const obbDistance = Math.max(0.001, obbWorld.clampPoint(point, _vector).distanceTo(point));
const obbDistance = Math.max(0.001, obbWorld.clampPoint(_point, _vector).distanceTo(_point));

const distance = obbDistance;
// Increase priority of nearest node
Expand Down Expand Up @@ -385,7 +385,7 @@ class PointCloudLayer extends GeometryLayer {
if (elt.children && elt.children.length) {
const obbWorld = obb.clone();
obbWorld.center = obb.center.clone().applyMatrix3(obb.rotation).add(obb.position);
const obbDistance = Math.max(0.001, obbWorld.clampPoint(point, _vector).distanceTo(point));
const obbDistance = Math.max(0.001, obbWorld.clampPoint(_point, _vector).distanceTo(_point));

const distance = obbDistance;
// const sse = computeScreenSpaceError(context, layer.pointSize, layer.spacing, elt, distance) / this.sseThreshold;
Expand Down
6 changes: 3 additions & 3 deletions src/Layer/PotreeLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import PointCloudLayer from 'Layer/PointCloudLayer';
import PotreeNode from 'Core/PotreeNode';
import Extent from 'Core/Geographic/Extent';

const bboxMesh = new THREE.Mesh();
const box3 = new THREE.Box3();
bboxMesh.geometry.boundingBox = box3;
// const bboxMesh = new THREE.Mesh();
// const box3 = new THREE.Box3();
// bboxMesh.geometry.boundingBox = box3;

/**
* @property {boolean} isPotreeLayer - Used to checkout whether this layer
Expand Down

0 comments on commit 048cb87

Please sign in to comment.