Skip to content

Commit

Permalink
Merge pull request #6584 from likangning93/clippingPlanesIeBugfix
Browse files Browse the repository at this point in the history
workaround for IE model + clipping planes shader bug
  • Loading branch information
lilleyse authored May 11, 2018
2 parents 5acc2cd + 2edcb9d commit 97eb855
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Change Log
* Fixed incorrect 3D Tiles statistics when a tile fails during processing. [#6558](https://github.com/AnalyticalGraphicsInc/cesium/pull/6558)
* Fixed race condition causing intermittent crash when changing geometry show value [#3061](https://github.com/AnalyticalGraphicsInc/cesium/issues/3061)
* `ProviderViewModel`s with no category are displayed in an untitled group in `BaseLayerPicker` instead of being labeled as `'Other'` [#6574](https://github.com/AnalyticalGraphicsInc/cesium/pull/6574)
* Added a workaround for clipping planes causing a picking shader compilation failure for gltf models and 3D Tilesets in Internet Explorer [#6575](https://github.com/AnalyticalGraphicsInc/cesium/issues/6575)

### 1.45 - 2018-05-01

Expand Down
33 changes: 23 additions & 10 deletions Source/Scene/Model.js
Original file line number Diff line number Diff line change
Expand Up @@ -1995,10 +1995,16 @@ define([
var drawVS = modifyShader(vs, id, model._vertexShaderLoaded);
var drawFS = modifyShader(fs, id, model._fragmentShaderLoaded);

drawVS = ModelUtility.modifyVertexShaderForLogDepth(drawVS, toClipCoordinatesGLSL);
drawFS = ModelUtility.modifyFragmentShaderForLogDepth(drawFS);
// Internet Explorer seems to have problems with discard (for clipping planes) after too many levels of indirection:
// https://github.com/AnalyticalGraphicsInc/cesium/issues/6575.
// For IE log depth code is defined out anyway due to unsupported WebGL extensions, so the wrappers can be omitted.
if (!FeatureDetection.isInternetExplorer()) {
drawVS = ModelUtility.modifyVertexShaderForLogDepth(drawVS, toClipCoordinatesGLSL);
drawFS = ModelUtility.modifyFragmentShaderForLogDepth(drawFS);
}

var pickFS, pickVS;
var pickFS;
var pickVS;
if (model.allowPicking) {
// PERFORMANCE_IDEA: Can optimize this shader with a glTF hint. https://github.com/KhronosGroup/glTF/issues/181
pickVS = modifyShader(vs, id, model._pickVertexShaderLoaded);
Expand All @@ -2008,8 +2014,10 @@ define([
pickFS = ShaderSource.createPickFragmentShaderSource(fs, 'uniform');
}

pickVS = ModelUtility.modifyVertexShaderForLogDepth(pickVS, toClipCoordinatesGLSL);
pickFS = ModelUtility.modifyFragmentShaderForLogDepth(pickFS);
if (!FeatureDetection.isInternetExplorer()) {
pickVS = ModelUtility.modifyVertexShaderForLogDepth(pickVS, toClipCoordinatesGLSL);
pickFS = ModelUtility.modifyFragmentShaderForLogDepth(pickFS);
}
}
createAttributesAndProgram(id, drawFS, drawVS, pickFS, pickVS, model, context);
}
Expand Down Expand Up @@ -2041,10 +2049,13 @@ define([
var drawVS = modifyShader(vs, id, model._vertexShaderLoaded);
var drawFS = modifyShader(finalFS, id, model._fragmentShaderLoaded);

drawVS = ModelUtility.modifyVertexShaderForLogDepth(drawVS, toClipCoordinatesGLSL);
drawFS = ModelUtility.modifyFragmentShaderForLogDepth(drawFS);
if (!FeatureDetection.isInternetExplorer()) {
drawVS = ModelUtility.modifyVertexShaderForLogDepth(drawVS, toClipCoordinatesGLSL);
drawFS = ModelUtility.modifyFragmentShaderForLogDepth(drawFS);
}

var pickFS, pickVS;
var pickFS;
var pickVS;
if (model.allowPicking) {
// PERFORMANCE_IDEA: Can optimize this shader with a glTF hint. https://github.com/KhronosGroup/glTF/issues/181
pickVS = modifyShader(vs, id, model._pickVertexShaderLoaded);
Expand All @@ -2058,8 +2069,10 @@ define([
pickFS = modifyShaderForClippingPlanes(pickFS, clippingPlaneCollection);
}

pickVS = ModelUtility.modifyVertexShaderForLogDepth(pickVS, toClipCoordinatesGLSL);
pickFS = ModelUtility.modifyFragmentShaderForLogDepth(pickFS);
if (!FeatureDetection.isInternetExplorer()) {
pickVS = ModelUtility.modifyVertexShaderForLogDepth(pickVS, toClipCoordinatesGLSL);
pickFS = ModelUtility.modifyFragmentShaderForLogDepth(pickFS);
}
}
createAttributesAndProgram(id, drawFS, drawVS, pickFS, pickVS, model, context);
}
Expand Down

0 comments on commit 97eb855

Please sign in to comment.