Skip to content

Commit 70a73cb

Browse files
authored
Merge branch 'master' into processing-queue
2 parents 70370f7 + fa3a642 commit 70a73cb

31 files changed

+889
-187
lines changed

Apps/Sandcastle/CesiumSandcastle.js

+19-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/*global require,Blob,JSHINT*/
2-
/*global gallery_demos*/// defined by gallery/gallery-index.js, created by build
3-
/*global hello_world_index*/// defined in gallery/gallery-index.js, created by build
2+
/*global gallery_demos, has_new_gallery_demos, hello_world_index*/// defined in gallery/gallery-index.js, created by build
43
/*global sandcastleJsHintOptions*/// defined by jsHintOptions.js, created by build
54
require({
65
baseUrl: '../../Source',
@@ -1080,6 +1079,7 @@ require({
10801079
});
10811080
}
10821081

1082+
var newInLabel = 'New in ' + window.Cesium.VERSION;
10831083
function loadDemoFromFile(demo) {
10841084
return requestDemo(demo.name).then(function(value) {
10851085
// Store the file contents for later searching.
@@ -1097,7 +1097,11 @@ require({
10971097

10981098
var labelsMeta = doc.querySelector('meta[name="cesium-sandcastle-labels"]');
10991099
var labels = labelsMeta && labelsMeta.getAttribute('content');
1100-
demo.label = labels ? labels : '';
1100+
if (demo.isNew) {
1101+
demo.label = labels ? labels + ',' + newInLabel : newInLabel;
1102+
} else {
1103+
demo.label = labels ? labels : '';
1104+
}
11011105

11021106
// Select the demo to load upon opening based on the query parameter.
11031107
if (defined(queryObject.src)) {
@@ -1249,6 +1253,18 @@ require({
12491253
subtabs[label] = cp;
12501254
registerScroll(dom.byId('showcasesContainer'));
12511255

1256+
if (has_new_gallery_demos) {
1257+
var name = 'New in ' + window.Cesium.VERSION;
1258+
subtabs[name] = new ContentPane({
1259+
content: '<div id="' + name + 'Container" class="demosContainer"><div class="demos" id="' + name + 'Demos"></div></div>',
1260+
title: name,
1261+
onShow: function() {
1262+
setSubtab(this.title);
1263+
}
1264+
}).placeAt('innerPanel');
1265+
registerScroll(dom.byId(name + 'Container'));
1266+
}
1267+
12521268
var i;
12531269
var len = gallery_demos.length;
12541270

CHANGES.md

+4
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ Change Log
1616
* `Credit.hasImage` and `Credit.hasLink` functions have been deprecated and will be removed in Cesium 1.46.
1717

1818
##### Additions :tada:
19+
* Added a new Sandcastle label, `New in X.X` which will include all new Sandcastle demos added for the current release. [#6384](https://github.com/AnalyticalGraphicsInc/cesium/issues/6384)
1920
* Fix Cesium ion browser caching [#6353](https://github.com/AnalyticalGraphicsInc/cesium/pull/6353).
2021
* Added support for glTF models with [Draco geometry compression](https://github.com/fanzhanggoogle/glTF/blob/KHR_mesh_compression/extensions/Khronos/KHR_draco_mesh_compression/README.md).
22+
* Added `dequantizeInShader` option parameter to `Model` and `Model.fromGltf` to specify if Draco compressed glTF assets should be dequantized on the GPU.
2123
* `ClippingPlaneCollection` updates [#6201](https://github.com/AnalyticalGraphicsInc/cesium/pull/6201)
2224
* Removed the 6-clipping-plane limit.
2325
* Added support for Internet Explorer.
@@ -43,7 +45,9 @@ Change Log
4345
* Fixed default value of `alphaCutoff` in glTF models. [#6346](https://github.com/AnalyticalGraphicsInc/cesium/pull/6346)
4446
* Fixed rendering vector tiles when using `invertClassification`. [#6349](https://github.com/AnalyticalGraphicsInc/cesium/pull/6349)
4547
* Fixed animation for glTF models with missing animation targets. [#6351](https://github.com/AnalyticalGraphicsInc/cesium/pull/6351)
48+
* Fixed occlusion when `globe.show` is `false`. [#6374](https://github.com/AnalyticalGraphicsInc/cesium/pull/6374)
4649
* Fixed double-sided flag for glTF materials with `BLEND` enabled. [#6371](https://github.com/AnalyticalGraphicsInc/cesium/pull/6371)
50+
* Fixed crash for entities with static geometry and time-dynamic attributes [#6377](https://github.com/AnalyticalGraphicsInc/cesium/pull/6377)
4751

4852
### 1.43 - 2018-03-01
4953

Source/Core/CesiumTerrainProvider.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ define([
161161
var deprecationLinkText = 'Check out the new high-resolution Cesium World Terrain';
162162
var deprecationLink = 'https://cesium.com/blog/2018/03/01/introducing-cesium-world-terrain/';
163163
that._tileCredits = [
164-
new Credit('<span>' + deprecationText + '</span> <a href="' + deprecationLink + '>' + deprecationLinkText + '</a>', true)
164+
new Credit('<span>' + deprecationText + '</span> <a href="' + deprecationLink + '">' + deprecationLinkText + '</a>', true)
165165
];
166166
deprecationWarning('assets.agi.com', deprecationText + ' ' + deprecationLinkText + ' ' + deprecationLink);
167167
} else {

Source/Core/CorridorGeometry.js

+5-10
Original file line numberDiff line numberDiff line change
@@ -823,13 +823,13 @@ define([
823823
this._granularity = defaultValue(options.granularity, CesiumMath.RADIANS_PER_DEGREE);
824824
this._shadowVolume = defaultValue(options.shadowVolume, false);
825825
this._workerName = 'createCorridorGeometry';
826-
this._rectangle = computeRectangle(positions, this._ellipsoid, width, this._cornerType);
826+
this._rectangle = undefined;
827827

828828
/**
829829
* The number of elements used to pack the object into an array.
830830
* @type {Number}
831831
*/
832-
this.packedLength = 1 + positions.length * Cartesian3.packedLength + Ellipsoid.packedLength + VertexFormat.packedLength + Rectangle.packedLength + 6;
832+
this.packedLength = 1 + positions.length * Cartesian3.packedLength + Ellipsoid.packedLength + VertexFormat.packedLength + 6;
833833
}
834834

835835
/**
@@ -867,9 +867,6 @@ define([
867867
VertexFormat.pack(value._vertexFormat, array, startingIndex);
868868
startingIndex += VertexFormat.packedLength;
869869

870-
Rectangle.pack(value._rectangle, array, startingIndex);
871-
startingIndex += Rectangle.packedLength;
872-
873870
array[startingIndex++] = value._width;
874871
array[startingIndex++] = value._height;
875872
array[startingIndex++] = value._extrudedHeight;
@@ -882,7 +879,6 @@ define([
882879

883880
var scratchEllipsoid = Ellipsoid.clone(Ellipsoid.UNIT_SPHERE);
884881
var scratchVertexFormat = new VertexFormat();
885-
var scratchRectangle = new Rectangle();
886882
var scratchOptions = {
887883
positions : undefined,
888884
ellipsoid : scratchEllipsoid,
@@ -925,9 +921,6 @@ define([
925921
var vertexFormat = VertexFormat.unpack(array, startingIndex, scratchVertexFormat);
926922
startingIndex += VertexFormat.packedLength;
927923

928-
var rectangle = Rectangle.unpack(array, startingIndex, scratchRectangle);
929-
startingIndex += Rectangle.packedLength;
930-
931924
var width = array[startingIndex++];
932925
var height = array[startingIndex++];
933926
var extrudedHeight = array[startingIndex++];
@@ -954,7 +947,6 @@ define([
954947
result._extrudedHeight = extrudedHeight;
955948
result._cornerType = cornerType;
956949
result._granularity = granularity;
957-
result._rectangle = Rectangle.clone(rectangle);
958950
result._shadowVolume = shadowVolume;
959951

960952
return result;
@@ -1047,6 +1039,9 @@ define([
10471039
*/
10481040
rectangle : {
10491041
get : function() {
1042+
if (!defined(this._rectangle)) {
1043+
this._rectangle = computeRectangle(this._positions, this._ellipsoid, this._width, this._cornerType);
1044+
}
10501045
return this._rectangle;
10511046
}
10521047
}

Source/Core/EllipseGeometry.js

+29-41
Original file line numberDiff line numberDiff line change
@@ -653,37 +653,30 @@ define([
653653
};
654654
}
655655

656-
var scratchEnuToFixedMatrix = new Matrix4();
657-
var scratchFixedToEnuMatrix = new Matrix4();
658-
var scratchRotationMatrix = new Matrix3();
659-
var scratchRectanglePoints = [new Cartesian3(), new Cartesian3(), new Cartesian3(), new Cartesian3()];
660-
var scratchCartographicPoints = [new Cartographic(), new Cartographic(), new Cartographic(), new Cartographic()];
661-
662-
function computeRectangle(center, ellipsoid, semiMajorAxis, semiMinorAxis, rotation) {
663-
Transforms.eastNorthUpToFixedFrame(center, ellipsoid, scratchEnuToFixedMatrix);
664-
Matrix4.inverseTransformation(scratchEnuToFixedMatrix, scratchFixedToEnuMatrix);
665-
666-
// Find the 4 extreme points of the ellipse in ENU
667-
var i;
668-
for (i = 0; i < 4; ++i) {
669-
Cartesian3.clone(Cartesian3.ZERO, scratchRectanglePoints[i]);
670-
}
671-
scratchRectanglePoints[0].x += semiMajorAxis;
672-
scratchRectanglePoints[1].x -= semiMajorAxis;
673-
scratchRectanglePoints[2].y += semiMinorAxis;
674-
scratchRectanglePoints[3].y -= semiMinorAxis;
675-
676-
Matrix3.fromRotationZ(rotation, scratchRotationMatrix);
677-
for (i = 0; i < 4; ++i) {
678-
// Apply the rotation
679-
Matrix3.multiplyByVector(scratchRotationMatrix, scratchRectanglePoints[i], scratchRectanglePoints[i]);
680-
681-
// Convert back to fixed and then to cartographic
682-
Matrix4.multiplyByPoint(scratchEnuToFixedMatrix, scratchRectanglePoints[i], scratchRectanglePoints[i]);
683-
ellipsoid.cartesianToCartographic(scratchRectanglePoints[i], scratchCartographicPoints[i]);
684-
}
685-
686-
return Rectangle.fromCartographicArray(scratchCartographicPoints);
656+
function computeRectangle(ellipseGeometry) {
657+
var cep = EllipseGeometryLibrary.computeEllipsePositions({
658+
center : ellipseGeometry._center,
659+
semiMajorAxis : ellipseGeometry._semiMajorAxis,
660+
semiMinorAxis : ellipseGeometry._semiMinorAxis,
661+
rotation : ellipseGeometry._rotation,
662+
granularity : ellipseGeometry._granularity
663+
}, false, true);
664+
var positionsFlat = cep.outerPositions;
665+
var positionsCount = positionsFlat.length / 3;
666+
var positions = new Array(positionsCount);
667+
for (var i = 0; i < positionsCount; ++i) {
668+
positions[i] = Cartesian3.fromArray(positionsFlat, i * 3);
669+
}
670+
var rectangle = Rectangle.fromCartesianArray(positions);
671+
// Rectangle width goes beyond 180 degrees when the ellipse crosses a pole.
672+
// When this happens, make the rectangle into a "circle" around the pole
673+
if (rectangle.width > CesiumMath.PI) {
674+
rectangle.north = rectangle.north > 0.0 ? CesiumMath.PI_OVER_TWO - CesiumMath.EPSILON7 : rectangle.north;
675+
rectangle.south = rectangle.south < 0.0 ? CesiumMath.EPSILON7 - CesiumMath.PI_OVER_TWO : rectangle.south;
676+
rectangle.east = CesiumMath.PI;
677+
rectangle.west = -CesiumMath.PI;
678+
}
679+
return rectangle;
687680
}
688681

689682
/**
@@ -766,14 +759,14 @@ define([
766759
this._shadowVolume = defaultValue(options.shadowVolume, false);
767760
this._workerName = 'createEllipseGeometry';
768761

769-
this._rectangle = computeRectangle(this._center, this._ellipsoid, semiMajorAxis, semiMinorAxis, this._rotation);
762+
this._rectangle = undefined;
770763
}
771764

772765
/**
773766
* The number of elements used to pack the object into an array.
774767
* @type {Number}
775768
*/
776-
EllipseGeometry.packedLength = Cartesian3.packedLength + Ellipsoid.packedLength + VertexFormat.packedLength + Rectangle.packedLength + 9;
769+
EllipseGeometry.packedLength = Cartesian3.packedLength + Ellipsoid.packedLength + VertexFormat.packedLength + 9;
777770

778771
/**
779772
* Stores the provided instance into the provided array.
@@ -805,9 +798,6 @@ define([
805798
VertexFormat.pack(value._vertexFormat, array, startingIndex);
806799
startingIndex += VertexFormat.packedLength;
807800

808-
Rectangle.pack(value._rectangle, array, startingIndex);
809-
startingIndex += Rectangle.packedLength;
810-
811801
array[startingIndex++] = value._semiMajorAxis;
812802
array[startingIndex++] = value._semiMinorAxis;
813803
array[startingIndex++] = value._rotation;
@@ -824,7 +814,6 @@ define([
824814
var scratchCenter = new Cartesian3();
825815
var scratchEllipsoid = new Ellipsoid();
826816
var scratchVertexFormat = new VertexFormat();
827-
var scratchRectangle = new Rectangle();
828817
var scratchOptions = {
829818
center : scratchCenter,
830819
ellipsoid : scratchEllipsoid,
@@ -865,9 +854,6 @@ define([
865854
var vertexFormat = VertexFormat.unpack(array, startingIndex, scratchVertexFormat);
866855
startingIndex += VertexFormat.packedLength;
867856

868-
var rectangle = Rectangle.unpack(array, startingIndex, scratchRectangle);
869-
startingIndex += Rectangle.packedLength;
870-
871857
var semiMajorAxis = array[startingIndex++];
872858
var semiMinorAxis = array[startingIndex++];
873859
var rotation = array[startingIndex++];
@@ -902,7 +888,6 @@ define([
902888
result._extrudedHeight = extrudedHeight;
903889
result._extrude = extrude;
904890
result._shadowVolume = shadowVolume;
905-
result._rectangle = Rectangle.clone(rectangle);
906891

907892
return result;
908893
};
@@ -980,6 +965,9 @@ define([
980965
*/
981966
rectangle : {
982967
get : function() {
968+
if (!defined(this._rectangle)) {
969+
this._rectangle = computeRectangle(this);
970+
}
983971
return this._rectangle;
984972
}
985973
}

Source/Core/PolygonGeometry.js

+11-15
Original file line numberDiff line numberDiff line change
@@ -601,18 +601,13 @@ define([
601601
this._shadowVolume = defaultValue(options.shadowVolume, false);
602602
this._workerName = 'createPolygonGeometry';
603603

604-
var positions = polygonHierarchy.positions;
605-
if (!defined(positions) || positions.length < 3) {
606-
this._rectangle = new Rectangle();
607-
} else {
608-
this._rectangle = Rectangle.fromCartesianArray(positions, ellipsoid);
609-
}
604+
this._rectangle = undefined;
610605

611606
/**
612607
* The number of elements used to pack the object into an array.
613608
* @type {Number}
614609
*/
615-
this.packedLength = PolygonGeometryLibrary.computeHierarchyPackedLength(polygonHierarchy) + Ellipsoid.packedLength + VertexFormat.packedLength + Rectangle.packedLength + 10;
610+
this.packedLength = PolygonGeometryLibrary.computeHierarchyPackedLength(polygonHierarchy) + Ellipsoid.packedLength + VertexFormat.packedLength + 10;
616611
}
617612

618613
/**
@@ -696,9 +691,6 @@ define([
696691
VertexFormat.pack(value._vertexFormat, array, startingIndex);
697692
startingIndex += VertexFormat.packedLength;
698693

699-
Rectangle.pack(value._rectangle, array, startingIndex);
700-
startingIndex += Rectangle.packedLength;
701-
702694
array[startingIndex++] = value._height;
703695
array[startingIndex++] = value._extrudedHeight;
704696
array[startingIndex++] = value._granularity;
@@ -715,7 +707,6 @@ define([
715707

716708
var scratchEllipsoid = Ellipsoid.clone(Ellipsoid.UNIT_SPHERE);
717709
var scratchVertexFormat = new VertexFormat();
718-
var scratchRectangle = new Rectangle();
719710

720711
//Only used to avoid inaability to default construct.
721712
var dummyOptions = {
@@ -746,9 +737,6 @@ define([
746737
var vertexFormat = VertexFormat.unpack(array, startingIndex, scratchVertexFormat);
747738
startingIndex += VertexFormat.packedLength;
748739

749-
var rectangle = Rectangle.unpack(array, startingIndex, scratchRectangle);
750-
startingIndex += Rectangle.packedLength;
751-
752740
var height = array[startingIndex++];
753741
var extrudedHeight = array[startingIndex++];
754742
var granularity = array[startingIndex++];
@@ -775,7 +763,6 @@ define([
775763
result._perPositionHeight = perPositionHeight;
776764
result._closeTop = closeTop;
777765
result._closeBottom = closeBottom;
778-
result._rectangle = Rectangle.clone(rectangle);
779766
result._shadowVolume = shadowVolume;
780767
result.packedLength = packedLength;
781768
return result;
@@ -931,6 +918,15 @@ define([
931918
*/
932919
rectangle : {
933920
get : function() {
921+
if (!defined(this._rectangle)) {
922+
var positions = this._polygonHierarchy.positions;
923+
if (!defined(positions) || positions.length < 3) {
924+
this._rectangle = new Rectangle();
925+
} else {
926+
this._rectangle = Rectangle.fromCartesianArray(positions, this._ellipsoid);
927+
}
928+
}
929+
934930
return this._rectangle;
935931
}
936932
}

0 commit comments

Comments
 (0)