Skip to content

Commit

Permalink
refactor(OBB): remove OBB from node's children.
Browse files Browse the repository at this point in the history
  • Loading branch information
gchoqueux authored and mgermerie committed Feb 2, 2023
1 parent 8f7ae1a commit 0440bb6
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 12 deletions.
2 changes: 0 additions & 2 deletions src/Converter/convertToTile.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ export default {
tile.visible = false;
tile.updateMatrix();

tile.add(tile.obb);

setTileFromTiledLayer(tile, layer);

if (parent) {
Expand Down
2 changes: 1 addition & 1 deletion src/Layer/TiledGeometryLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ class TiledGeometryLayer extends GeometryLayer {

// eslint-disable-next-line
culling(node, camera) {
return !camera.isBox3Visible(node.obb.box3D, node.obb.matrixWorld);
return !camera.isBox3Visible(node.obb.box3D, node.matrixWorld);
}

/**
Expand Down
9 changes: 1 addition & 8 deletions src/Renderer/OBB.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const center = new THREE.Vector3();
const coord = new Coordinates('EPSG:4326', 0, 0, 0);
let obb;

// it could be considered to remove THREE.Object3D extend.
class OBB extends THREE.Object3D {
/**
* Oriented bounding box
Expand Down Expand Up @@ -52,14 +53,6 @@ class OBB extends THREE.Object3D {
return this;
}

/**
* Update the top point world
*
*/
update() {
this.updateMatrixWorld(true);
}

/**
* Update z min, z max and z scale of oriented bounding box
*
Expand Down
2 changes: 1 addition & 1 deletion test/unit/obb.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe('OBB', function () {
obb.translateX(translate.x);
obb.translateY(translate.y);
obb.translateZ(translate.z);
obb.update();
obb.updateMatrixWorld(true);

it('should correctly instance obb', () => {
assert.equal(obb.natBox.min.x, min.x);
Expand Down

0 comments on commit 0440bb6

Please sign in to comment.