diff --git a/demo3/src/main.rs b/demo3/src/main.rs index 7de28e45..75e4c58b 100644 --- a/demo3/src/main.rs +++ b/demo3/src/main.rs @@ -136,7 +136,9 @@ fn main() { let mut event_handled = false; while !event_handled { - events.push(sdl_event_pump.wait_event()); + if camera_velocity.is_zero() { + events.push(sdl_event_pump.wait_event()); + } for event in sdl_event_pump.poll_iter() { events.push(event); } @@ -178,6 +180,11 @@ fn main() { event_handled = true; } + + // FIXME(pcwalton): This is so ugly! + if !camera_velocity.is_zero() { + event_handled = true; + } } } } diff --git a/geometry/src/point.rs b/geometry/src/point.rs index ae032fc4..8c07003f 100644 --- a/geometry/src/point.rs +++ b/geometry/src/point.rs @@ -238,6 +238,15 @@ impl Point4DF32 { pub fn approx_eq(&self, other: &Point4DF32, epsilon: f32) -> bool { self.0.approx_eq(other.0, epsilon) } + + /// Checks to see whether this *homogeneous* coordinate equals zero. + /// + /// Note that since this treats the coordinate as a homogeneous coordinate, the `w` is ignored. + // TODO(pcwalton): Optimize with SIMD. + #[inline] + pub fn is_zero(self) -> bool { + self.x() == 0.0 && self.y() == 0.0 && self.z() == 0.0 + } } impl Add for Point4DF32 {