mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Add XRHitTestResult::getPose
This commit is contained in:
parent
c7b91523d0
commit
87bce8cde9
4 changed files with 31 additions and 9 deletions
|
@ -55,12 +55,18 @@ impl XRRay {
|
|||
return Err(Error::Type("Direction w coordinate must be 0".into()));
|
||||
}
|
||||
if *direction.x == 0.0 && *direction.y == 0.0 && *direction.z == 0.0 {
|
||||
return Err(Error::Type("Direction vector cannot have zero length".into()));
|
||||
return Err(Error::Type(
|
||||
"Direction vector cannot have zero length".into(),
|
||||
));
|
||||
}
|
||||
|
||||
let origin = Vector3D::new(origin.x as f32, origin.y as f32, origin.z as f32);
|
||||
let direction =
|
||||
Vector3D::new(*direction.x as f32, *direction.y as f32, *direction.z as f32).normalize();
|
||||
let direction = Vector3D::new(
|
||||
*direction.x as f32,
|
||||
*direction.y as f32,
|
||||
*direction.z as f32,
|
||||
)
|
||||
.normalize();
|
||||
|
||||
Ok(Self::new(&window.global(), Ray { origin, direction }))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue