Skip to content

Commit

Permalink
Merge branch '3d-tiles' into 3d-tiles-texture-compresseion
Browse files Browse the repository at this point in the history
  • Loading branch information
bagnell committed Jan 9, 2017
2 parents 70b6027 + fd76c00 commit 05603e7
Show file tree
Hide file tree
Showing 65 changed files with 2,637 additions and 580 deletions.
14 changes: 7 additions & 7 deletions Apps/Sandcastle/gallery/3D Tiles Point Cloud Styling.html
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
});

addStyle('Min and Max', {
color : "rgb(min(${POSITION}[0], 0.75) * 255, max(${POSITION}[2], 0.25) * 255, 255)",
color : "rgb(min(${POSITION}.x, 0.75) * 255, max(${POSITION}.z, 0.25) * 255, 255)",
pointSize : "5"
});

Expand All @@ -141,12 +141,11 @@

addStyle('Secondary Color', {
color : {
expression : "[${secondaryColor}[0], ${secondaryColor}[1], ${secondaryColor}[2], 1.0]",
conditions : [
["${id} < 250", "${expression}"],
["${id} < 500", "${expression} * ${expression}"],
["${id} < 750", "${expression} / 5.0"],
["${id} < 1000", "rgb(0, 0, Number(${expression}[0] < 0.5) * 255)"]
["${id} < 250", "vec4(${secondaryColor}, 1.0)"],
["${id} < 500", "vec4(${secondaryColor} * ${secondaryColor}, 1.0)"],
["${id} < 750", "vec4(${secondaryColor} / 5.0, 1.0)"],
["${id} < 1000", "rgb(0, 0, Number(${secondaryColor}.x < 0.5) * 255)"]
]
}
});
Expand All @@ -159,8 +158,9 @@
show : "${POSITION}[0] > 0.5 || ${POSITION}[1] > 0.5 || ${POSITION}[2] > 0.5"
});

// POSITION contains 0 as its last component, so add 1.0 to make the point cloud opaque
addStyle('Color based on position', {
color : "rgb(${POSITION}[0] * 255, ${POSITION}[1] * 255, ${POSITION}[2] * 255)"
color : "vec4(${POSITION}, 1.0)"
});

addStyle('Style point size', {
Expand Down
90 changes: 90 additions & 0 deletions Apps/Sandcastle/gallery/Custom Geocoder.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<!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="Cluster labels, billboards and points.">
<meta name="cesium-sandcastle-labels" content="Tutorials,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">
require.config({
baseUrl : '../../../Source',
waitSeconds : 60
});
</script>
</head>
<body class="sandcastle-loading" data-sandcastle-bucket="bucket-requirejs.html">
<style>
@import url(../templates/bucket.css);
#toolbar {
background: rgba(42, 42, 42, 0.8);
padding: 4px;
border-radius: 4px;
}
#toolbar input {
vertical-align: middle;
padding-top: 2px;
padding-bottom: 2px;
}
</style>
<div id="cesiumContainer" class="fullSize"></div>
<div id="loadingOverlay"><h1>Loading...</h1></div>
<script id="cesium_sandcastle_script">
function startup(Cesium) {
'use strict';
//Sandcastle_Begin

/**
* This class is an example of a custom geocoder. It provides geocoding through the OpenStreetMap Nominatim service.
* @alias OpenStreetMapNominatimGeocoder
* @constructor
*/
function OpenStreetMapNominatimGeocoder() {
}

/**
* The function called to geocode using this geocoder service.
*
* @param {String} input The query to be sent to the geocoder service
* @returns {Promise<GeocoderResult[]>}
*/
OpenStreetMapNominatimGeocoder.prototype.geocode = function (input) {
var endpoint = 'http://nominatim.openstreetmap.org/search?';
var query = 'format=json&q=' + input;
var requestString = endpoint + query;
return Cesium.loadJson(requestString)
.then(function (results) {
var bboxDegrees;
return results.map(function (resultObject) {
bboxDegrees = resultObject.boundingbox;
return {
displayName: resultObject.display_name,
destination: Cesium.Rectangle.fromDegrees(
bboxDegrees[2],
bboxDegrees[0],
bboxDegrees[3],
bboxDegrees[1]
)
};
});
});
};

var viewer = new Cesium.Viewer('cesiumContainer', {
geocoder: new OpenStreetMapNominatimGeocoder()
});

//Sandcastle_End
Sandcastle.finishedLoading();
}
if (typeof Cesium !== "undefined") {
startup(Cesium);
} else if (typeof require === "function") {
require(["Cesium"], startup);
}
</script>
</body>
</html>
52 changes: 52 additions & 0 deletions Apps/Sandcastle/gallery/Offline.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<!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="Demo the minimum set of options needed to remove all external dependencies, for offline operation.">
<meta name="cesium-sandcastle-labels" content="Beginner, 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">
require.config({
baseUrl : '../../../Source',
waitSeconds : 60
});
</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
// This is an example of using Cesium "Offline", meaning disconnected from the
// external Internet. It must still be served from a local web server, but
// does not rely on any outside resources or services. For more info, see:
// https://github.com/AnalyticalGraphicsInc/cesium/wiki/Offline-Guide

