Skip to content

Commit

Permalink
Merge branch 'master' into opencage
Browse files Browse the repository at this point in the history
  • Loading branch information
marrouchi authored Sep 11, 2018
2 parents bbc738d + 4607a19 commit 3a4c280
Show file tree
Hide file tree
Showing 63 changed files with 2,817 additions and 2,570 deletions.
87 changes: 87 additions & 0 deletions Apps/Sandcastle/gallery/Cartographic Limit Rectangle.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<meta name="description" content="Limit terrain and imagery to a cartographic Rectangle area.">
<meta name="cesium-sandcastle-labels" content="Showcases">
<title>Cesium Demo</title>
<script type="text/javascript" src="../Sandcastle-header.js"></script>
<script type="text/javascript" src="../../../ThirdParty/requirejs-2.1.20/require.js"></script>
<script type="text/javascript">
if(typeof require === 'function') {
require.config({
baseUrl : '../../../Source',
waitSeconds : 120
});
}
</script>
</head>
<body class="sandcastle-loading" data-sandcastle-bucket="bucket-requirejs.html">
<style>
@import url(../templates/bucket.css);
</style>
<div id="cesiumContainer" class="fullSize"></div>
<div id="loadingOverlay"><h1>Loading...</h1></div>
<div id="toolbar"></div>
<script id="cesium_sandcastle_script">
function startup(Cesium) {
'use strict';
//Sandcastle_Begin
var viewer = new Cesium.Viewer('cesiumContainer', {
terrainProvider: Cesium.createWorldTerrain()
});

// Tropics of Cancer and Capricorn
var coffeeBeltRectangle = Cesium.Rectangle.fromDegrees(-180.0, -23.43687, 180.0, 23.43687);

viewer.scene.globe.cartographicLimitRectangle = coffeeBeltRectangle;
viewer.scene.skyAtmosphere.show = false;

// Add rectangles to show bounds
var rectangles = [];

for (var i = 0; i < 10; i++) {
rectangles.push(viewer.entities.add({
rectangle : {
coordinates : coffeeBeltRectangle,
material : Cesium.Color.WHITE.withAlpha(0.0),
height : i * 5000.0,
outline : true,
outlineWidth : 4.0,
outlineColor : Cesium.Color.WHITE
}
}));
}

Sandcastle.addToolbarButton('Show/Hide Bounds', function() {
var rectanglesLength = rectangles.length;
for (var i = 0; i < rectanglesLength; i++) {
var rectangleEntity = rectangles[i];
rectangleEntity.show = !rectangleEntity.show;
}
});

var limited = true;
Sandcastle.addToolbarButton('Enable/Disable Limiter', function() {
if (limited) {
viewer.scene.globe.cartographicLimitRectangle = Cesium.Rectangle.MAX_VALUE;
limited = false;
} else {
viewer.scene.globe.cartographicLimitRectangle = coffeeBeltRectangle;
limited = true;
}
});

//Sandcastle_End
Sandcastle.finishedLoading();
}
if (typeof Cesium !== 'undefined') {
startup(Cesium);
} else if (typeof require === 'function') {
require(['Cesium'], startup);
}
</script>
</body>
</html>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 10 additions & 4 deletions Apps/Sandcastle/gallery/Terrain.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@
<script type="text/javascript" src="../Sandcastle-header.js"></script>
<script type="text/javascript" src="../../../ThirdParty/requirejs-2.1.20/require.js"></script>
<script type="text/javascript">
require.config({
baseUrl : '../../../Source',
waitSeconds : 60
});
if(typeof require === 'function') {
require.config({
baseUrl : '../../../Source',
waitSeconds : 120
});
}
</script>
</head>
<body class="sandcastle-loading" data-sandcastle-bucket="bucket-requirejs.html">
Expand Down Expand Up @@ -191,6 +193,10 @@
}, 'sampleButtons');

