Skip to content

Commit

Permalink
Merge pull request #6428 from AnalyticalGraphicsInc/primitive-ready
Browse files Browse the repository at this point in the history
Classification primitives become ready when show is false
  • Loading branch information
mramato authored Apr 10, 2018
2 parents 8e7f485 + 7220fde commit 5b2890f
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Change Log
* 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)
* Fixed glTF support to handle skinned meshes when no skin is supplied. [#6061](https://github.com/AnalyticalGraphicsInc/cesium/issues/6061)
* Allow loadWithXhr to work with string URLs in a web worker.
* `GroundPrimitive`s and `ClassificationPrimitive`s will become ready when `show` is `false`. [#6428](https://github.com/AnalyticalGraphicsInc/cesium/pull/6428)
* Fix Firefox WebGL console warnings. [#5912](https://github.com/AnalyticalGraphicsInc/cesium/issues/5912)
* Fix parsing Cesium.js in older browsers that do not support all TypedArray types. [#6396](https://github.com/AnalyticalGraphicsInc/cesium/pull/6396)

Expand Down
3 changes: 2 additions & 1 deletion Source/Scene/ClassificationPrimitive.js
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,7 @@ define([
* @exception {DeveloperError} Not all of the geometry instances have the same color attribute.
*/
ClassificationPrimitive.prototype.update = function(frameState) {
if (!this.show || (!defined(this._primitive) && !defined(this.geometryInstances))) {
if (!defined(this._primitive) && !defined(this.geometryInstances)) {
return;
}

Expand Down Expand Up @@ -931,6 +931,7 @@ define([
this._rsColorPass = RenderState.fromCache(getColorRenderState(true));
}

this._primitive.show = this.show;
this._primitive.debugShowBoundingVolume = this.debugShowBoundingVolume;
this._primitive.update(frameState);
};
Expand Down
3 changes: 2 additions & 1 deletion Source/Scene/GroundPrimitive.js
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ define([
* @exception {DeveloperError} Not all of the geometry instances have the same color attribute.
*/
GroundPrimitive.prototype.update = function(frameState) {
if (!this.show || (!defined(this._primitive) && !defined(this.geometryInstances))) {
if (!defined(this._primitive) && !defined(this.geometryInstances)) {
return;
}

Expand Down Expand Up @@ -784,6 +784,7 @@ define([
});
}

this._primitive.show = this.show;
this._primitive.debugShowShadowVolume = this.debugShowShadowVolume;
this._primitive.debugShowBoundingVolume = this.debugShowBoundingVolume;
this._primitive.update(frameState);
Expand Down
23 changes: 23 additions & 0 deletions Specs/Scene/ClassificationPrimitiveSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,29 @@ defineSuite([
expect(frameState.commandList.length).toEqual(0);
});

it('becomes ready when show is false', function() {
if (!ClassificationPrimitive.isSupported(scene)) {
return;
}

primitive = scene.groundPrimitives.add(new ClassificationPrimitive({
geometryInstances : boxInstance
}));
primitive.show = false;

var ready = false;
primitive.readyPromise.then(function() {
ready = true;
});

return pollToPromise(function() {
scene.render();
return ready;
}).then(function() {
expect(ready).toEqual(true);
});
});

it('does not render other than for the color or pick pass', function() {
if (!ClassificationPrimitive.isSupported(scene)) {
return;
Expand Down
23 changes: 23 additions & 0 deletions Specs/Scene/GroundPrimitiveSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,29 @@ defineSuite([
expect(frameState.commandList.length).toEqual(0);
});

it('becomes ready when show is false', function() {
if (!GroundPrimitive.isSupported(scene)) {
return;
}

primitive = scene.groundPrimitives.add(new GroundPrimitive({
geometryInstances : rectangleInstance
}));
primitive.show = false;

var ready = false;
primitive.readyPromise.then(function() {
ready = true;
});

return pollToPromise(function() {
scene.render();
return ready;
}).then(function() {
expect(ready).toEqual(true);
});
});

it('does not render other than for the color or pick pass', function() {
if (!GroundPrimitive.isSupported(scene)) {
return;
Expand Down

0 comments on commit 5b2890f

Please sign in to comment.