Skip to content

Commit

Permalink
Merge pull request #1 from AnalyticalGraphicsInc/master
Browse files Browse the repository at this point in the history
merge latest
  • Loading branch information
dwastberg committed Sep 25, 2018
2 parents 0734aee + c448444 commit 755f79a
Show file tree
Hide file tree
Showing 98 changed files with 5,942 additions and 3,825 deletions.
21 changes: 8 additions & 13 deletions Apps/Sandcastle/gallery/3D Tiles Clipping Planes.html
Original file line number Diff line number Diff line change
Expand Up @@ -104,19 +104,18 @@
}
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);

var scratchPlane = new Cesium.ClippingPlane(Cesium.Cartesian3.UNIT_X, 0.0);
function createPlaneUpdateFunction(plane, transform) {
function createPlaneUpdateFunction(plane) {
return function () {
plane.distance = targetY;
return Cesium.Plane.transform(plane, transform, scratchPlane);
return plane;
};
}

var tileset;
function loadTileset(url) {
clippingPlanes = new Cesium.ClippingPlaneCollection({
planes : [
new Cesium.ClippingPlane(new Cesium.Cartesian3(0.0, 0.0, -1.0), -100.0)
new Cesium.ClippingPlane(new Cesium.Cartesian3(0.0, 0.0, -1.0), 0.0)
],
edgeWidth : viewModel.edgeStylingEnabled ? 1.0 : 0.0
});
Expand All @@ -140,7 +139,7 @@
plane : {
dimensions : new Cesium.Cartesian2(radius * 2.5, radius * 2.5),
material : Cesium.Color.WHITE.withAlpha(0.1),
plane : new Cesium.CallbackProperty(createPlaneUpdateFunction(plane, tileset.modelMatrix), false),
plane : new Cesium.CallbackProperty(createPlaneUpdateFunction(plane), false),
outline : true,
outlineColor : Cesium.Color.WHITE
}
Expand All @@ -157,7 +156,7 @@
function loadModel(url) {
clippingPlanes = new Cesium.ClippingPlaneCollection({
planes : [
new Cesium.ClippingPlane(new Cesium.Cartesian3(0.0, 0.0, -1.0), -100.0)
new Cesium.ClippingPlane(new Cesium.Cartesian3(0.0, 0.0, -1.0), 0.0)
],
edgeWidth : viewModel.edgeStylingEnabled ? 1.0 : 0.0
});
Expand Down Expand Up @@ -189,7 +188,7 @@
plane : {
dimensions : new Cesium.Cartesian2(300.0, 300.0),
material : Cesium.Color.WHITE.withAlpha(0.1),
plane : new Cesium.CallbackProperty(createPlaneUpdateFunction(plane, Cesium.Matrix4.IDENTITY), false),
plane : new Cesium.CallbackProperty(createPlaneUpdateFunction(plane), false),
outline : true,
outlineColor : Cesium.Color.WHITE
}
Expand Down Expand Up @@ -218,13 +217,9 @@
if (newValue === clipObjects[0]) {
loadTileset(bimUrl);
} else if (newValue === clipObjects[1]) {
loadTileset(pointCloudUrl).then(function(tileset) {
tileset.clippingPlanes.modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(tileset.boundingSphere.center);
});
loadTileset(pointCloudUrl);
} else if (newValue === clipObjects[2]) {
loadTileset(instancedUrl).then(function(tileset) {
tileset.clippingPlanes.modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(tileset.boundingSphere.center);
});
loadTileset(instancedUrl);
} else {
loadModel(modelUrl);
}
Expand Down
174 changes: 174 additions & 0 deletions Apps/Sandcastle/gallery/Atmosphere.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
<!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="Adjust hue, saturation, and brightness of the sky/atmosphere.">
<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">
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>
<div id="toolbar">
<table><tbody>
<tr>
<td>Lighting Fade Out Distance</td>
<td>
<input type="range" min="1e6" max="1e8" step="1e6" data-bind="value: lightingFadeOutDistance, valueUpdate: 'input'">
<input type="text" size="10" data-bind="value: lightingFadeOutDistance">
</td>
</tr>
<tr>
<td>Lighting Fade In Distance</td>
<td>
<input type="range" min="1e6" max="1e8" step="1e6" data-bind="value: lightingFadeInDistance, valueUpdate: 'input'">
<input type="text" size="10" data-bind="value: lightingFadeInDistance">
</td>
</tr>
<tr>
<td>Night Fade Out Distance</td>
<td>
<input type="range" min="1e6" max="1e8" step="1e6" data-bind="value: nightFadeOutDistance, valueUpdate: 'input'">
<input type="text" size="10" data-bind="value: nightFadeOutDistance">
</td>
</tr>
<tr>
<td>Night Fade In Distance</td>
<td>
<input type="range" min="1e6" max="1e8" step="1e6" data-bind="value: nightFadeInDistance, valueUpdate: 'input'">
<input type="text" size="10" data-bind="value: nightFadeInDistance">
</td>
</tr>
</tbody></table>
</div>
<script id="cesium_sandcastle_script">
function startup(Cesium) {
'use strict';
//Sandcastle_Begin
var viewer = new Cesium.Viewer('cesiumContainer', {
sceneModePicker:false
});
var scene = viewer.scene;
var globe = scene.globe;

var defaultLightFadeOut = globe.lightingFadeOutDistance;
var defaultLightFadeIn = globe.lightingFadeInDistance;
var defaultNightFadeOut = globe.nightFadeOutDistance;
var defaultNightFadeIn = globe.nightFadeInDistance;

// The viewModel tracks the state of our mini application.
var viewModel = {
lightingFadeOutDistance : defaultLightFadeOut,
lightingFadeInDistance : defaultLightFadeIn,
nightFadeOutDistance : defaultNightFadeOut,
nightFadeInDistance : defaultNightFadeIn
};
// Convert the viewModel members into knockout observables.
Cesium.knockout.track(viewModel);

// Bind the viewModel to the DOM elements of the UI that call for it.
var toolbar = document.getElementById('toolbar');
Cesium.knockout.applyBindings(viewModel, toolbar);

// Make the skyAtmosphere's HSB parameters subscribers of the viewModel.
function subscribeParameter(name) {
Cesium.knockout.getObservable(viewModel, name).subscribe(
function(newValue) {
globe[name] = newValue;
}
);
}

subscribeParameter('lightingFadeOutDistance');
subscribeParameter('lightingFadeInDistance');
subscribeParameter('nightFadeOutDistance');
subscribeParameter('nightFadeInDistance');

Sandcastle.addToggleButton('Ground atmosphere', globe.showGroundAtmosphere, function(checked) {
globe.showGroundAtmosphere = checked;
});

Sandcastle.addToggleButton('Lighting', globe.enableLighting, function(checked) {
globe.enableLighting = checked;
});

Sandcastle.addToolbarMenu([{
text : 'Cesium World Terrain - no effects',
onselect : function() {
viewer.terrainProvider = Cesium.createWorldTerrain();
}
}, {
text : 'Cesium World Terrain w/ Vertex Normals',
onselect : function() {
viewer.terrainProvider = Cesium.createWorldTerrain({
requestVertexNormals : true
});
}
}, {
text : 'Cesium World Terrain w/ Water',
onselect : function() {
viewer.terrainProvider = Cesium.createWorldTerrain({
requestWaterMask : true
});
}
}, {
text : 'Cesium World Terrain w/ Vertex Normals and Water',
onselect : function() {
viewer.terrainProvider = Cesium.createWorldTerrain({
requestVertexNormals : true,
requestWaterMask : true
});
}
}, {
text : 'EllipsoidTerrainProvider',
onselect : function() {
viewer.terrainProvider = new Cesium.EllipsoidTerrainProvider();
}
}]);

Sandcastle.addToolbarButton('Reset Fade Distances', function() {
globe.lightingFadeOutDistance = defaultLightFadeOut;
globe.lightingFadeInDistance = defaultLightFadeIn;
globe.nightFadeOutDistance = defaultNightFadeOut;
globe.nightFadeInDistance = defaultNightFadeIn;

viewModel.lightingFadeOutDistance = defaultLightFadeOut;
viewModel.lightingFadeInDistance = defaultLightFadeIn;
viewModel.nightFadeOutDistance = defaultNightFadeOut;
viewModel.nightFadeInDistance = defaultNightFadeIn;
});

//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/Atmosphere.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 24 additions & 1 deletion Apps/Sandcastle/gallery/Terrain Clipping Planes.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
});
var globe = viewer.scene.globe;

var exampleTypes = ['Cesium Man', 'St. Helens'];
var exampleTypes = ['Cesium Man', 'St. Helens', 'Grand Canyon Isolated'];
var viewModel = {
exampleTypes : exampleTypes,
currentExampleType : exampleTypes[0],
Expand Down Expand Up @@ -191,6 +191,27 @@
});
}

