Skip to content

Commit 755f79a

Browse files
authored
Merge pull request #1 from AnalyticalGraphicsInc/master
merge latest
2 parents 0734aee + c448444 commit 755f79a

File tree

98 files changed

+5942
-3825
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+5942
-3825
lines changed

Apps/Sandcastle/gallery/3D Tiles Clipping Planes.html

+8-13
Original file line numberDiff line numberDiff line change
@@ -104,19 +104,18 @@
104104
}
105105
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
106106

107-
var scratchPlane = new Cesium.ClippingPlane(Cesium.Cartesian3.UNIT_X, 0.0);
108-
function createPlaneUpdateFunction(plane, transform) {
107+
function createPlaneUpdateFunction(plane) {
109108
return function () {
110109
plane.distance = targetY;
111-
return Cesium.Plane.transform(plane, transform, scratchPlane);
110+
return plane;
112111
};
113112
}
114113

115114
var tileset;
116115
function loadTileset(url) {
117116
clippingPlanes = new Cesium.ClippingPlaneCollection({
118117
planes : [
119-
new Cesium.ClippingPlane(new Cesium.Cartesian3(0.0, 0.0, -1.0), -100.0)
118+
new Cesium.ClippingPlane(new Cesium.Cartesian3(0.0, 0.0, -1.0), 0.0)
120119
],
121120
edgeWidth : viewModel.edgeStylingEnabled ? 1.0 : 0.0
122121
});
@@ -140,7 +139,7 @@
140139
plane : {
141140
dimensions : new Cesium.Cartesian2(radius * 2.5, radius * 2.5),
142141
material : Cesium.Color.WHITE.withAlpha(0.1),
143-
plane : new Cesium.CallbackProperty(createPlaneUpdateFunction(plane, tileset.modelMatrix), false),
142+
plane : new Cesium.CallbackProperty(createPlaneUpdateFunction(plane), false),
144143
outline : true,
145144
outlineColor : Cesium.Color.WHITE
146145
}
@@ -157,7 +156,7 @@
157156
function loadModel(url) {
158157
clippingPlanes = new Cesium.ClippingPlaneCollection({
159158
planes : [
160-
new Cesium.ClippingPlane(new Cesium.Cartesian3(0.0, 0.0, -1.0), -100.0)
159+
new Cesium.ClippingPlane(new Cesium.Cartesian3(0.0, 0.0, -1.0), 0.0)
161160
],
162161
edgeWidth : viewModel.edgeStylingEnabled ? 1.0 : 0.0
163162
});
@@ -189,7 +188,7 @@
189188
plane : {
190189
dimensions : new Cesium.Cartesian2(300.0, 300.0),
191190
material : Cesium.Color.WHITE.withAlpha(0.1),
192-
plane : new Cesium.CallbackProperty(createPlaneUpdateFunction(plane, Cesium.Matrix4.IDENTITY), false),
191+
plane : new Cesium.CallbackProperty(createPlaneUpdateFunction(plane), false),
193192
outline : true,
194193
outlineColor : Cesium.Color.WHITE
195194
}
@@ -218,13 +217,9 @@
218217
if (newValue === clipObjects[0]) {
219218
loadTileset(bimUrl);
220219
} else if (newValue === clipObjects[1]) {
221-
loadTileset(pointCloudUrl).then(function(tileset) {
222-
tileset.clippingPlanes.modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(tileset.boundingSphere.center);
223-
});
220+
loadTileset(pointCloudUrl);
224221
} else if (newValue === clipObjects[2]) {
225-
loadTileset(instancedUrl).then(function(tileset) {
226-
tileset.clippingPlanes.modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(tileset.boundingSphere.center);
227-
});
222+
loadTileset(instancedUrl);
228223
} else {
229224
loadModel(modelUrl);
230225
}
+174
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
7+
<meta name="description" content="Adjust hue, saturation, and brightness of the sky/atmosphere.">
8+
<meta name="cesium-sandcastle-labels" content="Showcases">
9+
<title>Cesium Demo</title>
10+
<script type="text/javascript" src="../Sandcastle-header.js"></script>
11+
<script type="text/javascript" src="../../../ThirdParty/requirejs-2.1.20/require.js"></script>
12+
<script type="text/javascript">
13+
require.config({
14+
baseUrl : '../../../Source',
15+
waitSeconds : 60
16+
});
17+
</script>
18+
</head>
19+
<body class="sandcastle-loading" data-sandcastle-bucket="bucket-requirejs.html">
20+
<style>
21+
@import url(../templates/bucket.css);
22+
#toolbar {
23+
background: rgba(42, 42, 42, 0.8);
24+
padding: 4px;
25+
border-radius: 4px;
26+
}
27+
#toolbar input {
28+
vertical-align: middle;
29+
padding-top: 2px;
30+
padding-bottom: 2px;
31+
}
32+
</style>
33+
<div id="cesiumContainer" class="fullSize"></div>
34+
<div id="loadingOverlay"><h1>Loading...</h1></div>
35+
<div id="toolbar">
36+
<table><tbody>
37+
<tr>
38+
<td>Lighting Fade Out Distance</td>
39+
<td>
40+
<input type="range" min="1e6" max="1e8" step="1e6" data-bind="value: lightingFadeOutDistance, valueUpdate: 'input'">
41+
<input type="text" size="10" data-bind="value: lightingFadeOutDistance">
42+
</td>
43+
</tr>
44+
<tr>
45+
<td>Lighting Fade In Distance</td>
46+
<td>
47+
<input type="range" min="1e6" max="1e8" step="1e6" data-bind="value: lightingFadeInDistance, valueUpdate: 'input'">
48+
<input type="text" size="10" data-bind="value: lightingFadeInDistance">
49+
</td>
50+
</tr>
51+
<tr>
52+
<td>Night Fade Out Distance</td>
53+
<td>
54+
<input type="range" min="1e6" max="1e8" step="1e6" data-bind="value: nightFadeOutDistance, valueUpdate: 'input'">
55+
<input type="text" size="10" data-bind="value: nightFadeOutDistance">
56+
</td>
57+
</tr>
58+
<tr>
59+
<td>Night Fade In Distance</td>
60+
<td>
61+
<input type="range" min="1e6" max="1e8" step="1e6" data-bind="value: nightFadeInDistance, valueUpdate: 'input'">
62+
<input type="text" size="10" data-bind="value: nightFadeInDistance">
63+
</td>
64+
</tr>
65+
</tbody></table>
66+
</div>
67+
<script id="cesium_sandcastle_script">
68+
function startup(Cesium) {
69+
'use strict';
70+
//Sandcastle_Begin
71+
var viewer = new Cesium.Viewer('cesiumContainer', {
72+
sceneModePicker:false
73+
});
74+
var scene = viewer.scene;
75+
var globe = scene.globe;
76+
77+
var defaultLightFadeOut = globe.lightingFadeOutDistance;
78+
var defaultLightFadeIn = globe.lightingFadeInDistance;
79+
var defaultNightFadeOut = globe.nightFadeOutDistance;
80+
var defaultNightFadeIn = globe.nightFadeInDistance;
81+
82+
// The viewModel tracks the state of our mini application.
83+
var viewModel = {
84+
lightingFadeOutDistance : defaultLightFadeOut,
85+
lightingFadeInDistance : defaultLightFadeIn,
86+
nightFadeOutDistance : defaultNightFadeOut,
87+
nightFadeInDistance : defaultNightFadeIn
88+
};
89+
// Convert the viewModel members into knockout observables.
90+
Cesium.knockout.track(viewModel);
91+
92+
// Bind the viewModel to the DOM elements of the UI that call for it.
93+
var toolbar = document.getElementById('toolbar');
94+
Cesium.knockout.applyBindings(viewModel, toolbar);
95+
96+
// Make the skyAtmosphere's HSB parameters subscribers of the viewModel.
97+
function subscribeParameter(name) {
98+
Cesium.knockout.getObservable(viewModel, name).subscribe(
99+
function(newValue) {
100+
globe[name] = newValue;
101+
}
102+
);
103+
}
104+
105+
subscribeParameter('lightingFadeOutDistance');
106+
subscribeParameter('lightingFadeInDistance');
107+
subscribeParameter('nightFadeOutDistance');
108+
subscribeParameter('nightFadeInDistance');
109+
110+
Sandcastle.addToggleButton('Ground atmosphere', globe.showGroundAtmosphere, function(checked) {
111+
globe.showGroundAtmosphere = checked;
112+
});
113+
114+
Sandcastle.addToggleButton('Lighting', globe.enableLighting, function(checked) {
115+
globe.enableLighting = checked;
116+
});
117+
118+
Sandcastle.addToolbarMenu([{
119+
text : 'Cesium World Terrain - no effects',
120+
onselect : function() {
121+
viewer.terrainProvider = Cesium.createWorldTerrain();
122+
}
123+
}, {
124+
text : 'Cesium World Terrain w/ Vertex Normals',
125+
onselect : function() {
126+
viewer.terrainProvider = Cesium.createWorldTerrain({
127+
requestVertexNormals : true
128+
});
129+
}
130+
}, {
131+
text : 'Cesium World Terrain w/ Water',
132+
onselect : function() {
133+
viewer.terrainProvider = Cesium.createWorldTerrain({
134+
requestWaterMask : true
135+
});
136+
}
137+
}, {
138+
text : 'Cesium World Terrain w/ Vertex Normals and Water',
139+
onselect : function() {
140+
viewer.terrainProvider = Cesium.createWorldTerrain({
141+
requestVertexNormals : true,
142+
requestWaterMask : true
143+
});
144+
}
145+
}, {
146+
text : 'EllipsoidTerrainProvider',
147+
onselect : function() {
148+
viewer.terrainProvider = new Cesium.EllipsoidTerrainProvider();
149+
}
150+
}]);
151+
152+
Sandcastle.addToolbarButton('Reset Fade Distances', function() {
153+
globe.lightingFadeOutDistance = defaultLightFadeOut;
154+
globe.lightingFadeInDistance = defaultLightFadeIn;
155+
globe.nightFadeOutDistance = defaultNightFadeOut;
156+
globe.nightFadeInDistance = defaultNightFadeIn;
157+
158+
viewModel.lightingFadeOutDistance = defaultLightFadeOut;
159+
viewModel.lightingFadeInDistance = defaultLightFadeIn;
160+
viewModel.nightFadeOutDistance = defaultNightFadeOut;
161+
viewModel.nightFadeInDistance = defaultNightFadeIn;
162+
});
163+
164+
//Sandcastle_End
165+
Sandcastle.finishedLoading();
166+
}
167+
if (typeof Cesium !== 'undefined') {
168+
startup(Cesium);
169+
} else if (typeof require === 'function') {
170+
require(['Cesium'], startup);
171+
}
172+
</script>
173+
</body>
174+
</html>
16 KB
Loading

Apps/Sandcastle/gallery/Terrain Clipping Planes.html

+24-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
});
5353
var globe = viewer.scene.globe;
5454

