Skip to content

Commit

Permalink
merge with master
Browse files Browse the repository at this point in the history
  • Loading branch information
ateshuseyin committed Apr 14, 2017
2 parents b7037d0 + d6bc1ac commit 4354961
Show file tree
Hide file tree
Showing 27 changed files with 1,612 additions and 359 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Thumbs.db
/Source/Shaders/*.js
/Source/Shaders/*/*.js
/Source/Shaders/*/*/*.js
/Source/ThirdParty/Shaders/*.js

/Specs/SpecList.js

Expand Down
1 change: 1 addition & 0 deletions .idea/cesium.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/jsLibraryMappings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions .idea/runConfigurations/Run_tests.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 47 additions & 0 deletions Apps/Sandcastle/gallery/Ground Clamping.html
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,53 @@

viewer.trackedEntity = e;
}
}, {
text : 'Sample line positions and draw with depth test disabled',
onselect : function() {
var length = 1000;

var startLon = Cesium.Math.toRadians(86.953793);
var endLon = Cesium.Math.toRadians(86.896497);

var lat = Cesium.Math.toRadians(27.988257);

var terrainSamplePositions = [];
for (var i = 0; i < length; ++i) {
var lon = Cesium.Math.lerp(endLon, startLon, i / (length - 1));
var position = new Cesium.Cartographic(lon, lat);
terrainSamplePositions.push(position);
}

Cesium.when(Cesium.sampleTerrainMostDetailed(viewer.terrainProvider, terrainSamplePositions), function(samples) {
var offset = 10.0;
for (var i = 0; i < samples.length; ++i) {
samples[i].height += offset;
}

viewer.entities.add({
polyline : {
positions : Cesium.Ellipsoid.WGS84.cartographicArrayToCartesianArray(samples),
followSurface : false,
width : 5,
material : new Cesium.PolylineOutlineMaterialProperty({
color : Cesium.Color.ORANGE,
outlineWidth : 2,
outlineColor : Cesium.Color.BLACK
}),
depthFailMaterial : new Cesium.PolylineOutlineMaterialProperty({
color : Cesium.Color.RED,
outlineWidth : 2,
outlineColor : Cesium.Color.BLACK
})
}
});

var target = new Cesium.Cartesian3(300770.50872389384, 5634912.131394585, 2978152.2865545116);
offset = new Cesium.Cartesian3(6344.974098678562, -793.3419798081741, 2499.9508860763162);
viewer.camera.lookAt(target, offset);
viewer.camera.lookAtTransform(Cesium.Matrix4.IDENTITY);
});
}
}], 'zoomButtons');

Sandcastle.reset = function () {
Expand Down
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ Change Log
### 1.33 - 2017-05-01

* 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)
* Fixed issue with displaying `MapboxImageryProvider` default token error message [#5191](https://github.com/AnalyticalGraphicsInc/cesium/pull/5191)
* 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)
* Upgrade FXAA to version 3.11. [#5200](https://github.com/AnalyticalGraphicsInc/cesium/pull/5200)
* `Scene.pickPosition` now caches results per frame to increase performance [#5117](https://github.com/AnalyticalGraphicsInc/cesium/issues/5117)


Expand Down
2 changes: 2 additions & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to Cesiu
* [Dmitry Kiselev](https://github.com/kiselev-dv)
* [Bentley Systems, Inc.](https://www.bentley.com)
* [Paul Connelly](https://github.com/pmconne)
* [Flightradar24 AB](https://www.flightradar24.com)
* [Aleksei Kalmykov](https://github.com/kalmykov)

## [Individual CLA](http://www.agi.com/licenses/individual-cla-agi-v1.0.txt)
* [Victor Berchet](https://github.com/vicb)
Expand Down
6 changes: 3 additions & 3 deletions LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,11 @@ https://gist.github.com/banksean/300494
>
> 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.
### NVIDIA Image-Based Anti-Aliasing
### NVIDIA GameWorks Graphics Samples

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

> Copyright 2011 NVIDIA Corporation
> Copyright 2016 NVIDIA Corporation
>
> BY DOWNLOADING THE SOFTWARE AND OTHER AVAILABLE MATERIALS, YOU ("DEVELOPER") AGREE TO BE BOUND BY THE FOLLOWING TERMS AND CONDITIONS
>
Expand Down
45 changes: 33 additions & 12 deletions Source/DataSources/GeometryVisualizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,21 +95,31 @@ define([
that._outlineBatches[shadows].add(time, updater);
}

var multiplier = 0;
if (defined(updater.depthFailMaterialProperty)) {
multiplier = updater.depthFailMaterialProperty instanceof ColorMaterialProperty ? 1 : 2;
}

var index;
if (defined(shadows)) {
index = shadows + multiplier * ShadowMode.NUMBER_OF_SHADOW_MODES;
}

if (updater.fillEnabled) {
if (updater.onTerrain) {
that._groundColorBatch.add(time, updater);
} else {
if (updater.isClosed) {
if (updater.fillMaterialProperty instanceof ColorMaterialProperty) {
that._closedColorBatches[shadows].add(time, updater);
that._closedColorBatches[index].add(time, updater);
} else {
that._closedMaterialBatches[shadows].add(time, updater);
that._closedMaterialBatches[index].add(time, updater);
}
} else {
if (updater.fillMaterialProperty instanceof ColorMaterialProperty) {
that._openColorBatches[shadows].add(time, updater);
that._openColorBatches[index].add(time, updater);
} else {
that._openMaterialBatches[shadows].add(time, updater);
that._openMaterialBatches[index].add(time, updater);
}
}
}
Expand Down Expand Up @@ -152,17 +162,28 @@ define([

var numberOfShadowModes = ShadowMode.NUMBER_OF_SHADOW_MODES;
this._outlineBatches = new Array(numberOfShadowModes);
this._closedColorBatches = new Array(numberOfShadowModes);
this._closedMaterialBatches = new Array(numberOfShadowModes);
this._openColorBatches = new Array(numberOfShadowModes);
this._openMaterialBatches = new Array(numberOfShadowModes);
this._closedColorBatches = new Array(numberOfShadowModes * 3);
this._closedMaterialBatches = new Array(numberOfShadowModes * 3);
this._openColorBatches = new Array(numberOfShadowModes * 3);
this._openMaterialBatches = new Array(numberOfShadowModes * 3);

for (var i = 0; i < numberOfShadowModes; ++i) {
this._outlineBatches[i] = new StaticOutlineGeometryBatch(primitives, scene, i);
this._closedColorBatches[i] = new StaticGeometryColorBatch(primitives, type.perInstanceColorAppearanceType, true, i);
this._closedMaterialBatches[i] = new StaticGeometryPerMaterialBatch(primitives, type.materialAppearanceType, true, i);
this._openColorBatches[i] = new StaticGeometryColorBatch(primitives, type.perInstanceColorAppearanceType, false, i);
this._openMaterialBatches[i] = new StaticGeometryPerMaterialBatch(primitives, type.materialAppearanceType, false, i);

this._closedColorBatches[i] = new StaticGeometryColorBatch(primitives, type.perInstanceColorAppearanceType, undefined, true, i);
this._closedMaterialBatches[i] = new StaticGeometryPerMaterialBatch(primitives, type.materialAppearanceType, undefined, true, i);
this._openColorBatches[i] = new StaticGeometryColorBatch(primitives, type.perInstanceColorAppearanceType, undefined, false, i);
this._openMaterialBatches[i] = new StaticGeometryPerMaterialBatch(primitives, type.materialAppearanceType, undefined, false, i);

this._closedColorBatches[i + numberOfShadowModes] = new StaticGeometryColorBatch(primitives, type.perInstanceColorAppearanceType, type.perInstanceColorAppearanceType, true, i);
this._closedMaterialBatches[i + numberOfShadowModes] = new StaticGeometryPerMaterialBatch(primitives, type.materialAppearanceType, type.perInstanceColorAppearanceType, true, i);
this._openColorBatches[i + numberOfShadowModes] = new StaticGeometryColorBatch(primitives, type.perInstanceColorAppearanceType, type.perInstanceColorAppearanceType, false, i);
this._openMaterialBatches[i + numberOfShadowModes] = new StaticGeometryPerMaterialBatch(primitives, type.materialAppearanceType, type.perInstanceColorAppearanceType, false, i);

this._closedColorBatches[i + numberOfShadowModes * 2] = new StaticGeometryColorBatch(primitives, type.perInstanceColorAppearanceType, type.materialAppearanceType, true, i);
this._closedMaterialBatches[i + numberOfShadowModes * 2] = new StaticGeometryPerMaterialBatch(primitives, type.materialAppearanceType, type.materialAppearanceType, true, i);
this._openColorBatches[i + numberOfShadowModes * 2] = new StaticGeometryColorBatch(primitives, type.perInstanceColorAppearanceType, type.materialAppearanceType, false, i);
this._openMaterialBatches[i + numberOfShadowModes * 2] = new StaticGeometryPerMaterialBatch(primitives, type.materialAppearanceType, type.materialAppearanceType, false, i);
}

this._groundColorBatch = new StaticGroundGeometryColorBatch(groundPrimitives);
Expand Down
55 changes: 39 additions & 16 deletions Source/DataSources/PolylineGeometryUpdater.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ define([
this._materialProperty = undefined;
this._shadowsProperty = undefined;
this._distanceDisplayConditionProperty = undefined;
this._depthFailMaterialProperty = undefined;
this._options = new GeometryOptions(entity);
this._onEntityPropertyChanged(entity, 'polyline', entity.polyline, undefined);
}
Expand Down Expand Up @@ -171,6 +172,18 @@ define([
return this._materialProperty;
}
},
/**
* Gets the material property used to fill the geometry when it fails the depth test.
* @memberof PolylineGeometryUpdater.prototype
*
* @type {MaterialProperty}
* @readonly
*/
depthFailMaterialProperty : {
get : function() {
return this._depthFailMaterialProperty;
}
},
/**
* Gets a value indicating if the geometry has an outline component.
* @memberof PolylineGeometryUpdater.prototype
Expand Down Expand Up @@ -205,7 +218,7 @@ define([
* Gets the property specifying whether the geometry
* casts or receives shadows from each light source.
* @memberof PolylineGeometryUpdater.prototype
*
*
* @type {Property}
* @readonly
*/
Expand Down Expand Up @@ -306,30 +319,32 @@ define([
}
//>>includeEnd('debug');

var color;
var attributes;
var entity = this._entity;
var isAvailable = entity.isAvailable(time);
var show = new ShowGeometryInstanceAttribute(isAvailable && entity.isShowing && this._showProperty.getValue(time));
var distanceDisplayCondition = this._distanceDisplayConditionProperty.getValue(time);
var distanceDisplayConditionAttribute = DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(distanceDisplayCondition);

var attributes = {
show : show,
distanceDisplayCondition : distanceDisplayConditionAttribute
};

var currentColor;
if (this._materialProperty instanceof ColorMaterialProperty) {
var currentColor = Color.WHITE;
currentColor = Color.WHITE;
if (defined(this._materialProperty.color) && (this._materialProperty.color.isConstant || isAvailable)) {
currentColor = this._materialProperty.color.getValue(time);
}
color = ColorGeometryInstanceAttribute.fromColor(currentColor);
attributes = {
show : show,
distanceDisplayCondition : distanceDisplayConditionAttribute,
color : color
};
} else {
attributes = {
show : show,
distanceDisplayCondition : distanceDisplayConditionAttribute
};
attributes.color = ColorGeometryInstanceAttribute.fromColor(currentColor);
}

if (defined(this._depthFailMaterialProperty) && this._depthFailMaterialProperty instanceof ColorMaterialProperty) {
currentColor = Color.WHITE;
if (defined(this._depthFailMaterialProperty.color) && (this._depthFailMaterialProperty.color.isConstant || isAvailable)) {
currentColor = this._depthFailMaterialProperty.color.getValue(time);
}
attributes.depthFailColor = ColorGeometryInstanceAttribute.fromColor(currentColor);
}

return new GeometryInstance({
Expand Down Expand Up @@ -402,6 +417,7 @@ define([
var material = defaultValue(polyline.material, defaultMaterial);
var isColorMaterial = material instanceof ColorMaterialProperty;
this._materialProperty = material;
this._depthFailMaterialProperty = polyline.depthFailMaterial;
this._showProperty = defaultValue(show, defaultShow);
this._shadowsProperty = defaultValue(polyline.shadows, defaultShadows);
this._distanceDisplayConditionProperty = defaultValue(polyline.distanceDisplayCondition, defaultDistanceDisplayCondition);
Expand Down Expand Up @@ -431,7 +447,14 @@ define([
return;
}

options.vertexFormat = isColorMaterial ? PolylineColorAppearance.VERTEX_FORMAT : PolylineMaterialAppearance.VERTEX_FORMAT;
var vertexFormat;
if (isColorMaterial && (!defined(this._depthFailMaterialProperty) || this._depthFailMaterialProperty instanceof ColorMaterialProperty)) {
vertexFormat = PolylineColorAppearance.VERTEX_FORMAT;
} else {
vertexFormat = PolylineMaterialAppearance.VERTEX_FORMAT;
}

options.vertexFormat = vertexFormat;
options.positions = positions;
options.width = defined(width) ? width.getValue(Iso8601.MINIMUM_VALUE) : undefined;
options.followSurface = defined(followSurface) ? followSurface.getValue(Iso8601.MINIMUM_VALUE) : undefined;
Expand Down
17 changes: 16 additions & 1 deletion Source/DataSources/PolylineGraphics.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ define([
this._showSubscription = undefined;
this._material = undefined;
this._materialSubscription = undefined;
this._depthFailMaterial = undefined;
this._depthFailMaterialSubscription = undefined;
this._positions = undefined;
this._positionsSubscription = undefined;
this._followSurface = undefined;
Expand Down Expand Up @@ -91,6 +93,17 @@ define([
*/
material : createMaterialPropertyDescriptor('material'),

/**
* Gets or sets the Property specifying the material used to draw the polyline when it fails the depth test.
* <p>
* Requires the EXT_frag_depth WebGL extension to render properly. If the extension is not supported,
* there may be artifacts.
* </p>
* @type {MaterialProperty}
* @default undefined
*/
depthFailMaterial : createMaterialPropertyDescriptor('depthFailMaterial'),

/**
* Gets or sets the Property specifying the array of {@link Cartesian3}
* positions that define the line strip.
Expand Down Expand Up @@ -123,7 +136,7 @@ define([
* @default Cesium.Math.RADIANS_PER_DEGREE
*/
granularity : createPropertyDescriptor('granularity'),

/**
* Get or sets the enum Property specifying whether the polyline
* casts or receives shadows from each light source.
Expand Down Expand Up @@ -153,6 +166,7 @@ define([
}
result.show = this.show;
result.material = this.material;
result.depthFailMaterial = this.depthFailMaterial;
result.positions = this.positions;
result.width = this.width;
result.followSurface = this.followSurface;
Expand All @@ -177,6 +191,7 @@ define([

this.show = defaultValue(this.show, source.show);
this.material = defaultValue(this.material, source.material);
this.depthFailMaterial = defaultValue(this.depthFailMaterial, source.depthFailMaterial);
this.positions = defaultValue(this.positions, source.positions);
this.width = defaultValue(this.width, source.width);
this.followSurface = defaultValue(this.followSurface, source.followSurface);
Expand Down
Loading

0 comments on commit 4354961

Please sign in to comment.