Skip to content

Commit 5e90cb9

Browse files
authored
Merge pull request #6239 from AnalyticalGraphicsInc/better-batching
DataSources batch different geometry types together
2 parents d207b1a + f6b87e3 commit 5e90cb9

30 files changed

+1751
-931
lines changed

CHANGES.md

+6
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,18 @@ Change Log
33

44
### 1.43 - 2018-03-01
55

6+
##### Breaking Changes :mega:
7+
* Removed `GeometryUpdater.perInstanceColorAppearanceType` and `GeometryUpdater.materialAppearanceType`. [#6239](https://github.com/AnalyticalGraphicsInc/cesium/pull/6239)
8+
* `GeometryVisualizer` no longer uses a `type` parameter. [#6239](https://github.com/AnalyticalGraphicsInc/cesium/pull/6239)
9+
* `GeometryVisualizer` no longer displays polylines. Use `PolylineVisualizer` instead. [#6239](https://github.com/AnalyticalGraphicsInc/cesium/pull/6239)
10+
611
##### Deprecated :hourglass_flowing_sand:
712
* In the `Resource` class, `addQueryParameters` and `addTemplateValues` have been deprecated and will be removed in Cesium 1.45. Please use `setQueryParameters` and `setTemplateValues` instead.
813

914
##### Additions :tada:
1015
* Added support for a promise to a resource for `CesiumTerrainProvider`, `createTileMapServiceImageryProvider` and `Cesium3DTileset` [#6204](https://github.com/AnalyticalGraphicsInc/cesium/pull/6204)
1116
* Added `Cesium.Math.cbrt`. [#6222](https://github.com/AnalyticalGraphicsInc/cesium/pull/6222)
17+
* Added `PolylineVisualizer` for displaying polyline entities [#6239](https://github.com/AnalyticalGraphicsInc/cesium/pull/6239)
1218
* `Resource` class [#6205](https://github.com/AnalyticalGraphicsInc/cesium/issues/6205)
1319
* Added `put`, `patch`, `delete`, `options` and `head` methods, so it can be used for all XHR requests.
1420
* Added `preserveQueryParameters` parameter to `getDerivedResource`, to allow us to append query parameters instead of always replacing them.

Source/DataSources/BoxGeometryUpdater.js

+25-39
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
define([
22
'../Core/BoxGeometry',
33
'../Core/BoxOutlineGeometry',
4+
'../Core/Check',
45
'../Core/Color',
56
'../Core/ColorGeometryInstanceAttribute',
67
'../Core/defaultValue',
@@ -26,6 +27,7 @@ define([
2627
], function(
2728
BoxGeometry,
2829
BoxOutlineGeometry,
30+
Check,
2931
Color,
3032
ColorGeometryInstanceAttribute,
3133
defaultValue,
@@ -76,12 +78,8 @@ define([
7678
*/
7779
function BoxGeometryUpdater(entity, scene) {
7880
//>>includeStart('debug', pragmas.debug);
79-
if (!defined(entity)) {
80-
throw new DeveloperError('entity is required');
81-
}
82-
if (!defined(scene)) {
83-
throw new DeveloperError('scene is required');
84-
}
81+
Check.defined('entity', entity);
82+
Check.defined('scene', scene);
8583
//>>includeEnd('debug');
8684

8785
this._entity = entity;
@@ -100,29 +98,23 @@ define([
10098
this._shadowsProperty = undefined;
10199
this._distanceDisplayConditionProperty = undefined;
102100
this._options = new GeometryOptions(entity);
101+
this._id = 'box-' + entity.id;
102+
103103
this._onEntityPropertyChanged(entity, 'box', entity.box, undefined);
104104
}
105105

106-
defineProperties(BoxGeometryUpdater, {
106+
defineProperties(BoxGeometryUpdater.prototype, {
107107
/**
108-
* Gets the type of Appearance to use for simple color-based geometry.
109-
* @memberof BoxGeometryUpdater
110-
* @type {Appearance}
108+
* Gets the unique ID associated with this updater
109+
* @memberof BoxGeometryUpdater.prototype
110+
* @type {String}
111+
* @readonly
111112
*/
112-
perInstanceColorAppearanceType : {
113-
value : PerInstanceColorAppearance
113+
id: {
114+
get: function() {
115+
return this._id;
116+
}
114117
},
115-
/**
116-
* Gets the type of Appearance to use for material-based geometry.
117-
* @memberof BoxGeometryUpdater
118-
* @type {Appearance}
119-
*/
120-
materialAppearanceType : {
121-
value : MaterialAppearance
122-
}
123-
});
124-
125-
defineProperties(BoxGeometryUpdater.prototype, {
126118
/**
127119
* Gets the entity associated with this geometry.
128120
* @memberof BoxGeometryUpdater.prototype
@@ -323,9 +315,7 @@ define([
323315
*/
324316
BoxGeometryUpdater.prototype.createFillGeometryInstance = function(time) {
325317
//>>includeStart('debug', pragmas.debug);
326-
if (!defined(time)) {
327-
throw new DeveloperError('time is required.');
328-
}
318+
Check.defined('time', time);
329319

330320
if (!this._fillEnabled) {
331321
throw new DeveloperError('This instance does not represent a filled geometry.');
@@ -377,9 +367,7 @@ define([
377367
*/
378368
BoxGeometryUpdater.prototype.createOutlineGeometryInstance = function(time) {
379369
//>>includeStart('debug', pragmas.debug);
380-
if (!defined(time)) {
381-
throw new DeveloperError('time is required.');
382-
}
370+
Check.defined('time', time);
383371

384372
if (!this._outlineEnabled) {
385373
throw new DeveloperError('This instance does not represent an outlined geometry.');
@@ -512,13 +500,11 @@ define([
512500
*/
513501
BoxGeometryUpdater.prototype.createDynamicUpdater = function(primitives) {
514502
//>>includeStart('debug', pragmas.debug);
503+
Check.defined('primitives', primitives);
504+
515505
if (!this._dynamic) {
516506
throw new DeveloperError('This instance does not represent dynamic geometry.');
517507
}
518-
519-
if (!defined(primitives)) {
520-
throw new DeveloperError('primitives is required.');
521-
}
522508
//>>includeEnd('debug');
523509

524510
return new DynamicGeometryUpdater(primitives, this);
@@ -532,13 +518,13 @@ define([
532518
this._primitive = undefined;
533519
this._outlinePrimitive = undefined;
534520
this._geometryUpdater = geometryUpdater;
521+
this._entity = geometryUpdater._entity;
535522
this._options = new GeometryOptions(geometryUpdater._entity);
536523
}
524+
537525
DynamicGeometryUpdater.prototype.update = function(time) {
538526
//>>includeStart('debug', pragmas.debug);
539-
if (!defined(time)) {
540-
throw new DeveloperError('time is required.');
541-
}
527+
Check.defined('time', time);
542528
//>>includeEnd('debug');
543529

544530
var primitives = this._primitives;
@@ -548,7 +534,7 @@ define([
548534
this._outlinePrimitive = undefined;
549535

550536
var geometryUpdater = this._geometryUpdater;
551-
var entity = geometryUpdater._entity;
537+
var entity = this._entity;
552538
var box = entity.box;
553539
if (!entity.isShowing || !entity.isAvailable(time) || !Property.getValueOrDefault(box.show, time, true)) {
554540
return;
@@ -625,8 +611,8 @@ define([
625611
}
626612
};
627613

628-
DynamicGeometryUpdater.prototype.getBoundingSphere = function(entity, result) {
629-
return dynamicGeometryGetBoundingSphere(entity, this._primitive, this._outlinePrimitive, result);
614+
DynamicGeometryUpdater.prototype.getBoundingSphere = function(result) {
615+
return dynamicGeometryGetBoundingSphere(this._entity, this._primitive, this._outlinePrimitive, result);
630616
};
631617

632618
DynamicGeometryUpdater.prototype.isDestroyed = function() {

Source/DataSources/CorridorGeometryUpdater.js

+25-39
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
define([
2+
'../Core/Check',
23
'../Core/Color',
34
'../Core/ColorGeometryInstanceAttribute',
45
'../Core/CorridorGeometry',
@@ -26,6 +27,7 @@ define([
2627
'./MaterialProperty',
2728
'./Property'
2829
], function(
30+
Check,
2931
Color,
3032
ColorGeometryInstanceAttribute,
3133
CorridorGeometry,
@@ -85,12 +87,8 @@ define([
8587
*/
8688
function CorridorGeometryUpdater(entity, scene) {
8789
//>>includeStart('debug', pragmas.debug);
88-
if (!defined(entity)) {
89-
throw new DeveloperError('entity is required');
90-
}
91-
if (!defined(scene)) {
92-
throw new DeveloperError('scene is required');
93-
}
90+
Check.defined('entity', entity);
91+
Check.defined('scene', scene);
9492
//>>includeEnd('debug');
9593

9694
this._entity = entity;
@@ -111,30 +109,23 @@ define([
111109
this._distanceDisplayConditionProperty = undefined;
112110
this._onTerrain = false;
113111
this._options = new GeometryOptions(entity);
112+
this._id = 'corridor-' + entity.id;
114113

115114
this._onEntityPropertyChanged(entity, 'corridor', entity.corridor, undefined);
116115
}
117116

118-
defineProperties(CorridorGeometryUpdater, {
117+
defineProperties(CorridorGeometryUpdater.prototype, {
119118
/**
120-
* Gets the type of Appearance to use for simple color-based geometry.
121-
* @memberof CorridorGeometryUpdater
122-
* @type {Appearance}
119+
* Gets the unique ID associated with this updater
120+
* @memberof CorridorGeometryUpdater.prototype
121+
* @type {String}
122+
* @readonly
123123
*/
124-
perInstanceColorAppearanceType : {
125-
value : PerInstanceColorAppearance
124+
id: {
125+
get: function() {
126+
return this._id;
127+
}
126128
},
127-
/**
128-
* Gets the type of Appearance to use for material-based geometry.
129-
* @memberof CorridorGeometryUpdater
130-
* @type {Appearance}
131-
*/
132-
materialAppearanceType : {
133-
value : MaterialAppearance
134-
}
135-
});
136-
137-
defineProperties(CorridorGeometryUpdater.prototype, {
138129
/**
139130
* Gets the entity associated with this geometry.
140131
* @memberof CorridorGeometryUpdater.prototype
@@ -349,9 +340,7 @@ define([
349340
*/
350341
CorridorGeometryUpdater.prototype.createFillGeometryInstance = function(time) {
351342
//>>includeStart('debug', pragmas.debug);
352-
if (!defined(time)) {
353-
throw new DeveloperError('time is required.');
354-
}
343+
Check.defined('time', time);
355344

356345
if (!this._fillEnabled) {
357346
throw new DeveloperError('This instance does not represent a filled geometry.');
@@ -401,9 +390,7 @@ define([
401390
*/
402391
CorridorGeometryUpdater.prototype.createOutlineGeometryInstance = function(time) {
403392
//>>includeStart('debug', pragmas.debug);
404-
if (!defined(time)) {
405-
throw new DeveloperError('time is required.');
406-
}
393+
Check.defined('time', time);
407394

408395
if (!this._outlineEnabled) {
409396
throw new DeveloperError('This instance does not represent an outlined geometry.');
@@ -558,13 +545,12 @@ define([
558545
*/
559546
CorridorGeometryUpdater.prototype.createDynamicUpdater = function(primitives, groundPrimitives) {
560547
//>>includeStart('debug', pragmas.debug);
548+
Check.defined('primitives', primitives);
549+
Check.defined('groundPrimitives', groundPrimitives);
550+
561551
if (!this._dynamic) {
562552
throw new DeveloperError('This instance does not represent dynamic geometry.');
563553
}
564-
565-
if (!defined(primitives)) {
566-
throw new DeveloperError('primitives is required.');
567-
}
568554
//>>includeEnd('debug');
569555

570556
return new DynamicGeometryUpdater(primitives, groundPrimitives, this);
@@ -580,12 +566,12 @@ define([
580566
this._outlinePrimitive = undefined;
581567
this._geometryUpdater = geometryUpdater;
582568
this._options = new GeometryOptions(geometryUpdater._entity);
569+
this._entity = geometryUpdater._entity;
583570
}
571+
584572
DynamicGeometryUpdater.prototype.update = function(time) {
585573
//>>includeStart('debug', pragmas.debug);
586-
if (!defined(time)) {
587-
throw new DeveloperError('time is required.');
588-
}
574+
Check.defined('time', time);
589575
//>>includeEnd('debug');
590576

591577
var geometryUpdater = this._geometryUpdater;
@@ -602,7 +588,7 @@ define([
602588
}
603589
this._primitive = undefined;
604590

605-
var entity = geometryUpdater._entity;
591+
var entity = this._entity;
606592
var corridor = entity.corridor;
607593
if (!entity.isShowing || !entity.isAvailable(time) || !Property.getValueOrDefault(corridor.show, time, true)) {
608594
return;
@@ -701,8 +687,8 @@ define([
701687
}
702688
};
703689

704-
DynamicGeometryUpdater.prototype.getBoundingSphere = function(entity, result) {
705-
return dynamicGeometryGetBoundingSphere(entity, this._primitive, this._outlinePrimitive, result);
690+
DynamicGeometryUpdater.prototype.getBoundingSphere = function(result) {
691+
return dynamicGeometryGetBoundingSphere(this._entity, this._primitive, this._outlinePrimitive, result);
706692
};
707693

708694
DynamicGeometryUpdater.prototype.isDestroyed = function() {

0 commit comments

Comments
 (0)