-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Async pick/sample functions don't work with explicit rendering #8281
Comments
@richard-ling that seems like a good fix. I'll open a PR shortly.
Can you open a separate issue for this? It does sound like a useful feature. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Async functions
Scene.prototype.sampleHeightMostDetailed()
andScene.prototype.clampToHeightMostDetailed()
do not play nice with explicit rendering. The way these functions work is:create a promise for each point to be sampled, which resolves when all high-detail tiles needed for sampling that point have been loaded.
create a promise which resolves when all promises created at step 1 resolve.
pass the promise from step 2 to
deferPromiseUntilPostRender()
, which returns a new promise that resolves during the next post-render event after the promise from step 2 has resolved. This prevents the risk of modifying primitives during render callback (see https://git.patrocinium.com/pub/cesium/commit/502f34abebb4ffb06dfc1671db0983c52fdffe70)The return value is the promise created at step 3.
If an app that is using explicit rendering calls
sampleHeightMostDetailed()
, and waits for the returned promise without explicitly callingscene.requestRender()
, the promise won't resolve, because there are no post-render events. This means the app may seem non-responsive to the user.The app can't easily schedule a render using calling
scene.requestRender()
, because there's no way to know when the promise from step 2 resolved. The solution that worked for me is to modify deferPromiseUntilPostRender() to call scene.requestRender() when promise 2 resolves:Incidentally, it would also be very desirable for an app to be able to cancel pending calls to the async pick/sample functions when they are no longer needed. I'm doing it by setting
scene._mostDetailedRayPicks = []
, because I know I'm the only user of that array, but that wouldn't work in a more complex app.Browser: Chrome
Operating System: MacOS 10.14.6
No time to do a sandcastle, sorry.
The text was updated successfully, but these errors were encountered: