-
Notifications
You must be signed in to change notification settings - Fork 23
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
Implement support for hit testing, use in mock backend #149
Conversation
@@ -82,6 +84,14 @@ pub trait DeviceAPI<Surface>: 'static { | |||
} | |||
|
|||
fn granted_features(&self) -> &[String]; | |||
|
|||
fn request_hit_test(&mut self, _source: HitTestSource) { | |||
panic!("This device does not support requesting hit tests"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would a error! be more appropriate? I don't have an opinion on the matter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if this happens it's a bug on our side, it means we either wrote a backend that falsely claimed hit test support, or the script code is not validating features
which reminds me, the mock backend should start reporting that it supports hit testing
webxr-api/hittest.rs
Outdated
@@ -43,6 +45,19 @@ pub struct EntityTypes { | |||
pub mesh: bool, | |||
} | |||
|
|||
#[derive(Copy, Clone, Debug)] | |||
#[cfg_attr(feature = "ipc", derive(serde::Serialize, serde::Deserialize))] | |||
/// Vec<EntityType>, but better |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
orly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's a vec in the spec, but there are only three possible values, and it's easier to store and iterate in this form
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, but look at the lines following the line that I commented on. I think you copied a comment from another file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh oops, GitHub didn't show the context below lol
webxr/headless/mod.rs
Outdated
for region in &world.regions { | ||
if source.types.is_type(region.ty) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps:
let hits = world
.regions
.iter()
.filter(|region| !source.types.is_type(region.ty))
.flat_map(|region| ®ion.faces);
.filter_map(|triangle| triangle.intersect(ray))
.map(|space| HitTestResult { space, id: source.id });
frame.hit_test_results.extend(hits);
d85f412
to
2ed26d4
Compare
(this is ready for final review, but we should only merge this once the servo side (servo/servo#26171) lands) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some niggles.
pub point: bool, | ||
pub plane: bool, | ||
pub mesh: bool, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use bitstring for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you mean bitflags? I suppose, this seemed to be pretty small.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Chose to not do this, the code is about as complicated either way.
frame.hit_test_results.extend(hits); | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hit tests are performed synchronously every frame? For triangles hit-testing is cheap, but is this going to be expensive for other hit tests, e.g. meshes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just the mock backend, we don't care. In openxr we'll mostly be passing it down to the system.
@asajeffrey are you okay with this and the servo PR landing? I have more test changes to make and it would be easier to not build them on top of this |
Yes |
@bors-servo r=asajeffrey |
📌 Commit b5a3f97 has been approved by |
Implement support for hit testing, use in mock backend Servo side: servo/servo#26171 This adds support for all non-transient parts of he [WebXR Hit Test Module](https://immersive-web.github.io/hit-test), including mocking support. This has not yet been hooked up to script and is thus completely untested. r? @jdm
💔 Test failed - checks-travis |
Seems like the googlevr backend has been busted on master since the upgrade, cc @asajeffrey Going to manual merge |
Implement hit testing API Depends on servo/webxr#149 , #26170 This implements non-transient hit tests. The tests that do not pass are due to web-platform-tests/wpt#22898 , web-platform-tests/wpt#22900, web-platform-tests/wpt#22901 , and immersive-web/hit-test#86
Implement hit testing API Depends on servo/webxr#149 , #26170 This implements non-transient hit tests. The tests that do not pass are due to web-platform-tests/wpt#22898 , web-platform-tests/wpt#22900, web-platform-tests/wpt#22901 , and immersive-web/hit-test#86
Implement hit testing API Depends on servo/webxr#149 , #26170 This implements non-transient hit tests. The tests that do not pass are due to web-platform-tests/wpt#22898 , web-platform-tests/wpt#22900, web-platform-tests/wpt#22901 , and immersive-web/hit-test#86
Servo side: servo/servo#26171
This adds support for all non-transient parts of he WebXR Hit Test Module, including mocking support.
This has not yet been hooked up to script and is thus completely untested.
r? @jdm