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

Primitive picking #1524

Merged
merged 6 commits into from
Mar 4, 2014
Merged
Show file tree
Hide file tree
Changes from 3 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
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ Change Log
Beta Releases
-------------

### b27 - 2014-04-01

* Breaking changes:
* ...
* Fixed Primitive picking that have a closed appearance drawn on the surface. [#1333](https://github.com/AnalyticalGraphicsInc/cesium/issues/1333)

### b26 - 2014-03-03

* Breaking changes:
Expand Down
10 changes: 7 additions & 3 deletions Source/Scene/Primitive.js
Original file line number Diff line number Diff line change
Expand Up @@ -780,12 +780,16 @@ define([
this._backFaceRS = this._frontFaceRS;
}

var pickRS;
if (allowPicking) {
// Only need backface pass for picking when two-pass rendering is used.
this._pickRS = this._backFaceRS;
pickRS = clone(renderState, false);
Copy link
Contributor

Choose a reason for hiding this comment

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

It was probably my idea, but another problem with the old approach is that if another object occluded the backfaces but not the front, this object would not get picked (or picked first with drill picking).

pickRS.cull = {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm still not sure that we should do this. This is just to workaround a user-error, right? Why not just render the pick pass the same as the color pass, but with the standard pick states set?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is just to workaround a user-error, right?

Yes.

Why not just render the pick pass the same as the color pass, but with the standard pick states set?

I thought about it, but culling is disabled to only write depth (maybe) when allowPicking is false. I think the only time this would give incorrect results would be when the camera is inside closed opaque geometry. Should both be the same as the color pass?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not following you. If the object is closed and we go inside, it will not be shown in the color pass and should not be pickable in the depth pass.

I'm still having trouble understanding why we can't just render the pick pass the same way we render the color pass but with the standard pick state changes.

enabled : false
};
this._pickRS = context.createRenderState(pickRS);
} else {
// Still occlude if not pickable.
var pickRS = clone(renderState, false);
pickRS = clone(renderState, false);
pickRS.colorMask = {
red : false,
green : false,
Expand Down