Skip to content

Commit

Permalink
Rename clippingPlaneOffsetMatrix to be more descriptive
Browse files Browse the repository at this point in the history
  • Loading branch information
Shehata committed Oct 30, 2018
1 parent 7bca206 commit 26f5cab
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Source/Scene/Batched3DModel3DTileContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ define([
// Update clipping planes
var tilesetClippingPlanes = this._tileset.clippingPlanes;
if (defined(tilesetClippingPlanes)) {
this._model.clippingPlaneOffsetMatrix = this._tileset.clippingPlaneOffsetMatrix;
this._model.clippingPlanesOriginMatrix = this._tileset.clippingPlanesOriginMatrix;
if (this._tile.clippingPlanesDirty) {
// Dereference the clipping planes from the model if they are irrelevant.
// Link/Dereference directly to avoid ownership checks.
Expand Down
4 changes: 2 additions & 2 deletions Source/Scene/Cesium3DTile.js
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,7 @@ define([
var tileset = this._tileset;
var clippingPlanes = tileset.clippingPlanes;
if (defined(clippingPlanes) && clippingPlanes.enabled) {
var intersection = clippingPlanes.computeIntersectionWithBoundingVolume(boundingVolume, tileset.clippingPlaneOffsetMatrix);
var intersection = clippingPlanes.computeIntersectionWithBoundingVolume(boundingVolume, tileset.clippingPlanesOriginMatrix);
this._isClipped = intersection !== Intersect.INSIDE;
if (intersection === Intersect.OUTSIDE) {
return CullingVolume.MASK_OUTSIDE;
Expand Down Expand Up @@ -920,7 +920,7 @@ define([
var tileset = this._tileset;
var clippingPlanes = tileset.clippingPlanes;
if (defined(clippingPlanes) && clippingPlanes.enabled) {
var intersection = clippingPlanes.computeIntersectionWithBoundingVolume(boundingVolume, tileset.clippingPlaneOffsetMatrix);
var intersection = clippingPlanes.computeIntersectionWithBoundingVolume(boundingVolume, tileset.clippingPlanesOriginMatrix);
this._isClipped = intersection !== Intersect.INSIDE;
if (intersection === Intersect.OUTSIDE) {
return Intersect.OUTSIDE;
Expand Down
16 changes: 8 additions & 8 deletions Source/Scene/Cesium3DTileset.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,8 @@ define([

this._ellipsoid = defaultValue(options.ellipsoid, Ellipsoid.WGS84);

this._clippingPlaneOffsetMatrix = Matrix4.IDENTITY;
this._clippingPlaneTransformMatrix = undefined;
this._initialClippingPlanesOriginMatrix = Matrix4.IDENTITY; // Computed from the tileset JSON.
this._clippingPlanesOriginMatrix = undefined; // Combines the above with any run-time transforms.
this._recomputeClippingPlaneMatrix = true;

/**
Expand Down Expand Up @@ -752,9 +752,9 @@ define([
// root tile transform and the tileset's model matrix
var heightAboveEllipsoid = Cartographic.fromCartesian(clippingPlanesOrigin).height;
if (heightAboveEllipsoid > ApproximateTerrainHeights._defaultMinTerrainHeight) {
that._clippingPlaneOffsetMatrix = Transforms.eastNorthUpToFixedFrame(clippingPlanesOrigin);
that._initialClippingPlanesOriginMatrix = Transforms.eastNorthUpToFixedFrame(clippingPlanesOrigin);
}
that._clippingPlaneTransformMatrix = Matrix4.clone(that._clippingPlaneOffsetMatrix);
that._clippingPlanesOriginMatrix = Matrix4.clone(that._initialClippingPlanesOriginMatrix);
that._readyPromise.resolve(that);
}).otherwise(function(error) {
that._readyPromise.reject(error);
Expand Down Expand Up @@ -1168,18 +1168,18 @@ define([
/**
* @private
*/
clippingPlaneOffsetMatrix : {
clippingPlanesOriginMatrix : {
get : function() {
if (!defined(this._clippingPlaneTransformMatrix)) {
if (!defined(this._clippingPlanesOriginMatrix)) {
return Matrix4.IDENTITY;
}

if (this._recomputeClippingPlaneMatrix) {
Matrix4.multiply(this.root.computedTransform, this._clippingPlaneOffsetMatrix, this._clippingPlaneTransformMatrix);
Matrix4.multiply(this.root.computedTransform, this._initialClippingPlanesOriginMatrix, this._clippingPlanesOriginMatrix);
this._recomputeClippingPlaneMatrix = false;
}

return this._clippingPlaneTransformMatrix;
return this._clippingPlanesOriginMatrix;
}
},

Expand Down
2 changes: 1 addition & 1 deletion Source/Scene/Instanced3DModel3DTileContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ define([
// Update for clipping planes
var tilesetClippingPlanes = this._tileset.clippingPlanes;
if (defined(tilesetClippingPlanes)) {
model.clippingPlaneOffsetMatrix = this._tileset.clippingPlaneOffsetMatrix;
model.clippingPlanesOriginMatrix = this._tileset.clippingPlanesOriginMatrix;
if (this._tile.clippingPlanesDirty) {
// Dereference the clipping planes from the model if they are irrelevant - saves on shading
// Link/Dereference directly to avoid ownership checks.
Expand Down
6 changes: 3 additions & 3 deletions Source/Scene/Model.js
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ define([
// If defined, use this matrix to position the clipping planes instead of the modelMatrix.
// This is so that when models are part of a tileset they all get clipped relative
// to the root tile.
this.clippingPlaneOffsetMatrix = undefined;
this.clippingPlanesOriginMatrix = undefined;

/**
* This property is for debugging only; it is not for production use nor is it optimized.
Expand Down Expand Up @@ -4345,8 +4345,8 @@ define([
var clippingPlanes = this._clippingPlanes;
var currentClippingPlanesState = 0;
if (defined(clippingPlanes) && clippingPlanes.enabled && clippingPlanes.length > 0) {
var clippingPlaneOffsetMatrix = defaultValue(this.clippingPlaneOffsetMatrix, modelMatrix);
Matrix4.multiply(context.uniformState.view3D, clippingPlaneOffsetMatrix, this._clippingPlaneModelViewMatrix);
var clippingPlanesOriginMatrix = defaultValue(this.clippingPlanesOriginMatrix, modelMatrix);
Matrix4.multiply(context.uniformState.view3D, clippingPlanesOriginMatrix, this._clippingPlaneModelViewMatrix);
currentClippingPlanesState = clippingPlanes.clippingPlanesState;
}

Expand Down
6 changes: 3 additions & 3 deletions Source/Scene/PointCloud.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ define([
// If defined, use this matrix to position the clipping planes instead of the modelMatrix.
// This is so that when point clouds are part of a tileset they all get clipped relative
// to the root tile.
this.clippingPlaneOffsetMatrix = undefined;
this.clippingPlanesOriginMatrix = undefined;

this.attenuation = false;
this._attenuation = false;
Expand Down Expand Up @@ -824,8 +824,8 @@ define([
return Matrix4.IDENTITY;
}

var clippingPlaneOffsetMatrix = defaultValue(pointCloud.clippingPlaneOffsetMatrix, pointCloud._modelMatrix);
Matrix4.multiply(context.uniformState.view3D, clippingPlaneOffsetMatrix, scratchClippingPlaneMatrix);
var clippingPlanesOriginMatrix = defaultValue(pointCloud.clippingPlanesOriginMatrix, pointCloud._modelMatrix);
Matrix4.multiply(context.uniformState.view3D, clippingPlanesOriginMatrix, scratchClippingPlaneMatrix);
return Matrix4.multiply(scratchClippingPlaneMatrix, clippingPlanes.modelMatrix, scratchClippingPlaneMatrix);
}
};
Expand Down
2 changes: 1 addition & 1 deletion Source/Scene/PointCloud3DTileContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ define([
var styleDirty = this._styleDirty;
this._styleDirty = false;

pointCloud.clippingPlaneOffsetMatrix = tileset.clippingPlaneOffsetMatrix;
pointCloud.clippingPlanesOriginMatrix = tileset.clippingPlanesOriginMatrix;

pointCloud.style = defined(batchTable) ? undefined : tileset.style;
pointCloud.styleDirty = styleDirty;
Expand Down

0 comments on commit 26f5cab

Please sign in to comment.