Skip to content

Commit

Permalink
refactor(Three): remove deprecated matrix method.
Browse files Browse the repository at this point in the history
  • Loading branch information
gchoqueux committed Dec 3, 2020
1 parent 34ee221 commit fffef40
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/Controls/GlobeControls.js
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ class GlobeControls extends THREE.EventDispatcher {

// set new camera target on globe
positionObject(targetPosition, cameraTarget);
cameraTarget.matrixWorldInverse.getInverse(cameraTarget.matrixWorld);
cameraTarget.matrixWorldInverse.copy(cameraTarget.matrixWorld).invert();
targetPosition.copy(this.camera.position);
targetPosition.applyMatrix4(cameraTarget.matrixWorldInverse);
spherical.setFromVector3(targetPosition);
Expand Down
2 changes: 1 addition & 1 deletion src/Core/3DTiles/C3DTileset.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class C3DTileset {
if ((tile.viewerRequestVolume && tile.viewerRequestVolume.region)
|| (tile.boundingVolume && tile.boundingVolume.region)) {
if (tile._worldFromLocalTransform) {
inverseTileTransform.getInverse(tile._worldFromLocalTransform);
inverseTileTransform.copy(tile._worldFromLocalTransform).invert();
} else {
inverseTileTransform.identity();
}
Expand Down
2 changes: 1 addition & 1 deletion src/Core/Prefab/Globe/GlobeLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class GlobeLayer extends TiledGeometryLayer {
// https://cesiumjs.org/2013/04/25/Horizon-culling/
// This method assumes that the globe is a unit sphere at 0,0,0 so
// we setup a world-to-scaled-ellipsoid matrix4
worldToScaledEllipsoid.getInverse(this.object3d.matrixWorld);
worldToScaledEllipsoid.copy(this.object3d.matrixWorld).invert();
worldToScaledEllipsoid.premultiply(
new THREE.Matrix4().makeScale(
1 / ellipsoidSizes.x,
Expand Down
2 changes: 1 addition & 1 deletion src/Core/View.js
Original file line number Diff line number Diff line change
Expand Up @@ -965,7 +965,7 @@ class View extends THREE.EventDispatcher {
// Direction
ray.direction.set(screen.x, screen.y, 0.5);
// Unproject
matrix.multiplyMatrices(camera.matrixWorld, matrix.getInverse(camera.projectionMatrix));
matrix.multiplyMatrices(camera.matrixWorld, matrix.copy(camera.projectionMatrix).invert());
ray.direction.applyMatrix4(matrix);
ray.direction.sub(ray.origin);

Expand Down
2 changes: 1 addition & 1 deletion src/Process/FeatureProcessing.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export default {
if (isApplied) {
// NOTE: now data source provider use cache on Mesh
// TODO move transform in feature2Mesh
mat4.copy(node.matrixWorld).getInverse(mat4).elements[14] -= result.minAltitude;
mat4.copy(node.matrixWorld).invert().elements[14] -= result.minAltitude;
applyMatrix4(result, mat4);
}

Expand Down
4 changes: 2 additions & 2 deletions src/Utils/placeObjectOnGround.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ function placeObjectOnGround(layer, crs, obj, options = {}, tileHint) {
}
const matrices = {
worldFromLocal: obj.parent ? obj.parent.matrixWorld : undefined,
localFromWorld: obj.parent ? new THREE.Matrix4().getInverse(obj.parent.matrixWorld) : undefined,
localFromWorld: obj.parent ? new THREE.Matrix4().copy(obj.parent.matrixWorld).invert() : undefined,
};
const result = _updateVector3(
layer,
Expand All @@ -91,7 +91,7 @@ function placeObjectOnGround(layer, crs, obj, options = {}, tileHint) {
} else {
const matrices = {
worldFromLocal: obj.matrixWorld,
localFromWorld: new THREE.Matrix4().getInverse(obj.matrixWorld),
localFromWorld: new THREE.Matrix4().copy(obj.matrixWorld).invert(),
};

const geometry = obj.geometry;
Expand Down

0 comments on commit fffef40

Please sign in to comment.