Commit f744a3e9 authored by sumpfralle's avatar sumpfralle

r652@erker: lars | 2010-02-14 03:15:00 +0100

 improve function name
 remove obsolete code


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@117 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent b9081a81
...@@ -115,7 +115,7 @@ class GLView: ...@@ -115,7 +115,7 @@ class GLView:
GL.glMatrixMode(GL.GL_MODELVIEW) GL.glMatrixMode(GL.GL_MODELVIEW)
GL.glClear(GL.GL_COLOR_BUFFER_BIT|GL.GL_DEPTH_BUFFER_BIT) GL.glClear(GL.GL_COLOR_BUFFER_BIT|GL.GL_DEPTH_BUFFER_BIT)
result = func(self, *args, **kwargs) result = func(self, *args, **kwargs)
self.restore_view_setting() self.position_camera()
self._paint_raw() self._paint_raw()
GL.glMatrixMode(prev_mode) GL.glMatrixMode(prev_mode)
GL.glFlush() GL.glFlush()
...@@ -139,8 +139,10 @@ class GLView: ...@@ -139,8 +139,10 @@ class GLView:
GL.glMaterial(GL.GL_FRONT_AND_BACK, GL.GL_SPECULAR, (0.1, 0.1, 0.1, 1.0)) GL.glMaterial(GL.GL_FRONT_AND_BACK, GL.GL_SPECULAR, (0.1, 0.1, 0.1, 1.0))
GL.glMaterial(GL.GL_FRONT_AND_BACK, GL.GL_SHININESS, (0.5)) GL.glMaterial(GL.GL_FRONT_AND_BACK, GL.GL_SHININESS, (0.5))
GL.glPolygonMode(GL.GL_FRONT_AND_BACK, GL.GL_FILL) GL.glPolygonMode(GL.GL_FRONT_AND_BACK, GL.GL_FILL)
GL.glMatrixMode(GL.GL_MODELVIEW)
GL.glLoadIdentity()
GL.glMatrixMode(GL.GL_PROJECTION) GL.glMatrixMode(GL.GL_PROJECTION)
self.store_view_setting() GL.glLoadIdentity()
def destroy(self, widget=None): def destroy(self, widget=None):
self.area.destroy() self.area.destroy()
...@@ -192,7 +194,7 @@ class GLView: ...@@ -192,7 +194,7 @@ class GLView:
factors_y = (v_up[0], v_up[1], v_up[2]) factors_y = (v_up[0], v_up[1], v_up[2])
# calculate the proportion of each model axis according to the x axis of the screen # calculate the proportion of each model axis according to the x axis of the screen
distv = self.view["distance"] distv = self.view["distance"]
distv = Point(v[0], v[1], v[2]).normalize() distv = Point(distv[0], distv[1], distv[2]).normalize()
factors_x = distv.cross(Point(v_up[0], v_up[1], v_up[2])).normalize() factors_x = distv.cross(Point(v_up[0], v_up[1], v_up[2])).normalize()
factors_x = (factors_x.x, factors_x.y, factors_x.z) factors_x = (factors_x.x, factors_x.y, factors_x.z)
# determine the biggest dimension (x/y/z) for moving the screen's center in relation to this value # determine the biggest dimension (x/y/z) for moving the screen's center in relation to this value
...@@ -217,15 +219,7 @@ class GLView: ...@@ -217,15 +219,7 @@ class GLView:
self._paint_ignore_busy() self._paint_ignore_busy()
self.mouse["timestamp"] = time.time() self.mouse["timestamp"] = time.time()
def store_view_setting(self): def position_camera(self):
prev_mode = GL.glGetDoublev(GL.GL_MATRIX_MODE)
GL.glMatrixMode(GL.GL_PROJECTION)
GL.glPushMatrix()
self.projection_matrix = GL.glGetDoublev(GL.GL_PROJECTION_MATRIX)[:]
GL.glPopMatrix()
GL.glMatrixMode(prev_mode)
def restore_view_setting(self):
prev_mode = GL.glGetDoublev(GL.GL_MATRIX_MODE) prev_mode = GL.glGetDoublev(GL.GL_MATRIX_MODE)
GL.glMatrixMode(GL.GL_PROJECTION) GL.glMatrixMode(GL.GL_PROJECTION)
GL.glLoadIdentity() GL.glLoadIdentity()
...@@ -239,7 +233,7 @@ class GLView: ...@@ -239,7 +233,7 @@ class GLView:
def get_current_projection_matrix(self): def get_current_projection_matrix(self):
GL.glPushMatrix() GL.glPushMatrix()
prev_mode = GL.glGetDoublev(GL.GL_MATRIX_MODE) prev_mode = GL.glGetDoublev(GL.GL_MATRIX_MODE)
self.restore_view_setting() self.position_camera()
GL.glMatrixMode(GL.GL_PROJECTION) GL.glMatrixMode(GL.GL_PROJECTION)
GL.glPushMatrix() GL.glPushMatrix()
result = GL.glGetDoublev(GL.GL_PROJECTION_MATRIX) result = GL.glGetDoublev(GL.GL_PROJECTION_MATRIX)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment