Changeset 704 for trunk/RBRapier/RBRapier/Renderer/View
- Timestamp:
- 09/16/03 16:12:35 (5 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/RBRapier/RBRapier/Renderer/View/Transformations.py
r703 r704 27 27 from RBRapier.Tools import Projections 28 28 from RBRapier.Tools import Quaternion 29 from RBRapier.Tools import RectangleBase29 from RBRapier.Tools import ViewBox 30 30 31 31 from Numeric import transpose 32 32 from OpenGL import GL, GLU 33 34 try: 35 GL.GL_COLOR_MATRIX 36 except AttributeError: 37 GL.GL_COLOR_MATRIX = 0x80B1 33 38 34 39 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ … … 48 53 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 49 54 50 _ModeNameTable = {None:"< None >", GL.GL_MODELVIEW:"Model View", GL.GL_PROJECTION:"Projection", GL.GL_TEXTURE_MATRIX:"Texture", GL.GL_COLOR:"Color"} 55 _ModeNameTable = {None:"< None >", GL.GL_MODELVIEW:"Model View", GL.GL_PROJECTION:"Projection", GL.GL_TEXTURE:"Texture", GL.GL_COLOR:"Color"} 56 _SaveMatrixLookup = { 57 None: GL.GL_MODELVIEW_MATRIX, 58 GL.GL_MODELVIEW: GL.GL_MODELVIEW_MATRIX, 59 GL.GL_PROJECTION: GL.GL_PROJECTION_MATRIX, 60 GL.GL_TEXTURE: GL.GL_TEXTURE_MATRIX, 61 GL.GL_COLOR: GL.GL_COLOR_MATRIX, 62 } 51 63 Mode = None 52 64 Save = 0 … … 67 79 if self.Mode: 68 80 GL.glMatrixMode(self.Mode) 81 if self.Save: 82 self._SaveMatrix() 83 self.GLExecute(context) 84 GL.glMatrixMode(GL.GL_MODELVIEW) 85 elif self.Save: 69 86 self._SaveMatrix() 70 87 self.GLExecute(context) 71 GL.glMatrixMode(GL.GL_MODELVIEW)72 88 else: 73 self._SaveMatrix()74 89 self.GLExecute(context) 75 90 … … 86 101 try: 87 102 GL.glPushMatrix() 88 except GL.GLerror: 89 self._save_matrix = GL.glGetDouble(Gl.GL_MODELVIEW_MATRIX) 103 except GL.GLerror, e: 104 self._save_matrix = GL.glGetDouble(self._SaveMatrixLookup[self.Mode]) 105 #_SaveMatrix = staticmethod(GL.glPushMatrix) 90 106 91 107 def _RestoreMatrix(self): … … 96 112 GL.glLoadMatrixd(oldmatrix) 97 113 del self._save_matrix 114 #_RestoreMatrix = staticmethod(GL.glPopMatrix) 98 115 99 116 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ … … 169 186 pass 170 187 171 class RectangleMappingMatrix(RectangleBase.RectangleMappingMatrix3dh):172 GLExecute = GLExecuteAsMatrix 173 174 class RectangleMappingMatrixMgd(ManagedTransformationMixin, RectangleMappingMatrix):188 class ViewBoxMappingMatrix(ViewBox.ViewBoxMappingMatrix3dh): 189 GLExecute = GLExecuteAsMatrix 190 191 class ViewBoxMappingMatrixMgd(ManagedTransformationMixin, ViewBoxMappingMatrix): 175 192 pass 176 193 trunk/RBRapier/RBRapier/Renderer/View/Viewport.py
r702 r704 25 25 26 26 from OpenGL import GL 27 from RBRapier.Tools import RectangleBase27 from RBRapier.Tools import ViewBox 28 28 from RBRapier.Renderer.AttributeMgr import AttributeChangeElement 29 29 … … 32 32 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 33 33 34 class Viewport( RectangleBase.RectangleBase):34 class Viewport(ViewBox.ViewBox): 35 35 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 36 36 #~ Constants / Variables / Etc. … … 44 44 45 45 def GLExecute(self, context): 46 GL.glViewport(*self.Rectangle) 46 rectangle = map(int, self.GetRectangle()) 47 GL.glViewport(*rectangle) 47 48