var viewer = new Cesium.Viewer('cesiumContainer', {
imageryProvider : Cesium.createTileMapServiceImageryProvider({
url : Cesium.buildModuleUrl('Assets/Textures/NaturalEarthII')
}),
baseLayerPicker : false,
geocoder : false
});
//Sandcastle_End
Sandcastle.finishedLoading();
}
if (typeof Cesium !== "undefined") {
startup(Cesium);
} else if (typeof require === "function") {
require(["Cesium"], startup);
}
</script>
</body>
</html>
Binary file added Apps/Sandcastle/gallery/Offline.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 21 additions & 6 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
Change Log
==========

### 1.30 - 2017-02-01
* Deprecated
* The properties `url` and `key` will be removed from `GeocoderViewModel` in 1.31. These properties will be available on geocoder services that support them, like `BingMapsGeocoderService`.
* Added support for custom geocoder services and autocomplete [#4723](https://github.com/AnalyticalGraphicsInc/cesium/pull/4723).
* Added [Custom Geocoder Sandcastle example](http://localhost:8080/Apps/Sandcastle/index.html?src=Custom%20Geocoder.html)
* Added `GeocoderService`, an interface for geocoders.
* Added `BingMapsGeocoderService` implementing the `GeocoderService` interface.
* Added `CartographicGeocoderService` implementing the `GeocoderService` interface.
* Updated the morph so the default view in Columbus View is now angled. [#3878](https://github.com/AnalyticalGraphicsInc/cesium/issues/3878)
* Fixed sky atmosphere from causing incorrect picking and hanging drill picking. [#4783](https://github.com/AnalyticalGraphicsInc/cesium/issues/4783) and [#4784](https://github.com/AnalyticalGraphicsInc/cesium/issues/4784)

### TODO

* Added compressed texture support.
Expand All @@ -15,23 +26,27 @@ Change Log
* `Cesium3DTileFeature`

### 1.29 - 2017-01-02

* Improved 3D Models
* Added the ability to blend a `Model` with a color/translucency. Added `color`, `colorBlendMode`, and `colorBlendAmount` properties to `Model`, `ModelGraphics`, and CZML. Also added `ColorBlendMode` enum. [#4547](https://github.com/AnalyticalGraphicsInc/cesium/pull/4547)
* Added the ability to render a `Model` with a silhouette. Added `silhouetteColor` and `silhouetteSize` properties to `Model`, `ModelGraphics`, and CZML. [#4314](https://github.com/AnalyticalGraphicsInc/cesium/pull/4314)
* Improved Labels
* Added new `Label` properties `showBackground`, `backgroundColor`, and `backgroundPadding` to the primitive, Entity, and CZML layers.
* Added support for newlines (`\n`) in Cesium `Label`s and CZML. [#2402]
* Added new enum `VerticalOrigin.BASELINE`. Previously, `VerticalOrigin.BOTTOM` would sometimes align to the baseline depending on the contents of a label.
* Added support for newlines (`\n`) in Cesium `Label`s and CZML. [#2402](https://github.com/AnalyticalGraphicsInc/cesium/issues/2402)
* Fixed texture rotation for `RectangleGeometry` [#2737](https://github.com/AnalyticalGraphicsInc/cesium/issues/2737)
* Fixed translucency in Firefox 50. https://github.com/AnalyticalGraphicsInc/cesium/pull/4762
(https://github.com/AnalyticalGraphicsInc/cesium/issues/2402)
* Fixed translucency in Firefox 50. [#4762](https://github.com/AnalyticalGraphicsInc/cesium/pull/4762)
* Fixed texture rotation for `RectangleGeometry`. [#2737](https://github.com/AnalyticalGraphicsInc/cesium/issues/2737)
* Fixed issue where billboards on terrain had an incorrect offset. [#4598](https://github.com/AnalyticalGraphicsInc/cesium/issues/4598)
* Fixed issue where `globe.getHeight` incorrectly returned `undefined`. [#3411](https://github.com/AnalyticalGraphicsInc/cesium/issues/3411)
* Fixed a bug that caused `GroundPrimitive` to render incorrectly on systems without the `WEBGL_depth_texture` extension. [#4747](https://github.com/AnalyticalGraphicsInc/cesium/pull/4747)
* Fixed default Mapbox token and added a watermark to notify users that they need to sign up for their own token.
* Fixed glTF models with skinning that used `bindShapeMatrix`. [#4722](https://github.com/AnalyticalGraphicsInc/cesium/issues/4722)
* Fixed a bug that could cause a "readyImagery is not actually ready" exception with some configurations of imagery layers.
* Fixed `Rectangle.union` to correctly account for rectangles that cross the IDL [#4732](https://github.com/AnalyticalGraphicsInc/cesium/pull/4732).
* Fixed `Rectangle.union` to correctly account for rectangles that cross the IDL. [#4732](https://github.com/AnalyticalGraphicsInc/cesium/pull/4732)
* Fixed tooltips for gallery thumbnails in Sandcastle [#4702].(https://github.com/AnalyticalGraphicsInc/cesium/pull/4702)
* DataSourceClock.getValue now preserves the provided `result` properties when its properties are `undefined`. [#4029](https://github.com/AnalyticalGraphicsInc/cesium/issues/4029)
* Added `divideComponents` function to `Cartesian2`, `Cartesian3`, and `Cartesian4`. [#4750](https://github.com/AnalyticalGraphicsInc/cesium/pull/4750)
* Added `WebGLConstants` enum. Previously, this was part of the private Renderer API. [#4731](https://github.com/AnalyticalGraphicsInc/cesium/pull/4731)
* Fixed tooltips for gallery thumbnails in Sandcastle [#4702](https://github.com/AnalyticalGraphicsInc/cesium/pull/4702)

### 1.28 - 2016-12-01

Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,4 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to Cesiu
* [David Friedman](https://github.com/duvifn)
* [Abhishek Potnis](https://github.com/abhishekvp)
* [Brad Hover](https://github.com/tekhaus)
* [Hüseyin Ateş](https://github.com/ateshuseyin)
28 changes: 21 additions & 7 deletions Documentation/Contributors/CodingGuide/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -383,26 +383,40 @@ Some common sensible defaults are

### Throwing Exceptions

* Throw Cesium's `DeveloperError` when the user has a coding error. The most common errors are missing parameters and out-of-range parameters. For example:
Use the functions of Cesium's [Check](https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Source/Core/Check.js) class to throw a `DeveloperError` when the user has a coding error. The most common errors are parameters that are missing, have the wrong type or are out of rangers of the wrong type or are out of range.

* For example, to check that a parameter is defined and is an object:
```javascript
Cartesian3.maximumComponent = function(cartesian) {
//>>includeStart('debug', pragmas.debug);
if (!defined(cartesian)) {
throw new DeveloperError('cartesian is required.');
}
Check.typeOf.object(cartesian, 'cartesian');
//>>includeEnd('debug');

return Math.max(cartesian.x, cartesian.y, cartesian.z);
};
```

* For more complicated parameter checks, manually check the parameter and then throw a `DeveloperError`. Example:
```javascript
Cartesian3.unpackArray = function(array, result) {
//>>includeStart('debug', pragmas.debug);
Check.defined(array, 'array');
Check.numeric.minimum(array.length, 3);
if (array.length % 3 !== 0) {
throw new DeveloperError('array length must be a multiple of 3.');
}
//>>includeEnd('debug');

// ...
};
```

* To check for `DeveloperError`, surround code in `includeStart`/`includeEnd` comments, as shown above, so developer error checks can be optimized out of release builds. Do not include required side effects inside `includeStart`/`includeEnd`, e.g.,
```javascript
Cartesian3.maximumComponent = function(cartesian) {
//>>includeStart('debug', pragmas.debug);
var c = cartesian;
if (!defined(c)) {
throw new DeveloperError('cartesian is required.');
}
Check.typeOf.object(cartesian, 'cartesian');
//>>includeEnd('debug');

// Works in debug. Fails in release since c is optimized out!
Expand Down
107 changes: 107 additions & 0 deletions Source/Core/BingMapsGeocoderService.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
/*global define*/
define([
'./BingMapsApi',
'./defaultValue',
'./defined',
'./defineProperties',
'./DeveloperError',
'./loadJsonp',
'./Rectangle'
], function(
BingMapsApi,
defaultValue,
defined,
defineProperties,
DeveloperError,
loadJsonp,
Rectangle) {
'use strict';

var url = 'https://dev.virtualearth.net/REST/v1/Locations';

/**
* Provides geocoding through Bing Maps.
* @alias BingMapsGeocoderService
* @constructor
*
* @param {Object} options Object with the following properties:
* @param {String} [key] A key to use with the Bing Maps geocoding service
* @param {Boolean} autoComplete Indicates whether this service shall be used to fetch auto-complete suggestions
*/
function BingMapsGeocoderService(options) {
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
this._url = 'https://dev.virtualearth.net/REST/v1/Locations';
this._key = BingMapsApi.getKey(options.key);
}

defineProperties(BingMapsGeocoderService.prototype, {
/**
* The URL endpoint for the Bing geocoder service
* @type {String}
* @memberof {BingMapsGeocoderService.prototype}
* @readonly
*/
url : {
get : function () {
return this._url;
}
},

/**
* The key for the Bing geocoder service
* @type {String}
* @memberof {BingMapsGeocoderService.prototype}
* @readonly
*/
key : {
get : function () {
return this._key;
}
}
});

/**
* @function
*
* @param {String} query The query to be sent to the geocoder service
* @returns {Promise<GeocoderResult[]>}
*/
BingMapsGeocoderService.prototype.geocode = function(query) {
//>>includeStart('debug', pragmas.debug);
if (!defined(query)) {
throw new DeveloperError('query must be defined');
}
//>>includeEnd('debug');

var key = this.key;
var promise = loadJsonp(url, {
parameters : {
query : query,
key : key
},
callbackParameterName : 'jsonp'
});

return promise.then(function(result) {
if (result.resourceSets.length === 0) {
return [];
}

var results = result.resourceSets[0].resources;

return results.map(function (resource) {
var bbox = resource.bbox;
var south = bbox[0];
var west = bbox[1];
var north = bbox[2];
var east = bbox[3];
return {
displayName: resource.name,
destination: Rectangle.fromDegrees(west, south, east, north)
};
});
});
};

return BingMapsGeocoderService;
});
Loading

0 comments on commit 05603e7

Please sign in to comment.