mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Error on invalid rotation values in XRRigidTransform constructor
This commit is contained in:
parent
0b88c565c5
commit
036b495cb2
1 changed files with 6 additions and 0 deletions
|
@ -77,6 +77,12 @@ impl XRRigidTransform {
|
||||||
orientation.z as f32,
|
orientation.z as f32,
|
||||||
orientation.w as f32,
|
orientation.w as f32,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if !rotate.i.is_finite() {
|
||||||
|
// if quaternion has zero norm, we'll get an infinite or NaN
|
||||||
|
// value for each element. This is preferable to checking for zero.
|
||||||
|
return Err(Error::InvalidState);
|
||||||
|
}
|
||||||
let transform = TypedRigidTransform3D::new(rotate, translate);
|
let transform = TypedRigidTransform3D::new(rotate, translate);
|
||||||
Ok(XRRigidTransform::new(&window.global(), transform))
|
Ok(XRRigidTransform::new(&window.global(), transform))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue