Skip to content

Commit 4354961

Browse files
committed
merge with master
2 parents b7037d0 + d6bc1ac commit 4354961

27 files changed

+1612
-359
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Thumbs.db
1616
/Source/Shaders/*.js
1717
/Source/Shaders/*/*.js
1818
/Source/Shaders/*/*/*.js
19+
/Source/ThirdParty/Shaders/*.js
1920

2021
/Specs/SpecList.js
2122

.idea/cesium.iml

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/jsLibraryMappings.xml

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations/Run_tests.xml

+1-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Apps/Sandcastle/gallery/Ground Clamping.html

+47
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,53 @@
149149

150150
viewer.trackedEntity = e;
151151
}
152+
}, {
153+
text : 'Sample line positions and draw with depth test disabled',
154+
onselect : function() {
155+
var length = 1000;
156+
157+
var startLon = Cesium.Math.toRadians(86.953793);
158+
var endLon = Cesium.Math.toRadians(86.896497);
159+
160+
var lat = Cesium.Math.toRadians(27.988257);
161+
162+
var terrainSamplePositions = [];
163+
for (var i = 0; i < length; ++i) {
164+
var lon = Cesium.Math.lerp(endLon, startLon, i / (length - 1));
165+
var position = new Cesium.Cartographic(lon, lat);
166+
terrainSamplePositions.push(position);
167+
}
168+
169+
Cesium.when(Cesium.sampleTerrainMostDetailed(viewer.terrainProvider, terrainSamplePositions), function(samples) {
170+
var offset = 10.0;
171+
for (var i = 0; i < samples.length; ++i) {
172+
samples[i].height += offset;
173+
}
174+
175+
viewer.entities.add({
176+
polyline : {
177+
positions : Cesium.Ellipsoid.WGS84.cartographicArrayToCartesianArray(samples),
178+
followSurface : false,
179+
width : 5,
180+
material : new Cesium.PolylineOutlineMaterialProperty({
181+
color : Cesium.Color.ORANGE,
182+
outlineWidth : 2,
183+
outlineColor : Cesium.Color.BLACK
184+
}),
185+
depthFailMaterial : new Cesium.PolylineOutlineMaterialProperty({
186+
color : Cesium.Color.RED,
187+
outlineWidth : 2,
188+
outlineColor : Cesium.Color.BLACK
189+
})
190+
}
191+
});
192+
193+
var target = new Cesium.Cartesian3(300770.50872389384, 5634912.131394585, 2978152.2865545116);
194+
offset = new Cesium.Cartesian3(6344.974098678562, -793.3419798081741, 2499.9508860763162);
195+
viewer.camera.lookAt(target, offset);
196+
viewer.camera.lookAtTransform(Cesium.Matrix4.IDENTITY);
197+
});
198+
}
152199
}], 'zoomButtons');
153200

154201
Sandcastle.reset = function () {

CHANGES.md

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ Change Log
44
### 1.33 - 2017-05-01
55

66
* Added `disableDepthTestDistance` to billboards, points and labels. This sets the distance to the camera where the depth test will be disabled. Setting it to zero (the default) will alwasy enable the depth test. Setting it to `Number.POSITVE_INFINITY` will never enabled the depth test. Also added `scene.minimumDisableDepthTestDistance` to change the default value from zero. [#5166](https://github.com/AnalyticalGraphicsInc/cesium/pull/5166)
7+
* Fixed issue with displaying `MapboxImageryProvider` default token error message [#5191](https://github.com/AnalyticalGraphicsInc/cesium/pull/5191)
8+
* Added a `depthFailMaterial` property to line entities, which is the material used to render the line when it fails the depth test. [#5160](https://github.com/AnalyticalGraphicsInc/cesium/pull/5160)
9+
* Upgrade FXAA to version 3.11. [#5200](https://github.com/AnalyticalGraphicsInc/cesium/pull/5200)
710
* `Scene.pickPosition` now caches results per frame to increase performance [#5117](https://github.com/AnalyticalGraphicsInc/cesium/issues/5117)
811

912

CONTRIBUTORS.md

+2
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to Cesiu
7676
* [Dmitry Kiselev](https://github.com/kiselev-dv)
7777
* [Bentley Systems, Inc.](https://www.bentley.com)
7878
* [Paul Connelly](https://github.com/pmconne)
79+
* [Flightradar24 AB](https://www.flightradar24.com)
80+
* [Aleksei Kalmykov](https://github.com/kalmykov)
7981

8082
## [Individual CLA](http://www.agi.com/licenses/individual-cla-agi-v1.0.txt)
8183
* [Victor Berchet](https://github.com/vicb)

LICENSE.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -214,11 +214,11 @@ https://gist.github.com/banksean/300494
214214
>
215215
> THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
216216
217-
### NVIDIA Image-Based Anti-Aliasing
217+
### NVIDIA GameWorks Graphics Samples
218218

219-
https://developer.nvidia.com/nvidia-graphics-sdk-11-direct3d
219+
https://github.com/NVIDIAGameWorks/GraphicsSamples
220220

221-
> Copyright 2011 NVIDIA Corporation
221+
> Copyright 2016 NVIDIA Corporation
222222
>
223223
> BY DOWNLOADING THE SOFTWARE AND OTHER AVAILABLE MATERIALS, YOU ("DEVELOPER") AGREE TO BE BOUND BY THE FOLLOWING TERMS AND CONDITIONS
224224
>

Source/DataSources/GeometryVisualizer.js

+33-12
Original file line numberDiff line numberDiff line change
@@ -95,21 +95,31 @@ define([
9595
that._outlineBatches[shadows].add(time, updater);
9696
}
9797

98+
var multiplier = 0;
99+
if (defined(updater.depthFailMaterialProperty)) {
100+
multiplier = updater.depthFailMaterialProperty instanceof ColorMaterialProperty ? 1 : 2;
101+
}
102+
103+
var index;
104+
if (defined(shadows)) {
105+
index = shadows + multiplier * ShadowMode.NUMBER_OF_SHADOW_MODES;
106+
}
107+
98108
if (updater.fillEnabled) {
99109
if (updater.onTerrain) {
100110
that._groundColorBatch.add(time, updater);
101111
} else {
102112
if (updater.isClosed) {
103113
if (updater.fillMaterialProperty instanceof ColorMaterialProperty) {
104-
that._closedColorBatches[shadows].add(time, updater);
114+
that._closedColorBatches[index].add(time, updater);
105115
} else {
106-
that._closedMaterialBatches[shadows].add(time, updater);
116+
that._closedMaterialBatches[index].add(time, updater);
107117
}
108118
} else {
109119
if (updater.fillMaterialProperty instanceof ColorMaterialProperty) {
110-
that._openColorBatches[shadows].add(time, updater);
120+
that._openColorBatches[index].add(time, updater);
111121
} else {
112-
that._openMaterialBatches[shadows].add(time, updater);
122+
that._openMaterialBatches[index].add(time, updater);
113123
}
114124
}
115125
}
@@ -152,17 +162,28 @@ define([
152162

153163
var numberOfShadowModes = ShadowMode.NUMBER_OF_SHADOW_MODES;
154164
this._outlineBatches = new Array(numberOfShadowModes);
155-
this._closedColorBatches = new Array(numberOfShadowModes);
156-
this._closedMaterialBatches = new Array(numberOfShadowModes);
157-
this._openColorBatches = new Array(numberOfShadowModes);
158-
this._openMaterialBatches = new Array(numberOfShadowModes);
165+
this._closedColorBatches = new Array(numberOfShadowModes * 3);
166+
this._closedMaterialBatches = new Array(numberOfShadowModes * 3);
167+
this._openColorBatches = new Array(numberOfShadowModes * 3);
168+
this._openMaterialBatches = new Array(numberOfShadowModes * 3);
159169

160170
for (var i = 0; i < numberOfShadowModes; ++i) {
161171
this._outlineBatches[i] = new StaticOutlineGeometryBatch(primitives, scene, i);
162-
this._closedColorBatches[i] = new StaticGeometryColorBatch(primitives, type.perInstanceColorAppearanceType, true, i);
163-
this._closedMaterialBatches[i] = new StaticGeometryPerMaterialBatch(primitives, type.materialAppearanceType, true, i);
164-
this._openColorBatches[i] = new StaticGeometryColorBatch(primitives, type.perInstanceColorAppearanceType, false, i);
165-
this._openMaterialBatches[i] = new StaticGeometryPerMaterialBatch(primitives, type.materialAppearanceType, false, i);
172+
173+
this._closedColorBatches[i] = new StaticGeometryColorBatch(primitives, type.perInstanceColorAppearanceType, undefined, true, i);
174+
this._closedMaterialBatches[i] = new StaticGeometryPerMaterialBatch(primitives, type.materialAppearanceType, undefined, true, i);
175+
this._openColorBatches[i] = new StaticGeometryColorBatch(primitives, type.perInstanceColorAppearanceType, undefined, false, i);
176+
this._openMaterialBatches[i] = new StaticGeometryPerMaterialBatch(primitives, type.materialAppearanceType, undefined, false, i);
177+
178+
this._closedColorBatches[i + numberOfShadowModes] = new StaticGeometryColorBatch(primitives, type.perInstanceColorAppearanceType, type.perInstanceColorAppearanceType, true, i);
179+
this._closedMaterialBatches[i + numberOfShadowModes] = new StaticGeometryPerMaterialBatch(primitives, type.materialAppearanceType, type.perInstanceColorAppearanceType, true, i);
180+
this._openColorBatches[i + numberOfShadowModes] = new StaticGeometryColorBatch(primitives, type.perInstanceColorAppearanceType, type.perInstanceColorAppearanceType, false, i);
181+
this._openMaterialBatches[i + numberOfShadowModes] = new StaticGeometryPerMaterialBatch(primitives, type.materialAppearanceType, type.perInstanceColorAppearanceType, false, i);
182+
183+
this._closedColorBatches[i + numberOfShadowModes * 2] = new StaticGeometryColorBatch(primitives, type.perInstanceColorAppearanceType, type.materialAppearanceType, true, i);
184+
this._closedMaterialBatches[i + numberOfShadowModes * 2] = new StaticGeometryPerMaterialBatch(primitives, type.materialAppearanceType, type.materialAppearanceType, true, i);
185+
this._openColorBatches[i + numberOfShadowModes * 2] = new StaticGeometryColorBatch(primitives, type.perInstanceColorAppearanceType, type.materialAppearanceType, false, i);
186+
this._openMaterialBatches[i + numberOfShadowModes * 2] = new StaticGeometryPerMaterialBatch(primitives, type.materialAppearanceType, type.materialAppearanceType, false, i);
166187
}
167188

168189
this._groundColorBatch = new StaticGroundGeometryColorBatch(groundPrimitives);

Source/DataSources/PolylineGeometryUpdater.js

+39-16
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ define([
9999
this._materialProperty = undefined;
100100
this._shadowsProperty = undefined;
101101
this._distanceDisplayConditionProperty = undefined;
102+
this._depthFailMaterialProperty = undefined;
102103
this._options = new GeometryOptions(entity);
103104
this._onEntityPropertyChanged(entity, 'polyline', entity.polyline, undefined);
104105
}
@@ -171,6 +172,18 @@ define([
171172
return this._materialProperty;
172173
}
173174
},
175+
/**
176+
* Gets the material property used to fill the geometry when it fails the depth test.
177+
* @memberof PolylineGeometryUpdater.prototype
178+
*
179+
* @type {MaterialProperty}
180+
* @readonly
181+
*/
182+
depthFailMaterialProperty : {
183+
get : function() {
184+
return this._depthFailMaterialProperty;
185+
}
186+
},
174187
/**
175188
* Gets a value indicating if the geometry has an outline component.
176189
* @memberof PolylineGeometryUpdater.prototype
@@ -205,7 +218,7 @@ define([
205218
* Gets the property specifying whether the geometry
206219
* casts or receives shadows from each light source.
207220
* @memberof PolylineGeometryUpdater.prototype
208-
*
221+
*
209222
* @type {Property}
210223
* @readonly
211224
*/
@@ -306,30 +319,32 @@ define([
306319
}
307320
//>>includeEnd('debug');
308321

309-
var color;
310-
var attributes;
311322
var entity = this._entity;
312323
var isAvailable = entity.isAvailable(time);
313324
var show = new ShowGeometryInstanceAttribute(isAvailable && entity.isShowing && this._showProperty.getValue(time));
314325
var distanceDisplayCondition = this._distanceDisplayConditionProperty.getValue(time);
315326
var distanceDisplayConditionAttribute = DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(distanceDisplayCondition);
316327

328+
var attributes = {
329+
show : show,
330+
distanceDisplayCondition : distanceDisplayConditionAttribute
331+
};
332+
333+
var currentColor;
317334
if (this._materialProperty instanceof ColorMaterialProperty) {
318-
var currentColor = Color.WHITE;
335+
currentColor = Color.WHITE;
319336
if (defined(this._materialProperty.color) && (this._materialProperty.color.isConstant || isAvailable)) {
320337
currentColor = this._materialProperty.color.getValue(time);
321338
}
322-
color = ColorGeometryInstanceAttribute.fromColor(currentColor);
323-
attributes = {
324-
show : show,
325-
distanceDisplayCondition : distanceDisplayConditionAttribute,
326-
color : color
327-
};
328-
} else {
329-
attributes = {
330-
show : show,
331-
distanceDisplayCondition : distanceDisplayConditionAttribute
332-
};
339+
attributes.color = ColorGeometryInstanceAttribute.fromColor(currentColor);
340+
}
341+
342+
if (defined(this._depthFailMaterialProperty) && this._depthFailMaterialProperty instanceof ColorMaterialProperty) {
343+
currentColor = Color.WHITE;
344+
if (defined(this._depthFailMaterialProperty.color) && (this._depthFailMaterialProperty.color.isConstant || isAvailable)) {
345+
currentColor = this._depthFailMaterialProperty.color.getValue(time);
346+
}
347+
attributes.depthFailColor = ColorGeometryInstanceAttribute.fromColor(currentColor);
333348
}
334349

335350
return new GeometryInstance({
@@ -402,6 +417,7 @@ define([
402417
var material = defaultValue(polyline.material, defaultMaterial);
403418
var isColorMaterial = material instanceof ColorMaterialProperty;
404419
this._materialProperty = material;
420+
this._depthFailMaterialProperty = polyline.depthFailMaterial;
405421
this._showProperty = defaultValue(show, defaultShow);
406422
this._shadowsProperty = defaultValue(polyline.shadows, defaultShadows);
407423
this._distanceDisplayConditionProperty = defaultValue(polyline.distanceDisplayCondition, defaultDistanceDisplayCondition);
@@ -431,7 +447,14 @@ define([
431447
return;
432448
}
433449

434-
options.vertexFormat = isColorMaterial ? PolylineColorAppearance.VERTEX_FORMAT : PolylineMaterialAppearance.VERTEX_FORMAT;
450+
var vertexFormat;
451+
if (isColorMaterial && (!defined(this._depthFailMaterialProperty) || this._depthFailMaterialProperty instanceof ColorMaterialProperty)) {
452+
vertexFormat = PolylineColorAppearance.VERTEX_FORMAT;
453+
} else {
454+
vertexFormat = PolylineMaterialAppearance.VERTEX_FORMAT;
455+
}
456+
457+
options.vertexFormat = vertexFormat;
435458
options.positions = positions;
436459
options.width = defined(width) ? width.getValue(Iso8601.MINIMUM_VALUE) : undefined;
437460
options.followSurface = defined(followSurface) ? followSurface.getValue(Iso8601.MINIMUM_VALUE) : undefined;

Source/DataSources/PolylineGraphics.js

+16-1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ define([
4343
this._showSubscription = undefined;
4444
this._material = undefined;
4545
this._materialSubscription = undefined;
46+
this._depthFailMaterial = undefined;
47+
this._depthFailMaterialSubscription = undefined;
4648
this._positions = undefined;
4749
this._positionsSubscription = undefined;
4850
this._followSurface = undefined;
@@ -91,6 +93,17 @@ define([
9193
*/
9294
material : createMaterialPropertyDescriptor('material'),
9395

96+
/**
97+
* Gets or sets the Property specifying the material used to draw the polyline when it fails the depth test.
98+
* <p>
99+
* Requires the EXT_frag_depth WebGL extension to render properly. If the extension is not supported,
100+
* there may be artifacts.
101+
* </p>
102+
* @type {MaterialProperty}
103+
* @default undefined
104+
*/
105+
depthFailMaterial : createMaterialPropertyDescriptor('depthFailMaterial'),
106+
94107
/**
95108
* Gets or sets the Property specifying the array of {@link Cartesian3}
96109
* positions that define the line strip.
@@ -123,7 +136,7 @@ define([
123136
* @default Cesium.Math.RADIANS_PER_DEGREE
124137
*/
125138
granularity : createPropertyDescriptor('granularity'),
126-
139+
127140
/**
128141
* Get or sets the enum Property specifying whether the polyline
129142
* casts or receives shadows from each light source.
@@ -153,6 +166,7 @@ define([
153166
}
154167
result.show = this.show;
155168
result.material = this.material;
169+
result.depthFailMaterial = this.depthFailMaterial;
156170
result.positions = this.positions;
157171
result.width = this.width;
158172
result.followSurface = this.followSurface;
@@ -177,6 +191,7 @@ define([
177191

178192
this.show = defaultValue(this.show, source.show);
179193
this.material = defaultValue(this.material, source.material);
194+
this.depthFailMaterial = defaultValue(this.depthFailMaterial, source.depthFailMaterial);
180195
this.positions = defaultValue(this.positions, source.positions);
181196
this.width = defaultValue(this.width, source.width);
182197
this.followSurface = defaultValue(this.followSurface, source.followSurface);

0 commit comments

Comments
 (0)