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

Model caching fix #7796

Merged
merged 2 commits into from
May 1, 2019
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 @@ -25,6 +25,7 @@ Change Log
* Added `CesiumMath.normalize` to convert a scalar value in an arbitrary range to a scalar in the range [0.0, 1.0]. [#7774](https://github.com/AnalyticalGraphicsInc/cesium/pull/7774)

##### Fixes :wrench:
* Fixed an error when loading the same glTF model in two separate viewers. [#7688](https://github.com/AnalyticalGraphicsInc/cesium/issues/7688)
* Fixed an error where `clampToHeightMostDetailed` or `sampleHeightMostDetailed` would crash if entities were created when the promise resolved. [#7690](https://github.com/AnalyticalGraphicsInc/cesium/pull/7690)
* Fixed an issue with compositing merged entity availability. [#7717](https://github.com/AnalyticalGraphicsInc/cesium/issues/7717)
* Fixed an error where many imagery layers within a single tile would cause parts of the tile to render as black on some platforms. [#7649](https://github.com/AnalyticalGraphicsInc/cesium/issues/7649)
Expand Down
7 changes: 1 addition & 6 deletions Source/Scene/Model.js
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,6 @@ define([
this._rtcCenter3D = undefined; // in world coordinates
this._rtcCenter2D = undefined; // in projected world coordinates

this._keepPipelineExtras = options.keepPipelineExtras; // keep the buffers in memory for use in other applications
this._sourceVersion = undefined;
this._sourceKHRTechniquesWebGL = undefined;

Expand Down Expand Up @@ -4438,7 +4437,7 @@ define([
ModelUtility.updateForwardAxis(this);

// glTF pipeline updates, not needed if loading from cache
if (!this._loadRendererResourcesFromCache) {
if (!defined(this.gltf.extras.sourceVersion)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this the lighting issue fix? Are you using sourceVersion as a way to know if this gltf object has already gone through this code-path so it doesn't go through when it's loaded in other viewers?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, exactly.

var gltf = this.gltf;
// Add the original version so it remains cached
gltf.extras.sourceVersion = ModelUtility.getAssetVersion(gltf);
Expand Down Expand Up @@ -4517,10 +4516,6 @@ define([
}

if (loadResources.finished()) {
if (!this._keepPipelineExtras) {
removePipelineExtras(this.gltf);
}

this._loadResources = undefined; // Clear CPU memory since WebGL resources were created.

var resources = this._rendererResources;
Expand Down