source: src/models/Axis.pym @ 1309:54e8b7ad3663

Revision 1309:54e8b7ad3663, 3.2 KB checked in by Arc Riley <arcriley@…>, 6 years ago (diff)

More docs work.

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 1355 2008-09-08 08:24:34Z ArcRiley $
19
20cdef class Axis (Model) :
21  '''soy.models.Axis
22
23    This L{models class<soy.models>} renders a "XYZ axis" oriented to each
24    body it's attached to.  This is useful for debugging.
25  '''
26
27
28  ############################################################################
29  #
30  # WindowLoop Functions
31  #
32
33  cdef void _render(self, soy.bodies.Body _body) :
34    #
35    # This should be upgraded to use VBO.  Test for buffer ID here.
36    #
37    gl.glPushMatrix()
38    gl.glDisable(gl.GL_CULL_FACE)
39    gl.glDisable(gl.GL_DEPTH_TEST)
40    gl.glDisable(gl.GL_LIGHTING)
41    gl.glColor3f(1.,0.,0.)
42    gl.glBegin(gl.GL_LINES)
43    gl.glColor3f(1.,0.,0.)
44    gl.glVertex3f(0.,0.,0.)
45    gl.glVertex3f(1.,0.,0.)
46    gl.glVertex3f(1.,0.,0.)
47    gl.glVertex3f(1.,0.3,0.)
48    gl.glVertex3f(1.,0.3,0.)
49    gl.glVertex3f(1.3,0,0.)
50    gl.glVertex3f(1.3,0,0.)
51    gl.glVertex3f(1,-0.3,0.)
52    gl.glVertex3f(1,-0.3,0.)
53    gl.glVertex3f(1,0,0.)
54    gl.glColor3f(0.,1.,0.)
55    gl.glVertex3f(0.,0.,0.)
56    gl.glVertex3f(0.,1.,0.)
57    gl.glVertex3f(0.,1.,0.)
58    gl.glVertex3f(0.3,1.,0.)
59    gl.glVertex3f(0.3,1.,0.)
60    gl.glVertex3f(0.0,1.3,0.)
61    gl.glVertex3f(0.0,1.3,0.)
62    gl.glVertex3f(-0.3,1.0,0.)
63    gl.glVertex3f(-0.3,1.0,0.)
64    gl.glVertex3f(0.,1.0,0.)
65    gl.glColor3f(0.,0.,1.)
66    gl.glVertex3f(0.,0.,0.)
67    gl.glVertex3f(0.,0.,1.)
68    gl.glVertex3f(0.,0.,1.)
69    gl.glVertex3f(0.3,0.,1.)
70    gl.glVertex3f(0.3,0.,1.)
71    gl.glVertex3f(0.0,0.,1.3)
72    gl.glVertex3f(0.0,0.,1.3)
73    gl.glVertex3f(-0.3,0.,1.0)
74    gl.glVertex3f(-0.3,0.,1.0)
75    gl.glVertex3f(0.0,0.,1.0)
76    gl.glEnd()
77    gl.glBegin(gl.GL_LINE_STRIP)
78    gl.glColor3f(0.,0.,1.)
79    gl.glVertex3f(-0.2,0,1.35)#
80    gl.glVertex3f(0.2,0.,1.35)
81    gl.glVertex3f(-0.2,0.,1.75) # Z TAG
82    gl.glVertex3f(0.2,0.,1.75) #
83    gl.glEnd()
84    gl.glBegin(gl.GL_LINE_STRIP)
85    gl.glColor3f(0.,1.,0)
86    gl.glVertex3f(0.0,1.35,0)#
87    gl.glVertex3f(0.0,1.5,0) # Y TAG
88    gl.glVertex3f(0.2,1.7,0) #
89    gl.glVertex3f(0.0,1.5,0)
90    gl.glVertex3f(-0.2,1.7,0)
91    gl.glEnd()
92    gl.glBegin(gl.GL_LINES)
93    gl.glColor3f(1.,0.,0.)
94    gl.glVertex3f(1.35,0.2,0)#
95    gl.glVertex3f(1.75,-0.2,0) # X TAG
96    gl.glVertex3f(1.35,-0.2,0) #
97    gl.glVertex3f(1.75,0.2,0)
98    gl.glEnd()
99    gl.glEnable(gl.GL_LIGHTING)
100    gl.glEnable(gl.GL_DEPTH_TEST)
101    gl.glEnable(gl.GL_CULL_FACE)
102    gl.glPopMatrix()
Note: See TracBrowser for help on using the repository browser.