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

Implement support for hit testing, use in mock backend #149

Merged
merged 8 commits into from Apr 19, 2020

Conversation

@Manishearth
Copy link
Member

Manishearth commented Apr 3, 2020

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

@@ -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.

@jdm

jdm Apr 3, 2020

Member

Would a error! be more appropriate? I don't have an opinion on the matter.

This comment has been minimized.

@Manishearth

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.

@jdm

jdm Apr 3, 2020

Member

orly?

This comment has been minimized.

@Manishearth

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.

@jdm

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.

@Manishearth

Manishearth Apr 3, 2020

Author Member

oh oops, GitHub didn't show the context below lol

for region in &world.regions {
if source.types.is_type(region.ty) {
Comment on lines 214 to 215

This comment has been minimized.

@jdm

jdm Apr 3, 2020

Member

Perhaps:

let hits = world
    .regions
    .iter()
    .filter(|region| !source.types.is_type(region.ty))
    .flat_map(|region| &region.faces);
    .filter_map(|triangle| triangle.intersect(ray))
    .map(|space| HitTestResult { space, id: source.id });
frame.hit_test_results.extend(hits);
@Manishearth Manishearth force-pushed the Manishearth:hittest branch from fee5115 to f20702d Apr 7, 2020
@Manishearth Manishearth force-pushed the Manishearth:hittest branch 2 times, most recently from d85f412 to 2ed26d4 Apr 11, 2020
@Manishearth Manishearth marked this pull request as ready for review Apr 11, 2020
@Manishearth Manishearth changed the title [WIP] Implement support for hit testing, use in mock backend Implement support for hit testing, use in mock backend Apr 11, 2020
@Manishearth
Copy link
Member Author

Manishearth commented Apr 13, 2020

(this is ready for final review, but we should only merge this once the servo side (servo/servo#26171) lands)

Copy link
Member

asajeffrey left a comment

Some niggles.

webxr-api/hittest.rs Show resolved Hide resolved
pub point: bool,
pub plane: bool,
pub mesh: bool,
}

This comment has been minimized.

@asajeffrey

asajeffrey Apr 15, 2020

Member

use bitstring for this?

This comment has been minimized.

@Manishearth

Manishearth Apr 15, 2020

Author Member

you mean bitflags? I suppose, this seemed to be pretty small.

This comment has been minimized.

@Manishearth

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.

@asajeffrey

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.

@Manishearth

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.

@Manishearth Manishearth force-pushed the Manishearth:hittest branch from 2ed26d4 to a72aaf8 Apr 16, 2020
@Manishearth
Copy link
Member Author

Manishearth commented Apr 16, 2020

@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

@asajeffrey
Copy link
Member

asajeffrey commented Apr 17, 2020

Yes

@Manishearth Manishearth force-pushed the Manishearth:hittest branch from a72aaf8 to b5a3f97 Apr 19, 2020
@Manishearth
Copy link
Member Author

Manishearth commented Apr 19, 2020

@bors-servo r=asajeffrey

@bors-servo
Copy link
Contributor

bors-servo commented Apr 19, 2020

📌 Commit b5a3f97 has been approved by asajeffrey

bors-servo added a commit that referenced this pull request Apr 19, 2020
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
@bors-servo
Copy link
Contributor

bors-servo commented Apr 19, 2020

Testing commit b5a3f97 with merge ab47b0b...

@bors-servo
Copy link
Contributor

bors-servo commented Apr 19, 2020

💔 Test failed - checks-travis

@Manishearth
Copy link
Member Author

Manishearth commented Apr 19, 2020

Seems like the googlevr backend has been busted on master since the upgrade, cc @asajeffrey

Going to manual merge

@Manishearth Manishearth merged commit 8058115 into servo:master Apr 19, 2020
0 of 3 checks passed
0 of 3 checks passed
Travis CI - Pull Request Build Failed
Details
continuous-integration/travis-ci/pr The Travis CI build failed
Details
homu Test failed
Details
@Manishearth Manishearth deleted the Manishearth:hittest branch Apr 19, 2020
bors-servo added a commit to servo/servo that referenced this pull request Apr 19, 2020
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
bors-servo added a commit to servo/servo that referenced this pull request Apr 20, 2020
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
bors-servo added a commit to servo/servo that referenced this pull request Apr 20, 2020
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.