Sandcastle.addToolbarButton('Sample Most Detailed Everest Terrain', function() {
if (!Cesium.defined(viewer.terrainProvider.availability)) {
console.log('sampleTerrainMostDetailed is not supported for the selected terrain provider');
return;
}
var terrainSamplePositions = createGrid(0.0005);
Cesium.when(Cesium.sampleTerrainMostDetailed(viewer.terrainProvider, terrainSamplePositions), sampleTerrainSuccess);
lookAtMtEverest();
Expand Down
9 changes: 6 additions & 3 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
Change Log
==========

### 1.50
### 1.50 - 2018-10-01

##### Additions :tada:
* Added `OpenCageGeocoderService`, which provides geocoding via [OpenCage](https://opencagedata.com/).
[#7015](https://github.com/AnalyticalGraphicsInc/cesium/pull/7015)
* Added `cartographicLimitRectangle` to `Globe`. Use this to limit terrain and imagery to a specific `Rectangle` area. [#6987](https://github.com/AnalyticalGraphicsInc/cesium/pull/6987)
* Added `OpenCageGeocoderService`, which provides geocoding via [OpenCage](https://opencagedata.com/). [#7015](https://github.com/AnalyticalGraphicsInc/cesium/pull/7015)

##### Fixes :wrench:
* Fixed an issue in the 3D Tiles traversal where empty tiles would be selected instead of their nearest loaded ancestors. [#7011](https://github.com/AnalyticalGraphicsInc/cesium/pull/7011)

### 1.49 - 2018-09-04

Expand Down
39 changes: 18 additions & 21 deletions LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -746,33 +746,30 @@ https://github.com/google/draco
>License for the specific language governing permissions and limitations under
>the License.
### JSXSS
### DOMPUrify

https://github.com/leizongmin/js-xss
https://github.com/cure53/DOMPurify

> Copyright (c) 2012-2017 Zongmin Lei(雷宗民) <leizongmin@gmail.com>
> http://ucdok.com
>DOMPurify
>Copyright 2015 Mario Heiderich
>
> The MIT License
>DOMPurify is free software; you can redistribute it and/or modify it under the
>terms of either:
>
> Permission is hereby granted, free of charge, to any person obtaining
> a copy of this software and associated documentation files (the
> "Software"), to deal in the Software without restriction, including
> without limitation the rights to use, copy, modify, merge, publish,
> distribute, sublicense, and/or sell copies of the Software, and to
> permit persons to whom the Software is furnished to do so, subject to
> the following conditions:
>a) the Apache License Version 2.0, or
>b) the Mozilla Public License Version 2.0
>
> The above copyright notice and this permission notice shall be
> included in all copies or substantial portions of the Software.
>Licensed under the Apache License, Version 2.0 (the "License");
>you may not use this file except in compliance with the License.
>You may obtain a copy of the License at
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
> NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
> LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
> OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
> WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
> http://www.apache.org/licenses/LICENSE-2.0
>
> Unless required by applicable law or agreed to in writing, software
> distributed under the License is distributed on an "AS IS" BASIS,
> WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
> See the License for the specific language governing permissions and
> limitations under the License.
Tests
=====
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/ApproximateTerrainHeights.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ define([

/**
* Computes the minimum and maximum terrain heights for a given rectangle
* @param {Rectangle} rectangle THe bounding rectangle
* @param {Rectangle} rectangle The bounding rectangle
* @param {Ellipsoid} [ellipsoid=Ellipsoid.WGS84] The ellipsoid
* @return {{minimumTerrainHeight: Number, maximumTerrainHeight: Number}}
*/
Expand Down
6 changes: 3 additions & 3 deletions Source/Core/Credit.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
define([
'../ThirdParty/xss',
'../ThirdParty/purify',
'./defaultValue',
'./defined',
'./defineProperties'
], function(
xss,
DOMPurify,
defaultValue,
defined,
defineProperties) {
Expand Down Expand Up @@ -94,7 +94,7 @@ define([
element: {
get: function() {
if (!defined(this._element)) {
var html = xss(this._html);
var html = DOMPurify.sanitize(this._html);

var div = document.createElement('div');
div._creditId = this._id;
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/IonGeocoderService.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ define([

var defaultTokenCredit = Ion.getDefaultTokenCredit(accessToken);
if (defined(defaultTokenCredit)) {
options.scene._frameState.creditDisplay.addDefaultCredit(defaultTokenCredit);
options.scene.frameState.creditDisplay.addDefaultCredit(defaultTokenCredit);
}

var searchEndpoint = server.getDerivedResource({
Expand Down
53 changes: 42 additions & 11 deletions Source/Renderer/Context.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ define([
'./CubeMap',
'./DrawCommand',
'./PassState',
'./PickFramebuffer',
'./PixelDatatype',
'./RenderState',
'./ShaderCache',
Expand Down Expand Up @@ -56,7 +55,6 @@ define([
CubeMap,
DrawCommand,
PassState,
PickFramebuffer,
PixelDatatype,
RenderState,
ShaderCache,
Expand Down Expand Up @@ -276,11 +274,15 @@ define([
this._blendMinmax = !!getExtension(gl, ['EXT_blend_minmax']);
this._elementIndexUint = !!getExtension(gl, ['OES_element_index_uint']);
this._depthTexture = !!getExtension(gl, ['WEBGL_depth_texture', 'WEBKIT_WEBGL_depth_texture']);
this._textureFloat = !!getExtension(gl, ['OES_texture_float']);
this._textureHalfFloat = !!getExtension(gl, ['OES_texture_half_float']);
this._fragDepth = !!getExtension(gl, ['EXT_frag_depth']);
this._debugShaders = getExtension(gl, ['WEBGL_debug_shaders']);

this._textureFloat = !!getExtension(gl, ['OES_texture_float']);
this._textureHalfFloat = !!getExtension(gl, ['OES_texture_half_float']);

this._textureFloatLinear = !!getExtension(gl, ['OES_texture_float_linear']);
this._textureHalfFloatLinear = !!getExtension(gl, ['OES_texture_half_float_linear']);

this._colorBufferFloat = !!getExtension(gl, ['EXT_color_buffer_float', 'WEBGL_color_buffer_float']);
this._colorBufferHalfFloat = !!getExtension(gl, ['EXT_color_buffer_half_float']);

Expand Down Expand Up @@ -566,7 +568,7 @@ define([
},

/**
* <code>true</code> if OES_texture_float is supported. This extension provides
* <code>true</code> if OES_texture_float is supported. This extension provides
* access to floating point textures that, for example, can be attached to framebuffers for high dynamic range.
* @memberof Context.prototype
* @type {Boolean}
Expand All @@ -579,7 +581,7 @@ define([
},

/**
* <code>true</code> if OES_texture_half_float is supported. This extension provides
* <code>true</code> if OES_texture_half_float is supported. This extension provides
* access to floating point textures that, for example, can be attached to framebuffers for high dynamic range.
* @memberof Context.prototype
* @type {Boolean}
Expand All @@ -591,6 +593,39 @@ define([
}
},

/**
* <code>true</code> if OES_texture_float_linear is supported. This extension provides
* access to linear sampling methods for minification and magnification filters of floating-point textures.
* @memberof Context.prototype
* @type {Boolean}
* @see {@link https://www.khronos.org/registry/webgl/extensions/OES_texture_float_linear/}
*/
textureFloatLinear : {
get : function() {
return this._textureFloatLinear;
}
},

/**
* <code>true</code> if OES_texture_half_float_linear is supported. This extension provides
* access to linear sampling methods for minification and magnification filters of half floating-point textures.
* @memberof Context.prototype
* @type {Boolean}
* @see {@link https://www.khronos.org/registry/webgl/extensions/OES_texture_half_float_linear/}
*/
textureHalfFloatLinear : {
get : function() {
return (this._webgl2 && this._textureFloatLinear) || (!this._webgl2 && this._textureHalfFloatLinear);
}
},

/**
* <code>true</code> if EXT_texture_filter_anisotropic is supported. This extension provides
* access to anisotropic filtering for textured surfaces at an oblique angle from the viewer.
* @memberof Context.prototype
* @type {Boolean}
* @see {@link https://www.khronos.org/registry/webgl/extensions/EXT_texture_filter_anisotropic/}
*/
textureFilterAnisotropic : {
get : function() {
return !!this._textureFilterAnisotropic;
Expand Down Expand Up @@ -824,7 +859,7 @@ define([
/**
* Gets an object representing the currently bound framebuffer. While this instance is not an actual
* {@link Framebuffer}, it is used to represent the default framebuffer in calls to
* {@link Texture.FromFramebuffer}.
* {@link Texture.fromFramebuffer}.
* @memberof Context.prototype
* @type {Object}
*/
Expand Down Expand Up @@ -1158,10 +1193,6 @@ define([
});
};

Context.prototype.createPickFramebuffer = function() {
return new PickFramebuffer(this);
};

/**
* Gets the object associated with a pick color.
*
Expand Down
15 changes: 9 additions & 6 deletions Source/Renderer/CubeMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ define([
}
gl.bindTexture(textureTarget, null);

this._gl = gl;
this._context = context;
this._textureFilterAnisotropic = context._textureFilterAnisotropic;
this._textureTarget = textureTarget;
this._texture = texture;
Expand Down Expand Up @@ -231,13 +231,16 @@ define([
(minificationFilter === TextureMinificationFilter.LINEAR_MIPMAP_NEAREST) ||
(minificationFilter === TextureMinificationFilter.LINEAR_MIPMAP_LINEAR);

// float textures only support nearest filtering, so override the sampler's settings
if (this._pixelDatatype === PixelDatatype.FLOAT || this._pixelDatatype === PixelDatatype.HALF_FLOAT) {
var context = this._context;
var pixelDatatype = this._pixelDatatype;

// float textures only support nearest filtering unless the linear extensions are supported, so override the sampler's settings
if ((pixelDatatype === PixelDatatype.FLOAT && !context.textureFloatLinear) || (pixelDatatype === PixelDatatype.HALF_FLOAT && !context.textureHalfFloatLinear)) {
minificationFilter = mipmap ? TextureMinificationFilter.NEAREST_MIPMAP_NEAREST : TextureMinificationFilter.NEAREST;
magnificationFilter = TextureMagnificationFilter.NEAREST;
}

var gl = this._gl;
var gl = context._gl;
var target = this._textureTarget;

gl.activeTexture(gl.TEXTURE0);
Expand Down Expand Up @@ -332,7 +335,7 @@ define([

this._hasMipmap = true;

var gl = this._gl;
var gl = this._context._gl;
var target = this._textureTarget;
gl.hint(gl.GENERATE_MIPMAP_HINT, hint);
gl.activeTexture(gl.TEXTURE0);
Expand All @@ -346,7 +349,7 @@ define([
};

CubeMap.prototype.destroy = function() {
this._gl.deleteTexture(this._texture);
this._context._gl.deleteTexture(this._texture);
this._positiveX = destroyObject(this._positiveX);
this._negativeX = destroyObject(this._negativeX);
this._positiveY = destroyObject(this._positiveY);
Expand Down
Loading

0 comments on commit 3a4c280

Please sign in to comment.