55-
var exampleTypes = ['Cesium Man', 'St. Helens'];
55+
var exampleTypes = ['Cesium Man', 'St. Helens', 'Grand Canyon Isolated'];
5656
var viewModel = {
5757
exampleTypes : exampleTypes,
5858
currentExampleType : exampleTypes[0],
@@ -191,6 +191,27 @@
191191
});
192192
}
193193

194+
function loadGrandCanyon(){
195+
// Pick a position at the Grand Canyon
196+
var position = Cesium.Cartographic.toCartesian(new Cesium.Cartographic.fromDegrees(-113.2665534, 36.0939345, 100));
197+
var distance = 3000.0;
198+
var boundingSphere = new Cesium.BoundingSphere(position, distance);
199+
200+
globe.clippingPlanes = new Cesium.ClippingPlaneCollection({
201+
modelMatrix : Cesium.Transforms.eastNorthUpToFixedFrame(position),
202+
planes : [
203+
new Cesium.ClippingPlane(new Cesium.Cartesian3( 1.0, 0.0, 0.0), distance),
204+
new Cesium.ClippingPlane(new Cesium.Cartesian3(-1.0, 0.0, 0.0), distance),
205+
new Cesium.ClippingPlane(new Cesium.Cartesian3( 0.0, 1.0, 0.0), distance),
206+
new Cesium.ClippingPlane(new Cesium.Cartesian3( 0.0, -1.0, 0.0), distance)
207+
],
208+
unionClippingRegions : true
209+
});
210+
211+
viewer.camera.viewBoundingSphere(boundingSphere, new Cesium.HeadingPitchRange(0.5, -0.5, boundingSphere.radius * 5.0));
212+
viewer.camera.lookAtTransform(Cesium.Matrix4.IDENTITY);
213+
}
214+
194215
Cesium.knockout.getObservable(viewModel, 'clippingPlanesEnabled').subscribe(function(value) {
195216
globe.clippingPlanes.enabled = value;
196217
clippingPlanesEnabled = value;
@@ -207,6 +228,8 @@
207228
loadCesiumMan();
208229
} else if (newValue === exampleTypes[1]) {
209230
loadStHelens();
231+
} else if (newValue === exampleTypes[2]) {
232+
loadGrandCanyon();
210233
}
211234
});
212235

