source: src/models/Axis.pym @ 1182:9b46968aa773

Revision 1182:9b46968aa773, 3.0 KB checked in by Jon Neal <reportingsjr@…>, 7 years ago (diff)

Ticket #954 :

  • Migrated soy.bodies to PyMill
  • Migrated soy.models to PyMill
Line 
1# PySoy's models.Axis 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: Axis.pym 1228 2008-04-04 06:12:51Z JonNeal $
19
20cdef class Axis (Model) :
21  '''soy.models.Axis
22
23    This models class renders an XYZ axis at the center of bodies.
24  '''
25
26
27  ############################################################################
28  #
29  # WindowLoop Functions
30  #
31
32  cdef void _render(self, void* _body) :
33    gl.glPushMatrix()
34    gl.glDisable(gl.GL_CULL_FACE)
35    gl.glDisable(gl.GL_DEPTH_TEST)
36    gl.glDisable(gl.GL_LIGHTING)
37    gl.glColor3f(1.,0.,0.)
38    gl.glBegin(gl.GL_LINES)
39    gl.glColor3f(1.,0.,0.)
40    gl.glVertex3f(0.,0.,0.)
41    gl.glVertex3f(1.,0.,0.)
42    gl.glVertex3f(1.,0.,0.)
43    gl.glVertex3f(1.,0.3,0.)
44    gl.glVertex3f(1.,0.3,0.)
45    gl.glVertex3f(1.3,0,0.)
46    gl.glVertex3f(1.3,0,0.)
47    gl.glVertex3f(1,-0.3,0.)
48    gl.glVertex3f(1,-0.3,0.)
49    gl.glVertex3f(1,0,0.)
50    gl.glColor3f(0.,1.,0.)
51    gl.glVertex3f(0.,0.,0.)
52    gl.glVertex3f(0.,1.,0.)
53    gl.glVertex3f(0.,1.,0.)
54    gl.glVertex3f(0.3,1.,0.)
55    gl.glVertex3f(0.3,1.,0.)
56    gl.glVertex3f(0.0,1.3,0.)
57    gl.glVertex3f(0.0,1.3,0.)
58    gl.glVertex3f(-0.3,1.0,0.)
59    gl.glVertex3f(-0.3,1.0,0.)
60    gl.glVertex3f(0.,1.0,0.)
61    gl.glColor3f(0.,0.,1.)
62    gl.glVertex3f(0.,0.,0.)
63    gl.glVertex3f(0.,0.,1.)
64    gl.glVertex3f(0.,0.,1.)
65    gl.glVertex3f(0.3,0.,1.)
66    gl.glVertex3f(0.3,0.,1.)
67    gl.glVertex3f(0.0,0.,1.3)
68    gl.glVertex3f(0.0,0.,1.3)
69    gl.glVertex3f(-0.3,0.,1.0)
70    gl.glVertex3f(-0.3,0.,1.0)
71    gl.glVertex3f(0.0,0.,1.0)
72    gl.glEnd()
73    gl.glBegin(gl.GL_LINE_STRIP)
74    gl.glColor3f(0.,0.,1.)
75    gl.glVertex3f(-0.2,0,1.35)#
76    gl.glVertex3f(0.2,0.,1.35)
77    gl.glVertex3f(-0.2,0.,1.75) # Z TAG
78    gl.glVertex3f(0.2,0.,1.75) #
79    gl.glEnd()
80    gl.glBegin(gl.GL_LINE_STRIP)
81    gl.glColor3f(0.,1.,0)
82    gl.glVertex3f(0.0,1.35,0)#
83    gl.glVertex3f(0.0,1.5,0) # Y TAG
84    gl.glVertex3f(0.2,1.7,0) #
85    gl.glVertex3f(0.0,1.5,0)
86    gl.glVertex3f(-0.2,1.7,0)
87    gl.glEnd()
88    gl.glBegin(gl.GL_LINES)
89    gl.glColor3f(1.,0.,0.)
90    gl.glVertex3f(1.35,0.2,0)#
91    gl.glVertex3f(1.75,-0.2,0) # X TAG
92    gl.glVertex3f(1.35,-0.2,0) #
93    gl.glVertex3f(1.75,0.2,0)
94    gl.glEnd()
95    gl.glEnable(gl.GL_LIGHTING)
96    gl.glEnable(gl.GL_DEPTH_TEST)
97    gl.glEnable(gl.GL_CULL_FACE)
98    gl.glPopMatrix()
Note: See TracBrowser for help on using the repository browser.