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

Fix for model coloring #4798

Merged
merged 8 commits into from
Jan 6, 2017
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 @@ -12,6 +12,7 @@ Change Log
* Updated the morph so the default view in Columbus View is now angled. [#3878](https://github.com/AnalyticalGraphicsInc/cesium/issues/3878)
* Fixed sky atmosphere from causing incorrect picking and hanging drill picking. [#4783](https://github.com/AnalyticalGraphicsInc/cesium/issues/4783) and [#4784](https://github.com/AnalyticalGraphicsInc/cesium/issues/4784)
* Fixed a bug that could cause a "readyImagery is not actually ready" exception when quickly zooming past the maximum available imagery level of an imagery layer near the poles.
* Fixed a bug that caused all models to use the same highlight color. [#4798] (https://github.com/AnalyticalGraphicsInc/cesium/pull/4798)

### 1.29 - 2017-01-02
* Improved 3D Models
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,4 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to Cesiu
* [Abhishek Potnis](https://github.com/abhishekvp)
* [Brad Hover](https://github.com/tekhaus)
* [Hüseyin Ateş](https://github.com/ateshuseyin)
* [Zsolt Simon](https://github.com/szsolt)
7 changes: 3 additions & 4 deletions Source/DataSources/ModelVisualizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ define([
var defaultColorBlendMode = ColorBlendMode.HIGHLIGHT;
var defaultColorBlendAmount = 0.5;

var color = new Color();
var modelMatrixScratch = new Matrix4();
var nodeMatrixScratch = new Matrix4();

Expand Down Expand Up @@ -149,9 +148,9 @@ define([
model.shadows = Property.getValueOrDefault(modelGraphics._shadows, time, defaultShadows);
model.heightReference = Property.getValueOrDefault(modelGraphics._heightReference, time, defaultHeightReference);
model.distanceDisplayCondition = Property.getValueOrUndefined(modelGraphics._distanceDisplayCondition, time);
model.silhouetteColor = Property.getValueOrDefault(modelGraphics.silhouetteColor, time, defaultSilhouetteColor);
model.silhouetteSize = Property.getValueOrDefault(modelGraphics.silhouetteSize, time, defaultSilhouetteSize);
model.color = Property.getValueOrDefault(modelGraphics._color, time, defaultColor, color);
model.silhouetteColor = Property.getValueOrDefault(modelGraphics._silhouetteColor, time, defaultSilhouetteColor, model._silhouetteColor);
model.silhouetteSize = Property.getValueOrDefault(modelGraphics._silhouetteSize, time, defaultSilhouetteSize);
model.color = Property.getValueOrDefault(modelGraphics._color, time, defaultColor, model._color);
model.colorBlendMode = Property.getValueOrDefault(modelGraphics._colorBlendMode, time, defaultColorBlendMode);
model.colorBlendAmount = Property.getValueOrDefault(modelGraphics._colorBlendAmount, time, defaultColorBlendAmount);

Expand Down
10 changes: 6 additions & 4 deletions Source/Scene/Model.js
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,7 @@ define([
*/
this.silhouetteColor = defaultValue(options.silhouetteColor, Color.RED);
this._silhouetteColor = new Color();
this._silhouetteColorPreviousAlpha = 1.0;
this._normalAttributeName = undefined;

/**
Expand Down Expand Up @@ -556,6 +557,7 @@ define([
*/
this.color = defaultValue(options.color, Color.WHITE);
this._color = new Color();
this._colorPreviousAlpha = 1.0;

/**
* Defines how the color blends with the model.
Expand Down Expand Up @@ -3800,12 +3802,12 @@ define([
}

var nodeCommands = model._nodeCommands;
var dirty = alphaDirty(model.color.alpha, model._color.alpha) ||
alphaDirty(model.silhouetteColor.alpha, model._silhouetteColor.alpha) ||
var dirty = alphaDirty(model.color.alpha, model._colorPreviousAlpha) ||
alphaDirty(model.silhouetteColor.alpha, model._silhouetteColorPreviousAlpha) ||
!defined(nodeCommands[0].silhouetteModelCommand);

Color.clone(model.color, model._color);
Color.clone(model.silhouetteColor, model._silhouetteColor);
model._colorPreviousAlpha = model.color.alpha;
model._silhouetteColorPreviousAlpha = model.silhouetteColor.alpha;

if (dirty) {
createSilhouetteCommands(model, frameState);
Expand Down