Skip to content

Commit

Permalink
Merge branch 'master' into spector-editor
Browse files Browse the repository at this point in the history
  • Loading branch information
kring authored Feb 18, 2020
2 parents c645aa3 + ef95027 commit f5a6b48
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 37 deletions.
25 changes: 11 additions & 14 deletions .slackbot.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
# List of Slack usernames (not GitHub) for the Cesium Concierge Slackbot to send release reminders for.
releaseSchedule:
OmarShehata: 9/2/2019
mramato: 10/1/2019
hpinkos: 11/1/2019
lilleyse: 12/1/2019
kring: 1/6/2020
lilleyse: 2/3/2020
mramato: 3/2/2020

greetings:
- Happy Friday everyone!
- Can you believe Friday is already here?
- I hope you all had awesome week!
- I skipped breakfast, so I hope Gary baked something good today...
- Good morning everyone!
mamato: 3/2/2020
oshehata: 4/1/2020
lilleyse: 5/1/2020
ian: 6/1/2020
sam.suhag: 7/1/2020
sam.vargas: 8/3/2020
kevin: 9/1/2020
mamato: 10/1/2020
oshehata: 11/2/2020
lilleyse: 12/1/2020
4 changes: 2 additions & 2 deletions Apps/Sandcastle/CesiumSandcastle.js
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,7 @@ require({

var json, code, html;
if (defined(queryObject.gist)) {
dojoscript.get('https://api.github.com/gists/' + queryObject.gist + '?access_token=dd8f755c2e5d9bbb26806bb93eaa2291f2047c60', {
dojoscript.get('https://api.github.com/gists/' + queryObject.gist, {
jsonp: 'callback'
}).then(function(data) {
var files = data.data.files;
Expand All @@ -720,7 +720,7 @@ require({
var html = defined(htmlFile) ? htmlFile.content : defaultHtml; // Use the default html for old gists
applyLoadedDemo(code, html);
}).otherwise(function(error) {
appendConsole('consoleError', 'Unable to GET from GitHub API. This could be due to too many request, try again in an hour or copy and paste the code from the gist: https://gist.github.com/' + queryObject.gist, true);
appendConsole('consoleError', 'Unable to GET gist from GitHub API. This could be due to too many requests from your IP. Try again in an hour or copy and paste the code from the gist: https://gist.github.com/' + queryObject.gist, true);
console.log(error);
});
} else if (defined(queryObject.code)) {
Expand Down
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Change Log
* Added `Entity.tileset` for loading a 3D Tiles tileset via the Entity API using the new `Cesium3DTilesetGraphics` class.
* Added `tileset.uri`, `tileset.show`, and `tileset.maximumScreenSpaceError` properties to CZML processing for loading 3D Tiles.
* Added `Color.lerp` for linearly interpolating between two RGB colors. [#8607](https://github.com/AnalyticalGraphicsInc/cesium/pull/8607)
* `CesiumTerrainProvider` now supports terrain tiles using a `WebMercatorTilingScheme` by specifying `"projection": "EPSG:3857"` in `layer.json`. It also now supports numbering tiles from the North instead of the South by specifying `"scheme": "slippyMap"` in `layer.json`. [#8563](https://github.com/AnalyticalGraphicsInc/cesium/pull/8563)
* Added the ability to edit CesiumJS shaders on-the-fly using the [SpectorJS](https://spector.babylonjs.com/) Shader Editor.

##### Fixes :wrench:
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,3 +245,4 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to Cesiu
* [André Borud](https://github.com/andreborud)
* [Nathan Schulte](https://github.com/nmschulte)
* [Jan Wąsak](https://github.com/jhnwsk)
* [Julian Fell](https://github.com/jtfell)
66 changes: 49 additions & 17 deletions Source/Core/CesiumTerrainProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import defineProperties from './defineProperties.js';
import DeveloperError from './DeveloperError.js';
import Event from './Event.js';
import GeographicTilingScheme from './GeographicTilingScheme.js';
import WebMercatorTilingScheme from './WebMercatorTilingScheme.js';
import getStringFromTypedArray from './getStringFromTypedArray.js';
import HeightmapTerrainData from './HeightmapTerrainData.js';
import IndexDatatype from './IndexDatatype.js';
Expand Down Expand Up @@ -72,18 +73,11 @@ import TileProviderError from './TileProviderError.js';
}
//>>includeEnd('debug');

this._tilingScheme = new GeographicTilingScheme({
numberOfLevelZeroTilesX : 2,
numberOfLevelZeroTilesY : 1,
ellipsoid : options.ellipsoid
});

this._heightmapWidth = 65;
this._levelZeroMaximumGeometricError = TerrainProvider.getEstimatedLevelZeroGeometricErrorForAHeightmap(this._tilingScheme.ellipsoid, this._heightmapWidth, this._tilingScheme.getNumberOfXTilesAtLevel(0));

this._heightmapStructure = undefined;
this._hasWaterMask = false;
this._hasVertexNormals = false;
this._ellipsoid = options.ellipsoid;

/**
* Boolean flag that indicates if the client should request vertex normals from the server.
Expand Down Expand Up @@ -198,6 +192,38 @@ import TileProviderError from './TileProviderError.js';
var maxZoom = data.maxzoom;
overallMaxZoom = Math.max(overallMaxZoom, maxZoom);
// Keeps track of which of the availablity containing tiles have been loaded

if (!data.projection || data.projection === 'EPSG:4326') {
that._tilingScheme = new GeographicTilingScheme({
numberOfLevelZeroTilesX : 2,
numberOfLevelZeroTilesY : 1,
ellipsoid : that._ellipsoid
});
} else if (data.projection === 'EPSG:3857') {
that._tilingScheme = new WebMercatorTilingScheme({
numberOfLevelZeroTilesX : 1,
numberOfLevelZeroTilesY : 1,
ellipsoid : that._ellipsoid
});
} else {
message = 'The projection "' + data.projection + '" is invalid or not supported.';
metadataError = TileProviderError.handleError(metadataError, that, that._errorEvent, message, undefined, undefined, undefined, requestLayerJson);
return;
}

that._levelZeroMaximumGeometricError = TerrainProvider.getEstimatedLevelZeroGeometricErrorForAHeightmap(
that._tilingScheme.ellipsoid,
that._heightmapWidth,
that._tilingScheme.getNumberOfXTilesAtLevel(0)
);
if (!data.scheme || data.scheme === 'tms' || data.scheme === 'slippyMap') {
that._scheme = data.scheme;
} else {
message = 'The scheme "' + data.scheme + '" is invalid or not supported.';
metadataError = TileProviderError.handleError(metadataError, that, that._errorEvent, message, undefined, undefined, undefined, requestLayerJson);
return;
}

var availabilityTilesLoaded;

// The vertex normals defined in the 'octvertexnormals' extension is identical to the original
Expand Down Expand Up @@ -402,7 +428,7 @@ import TileProviderError from './TileProviderError.js';
};
}

function createHeightmapTerrainData(provider, buffer, level, x, y, tmsY) {
function createHeightmapTerrainData(provider, buffer, level, x, y) {
var heightBuffer = new Uint16Array(buffer, 0, provider._heightmapWidth * provider._heightmapWidth);
return new HeightmapTerrainData({
buffer : heightBuffer,
Expand All @@ -415,7 +441,7 @@ import TileProviderError from './TileProviderError.js';
});
}

function createQuantizedMeshTerrainData(provider, buffer, level, x, y, tmsY, layer) {
function createQuantizedMeshTerrainData(provider, buffer, level, x, y, layer) {
var littleEndianExtensionSize = layer.littleEndianExtensionSize;
var pos = 0;
var cartesian3Elements = 3;
Expand Down Expand Up @@ -633,9 +659,14 @@ import TileProviderError from './TileProviderError.js';
return undefined;
}

var yTiles = provider._tilingScheme.getNumberOfYTilesAtLevel(level);

var tmsY = (yTiles - y - 1);
// The TileMapService scheme counts from the bottom left
var terrainY;
if (!provider._scheme || provider._scheme === 'tms') {
var yTiles = provider._tilingScheme.getNumberOfYTilesAtLevel(level);
terrainY = (yTiles - y - 1);
} else {
terrainY = y;
}

var extensionList = [];
if (provider._requestVertexNormals && layerToUse.hasVertexNormals) {
Expand All @@ -650,7 +681,8 @@ import TileProviderError from './TileProviderError.js';

var headers;
var query;
var url = urlTemplates[(x + tmsY + level) % urlTemplates.length];
var url = urlTemplates[(x + terrainY + level) % urlTemplates.length];

var resource = layerToUse.resource;
if (defined(resource._ionEndpoint) && !defined(resource._ionEndpoint.externalType)) {
// ion uses query paremeters to request extensions
Expand All @@ -669,7 +701,7 @@ import TileProviderError from './TileProviderError.js';
version: layerToUse.version,
z: level,
x: x,
y: tmsY
y: terrainY
},
queryParameters: query,
headers: headers,
Expand All @@ -682,9 +714,9 @@ import TileProviderError from './TileProviderError.js';

return promise.then(function (buffer) {
if (defined(provider._heightmapStructure)) {
return createHeightmapTerrainData(provider, buffer, level, x, y, tmsY);
return createHeightmapTerrainData(provider, buffer, level, x, y);
}
return createQuantizedMeshTerrainData(provider, buffer, level, x, y, tmsY, layerToUse);
return createQuantizedMeshTerrainData(provider, buffer, level, x, y, layerToUse);
});
}

Expand Down
12 changes: 9 additions & 3 deletions Specs/Core/CesiumTerrainProviderSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,13 +206,19 @@ describe('Core/CesiumTerrainProvider', function() {
});

it('returns reasonable geometric error for various levels', function() {
returnQuantizedMeshTileJson();

var provider = new CesiumTerrainProvider({
url : 'made/up/url'
});

expect(provider.getLevelMaximumGeometricError(0)).toBeGreaterThan(0.0);
expect(provider.getLevelMaximumGeometricError(0)).toEqualEpsilon(provider.getLevelMaximumGeometricError(1) * 2.0, CesiumMath.EPSILON10);
expect(provider.getLevelMaximumGeometricError(1)).toEqualEpsilon(provider.getLevelMaximumGeometricError(2) * 2.0, CesiumMath.EPSILON10);
return pollToPromise(function() {
return provider.ready;
}).then(function() {
expect(provider.getLevelMaximumGeometricError(0)).toBeGreaterThan(0.0);
expect(provider.getLevelMaximumGeometricError(0)).toEqualEpsilon(provider.getLevelMaximumGeometricError(1) * 2.0, CesiumMath.EPSILON10);
expect(provider.getLevelMaximumGeometricError(1)).toEqualEpsilon(provider.getLevelMaximumGeometricError(2) * 2.0, CesiumMath.EPSILON10);
});
});

it('logo is undefined if credit is not provided', function() {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"karma-edge-launcher": "^0.4.2",
"karma-firefox-launcher": "^1.0.0",
"karma-ie-launcher": "^1.0.0",
"karma-jasmine": "^2.0.0",
"karma-jasmine": "^3.1.1",
"karma-longest-reporter": "^1.1.0",
"karma-safari-launcher": "^1.0.0",
"karma-spec-reporter": "^0.0.32",
Expand Down

0 comments on commit f5a6b48

Please sign in to comment.