Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upImplement 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"); | |||
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Manishearth
Apr 3, 2020
Author
Member
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
| @@ -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 | |||
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Manishearth
Apr 3, 2020
Author
Member
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
This comment has been minimized.
This comment has been minimized.
jdm
Apr 3, 2020
Member
Ok, but look at the lines following the line that I commented on. I think you copied a comment from another file.
This comment has been minimized.
This comment has been minimized.
| for region in &world.regions { | ||
| if source.types.is_type(region.ty) { |
This comment has been minimized.
This comment has been minimized.
jdm
Apr 3, 2020
Member
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
|
(this is ready for final review, but we should only merge this once the servo side (servo/servo#26171) lands) |
|
Some niggles. |
| pub point: bool, | ||
| pub plane: bool, | ||
| pub mesh: bool, | ||
| } |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Manishearth
Apr 15, 2020
Author
Member
you mean bitflags? I suppose, this seemed to be pretty small.
This comment has been minimized.
This comment has been minimized.
Manishearth
Apr 16, 2020
Author
Member
Chose to not do this, the code is about as complicated either way.
| frame.hit_test_results.extend(hits); | ||
| } | ||
| } | ||
|
|
This comment has been minimized.
This comment has been minimized.
asajeffrey
Apr 15, 2020
Member
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?
This comment has been minimized.
This comment has been minimized.
Manishearth
Apr 15, 2020
Author
Member
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 |
|
|
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
|
|
|
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
Manishearth commentedApr 3, 2020
•
edited
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