function loadGrandCanyon(){
// Pick a position at the Grand Canyon
var position = Cesium.Cartographic.toCartesian(new Cesium.Cartographic.fromDegrees(-113.2665534, 36.0939345, 100));
var distance = 3000.0;
var boundingSphere = new Cesium.BoundingSphere(position, distance);

globe.clippingPlanes = new Cesium.ClippingPlaneCollection({
modelMatrix : Cesium.Transforms.eastNorthUpToFixedFrame(position),
planes : [
new Cesium.ClippingPlane(new Cesium.Cartesian3( 1.0, 0.0, 0.0), distance),
new Cesium.ClippingPlane(new Cesium.Cartesian3(-1.0, 0.0, 0.0), distance),
new Cesium.ClippingPlane(new Cesium.Cartesian3( 0.0, 1.0, 0.0), distance),
new Cesium.ClippingPlane(new Cesium.Cartesian3( 0.0, -1.0, 0.0), distance)
],
unionClippingRegions : true
});

viewer.camera.viewBoundingSphere(boundingSphere, new Cesium.HeadingPitchRange(0.5, -0.5, boundingSphere.radius * 5.0));
viewer.camera.lookAtTransform(Cesium.Matrix4.IDENTITY);
}

Cesium.knockout.getObservable(viewModel, 'clippingPlanesEnabled').subscribe(function(value) {
globe.clippingPlanes.enabled = value;
clippingPlanesEnabled = value;
Expand All @@ -207,6 +228,8 @@
loadCesiumMan();
} else if (newValue === exampleTypes[1]) {
loadStHelens();
} else if (newValue === exampleTypes[2]) {
loadGrandCanyon();
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,7 @@
});
} else if (newValue === clipObjects[3]) {
// i3dm
loadTileset(instancedUrl, 100.0).then(function() {
tileset.clippingPlanes.modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(tileset.boundingSphere.center);
});
loadTileset(instancedUrl, 100.0);
} else if (newValue === clipObjects[4]) {
// Terrain
var position = Cesium.Cartesian3.fromRadians(-2.0872979473351286, 0.6596620013036164, 2380.0);
Expand Down
18 changes: 17 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,33 @@ Change Log

### 1.50 - 2018-10-01

##### Breaking Changes :mega:
* Clipping planes on tilesets now use the root tile's transform, or the root tile's bounding sphere if a transform is not defined. [#7034](https://github.com/AnalyticalGraphicsInc/cesium/pull/7034)
* This is to make clipping planes' coordinates always relative to the object they're attached to. So if you were positioning the clipping planes as in the example below, this is no longer necessary:
```javascript
clippingPlanes.modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(tileset.boundingSphere.center);
```
* This also fixes several issues with clipping planes not using the correct transform for tilesets with children.

##### Additions :tada:
* Added support for glTF extension [KHR_materials_pbrSpecularGlossiness](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_pbrSpecularGlossiness) [#7006](https://github.com/AnalyticalGraphicsInc/cesium/pull/7006).
* Added support for glTF extension [KHR_materials_unlit](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_unlit) [#6977](https://github.com/AnalyticalGraphicsInc/cesium/pull/6977).
* Added support for glTF extensions [KHR_techniques_webgl](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_techniques_webgl) and [KHR_blend](https://github.com/KhronosGroup/glTF/pull/1302). [#6805](https://github.com/AnalyticalGraphicsInc/cesium/pull/6805)
* Update [gltf-pipeline](https://github.com/AnalyticalGraphicsInc/gltf-pipeline/) to 2.0. [#6805](https://github.com/AnalyticalGraphicsInc/cesium/pull/6805)
* 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)
* Added ground atmosphere lighting in 3D. This can be toggled with `Globe.showGroundAtmosphere`. [6877](https://github.com/AnalyticalGraphicsInc/cesium/pull/6877)
* Added `Globe.nightFadeOutDistance` and `Globe.nightFadeInDistance` to configure when ground atmosphere night lighting fades in and out. [6877](https://github.com/AnalyticalGraphicsInc/cesium/pull/6877)

##### Fixes :wrench:
* Fixed picking for overlapping translucent primitives. [#7039](https://github.com/AnalyticalGraphicsInc/cesium/pull/7039)
* Fixed an issue in the 3D Tiles traversal where external tilesets would not always traverse to their root tile. [#7035](https://github.com/AnalyticalGraphicsInc/cesium/pull/7035)
* 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)
* Fixed an issue where scaling near zero with an model animation could cause rendering to stop. [#6954](https://github.com/AnalyticalGraphicsInc/cesium/pull/6954)
* Fixed bug where credits weren't displaying correctly if more than one viewer was initialized [#6965](expect(https://github.com/AnalyticalGraphicsInc/cesium/issues/6965)
* Fixed entity show issues. [#7048](https://github.com/AnalyticalGraphicsInc/cesium/issues/7048)
* Fixed a bug where polylines on terrain covering very large portions of the globe would cull incorrectly in 3d-only scenes. [#7043](https://github.com/AnalyticalGraphicsInc/cesium/issues/7043)
* Fixed bug causing crash on entity geometry material change [#7047](https://github.com/AnalyticalGraphicsInc/cesium/pull/7047)
### 1.49 - 2018-09-04
Expand All @@ -28,7 +45,6 @@ Change Log
* Added `GeocoderViewModel.destinationFound` for specifying a function that is called upon a successful geocode. The default behavior is to fly to the destination found by the geocoder. [#6915](https://github.com/AnalyticalGraphicsInc/cesium/pull/6915
* Added `ClippingPlaneCollection.planeAdded` and `ClippingPlaneCollection.planeRemoved` events. `planeAdded` is raised when a new plane is added to the collection and `planeRemoved` is raised when a plane is removed. [#6875](https://github.com/AnalyticalGraphicsInc/cesium/pull/6875)
* Added `Matrix4.setScale` for setting the scale on an affine transformation matrix [#6888](https://github.com/AnalyticalGraphicsInc/cesium/pull/6888)
)
* Added optional `width` and `height` to `Scene.drillPick` for specifying a search area. [#6922](https://github.com/AnalyticalGraphicsInc/cesium/pull/6922)
* Added `Cesium3DTileset.root` for getting the root tile of a tileset. [#6944](https://github.com/AnalyticalGraphicsInc/cesium/pull/6944)
* Added `Cesium3DTileset.extras` and `Cesium3DTile.extras` for getting application specific metadata from 3D Tiles. [#6974](https://github.com/AnalyticalGraphicsInc/cesium/pull/6974)
Expand Down
7 changes: 5 additions & 2 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to Cesiu
* [Matt Petry](https://github.com/MattPetry)
* [Michael Squires](https://github.com/mksquires)
* [NICTA](http://www.nicta.com.au/)
* [Chris Cooper](https://github.com/chris-cooper)
* [Kevin Ring](https://github.com/kring)
* [Keith Grochow](https://github.com/kgrochow)
* [Chloe Chen](https://github.com/chloeleichen)
Expand Down Expand Up @@ -114,7 +113,10 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to Cesiu
* [Roderick Green](https://github.com/roderickgreen/)
* [Hexastack](https://www.hexastack.com)
* [Mohamed Marrouchi](https://github.com/marrouchi/)

* [PropellerAero](https://www.propelleraero.com/)
* [Chris Cooper](https://github.com/chris-cooper)
* [Andrew McDowell](https://github.com/madole)
* [Tony Luk](https://github.com/impactblue573)
## [Individual CLA](Documentation/Contributors/CLAs/individual-cla-agi-v1.0.txt)
* [Victor Berchet](https://github.com/vicb)
* [Caleb Morse](https://github.com/cmorse)
Expand Down Expand Up @@ -190,3 +192,4 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to Cesiu
* [Mark Erikson](https://github.com/markerikson)
* [Hannah Bollar](https://github.com/hanbollar)
* [Felix Palmer](https://github.com/felixpalmer)
* [Cedric Le Roux](https://github.com/cleroux)
9 changes: 2 additions & 7 deletions Source/Core/GroundPolylineGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,6 @@ define([
var normalNudgeScratch = new Cartesian3();

var scratchBoundingSpheres = [new BoundingSphere(), new BoundingSphere()];
var boundingSphereCenterCartographicScratch = new Cartographic();

// Winding order is reversed so each segment's volume is inside-out
var REFERENCE_INDICES = [
Expand Down Expand Up @@ -1061,12 +1060,8 @@ define([
BoundingSphere.fromVertices(topPositionsArray, Cartesian3.ZERO, 3, boundingSpheres[1]);
var boundingSphere = BoundingSphere.fromBoundingSpheres(boundingSpheres);

// Adjust bounding sphere height and radius to cover whole volume
var midHeight = sumHeights / (segmentCount * 2.0);
var boundingSphereCenterCartographic = Cartographic.fromCartesian(boundingSphere.center, ellipsoid, boundingSphereCenterCartographicScratch);
boundingSphereCenterCartographic.height = midHeight;
boundingSphere.center = Cartographic.toCartesian(boundingSphereCenterCartographic, ellipsoid, boundingSphere.center);
boundingSphere.radius = Math.max(boundingSphere.radius, midHeight);
// Adjust bounding sphere height and radius to cover more of the volume
boundingSphere.radius += sumHeights / (segmentCount * 2.0);

var attributes = {
position : new GeometryAttribute({
Expand Down
Loading

0 comments on commit 755f79a

Please sign in to comment.