Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Change Log
* Allowed Bing Maps servers with a subpath (instead of being at the root) to work correctly. [#6597](https://github.com/AnalyticalGraphicsInc/cesium/pull/6597)
* Fixed polygon outline when using `perPositionHeight` and `extrudedHeight`. [#6595](https://github.com/AnalyticalGraphicsInc/cesium/issues/6595)
* Fixed broken links in documentation of `createTileMapServiceImageryProvider`. [#5818](https://github.com/AnalyticalGraphicsInc/cesium/issues/5818)
* Fixed bug where child tiles with transforms were not being clipped correctly. [#6600](https://github.com/AnalyticalGraphicsInc/cesium/issues/6600)

### 1.45 - 2018-05-01

Expand Down
5 changes: 5 additions & 0 deletions Source/Scene/Batched3DModel3DTileContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ define([
'../Core/FeatureDetection',
'../Core/getBaseUri',
'../Core/getStringFromTypedArray',
'../Core/Matrix4',
'../Core/RequestType',
'../Core/RuntimeError',
'../Renderer/Pass',
Expand All @@ -29,6 +30,7 @@ define([
FeatureDetection,
getBaseUri,
getStringFromTypedArray,
Matrix4,
RequestType,
RuntimeError,
Pass,
Expand Down Expand Up @@ -439,6 +441,7 @@ define([
this._batchTable.applyStyle(frameState, style);
};

var scratchClippingPlaneMatrix = new Matrix4();
Batched3DModel3DTileContent.prototype.update = function(tileset, frameState) {
var commandStart = frameState.commandList.length;

Expand All @@ -453,6 +456,8 @@ define([
// Update clipping planes
var tilesetClippingPlanes = this._tileset.clippingPlanes;
if (this._tile.clippingPlanesDirty && defined(tilesetClippingPlanes)) {
// Apply inverse transform relative to root tile transform to the model clipping plane
this._model._clippingPlaneModelMatrix = Matrix4.multiply(Matrix4.inverse(this._tile.computedTransform, scratchClippingPlaneMatrix), this._tileset._root.computedTransform, scratchClippingPlaneMatrix);
// Dereference the clipping planes from the model if they are irrelevant.
// Link/Dereference directly to avoid ownership checks.
// This will also trigger synchronous shader regeneration to remove or add the clipping plane and color blending code.
Expand Down
2 changes: 2 additions & 0 deletions Source/Scene/Instanced3DModel3DTileContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,8 @@ define([
// Update for clipping planes
var tilesetClippingPlanes = this._tileset.clippingPlanes;
if (this._tile.clippingPlanesDirty && defined(tilesetClippingPlanes)) {
// Apply root tile transforms to instanced model clipping planes
model._clippingPlaneModelMatrix = this._tileset._root.computedTransform;
// Dereference the clipping planes from the model if they are irrelevant - saves on shading
// Link/Dereference directly to avoid ownership checks.
model._clippingPlanes = (tilesetClippingPlanes.enabled && this._tile._isClipped) ? tilesetClippingPlanes : undefined;
Expand Down
6 changes: 5 additions & 1 deletion Source/Scene/Model.js
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,9 @@ define([
this.clippingPlanes = options.clippingPlanes;
// Used for checking if shaders need to be regenerated due to clipping plane changes.
this._clippingPlanesState = 0;
// Tiles all reference the same clippingPlaneCollection, this additional transform is
// applied to account for additional child transforms.
this._clippingPlaneModelMatrix = Matrix4.IDENTITY;

/**
* This property is for debugging only; it is not for production use nor is it optimized.
Expand Down Expand Up @@ -4464,7 +4467,8 @@ define([
var clippingPlanes = this._clippingPlanes;
var currentClippingPlanesState = 0;
if (defined(clippingPlanes) && clippingPlanes.enabled) {
Matrix4.multiply(context.uniformState.view3D, modelMatrix, this._modelViewMatrix);
var clippingPlanesModelMatrix = Matrix4.multiply(modelMatrix, this._clippingPlaneModelMatrix, this._modelViewMatrix);
Matrix4.multiply(context.uniformState.view3D, clippingPlanesModelMatrix, this._modelViewMatrix);
currentClippingPlanesState = clippingPlanes.clippingPlanesState;
}

Expand Down