| 1 | # PySoy's models.Camera class |
|---|
| 2 | # |
|---|
| 3 | # Copyright (C) 2006,2007,2008 PySoy Group |
|---|
| 4 | # |
|---|
| 5 | # This program is free software; you can redistribute it and/or modify |
|---|
| 6 | # it under the terms of the GNU Affero General Public License as published |
|---|
| 7 | # by the Free Software Foundation, either version 3 of the License, or |
|---|
| 8 | # (at your option) any later version. |
|---|
| 9 | # |
|---|
| 10 | # This program is distributed in the hope that it will be useful, |
|---|
| 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 13 | # GNU Affero General Public License for more details. |
|---|
| 14 | # |
|---|
| 15 | # You should have received a copy of the GNU Affero General Public License |
|---|
| 16 | # along with this program; if not, see http://www.gnu.org/licenses |
|---|
| 17 | # |
|---|
| 18 | # $Id: Camera.pxi 1191 2008-03-20 09:06:53Z ArcRiley $ |
|---|
| 19 | |
|---|
| 20 | cdef class Camera(Mesh) : |
|---|
| 21 | '''soy.models.Camera |
|---|
| 22 | |
|---|
| 23 | This class renders a "camera", intended for debugging purposes. |
|---|
| 24 | ''' |
|---|
| 25 | |
|---|
| 26 | |
|---|
| 27 | ############################################################################ |
|---|
| 28 | # |
|---|
| 29 | # WindowLoop Functions |
|---|
| 30 | # |
|---|
| 31 | |
|---|
| 32 | cdef void _render(self, void* _body) : |
|---|
| 33 | gl.glPushMatrix() |
|---|
| 34 | gl.glScalef(0.1,0.1,0.1) |
|---|
| 35 | gl.glDisable(gl.GL_CULL_FACE) |
|---|
| 36 | gl.glDisable(gl.GL_DEPTH_TEST) |
|---|
| 37 | gl.glDisable(gl.GL_LIGHTING) |
|---|
| 38 | gl.glColor3f(0.5,0.5,0.5) |
|---|
| 39 | gl.glBegin(gl.GL_LINE_STRIP) |
|---|
| 40 | gl.glVertex3f(-1,1.,1.) |
|---|
| 41 | gl.glVertex3f(1,1.,1.) |
|---|
| 42 | gl.glVertex3f(1,-1.,1.) |
|---|
| 43 | gl.glVertex3f(-1,-1.,1.) |
|---|
| 44 | gl.glEnd() |
|---|
| 45 | gl.glColor3f(0.5,0.5,0.5) |
|---|
| 46 | gl.glBegin(gl.GL_LINES) |
|---|
| 47 | gl.glVertex3f(-1,1.,1.) |
|---|
| 48 | gl.glVertex3f(0,0,0) |
|---|
| 49 | gl.glVertex3f(1,1.,1.) |
|---|
| 50 | gl.glVertex3f(0,0,0) |
|---|
| 51 | gl.glVertex3f(-1,-1.,1.) |
|---|
| 52 | gl.glVertex3f(0,0,0) |
|---|
| 53 | gl.glVertex3f(1,-1.,1.) |
|---|
| 54 | gl.glVertex3f(0,0,0) |
|---|
| 55 | gl.glVertex3f(-1,-1.,1.) |
|---|
| 56 | gl.glVertex3f(-1,1.,1.) |
|---|
| 57 | gl.glEnd() |
|---|
| 58 | gl.glEnable(gl.GL_LIGHTING) |
|---|
| 59 | gl.glEnable(gl.GL_DEPTH_TEST) |
|---|
| 60 | gl.glEnable(gl.GL_CULL_FACE) |
|---|
| 61 | gl.glPopMatrix() |
|---|