Apps/Sandcastle/gallery/development/Many Clipping Planes.html

+1-3
Original file line numberDiff line numberDiff line change
@@ -226,9 +226,7 @@
226226
});
227227
} else if (newValue === clipObjects[3]) {
228228
// i3dm
229-
loadTileset(instancedUrl, 100.0).then(function() {
230-
tileset.clippingPlanes.modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(tileset.boundingSphere.center);
231-
});
229+
loadTileset(instancedUrl, 100.0);
232230
} else if (newValue === clipObjects[4]) {
233231
// Terrain
234232
var position = Cesium.Cartesian3.fromRadians(-2.0872979473351286, 0.6596620013036164, 2380.0);

CHANGES.md

+17-1
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,33 @@ Change Log
33

44
### 1.50 - 2018-10-01
55

6+
##### Breaking Changes :mega:
7+
* 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)
8+
* 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:
9+
```javascript
10+
clippingPlanes.modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(tileset.boundingSphere.center);
11+
```
12+
* This also fixes several issues with clipping planes not using the correct transform for tilesets with children.
13+
614
##### Additions :tada:
15+
* 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).
16+
* 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).
17+
* 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)
18+
* Update [gltf-pipeline](https://github.com/AnalyticalGraphicsInc/gltf-pipeline/) to 2.0. [#6805](https://github.com/AnalyticalGraphicsInc/cesium/pull/6805)
719
* Added `cartographicLimitRectangle` to `Globe`. Use this to limit terrain and imagery to a specific `Rectangle` area. [#6987](https://github.com/AnalyticalGraphicsInc/cesium/pull/6987)
820
* Added `OpenCageGeocoderService`, which provides geocoding via [OpenCage](https://opencagedata.com/). [#7015](https://github.com/AnalyticalGraphicsInc/cesium/pull/7015)
21+
* Added ground atmosphere lighting in 3D. This can be toggled with `Globe.showGroundAtmosphere`. [6877](https://github.com/AnalyticalGraphicsInc/cesium/pull/6877)
22+
* 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)
923

1024
##### Fixes :wrench:
1125
* Fixed picking for overlapping translucent primitives. [#7039](https://github.com/AnalyticalGraphicsInc/cesium/pull/7039)
1226
* 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)
1327
* 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)
1428
* Fixed an issue where scaling near zero with an model animation could cause rendering to stop. [#6954](https://github.com/AnalyticalGraphicsInc/cesium/pull/6954)
1529
* Fixed bug where credits weren't displaying correctly if more than one viewer was initialized [#6965](expect(https://github.com/AnalyticalGraphicsInc/cesium/issues/6965)
30+
* Fixed entity show issues. [#7048](https://github.com/AnalyticalGraphicsInc/cesium/issues/7048)
31+
* 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)
32+
* Fixed bug causing crash on entity geometry material change [#7047](https://github.com/AnalyticalGraphicsInc/cesium/pull/7047)
1633
1734
### 1.49 - 2018-09-04
1835
@@ -28,7 +45,6 @@ Change Log
2845
* 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
2946
* 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)
3047
* Added `Matrix4.setScale` for setting the scale on an affine transformation matrix [#6888](https://github.com/AnalyticalGraphicsInc/cesium/pull/6888)
31-
)
3248
* Added optional `width` and `height` to `Scene.drillPick` for specifying a search area. [#6922](https://github.com/AnalyticalGraphicsInc/cesium/pull/6922)
3349
* Added `Cesium3DTileset.root` for getting the root tile of a tileset. [#6944](https://github.com/AnalyticalGraphicsInc/cesium/pull/6944)
3450
* Added `Cesium3DTileset.extras` and `Cesium3DTile.extras` for getting application specific metadata from 3D Tiles. [#6974](https://github.com/AnalyticalGraphicsInc/cesium/pull/6974)

CONTRIBUTORS.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to Cesiu
5151
* [Matt Petry](https://github.com/MattPetry)
5252
* [Michael Squires](https://github.com/mksquires)
5353
* [NICTA](http://www.nicta.com.au/)
54-
* [Chris Cooper](https://github.com/chris-cooper)
5554
* [Kevin Ring](https://github.com/kring)
5655
* [Keith Grochow](https://github.com/kgrochow)
5756
* [Chloe Chen](https://github.com/chloeleichen)
@@ -114,7 +113,10 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to Cesiu
114113
* [Roderick Green](https://github.com/roderickgreen/)
115114
* [Hexastack](https://www.hexastack.com)
116115
* [Mohamed Marrouchi](https://github.com/marrouchi/)
117-
116+
* [PropellerAero](https://www.propelleraero.com/)
117+
* [Chris Cooper](https://github.com/chris-cooper)
118+
* [Andrew McDowell](https://github.com/madole)
119+
* [Tony Luk](https://github.com/impactblue573)
118120
## [Individual CLA](Documentation/Contributors/CLAs/individual-cla-agi-v1.0.txt)
119121
* [Victor Berchet](https://github.com/vicb)
120122
* [Caleb Morse](https://github.com/cmorse)
@@ -190,3 +192,4 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to Cesiu
190192
* [Mark Erikson](https://github.com/markerikson)
191193
* [Hannah Bollar](https://github.com/hanbollar)
192194
* [Felix Palmer](https://github.com/felixpalmer)
195+
* [Cedric Le Roux](https://github.com/cleroux)

Source/Core/GroundPolylineGeometry.js

+2-7
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,6 @@ define([
697697
var normalNudgeScratch = new Cartesian3();
698698

699699
var scratchBoundingSpheres = [new BoundingSphere(), new BoundingSphere()];
700-
var boundingSphereCenterCartographicScratch = new Cartographic();
701700

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

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

10711066
var attributes = {
10721067
position : new GeometryAttribute({

0 commit comments

Comments
 (0)