Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Classification primitives become ready when show is false #6428

Merged
merged 3 commits into from
Apr 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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