Skip to content

Commit 5b2890f

Browse files
authored
Merge pull request #6428 from AnalyticalGraphicsInc/primitive-ready
Classification primitives become ready when show is false
2 parents 8e7f485 + 7220fde commit 5b2890f

5 files changed

+51
-2
lines changed

CHANGES.md

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Change Log
88
* Fixed glTF support to handle meshes with and without tangent vectors, and with/without morph targets, sharing one material. [#6421](https://github.com/AnalyticalGraphicsInc/cesium/pull/6421)
99
* Fixed glTF support to handle skinned meshes when no skin is supplied. [#6061](https://github.com/AnalyticalGraphicsInc/cesium/issues/6061)
1010
* Allow loadWithXhr to work with string URLs in a web worker.
11+
* `GroundPrimitive`s and `ClassificationPrimitive`s will become ready when `show` is `false`. [#6428](https://github.com/AnalyticalGraphicsInc/cesium/pull/6428)
1112
* Fix Firefox WebGL console warnings. [#5912](https://github.com/AnalyticalGraphicsInc/cesium/issues/5912)
1213
* Fix parsing Cesium.js in older browsers that do not support all TypedArray types. [#6396](https://github.com/AnalyticalGraphicsInc/cesium/pull/6396)
1314

Source/Scene/ClassificationPrimitive.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -834,7 +834,7 @@ define([
834834
* @exception {DeveloperError} Not all of the geometry instances have the same color attribute.
835835
*/
836836
ClassificationPrimitive.prototype.update = function(frameState) {
837-
if (!this.show || (!defined(this._primitive) && !defined(this.geometryInstances))) {
837+
if (!defined(this._primitive) && !defined(this.geometryInstances)) {
838838
return;
839839
}
840840

@@ -931,6 +931,7 @@ define([
931931
this._rsColorPass = RenderState.fromCache(getColorRenderState(true));
932932
}
933933

934+
this._primitive.show = this.show;
934935
this._primitive.debugShowBoundingVolume = this.debugShowBoundingVolume;
935936
this._primitive.update(frameState);
936937
};

Source/Scene/GroundPrimitive.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,7 @@ define([
684684
* @exception {DeveloperError} Not all of the geometry instances have the same color attribute.
685685
*/
686686
GroundPrimitive.prototype.update = function(frameState) {
687-
if (!this.show || (!defined(this._primitive) && !defined(this.geometryInstances))) {
687+
if (!defined(this._primitive) && !defined(this.geometryInstances)) {
688688
return;
689689
}
690690

@@ -784,6 +784,7 @@ define([
784784
});
785785
}
786786

787+
this._primitive.show = this.show;
787788
this._primitive.debugShowShadowVolume = this.debugShowShadowVolume;
788789
this._primitive.debugShowBoundingVolume = this.debugShowBoundingVolume;
789790
this._primitive.update(frameState);

Specs/Scene/ClassificationPrimitiveSpec.js

+23
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,29 @@ defineSuite([
282282
expect(frameState.commandList.length).toEqual(0);
283283
});
284284

285+
it('becomes ready when show is false', function() {
286+
if (!ClassificationPrimitive.isSupported(scene)) {
287+
return;
288+
}
289+
290+
primitive = scene.groundPrimitives.add(new ClassificationPrimitive({
291+
geometryInstances : boxInstance
292+
}));
293+
primitive.show = false;
294+
295+
var ready = false;
296+
primitive.readyPromise.then(function() {
297+
ready = true;
298+
});
299+
300+
return pollToPromise(function() {
301+
scene.render();
302+
return ready;
303+
}).then(function() {
304+
expect(ready).toEqual(true);
305+
});
306+
});
307+
285308
it('does not render other than for the color or pick pass', function() {
286309
if (!ClassificationPrimitive.isSupported(scene)) {
287310
return;

Specs/Scene/GroundPrimitiveSpec.js

+23
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,29 @@ defineSuite([
285285
expect(frameState.commandList.length).toEqual(0);
286286
});
287287

288+
it('becomes ready when show is false', function() {
289+
if (!GroundPrimitive.isSupported(scene)) {
290+
return;
291+
}
292+
293+
primitive = scene.groundPrimitives.add(new GroundPrimitive({
294+
geometryInstances : rectangleInstance
295+
}));
296+
primitive.show = false;
297+
298+
var ready = false;
299+
primitive.readyPromise.then(function() {
300+
ready = true;
301+
});
302+
303+
return pollToPromise(function() {
304+
scene.render();
305+
return ready;
306+
}).then(function() {
307+
expect(ready).toEqual(true);
308+
});
309+
});
310+
288311
it('does not render other than for the color or pick pass', function() {
289312
if (!GroundPrimitive.isSupported(scene)) {
290313
return;

0 commit comments

Comments
 (0)