summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Seibert <stan@mtrr.org>2011-09-16 13:25:15 -0400
committerStan Seibert <stan@mtrr.org>2011-09-16 13:25:15 -0400
commit2cf0ffc534e8ea34101603c71fa26fe58355813a (patch)
tree87ddbbda1a662d3afe7a80589a8e140a520cee07
parent1071591b14fbafa21761f73eb80fb8e81dcfdbde (diff)
downloadchroma-2cf0ffc534e8ea34101603c71fa26fe58355813a.tar.gz
chroma-2cf0ffc534e8ea34101603c71fa26fe58355813a.tar.bz2
chroma-2cf0ffc534e8ea34101603c71fa26fe58355813a.zip
Switch to now published spnav module rather than internal copy.
-rwxr-xr-xcamera.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/camera.py b/camera.py
index af48735..470a1b9 100755
--- a/camera.py
+++ b/camera.py
@@ -588,7 +588,7 @@ class Camera(multiprocessing.Process):
if spnav_event is None:
return
- if spnav_event.type == self.spnav_module.SPNAV_EVENT_MOTION:
+ if spnav_event.ev_type == self.spnav_module.SPNAV_EVENT_MOTION:
if pygame.key.get_mods() & (KMOD_LSHIFT | KMOD_RSHIFT):
accelerate_factor = 2.0
else:
@@ -598,14 +598,15 @@ class Camera(multiprocessing.Process):
v2 = self.axis2
v3 = np.cross(self.axis1,self.axis2)
- v = v2*spnav_event.motion.x + v1*spnav_event.motion.y + \
- v3*spnav_event.motion.z
+ x, y, z = spnav_event.translation
+ rx, ry, rz = spnav_event.rotation
+
+ v = v2*x + v1*y + v3*z
v *= self.scale / 5000.0 * accelerate_factor
self.translate(v, redraw=False)
- axis = -v2*spnav_event.motion.rx - v1*spnav_event.motion.ry - \
- v3*spnav_event.motion.rz
+ axis = -v2*rx - v1*ry - v3*rz
if (axis != 0).any():
axis = axis.astype(float)
@@ -621,8 +622,8 @@ class Camera(multiprocessing.Process):
self.update()
pygame.event.clear(pygame.SYSWMEVENT)
- elif spnav_event.type == self.spnav_module.SPNAV_EVENT_BUTTON:
- if spnav_event.button.bnum == 0 and spnav_event.button.press:
+ elif spnav_event.ev_type == self.spnav_module.SPNAV_EVENT_BUTTON:
+ if spnav_event.bnum == 0 and spnav_event.press:
if not hasattr(self, 'rng_states_gpu'):
self.initialize_render()