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

Update orthographic projection width #5108

Merged
merged 2 commits into from
Mar 17, 2017
Merged

Update orthographic projection width #5108

merged 2 commits into from
Mar 17, 2017

Conversation

bagnell
Copy link
Contributor

@bagnell bagnell commented Mar 15, 2017

Update frustum width by picking the depth buffer. Previously, the width was set by the distance to the globe. This would cause clipping large building models.

if (defined(rayIntersection)) {

if (scene.pickPositionSupported) {
depthIntersection = scene.pickPositionWorldCoordinates(mousePosition, scratchDepthIntersection);
Copy link
Contributor

Choose a reason for hiding this comment

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

Just wondering, are there other areas that commonly call pickPosition? Caching based on the window coordinates per-frame might not be a bad idea.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a good idea. We could even take it further and cache it for a few frames or more depending on the frame rate, but that's not something I want to explore here.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, I'll open an issue so we can think about it more.

if (defined(rayIntersection) && defined(depthIntersection)) {
var depthDistance = defined(depthIntersection) ? Cartesian3.distance(depthIntersection, this.positionWC) : Number.POSITIVE_INFINITY;
var rayDistance = defined(rayIntersection) ? Cartesian3.distance(rayIntersection, this.positionWC) : Number.POSITIVE_INFINITY;
this.frustum.width = depthDistance < rayDistance ? depthDistance : rayDistance;
Copy link
Contributor

Choose a reason for hiding this comment

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

Math.min?

@bagnell
Copy link
Contributor Author

bagnell commented Mar 17, 2017

@lilleyse This is ready.

@lilleyse lilleyse merged commit c325720 into master Mar 17, 2017
@lilleyse lilleyse deleted the ortho-update branch March 17, 2017 21:57
@pjcozzi pjcozzi mentioned this pull request Mar 19, 2017
53 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants