Skip to content

Commit 588d98b

Browse files
authored
Merge pull request #6084 from AnalyticalGraphicsInc/clip-planes-fix
Clipping planes support cleanup
2 parents 7f9abdd + c8948f3 commit 588d98b

6 files changed

+34
-6
lines changed

CHANGES.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
Change Log
22
==========
33

4+
### 1.42 - 2018-02-01
5+
6+
* Added `ClippingPlaneCollection.isSupported` function for checking if rendering with clipping planes is supported.
7+
48
### 1.41 - 2018-01-02
59

610
* Breaking changes

Source/Core/ClippingPlaneCollection.js

+11
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ define([
77
'./defined',
88
'./defineProperties',
99
'./DeveloperError',
10+
'./FeatureDetection',
1011
'./Intersect',
1112
'./Matrix4',
1213
'./Plane'
@@ -19,6 +20,7 @@ define([
1920
defined,
2021
defineProperties,
2122
DeveloperError,
23+
FeatureDetection,
2224
Intersect,
2325
Matrix4,
2426
Plane) {
@@ -362,6 +364,15 @@ define([
362364
return intersection;
363365
};
364366

367+
/**
368+
* Determines if rendering with clipping planes is supported.
369+
*
370+
* @returns {Boolean} <code>true</code> if ClippingPlaneCollections are supported; otherwise, returns <code>false</code>
371+
*/
372+
ClippingPlaneCollection.isSupported = function() {
373+
return !FeatureDetection.isInternetExplorer();
374+
};
375+
365376
/**
366377
* The maximum number of supported clipping planes.
367378
*

Source/DataSources/ModelGraphics.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ define([
5555
* @param {Property} [options.color=Color.WHITE] A Property specifying the {@link Color} that blends with the model's rendered color.
5656
* @param {Property} [options.colorBlendMode=ColorBlendMode.HIGHLIGHT] An enum Property specifying how the color blends with the model.
5757
* @param {Property} [options.colorBlendAmount=0.5] A numeric Property specifying the color strength when the <code>colorBlendMode</code> is <code>MIX</code>. A value of 0.0 results in the model's rendered color while a value of 1.0 results in a solid color, with any value in-between resulting in a mix of the two.
58-
* @param {Property} [options.clippingPlanes] A property specifying the {@link ClippingPlaneCollection} used to selectively disable rendering the model.
58+
* @param {Property} [options.clippingPlanes] A property specifying the {@link ClippingPlaneCollection} used to selectively disable rendering the model. Clipping planes are not currently supported in Internet Explorer.
5959
*
6060
* @see {@link http://cesiumjs.org/2014/03/03/Cesium-3D-Models-Tutorial/|3D Models Tutorial}
6161
* @demo {@link http://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=3D%20Models.html|Cesium Sandcastle 3D Models Demo}

Source/Scene/GlobeSurfaceTileProvider.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ define([
44
'../Core/Cartesian2',
55
'../Core/Cartesian3',
66
'../Core/Cartesian4',
7+
'../Core/ClippingPlaneCollection',
78
'../Core/Color',
89
'../Core/ColorGeometryInstanceAttribute',
910
'../Core/combine',
@@ -13,7 +14,6 @@ define([
1314
'../Core/destroyObject',
1415
'../Core/DeveloperError',
1516
'../Core/Event',
16-
'../Core/FeatureDetection',
1717
'../Core/GeometryInstance',
1818
'../Core/GeometryPipeline',
1919
'../Core/IndexDatatype',
@@ -51,6 +51,7 @@ define([
5151
Cartesian2,
5252
Cartesian3,
5353
Cartesian4,
54+
ClippingPlaneCollection,
5455
Color,
5556
ColorGeometryInstanceAttribute,
5657
combine,
@@ -60,7 +61,6 @@ define([
6061
destroyObject,
6162
DeveloperError,
6263
Event,
63-
FeatureDetection,
6464
GeometryInstance,
6565
GeometryPipeline,
6666
IndexDatatype,
@@ -1322,7 +1322,7 @@ define([
13221322
uniformMapProperties.clippingPlanesEdgeWidth = clippingPlanes.edgeWidth;
13231323
}
13241324

1325-
var clippingPlanesEnabled = defined(clippingPlanes) && clippingPlanes.enabled && (uniformMapProperties.clippingPlanes.length > 0) && !FeatureDetection.isInternetExplorer();
1325+
var clippingPlanesEnabled = defined(clippingPlanes) && clippingPlanes.enabled && (uniformMapProperties.clippingPlanes.length > 0) && ClippingPlaneCollection.isSupported();
13261326
var unionClippingRegions = clippingPlanesEnabled ? clippingPlanes.unionClippingRegions : false;
13271327

13281328
if (defined(tileProvider.uniformMap)) {

Source/Scene/Model.js

+12-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ define([
44
'../Core/Cartesian3',
55
'../Core/Cartesian4',
66
'../Core/Cartographic',
7+
'../Core/ClippingPlaneCollection',
78
'../Core/clone',
89
'../Core/Color',
910
'../Core/combine',
@@ -81,6 +82,7 @@ define([
8182
Cartesian3,
8283
Cartesian4,
8384
Cartographic,
85+
ClippingPlaneCollection,
8486
clone,
8587
Color,
8688
combine,
@@ -1135,6 +1137,15 @@ define([
11351137
* @param {ShadowMode} [options.shadows=ShadowMode.ENABLED] Determines whether the model casts or receives shadows from each light source.
11361138
* @param {Boolean} [options.debugShowBoundingVolume=false] For debugging only. Draws the bounding sphere for each {@link DrawCommand} in the model.
11371139
* @param {Boolean} [options.debugWireframe=false] For debugging only. Draws the model in wireframe.
1140+
* @param {HeightReference} [options.heightReference] Determines how the model is drawn relative to terrain.
1141+
* @param {Scene} [options.scene] Must be passed in for models that use the height reference property.
1142+
* @param {DistanceDisplayCondition} [options.distanceDisplayCondition] The condition specifying at what distance from the camera that this model will be displayed.
1143+
* @param {Color} [options.color=Color.WHITE] A color that blends with the model's rendered color.
1144+
* @param {ColorBlendMode} [options.colorBlendMode=ColorBlendMode.HIGHLIGHT] Defines how the color blends with the model.
1145+
* @param {Number} [options.colorBlendAmount=0.5] Value used to determine the color strength when the <code>colorBlendMode</code> is <code>MIX</code>. A value of 0.0 results in the model's rendered color while a value of 1.0 results in a solid color, with any value in-between resulting in a mix of the two.
1146+
* @param {Color} [options.silhouetteColor=Color.RED] The silhouette color. If more than 256 models have silhouettes enabled, there is a small chance that overlapping models will have minor artifacts.
1147+
* @param {Number} [options.silhouetteSize=0.0] The size of the silhouette in pixels.
1148+
* @param {ClippingPlaneCollection} [options.clippingPlanes] The {@link ClippingPlaneCollection} used to selectively disable rendering the model. Clipping planes are not currently supported in Internet Explorer.
11381149
*
11391150
* @returns {Model} The newly created model.
11401151
*
@@ -2116,7 +2127,7 @@ define([
21162127

21172128
var premultipliedAlpha = hasPremultipliedAlpha(model);
21182129
var finalFS = modifyShaderForColor(fs, premultipliedAlpha);
2119-
if (!FeatureDetection.isInternetExplorer()) {
2130+
if (ClippingPlaneCollection.isSupported()) {
21202131
finalFS = modifyShaderForClippingPlanes(finalFS);
21212132
}
21222133

Source/Scene/PointCloud3DTileContent.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ define([
22
'../Core/Cartesian2',
33
'../Core/Cartesian3',
44
'../Core/Cartesian4',
5+
'../Core/ClippingPlaneCollection',
56
'../Core/Color',
67
'../Core/combine',
78
'../Core/ComponentDatatype',
@@ -38,6 +39,7 @@ define([
3839
Cartesian2,
3940
Cartesian3,
4041
Cartesian4,
42+
ClippingPlaneCollection,
4143
Color,
4244
combine,
4345
ComponentDatatype,
@@ -844,7 +846,7 @@ define([
844846
var hasColorStyle = defined(colorStyleFunction);
845847
var hasShowStyle = defined(showStyleFunction);
846848
var hasPointSizeStyle = defined(pointSizeStyleFunction);
847-
var hasClippedContent = defined(clippingPlanes) && clippingPlanes.enabled && content._tile._isClipped && !FeatureDetection.isInternetExplorer();
849+
var hasClippedContent = defined(clippingPlanes) && clippingPlanes.enabled && content._tile._isClipped && ClippingPlaneCollection.isSupported();
848850

849851
// Get the properties in use by the style
850852
var styleableProperties = [];

0 commit comments

Comments
 (0)