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 call to ApproximateTerrainHeights.initialize from GroundPolylinePrimitive #6715

Closed
wants to merge 1 commit into from
Closed
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
2 changes: 1 addition & 1 deletion Source/Scene/GroundPolylinePrimitive.js
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ define([
return initPromise;
}

GroundPolylinePrimitive._initPromise = ApproximateTerrainHeights.initialize('../Assets/approximateTerrainHeights.json')
GroundPolylinePrimitive._initPromise = ApproximateTerrainHeights.initialize()
Copy link
Contributor

Choose a reason for hiding this comment

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

@hpinkos this seems to cause the JSON load to fail for local hosted and unproxied (?) apps. I'm getting a runtime error for the deployed Sandcastle demos:
http://cesium-dev.s3-website-us-east-1.amazonaws.com/cesium/fix-approx-heights/Apps/Sandcastle/index.html?src=Polyline.html

Is there a good way to test this with a proxy?

Copy link
Contributor

Choose a reason for hiding this comment

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

ApproximateTerrainHeights.initialize needs to use buildModuleUrl like everything else, never load a Cesium required asset without it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I mean, this is what GroundPrimitive does already so this should be the right thing to do. I don't know where that runtime error is coming from. I'll see if I can figure it out.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mramato ApproximateTerrainHeights.initialize does use buildModuleUrl

Copy link
Contributor Author

@hpinkos hpinkos Jun 21, 2018

Choose a reason for hiding this comment

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

Ah okay, I this is happening because ApproximateTerrainHeights is being used by GroundPolylinePrimitive in a webworker

Copy link
Contributor

Choose a reason for hiding this comment

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

sorry about this >__<

Copy link
Contributor

Choose a reason for hiding this comment

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

Probably no one has ever tried to use buildModuleUrl from a worker, which is pretty unusual. I suspect an easier path would be to load the terrain height data in the main thread and send the data across, rather than trying to re-load it independently in the worker.

Copy link
Contributor

Choose a reason for hiding this comment

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

Alternatively you could compute the full absolute url and send that across to the worker.

.then(function() {
GroundPolylinePrimitive._initialized = true;
});
Expand Down