Skip to content

Commit

Permalink
fix_test
Browse files Browse the repository at this point in the history
  • Loading branch information
peppsac committed Jul 2, 2018
1 parent 87246a6 commit 60bfc5a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
8 changes: 3 additions & 5 deletions src/Process/3dTilesProcessing.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,16 +220,14 @@ export function pre3dTilesUpdate(context, layer) {
return [layer.root];
}

const cameraLocalPosition = new THREE.Vector3();
const worldPosition = new THREE.Vector3();
const boundingVolumeBox = new THREE.Box3();
const boundingVolumeSphere = new THREE.Sphere();
export function computeNodeSSE(camera, node) {
node.distance = 0;
if (node.boundingVolume.region) {
worldPosition.setFromMatrixPosition(node.boundingVolume.region.matrixWorld);
cameraLocalPosition.copy(camera.camera3D.position).sub(worldPosition);
node.distance = node.boundingVolume.region.box3D.distanceToPoint(cameraLocalPosition);
boundingVolumeBox.copy(node.boundingVolume.region.box3D);
boundingVolumeBox.applyMatrix4(node.boundingVolume.region.matrixWorld);
node.distance = boundingVolumeBox.distanceToPoint(camera.camera3D.position);
} else if (node.boundingVolume.box) {
// boundingVolume.box is affected by matrixWorld
boundingVolumeBox.copy(node.boundingVolume.box);
Expand Down
6 changes: 3 additions & 3 deletions test/3dtiles_unit_test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* global describe, it, xit */
/* global describe, it */
import proj4 from 'proj4';
import assert from 'assert';
import { Matrix4, Object3D } from 'three';
Expand Down Expand Up @@ -61,7 +61,7 @@ describe('Distance computation using boundingVolume.region', function () {
camera.camera3D.position.copy(new Coordinates('EPSG:4326', 0, 0, 10000).as('EPSG:4978').xyz());
camera.camera3D.updateMatrixWorld(true);

xit('should compute distance correctly', function () {
it('should compute distance correctly', function () {
const tileset = tilesetWithRegion();
const tileIndex = new $3dTilesIndex(tileset, '');
const tile = new Object3D();
Expand All @@ -72,7 +72,7 @@ describe('Distance computation using boundingVolume.region', function () {
assert.equal(tile.distance, camera.position().as('EPSG:4326').altitude());
});

xit('should not be affected by transform', function () {
it('should not be affected by transform', function () {
const m = new Matrix4().makeTranslation(0, 0, 10).multiply(
new Matrix4().makeScale(0.01, 0.01, 0.01));
const tileset = tilesetWithRegion(m);
Expand Down

0 comments on commit 60bfc5a

Please sign in to comment.