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

Geometry not always obeying Entity.show #2756

Merged
merged 4 commits into from
May 28, 2015
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 @@ -36,6 +36,7 @@ Change Log
* Added support for the [CESIUM_binary_glTF](https://github.com/KhronosGroup/glTF/blob/new-extensions/extensions/CESIUM_binary_glTF/README.md) extension for loading binary blobs of glTF to `Model`.
* Added support for the [CESIUM_RTC](https://github.com/KhronosGroup/glTF/blob/new-extensions/extensions/CESIUM_RTC/README.md) glTF extension for high-precision rendering to `Model`.
* Fixed a bug where the sun was smeared when the skybox/stars was disabled. [#1829](https://github.com/AnalyticalGraphicsInc/cesium/issue/1829)
* Fixed a bug that sometimes caused `Entity` instances with `show` set to false to reappear when new `Entity` geometry is added. [#2686](https://github.com/AnalyticalGraphicsInc/cesium/issues/2686)

### 1.9 - 2015-05-01

Expand Down
4 changes: 2 additions & 2 deletions Source/DataSources/BoxGeometryUpdater.js
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ define([
var attributes;

var color;
var show = new ShowGeometryInstanceAttribute(isAvailable && this._showProperty.getValue(time) && this._fillProperty.getValue(time));
var show = new ShowGeometryInstanceAttribute(isAvailable && entity.isShowing && this._showProperty.getValue(time) && this._fillProperty.getValue(time));
if (this._materialProperty instanceof ColorMaterialProperty) {
var currentColor = Color.WHITE;
if (defined(this._materialProperty.color) && (this._materialProperty.color.isConstant || isAvailable)) {
Expand Down Expand Up @@ -357,7 +357,7 @@ define([
geometry : BoxOutlineGeometry.fromDimensions(this._options),
modelMatrix : entity._getModelMatrix(Iso8601.MINIMUM_VALUE),
attributes : {
show : new ShowGeometryInstanceAttribute(isAvailable && this._showProperty.getValue(time) && this._showOutlineProperty.getValue(time)),
show : new ShowGeometryInstanceAttribute(isAvailable && entity.isShowing && this._showProperty.getValue(time) && this._showOutlineProperty.getValue(time)),
color : ColorGeometryInstanceAttribute.fromColor(outlineColor)
}
});
Expand Down
4 changes: 2 additions & 2 deletions Source/DataSources/CorridorGeometryUpdater.js
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ define([
var attributes;

var color;
var show = new ShowGeometryInstanceAttribute(isAvailable && this._showProperty.getValue(time) && this._fillProperty.getValue(time));
var show = new ShowGeometryInstanceAttribute(isAvailable && entity.isShowing && this._showProperty.getValue(time) && this._fillProperty.getValue(time));
if (this._materialProperty instanceof ColorMaterialProperty) {
var currentColor = Color.WHITE;
if (defined(this._materialProperty.color) && (this._materialProperty.color.isConstant || isAvailable)) {
Expand Down Expand Up @@ -363,7 +363,7 @@ define([
id : entity,
geometry : new CorridorOutlineGeometry(this._options),
attributes : {
show : new ShowGeometryInstanceAttribute(isAvailable && this._showProperty.getValue(time) && this._showOutlineProperty.getValue(time)),
show : new ShowGeometryInstanceAttribute(isAvailable && entity.isShowing && this._showProperty.getValue(time) && this._showOutlineProperty.getValue(time)),
color : ColorGeometryInstanceAttribute.fromColor(outlineColor)
}
});
Expand Down
4 changes: 2 additions & 2 deletions Source/DataSources/CylinderGeometryUpdater.js
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ define([
var attributes;

var color;
var show = new ShowGeometryInstanceAttribute(isAvailable && this._showProperty.getValue(time) && this._fillProperty.getValue(time));
var show = new ShowGeometryInstanceAttribute(isAvailable && entity.isShowing && this._showProperty.getValue(time) && this._fillProperty.getValue(time));
if (this._materialProperty instanceof ColorMaterialProperty) {
var currentColor = Color.WHITE;
if (defined(this._materialProperty.color) && (this._materialProperty.color.isConstant || isAvailable)) {
Expand Down Expand Up @@ -364,7 +364,7 @@ define([
geometry : new CylinderOutlineGeometry(this._options),
modelMatrix : entity._getModelMatrix(Iso8601.MINIMUM_VALUE),
attributes : {
show : new ShowGeometryInstanceAttribute(isAvailable && this._showProperty.getValue(time) && this._showOutlineProperty.getValue(time)),
show : new ShowGeometryInstanceAttribute(isAvailable && entity.isShowing && this._showProperty.getValue(time) && this._showOutlineProperty.getValue(time)),
color : ColorGeometryInstanceAttribute.fromColor(outlineColor)
}
});
Expand Down
4 changes: 2 additions & 2 deletions Source/DataSources/EllipseGeometryUpdater.js
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ define([
var attributes;

var color;
var show = new ShowGeometryInstanceAttribute(isAvailable && this._showProperty.getValue(time) && this._fillProperty.getValue(time));
var show = new ShowGeometryInstanceAttribute(isAvailable && entity.isShowing && this._showProperty.getValue(time) && this._fillProperty.getValue(time));
if (this._materialProperty instanceof ColorMaterialProperty) {
var currentColor = Color.WHITE;
if (defined(this._materialProperty.color) && (this._materialProperty.color.isConstant || isAvailable)) {
Expand Down Expand Up @@ -366,7 +366,7 @@ define([
id : entity,
geometry : new EllipseOutlineGeometry(this._options),
attributes : {
show : new ShowGeometryInstanceAttribute(isAvailable && this._showProperty.getValue(time) && this._showOutlineProperty.getValue(time)),
show : new ShowGeometryInstanceAttribute(isAvailable && entity.isShowing && this._showProperty.getValue(time) && this._showOutlineProperty.getValue(time)),
color : ColorGeometryInstanceAttribute.fromColor(outlineColor)
}
});
Expand Down
4 changes: 2 additions & 2 deletions Source/DataSources/EllipsoidGeometryUpdater.js
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ define([
var attributes;

var color;
var show = new ShowGeometryInstanceAttribute(isAvailable && this._showProperty.getValue(time) && this._fillProperty.getValue(time));
var show = new ShowGeometryInstanceAttribute(isAvailable && entity.isShowing && this._showProperty.getValue(time) && this._fillProperty.getValue(time));
if (this._materialProperty instanceof ColorMaterialProperty) {
var currentColor = Color.WHITE;
if (defined(this._materialProperty.color) && (this._materialProperty.color.isConstant || isAvailable)) {
Expand Down Expand Up @@ -370,7 +370,7 @@ define([
geometry : new EllipsoidOutlineGeometry(this._options),
modelMatrix : entity._getModelMatrix(Iso8601.MINIMUM_VALUE),
attributes : {
show : new ShowGeometryInstanceAttribute(isAvailable && this._showProperty.getValue(time) && this._showOutlineProperty.getValue(time)),
show : new ShowGeometryInstanceAttribute(isAvailable && entity.isShowing && this._showProperty.getValue(time) && this._showOutlineProperty.getValue(time)),
color : ColorGeometryInstanceAttribute.fromColor(outlineColor)
}
});
Expand Down
4 changes: 2 additions & 2 deletions Source/DataSources/PolygonGeometryUpdater.js
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ define([
var attributes;

var color;
var show = new ShowGeometryInstanceAttribute(isAvailable && this._showProperty.getValue(time) && this._fillProperty.getValue(time));
var show = new ShowGeometryInstanceAttribute(isAvailable && entity.isShowing && this._showProperty.getValue(time) && this._fillProperty.getValue(time));
if (this._materialProperty instanceof ColorMaterialProperty) {
var currentColor = Color.WHITE;
if (defined(this._materialProperty.color) && (this._materialProperty.color.isConstant || isAvailable)) {
Expand Down Expand Up @@ -367,7 +367,7 @@ define([
id : entity,
geometry : new PolygonOutlineGeometry(this._options),
attributes : {
show : new ShowGeometryInstanceAttribute(isAvailable && this._showProperty.getValue(time) && this._showOutlineProperty.getValue(time)),
show : new ShowGeometryInstanceAttribute(isAvailable && entity.isShowing && this._showProperty.getValue(time) && this._showOutlineProperty.getValue(time)),
color : ColorGeometryInstanceAttribute.fromColor(outlineColor)
}
});
Expand Down
2 changes: 1 addition & 1 deletion Source/DataSources/PolylineGeometryUpdater.js
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ define([
var attributes;
var entity = this._entity;
var isAvailable = entity.isAvailable(time);
var show = new ShowGeometryInstanceAttribute(isAvailable && this._showProperty.getValue(time));
var show = new ShowGeometryInstanceAttribute(isAvailable && entity.isShowing && this._showProperty.getValue(time));

if (this._materialProperty instanceof ColorMaterialProperty) {
var currentColor = Color.WHITE;
Expand Down
4 changes: 2 additions & 2 deletions Source/DataSources/PolylineVolumeGeometryUpdater.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ define([
var attributes;

var color;
var show = new ShowGeometryInstanceAttribute(isAvailable && this._showProperty.getValue(time) && this._fillProperty.getValue(time));
var show = new ShowGeometryInstanceAttribute(isAvailable && entity.isShowing && this._showProperty.getValue(time) && this._fillProperty.getValue(time));
if (this._materialProperty instanceof ColorMaterialProperty) {
var currentColor = Color.WHITE;
if (defined(this._materialProperty.color) && (this._materialProperty.color.isConstant || isAvailable)) {
Expand Down Expand Up @@ -358,7 +358,7 @@ define([
id : entity,
geometry : new PolylineVolumeOutlineGeometry(this._options),
attributes : {
show : new ShowGeometryInstanceAttribute(isAvailable && this._showProperty.getValue(time) && this._showOutlineProperty.getValue(time)),
show : new ShowGeometryInstanceAttribute(isAvailable && entity.isShowing && this._showProperty.getValue(time) && this._showOutlineProperty.getValue(time)),
color : ColorGeometryInstanceAttribute.fromColor(outlineColor)
}
});
Expand Down
4 changes: 2 additions & 2 deletions Source/DataSources/RectangleGeometryUpdater.js
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ define([
var attributes;

var color;
var show = new ShowGeometryInstanceAttribute(isAvailable && this._showProperty.getValue(time) && this._fillProperty.getValue(time));
var show = new ShowGeometryInstanceAttribute(isAvailable && entity.isShowing && this._showProperty.getValue(time) && this._fillProperty.getValue(time));
if (this._materialProperty instanceof ColorMaterialProperty) {
var currentColor = Color.WHITE;
if (defined(this._materialProperty.color) && (this._materialProperty.color.isConstant || isAvailable)) {
Expand Down Expand Up @@ -365,7 +365,7 @@ define([
id : entity,
geometry : new RectangleOutlineGeometry(this._options),
attributes : {
show : new ShowGeometryInstanceAttribute(isAvailable && this._showProperty.getValue(time) && this._showOutlineProperty.getValue(time)),
show : new ShowGeometryInstanceAttribute(isAvailable && entity.isShowing && this._showProperty.getValue(time) && this._showOutlineProperty.getValue(time)),
color : ColorGeometryInstanceAttribute.fromColor(outlineColor)
}
});
Expand Down
33 changes: 27 additions & 6 deletions Source/DataSources/StaticGeometryColorBatch.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ define([
var removedCount = 0;
var primitive = this.primitive;
var primitives = this.primitives;
var attributes;
var i;

if (this.createPrimitive) {
if (defined(primitive)) {
if (!defined(this.oldPrimitive)) {
Expand All @@ -79,12 +82,28 @@ define([
primitives.remove(primitive);
}
}
this.attributes.removeAll();
var geometry = this.geometry.values;
if (geometry.length > 0) {

var geometries = this.geometry.values;
var geometriesLength = geometries.length;
if (geometriesLength > 0) {
for (i = 0; i < geometriesLength; i++) {
var geometryItem = geometries[i];
var originalAttributes = geometryItem.attributes;
attributes = this.attributes.get(geometryItem.id.id);

if (defined(attributes)) {
if (defined(originalAttributes.show)) {
originalAttributes.show.value = attributes.show;
}
if (defined(originalAttributes.color)) {
originalAttributes.color.value = attributes.color;
}
}
}

primitive = new Primitive({
asynchronous : true,
geometryInstances : geometry,
geometryInstances : geometries,
appearance : new this.appearanceType({
translucent : this.translucent,
closed : this.closed
Expand All @@ -93,6 +112,8 @@ define([
primitives.add(primitive);
isUpdated = false;
}

this.attributes.removeAll();
this.primitive = primitive;
this.createPrimitive = false;
} else if (defined(primitive) && primitive.ready) {
Expand All @@ -102,11 +123,11 @@ define([
}
var updatersWithAttributes = this.updatersWithAttributes.values;
var length = updatersWithAttributes.length;
for (var i = 0; i < length; i++) {
for (i = 0; i < length; i++) {
var updater = updatersWithAttributes[i];
var instance = this.geometry.get(updater.entity.id);

var attributes = this.attributes.get(instance.id.id);
attributes = this.attributes.get(instance.id.id);
if (!defined(attributes)) {
attributes = primitive.getGeometryInstanceAttributes(instance.id);
this.attributes.set(instance.id.id, attributes);
Expand Down
28 changes: 25 additions & 3 deletions Source/DataSources/StaticGeometryPerMaterialBatch.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ define([
var primitive = this.primitive;
var primitives = this.primitives;
var geometries = this.geometry.values;
var attributes;
var i;

if (this.createPrimitive) {
if (defined(primitive)) {
if (!defined(this.oldPrimitive)) {
Expand All @@ -97,7 +100,24 @@ define([
primitives.remove(primitive);
}
}
if (geometries.length > 0) {

var geometriesLength = geometries.length;
if (geometriesLength > 0) {
for (i = 0; i < geometriesLength; i++) {
var geometry = geometries[i];
var originalAttributes = geometry.attributes;
attributes = this.attributes.get(geometry.id.id);

if (defined(attributes)) {
if (defined(originalAttributes.show)) {
originalAttributes.show.value = attributes.show;
}
if (defined(originalAttributes.color)) {
originalAttributes.color.value = attributes.color;
}
}
}

this.material = MaterialProperty.getValue(time, this.materialProperty, this.material);
primitive = new Primitive({
asynchronous : true,
Expand All @@ -112,6 +132,8 @@ define([
primitives.add(primitive);
isUpdated = false;
}

this.attributes.removeAll();
this.primitive = primitive;
this.createPrimitive = false;
} else if (defined(primitive) && primitive.ready) {
Expand All @@ -125,12 +147,12 @@ define([

var updatersWithAttributes = this.updatersWithAttributes.values;
var length = updatersWithAttributes.length;
for (var i = 0; i < length; i++) {
for (i = 0; i < length; i++) {
var updater = updatersWithAttributes[i];
var entity = updater.entity;
var instance = this.geometry.get(entity.id);

var attributes = this.attributes.get(instance.id.id);
attributes = this.attributes.get(instance.id.id);
if (!defined(attributes)) {
attributes = primitive.getGeometryInstanceAttributes(instance.id);
this.attributes.set(instance.id.id, attributes);
Expand Down
32 changes: 26 additions & 6 deletions Source/DataSources/StaticOutlineGeometryBatch.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,20 +71,38 @@ define([
var removedCount = 0;
var primitive = this.primitive;
var primitives = this.primitives;
var attributes;
var i;

if (this.createPrimitive) {
this.attributes.removeAll();
if (defined(primitive)) {
if (!defined(this.oldPrimitive)) {
this.oldPrimitive = primitive;
} else {
primitives.remove(primitive);
}
}
var geometry = this.geometry.values;
if (geometry.length > 0) {
var geometries = this.geometry.values;
var geometriesLength = geometries.length;
if (geometriesLength > 0) {
for (i = 0; i < geometriesLength; i++) {
var geometryItem = geometries[i];
var originalAttributes = geometryItem.attributes;
attributes = this.attributes.get(geometryItem.id.id);

if (defined(attributes)) {
if (defined(originalAttributes.show)) {
originalAttributes.show.value = attributes.show;
}
if (defined(originalAttributes.color)) {
originalAttributes.color.value = attributes.color;
}
}
}

primitive = new Primitive({
asynchronous : true,
geometryInstances : geometry,
geometryInstances : geometries,
appearance : new PerInstanceColorAppearance({
flat : true,
translucent : this.translucent,
Expand All @@ -97,6 +115,8 @@ define([
primitives.add(primitive);
isUpdated = false;
}

this.attributes.removeAll();
this.primitive = primitive;
this.createPrimitive = false;
} else if (defined(primitive) && primitive.ready) {
Expand All @@ -107,11 +127,11 @@ define([

var updatersWithAttributes = this.updatersWithAttributes.values;
var length = updatersWithAttributes.length;
for (var i = 0; i < length; i++) {
for (i = 0; i < length; i++) {
var updater = updatersWithAttributes[i];
var instance = this.geometry.get(updater.entity.id);

var attributes = this.attributes.get(instance.id.id);
attributes = this.attributes.get(instance.id.id);
if (!defined(attributes)) {
attributes = primitive.getGeometryInstanceAttributes(instance.id);
this.attributes.set(instance.id.id, attributes);
Expand Down
4 changes: 2 additions & 2 deletions Source/DataSources/WallGeometryUpdater.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ define([
var attributes;

var color;
var show = new ShowGeometryInstanceAttribute(isAvailable && this._showProperty.getValue(time) && this._fillProperty.getValue(time));
var show = new ShowGeometryInstanceAttribute(isAvailable && entity.isShowing && this._showProperty.getValue(time) && this._fillProperty.getValue(time));
if (this._materialProperty instanceof ColorMaterialProperty) {
var currentColor = Color.WHITE;
if (defined(this._materialProperty.color) && (this._materialProperty.color.isConstant || isAvailable)) {
Expand Down Expand Up @@ -360,7 +360,7 @@ define([
id : entity,
geometry : new WallOutlineGeometry(this._options),
attributes : {
show : new ShowGeometryInstanceAttribute(isAvailable && this._showProperty.getValue(time) && this._showOutlineProperty.getValue(time)),
show : new ShowGeometryInstanceAttribute(isAvailable && entity.isShowing && this._showProperty.getValue(time) && this._showOutlineProperty.getValue(time)),
color : ColorGeometryInstanceAttribute.fromColor(outlineColor)
}
});
Expand Down
Loading