4 from OpenGL.GL import *
\r
5 from OpenGL.GLU import *
\r
7 from . import baseview
\r
9 class RokuroView(baseview.BaseView):
\r
10 def __init__(self, distance):
\r
11 super(RokuroView, self).__init__()
\r
16 self.distance=distance
\r
23 def onResize(self, w=None, h=None):
\r
24 super(RokuroView, self).onResize(w, h)
\r
25 self.aspect=float(self.w)/float(self.h)
\r
33 def shift(self, dx, dy):
\r
35 self.shiftX+=dx * self.distance * FACTOR
\r
36 self.shiftY+=dy * self.distance * FACTOR
\r
38 def rotate(self, head, pitch):
\r
42 def updateProjection(self):
\r
43 gluPerspective(30, self.aspect, self.n, self.f)
\r
45 def updateView(self):
\r
46 glTranslate(self.shiftX, self.shiftY, -self.distance)
\r
47 glRotate(self.head, 0, 1, 0)
\r
48 glRotate(self.pitch, 1, 0, 0)
\r
50 def onMotion(self, x, y):
\r
53 self.dolly(y-self.y)
\r
55 if self.isMiddelDown:
\r
56 self.shift(x-self.x, self.y-y)
\r
58 if self.isRightDown:
\r
59 self.rotate(x-self.x, y-self.y)
\r
65 def onWheel(self, d):
\r