Author: JonNeal
Date: 2008-04-04 01:50:29 -0400 (Fri, 04 Apr 2008)
New Revision: 1224

Added:
   trunk/pysoy/src/scenes/Landscape.pym
   trunk/pysoy/src/scenes/Planar.pym
   trunk/pysoy/src/scenes/Scene.pym
   trunk/pysoy/src/scenes/Space.pym
   trunk/pysoy/src/scenes/__init__.pym
   trunk/pysoy/src/scenes/_prerunField.pym
   trunk/pysoy/src/scenes/_runField.pym
Removed:
   trunk/pysoy/src/scenes/Landscape.pxi
   trunk/pysoy/src/scenes/Planar.pxi
   trunk/pysoy/src/scenes/Scene.pxi
   trunk/pysoy/src/scenes/Space.pxi
   trunk/pysoy/src/scenes/_prerunField.pxi
   trunk/pysoy/src/scenes/_runField.pxi
Modified:
   trunk/pysoy/src/scenes/soy.scenes.pyx
Log:
Ticket #954 :
  * Migrated soy.scenes to PyMill


Deleted: trunk/pysoy/src/scenes/Landscape.pxi
===================================================================
--- trunk/pysoy/src/scenes/Landscape.pxi        2008-04-04 05:40:07 UTC (rev 
1223)
+++ trunk/pysoy/src/scenes/Landscape.pxi        2008-04-04 05:50:29 UTC (rev 
1224)
@@ -1,68 +0,0 @@
-# PySoy's soy.scenes.Landscape
-#
-# Copyright (C) 2006,2007,2008 PySoy Group
-#
-#  This program is free software; you can redistribute it and/or modify
-#  it under the terms of the GNU Affero General Public License as published
-#  by the Free Software Foundation, either version 3 of the License, or
-#  (at your option) any later version.
-#
-#  This program is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#  GNU Affero General Public License for more details.
-#
-#  You should have received a copy of the GNU Affero General Public License
-#  along with this program; if not, see http://www.gnu.org/licenses
-#
-# $Id$
-
-
-cdef class Landscape (Scene) :
-  ''' Landscape Scene
-
-    This is a scene based on a heightmap.
-    Accepts a heightmap and the width, depth, and heigth of it.
-  '''
-
-  ############################################################################
-  #
-  # Python functions
-  #
-
-  def __cinit__(self, heightmap, scale, width=1024, depth=1024, *args, **kw) :
-    if not isinstance(soy.textures.Texture, heightmap) or heightmap._chans != 
1 :
-      raise TypeError('heightmap must be of type soy.textures.Texture and 1 
channel.')
-    self._width = width
-    self._depth = depth
-    self._heightmapID = ode.dGeomHeightfieldDataCreate()
-    ode.dGeomHeightfieldDataBuildByte(self._heightmapID,
-                                      <unsigned char*> heightmap._texels, 0,
-                                      heightmap._width, heightmap._depth,
-                                      self._width/heightmap._width,
-                                      self._depth/heightmap._depth, 
-                                      1, 0, 1, 0)
-    self._heightmap = ode.dCreateHeightfield(self._spaceID, self._heightmapID, 
1)
-
-
-  def __dealloc__(self) :
-    ode.dGeomHeightfieldDataDestroy(self._heightmapID)
-    #gl.glDeleteBuffersARB(1, &self._buffer);
-
-
-  ############################################################################
-  #
-  # General C functions
-  #
-
-  cdef void _createBuffer(self) :
-    pass
-    #gl.glGenBuffersARB(1, &self._buffer)
-    #gl.glBindBufferARB(gl.GL_ARRAY_BUFFER_ARB, self._buffer)
-    #gl.glBufferDataARB(gl.GL_ARRAY_BUFFER_ARB, 
(sizeof(Vert)+4+12)*self._bufferAlloc,
-    #                   self._heightmap, gl.GL_STATIC_DRAW_ARB)
-
-
-  cdef void _render(self) :
-    pass
-

Copied: trunk/pysoy/src/scenes/Landscape.pym (from rev 1220, 
trunk/pysoy/src/scenes/Landscape.pxi)
===================================================================
--- trunk/pysoy/src/scenes/Landscape.pym                                (rev 0)
+++ trunk/pysoy/src/scenes/Landscape.pym        2008-04-04 05:50:29 UTC (rev 
1224)
@@ -0,0 +1,68 @@
+# PySoy's soy.scenes.Landscape
+#
+# Copyright (C) 2006,2007,2008 PySoy Group
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU Affero General Public License as published
+#  by the Free Software Foundation, either version 3 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU Affero General Public License for more details.
+#
+#  You should have received a copy of the GNU Affero General Public License
+#  along with this program; if not, see http://www.gnu.org/licenses
+#
+# $Id$
+
+
+cdef class Landscape (Scene) :
+  ''' Landscape Scene
+
+    This is a scene based on a heightmap.
+    Accepts a heightmap and the width, depth, and heigth of it.
+  '''
+
+  ############################################################################
+  #
+  # Python functions
+  #
+
+  def __cinit__(self, heightmap, scale, width=1024, depth=1024, *args, **kw) :
+    if not isinstance(soy.textures.Texture, heightmap) or heightmap._chans != 
1 :
+      raise TypeError('heightmap must be of type soy.textures.Texture and 1 
channel.')
+    self._width = width
+    self._depth = depth
+    self._heightmapID = ode.dGeomHeightfieldDataCreate()
+    ode.dGeomHeightfieldDataBuildByte(self._heightmapID,
+                                      <unsigned char*> heightmap._texels, 0,
+                                      heightmap._width, heightmap._depth,
+                                      self._width/heightmap._width,
+                                      self._depth/heightmap._depth, 
+                                      1, 0, 1, 0)
+    self._heightmap = ode.dCreateHeightfield(self._spaceID, self._heightmapID, 
1)
+
+
+  def __dealloc__(self) :
+    ode.dGeomHeightfieldDataDestroy(self._heightmapID)
+    #gl.glDeleteBuffersARB(1, &self._buffer);
+
+
+  ############################################################################
+  #
+  # General C functions
+  #
+
+  cdef void _createBuffer(self) :
+    pass
+    #gl.glGenBuffersARB(1, &self._buffer)
+    #gl.glBindBufferARB(gl.GL_ARRAY_BUFFER_ARB, self._buffer)
+    #gl.glBufferDataARB(gl.GL_ARRAY_BUFFER_ARB, 
(sizeof(Vert)+4+12)*self._bufferAlloc,
+    #                   self._heightmap, gl.GL_STATIC_DRAW_ARB)
+
+
+  cdef void _render(self) :
+    pass
+

Deleted: trunk/pysoy/src/scenes/Planar.pxi
===================================================================
--- trunk/pysoy/src/scenes/Planar.pxi   2008-04-04 05:40:07 UTC (rev 1223)
+++ trunk/pysoy/src/scenes/Planar.pxi   2008-04-04 05:50:29 UTC (rev 1224)
@@ -1,211 +0,0 @@
-# PySoy's scenes.Planar class
-#
-# Copyright (C) 2006,2007,2008 PySoy Group
-#
-#  This program is free software; you can redistribute it and/or modify
-#  it under the terms of the GNU Affero General Public License as published
-#  by the Free Software Foundation, either version 3 of the License, or
-#  (at your option) any later version.
-#
-#  This program is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#  GNU Affero General Public License for more details.
-#
-#  You should have received a copy of the GNU Affero General Public License
-#  along with this program; if not, see http://www.gnu.org/licenses
-#
-# $Id$
-DEF GeomScene = 1
-DEF GeomBody = 2
-DEF GeomField = 4
-DEF GeomLight = 8
-
-cimport soy.materials
-
-
-cdef class Planar (Scene) :
-  ''' Planar Scene
-
-    This is a scene based on a collision plane of infinite size facing up in 
-    the direction of gravity.
-  '''
-
-  ############################################################################
-  #
-  # Python functions
-  #
-
-  def __cinit__(self, offset=0, step=15, material=None, *args, **kw) :
-    cdef int _i
-    cdef Vert _a, _b, _c, _d, _e, _f
-    
-    self._offset = offset
-    self._planeID = ode.dCreatePlane(self._spaceID, 0.0, 1.0, 0.0, 
self._offset)
-    ode.dGeomSetCategoryBits(self._planeID,GeomScene)
-    ode.dGeomSetData(self._planeID, <void*> self)
-    
-    size = 100
-    #
-    # Create the verts for the first, biggest triangle
-    self._verts[0].px = 0.0
-    self._verts[0].py = self._offset
-    self._verts[0].pz = size + (ode.dSin(60)*size)/2
-    self._verts[1].px = ode.dCos(60)*size
-    self._verts[1].py = self._offset
-    self._verts[1].pz = ode.dSin(60)*size + (ode.dSin(60)*size)/2
-    self._verts[2].px = -ode.dCos(60)*size
-    self._verts[2].py = self._offset
-    self._verts[2].pz = ode.dSin(60)*size + (ode.dSin(60)*size)/2
-    #
-    # Provide array indices in order for the triangle face
-    self._faces[0].a  = 0
-    self._faces[0].b  = 2
-    self._faces[0].c  = 1
-    _a = self._verts[0]
-    _b = self._verts[1]
-    _c = self._verts[2]
-
-    self._verts[0].tx = _a.px - ode.dFabs(_a.px)
-    self._verts[0].ty = _a.pz - ode.dFabs(_a.pz)
-    self._verts[1].tx = _b.px - ode.dFabs(_b.px)
-    self._verts[1].ty = _b.pz - ode.dFabs(_b.pz)
-    self._verts[2].tx = _c.px - ode.dFabs(_c.px)
-    self._verts[2].ty = _c.pz - ode.dFabs(_c.pz)
-    
-    for _i from 1 <= _i < step :
-      #
-      # We get the midpoints from the smallest (encapsulating) triangle
-      # and create faces from them
-      _d = self._midpoint(_a,_b)
-      _e = self._midpoint(_b,_c)
-      _f = self._midpoint(_c,_a)
-      #
-      # Calculate the verts
-      _d.py = self._offset
-      _e.py = self._offset
-      _f.py = self._offset
-      _d.tx = _d.px - ode.dFabs(_d.px)
-      _d.ty = _d.pz - ode.dFabs(_d.pz)
-      _e.tx = _e.px - ode.dFabs(_e.px)
-      _e.ty = _e.pz - ode.dFabs(_e.pz)
-      _f.tx = _f.px - ode.dFabs(_f.px)
-      _f.ty = _f.pz - ode.dFabs(_f.pz)
-      #
-      # Set the verts for this triangle
-      self._verts[_i*3]   = _d
-      self._verts[_i*3+1] = _e
-      self._verts[_i*3+2] = _f
-      #
-      # Provide array indices in order for the triangle face
-      self._faces[_i].a   = _i*3
-      self._faces[_i].b   = _i*3+2
-      self._faces[_i].c   = _i*3+1
-      _a = _d
-      _b = _e
-      _c = _f
-    
-    #
-    # Set the material of the plane
-    if isinstance(material, soy.materials.Material) :    
-      self._material = material      
-    elif material == None:
-      self._material = soy.materials.Material()
-    else:
-      raise TypeError('Must provide an instance of soy.materials.Material')
-
-
-  def __dealloc__(self) :
-    ode.dGeomDestroy(self._planeID)
-
-
-  ############################################################################
-  #
-  # Properties
-  #
-
-  property material :
-    def __get__(self) :
-      return self._material
-    def __set__(self, value) :
-      if not isinstance(value, soy.materials.Material) :
-        raise TypeError('Must provide an instance of soy.materials.Material')
-      self._material = value
-
-
-  property gravity :
-    '''Scene gravity
-
-    This is a scene-wide pseudo-force drawing all bodies in a single 
-    direction.  This should not be confused with a monopole force or other
-    forces which are often used for gravity in larger scenes.
-
-    Takes a (x,y,z) tuple of numbers, defaults to (0.0, 0.0, 0.0)
-    An offset for the Y axis may be provided by a fourth value in the tuple.
-    '''
-    def __get__(self) :
-      cdef ode.dVector3 _grav
-      ode.dWorldGetGravity(self._worldID, _grav)
-      return (_grav[0], _grav[1], _grav[2])
-    
-    def __set__(self, value) :
-      cdef ode.dVector3 _normal
-      if type(value) != list or type(value) != tuple :
-        raise TypeError("A tuple or list must be provided.")
-      _normal[0] = -(value[0])
-      _normal[1] = -(value[1])
-      _normal[2] = -(value[2])
-      #
-      # If fourth value is provided, set the offset
-      if len(value) == 4: 
-        #stdio.printf("4 Values! using the fourth one as offset")
-        #print value[3]
-        self._offset = value[3]
-      #
-      # Now that we have all of the points set, destroy the old plane and
-      # make a new one with updated position.
-      ode.dGeomDestroy(self._planeID)
-      ode.dNormalize3(_normal)
-      self._planeID = ode.dCreatePlane(self._spaceID, _normal[0], _normal[1], 
_normal[2], self._offset)
-      ode.dGeomSetCategoryBits(self._planeID,GeomScene)
-      ode.dGeomSetData(self._planeID, <void*> self)
-      ode.dWorldSetGravity(self._worldID, value[0], value[1], value[2])
-
-
-  ############################################################################
-  #
-  # General C functions
-  #
-
-  cdef void _render(self) :
-    #gl.glDisable(gl.GL_DEPTH_BUFFER)
-    self._material._coreBind()
-    
-    gl.glVertexPointer  (3,  gl.GL_FLOAT, 48, &self._verts[0].px)
-    gl.glNormalPointer  (    gl.GL_FLOAT, 48, &self._verts[0].nx)
-    gl.glTexCoordPointer(3,  gl.GL_FLOAT, 48, &self._verts[0].tx)
-    #cdef gl.GLfloat  mtx[16]
-    #self._coreGetModelview(mtx)
-    #gl.glPushMatrix()
-    #gl.glMultMatrixf(mtx)
-        
-    gl.glDrawElements   (gl.GL_TRIANGLES, 60, gl.GL_UNSIGNED_SHORT, 
-                         <unsigned short*> self._faces)
-    
-    #gl.glPopMatrix()
-    self._material._coreUnBind()
-    Scene._render(self)
-    #gl.glEnable(gl.GL_DEPTH_BUFFER)
-
-
-  cdef Vert _midpoint(self, Vert a, Vert b):
-    cdef Vert _res
-    #
-    # Get midpoint between two points, (a.x+b.x)/2, etc..
-    x = 0.5*(a.px+b.px)
-    y = 0.5*(a.py+b.py)
-    z = 0.5*(a.pz+b.pz)
-    _res.px = x
-    _res.py = y
-    _res.pz = z
-    return _res

Copied: trunk/pysoy/src/scenes/Planar.pym (from rev 1220, 
trunk/pysoy/src/scenes/Planar.pxi)
===================================================================
--- trunk/pysoy/src/scenes/Planar.pym                           (rev 0)
+++ trunk/pysoy/src/scenes/Planar.pym   2008-04-04 05:50:29 UTC (rev 1224)
@@ -0,0 +1,211 @@
+# PySoy's scenes.Planar class
+#
+# Copyright (C) 2006,2007,2008 PySoy Group
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU Affero General Public License as published
+#  by the Free Software Foundation, either version 3 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU Affero General Public License for more details.
+#
+#  You should have received a copy of the GNU Affero General Public License
+#  along with this program; if not, see http://www.gnu.org/licenses
+#
+# $Id$
+DEF GeomScene = 1
+DEF GeomBody = 2
+DEF GeomField = 4
+DEF GeomLight = 8
+
+cimport soy.materials
+
+
+cdef class Planar (Scene) :
+  ''' Planar Scene
+
+    This is a scene based on a collision plane of infinite size facing up in 
+    the direction of gravity.
+  '''
+
+  ############################################################################
+  #
+  # Python functions
+  #
+
+  def __cinit__(self, offset=0, step=15, material=None, *args, **kw) :
+    cdef int _i
+    cdef Vert _a, _b, _c, _d, _e, _f
+    
+    self._offset = offset
+    self._planeID = ode.dCreatePlane(self._spaceID, 0.0, 1.0, 0.0, 
self._offset)
+    ode.dGeomSetCategoryBits(self._planeID,GeomScene)
+    ode.dGeomSetData(self._planeID, <void*> self)
+    
+    size = 100
+    #
+    # Create the verts for the first, biggest triangle
+    self._verts[0].px = 0.0
+    self._verts[0].py = self._offset
+    self._verts[0].pz = size + (ode.dSin(60)*size)/2
+    self._verts[1].px = ode.dCos(60)*size
+    self._verts[1].py = self._offset
+    self._verts[1].pz = ode.dSin(60)*size + (ode.dSin(60)*size)/2
+    self._verts[2].px = -ode.dCos(60)*size
+    self._verts[2].py = self._offset
+    self._verts[2].pz = ode.dSin(60)*size + (ode.dSin(60)*size)/2
+    #
+    # Provide array indices in order for the triangle face
+    self._faces[0].a  = 0
+    self._faces[0].b  = 2
+    self._faces[0].c  = 1
+    _a = self._verts[0]
+    _b = self._verts[1]
+    _c = self._verts[2]
+
+    self._verts[0].tx = _a.px - ode.dFabs(_a.px)
+    self._verts[0].ty = _a.pz - ode.dFabs(_a.pz)
+    self._verts[1].tx = _b.px - ode.dFabs(_b.px)
+    self._verts[1].ty = _b.pz - ode.dFabs(_b.pz)
+    self._verts[2].tx = _c.px - ode.dFabs(_c.px)
+    self._verts[2].ty = _c.pz - ode.dFabs(_c.pz)
+    
+    for _i from 1 <= _i < step :
+      #
+      # We get the midpoints from the smallest (encapsulating) triangle
+      # and create faces from them
+      _d = self._midpoint(_a,_b)
+      _e = self._midpoint(_b,_c)
+      _f = self._midpoint(_c,_a)
+      #
+      # Calculate the verts
+      _d.py = self._offset
+      _e.py = self._offset
+      _f.py = self._offset
+      _d.tx = _d.px - ode.dFabs(_d.px)
+      _d.ty = _d.pz - ode.dFabs(_d.pz)
+      _e.tx = _e.px - ode.dFabs(_e.px)
+      _e.ty = _e.pz - ode.dFabs(_e.pz)
+      _f.tx = _f.px - ode.dFabs(_f.px)
+      _f.ty = _f.pz - ode.dFabs(_f.pz)
+      #
+      # Set the verts for this triangle
+      self._verts[_i*3]   = _d
+      self._verts[_i*3+1] = _e
+      self._verts[_i*3+2] = _f
+      #
+      # Provide array indices in order for the triangle face
+      self._faces[_i].a   = _i*3
+      self._faces[_i].b   = _i*3+2
+      self._faces[_i].c   = _i*3+1
+      _a = _d
+      _b = _e
+      _c = _f
+    
+    #
+    # Set the material of the plane
+    if isinstance(material, soy.materials.Material) :    
+      self._material = material      
+    elif material == None:
+      self._material = soy.materials.Material()
+    else:
+      raise TypeError('Must provide an instance of soy.materials.Material')
+
+
+  def __dealloc__(self) :
+    ode.dGeomDestroy(self._planeID)
+
+
+  ############################################################################
+  #
+  # Properties
+  #
+
+  property material :
+    def __get__(self) :
+      return self._material
+    def __set__(self, value) :
+      if not isinstance(value, soy.materials.Material) :
+        raise TypeError('Must provide an instance of soy.materials.Material')
+      self._material = value
+
+
+  property gravity :
+    '''Scene gravity
+
+    This is a scene-wide pseudo-force drawing all bodies in a single 
+    direction.  This should not be confused with a monopole force or other
+    forces which are often used for gravity in larger scenes.
+
+    Takes a (x,y,z) tuple of numbers, defaults to (0.0, 0.0, 0.0)
+    An offset for the Y axis may be provided by a fourth value in the tuple.
+    '''
+    def __get__(self) :
+      cdef ode.dVector3 _grav
+      ode.dWorldGetGravity(self._worldID, _grav)
+      return (_grav[0], _grav[1], _grav[2])
+    
+    def __set__(self, value) :
+      cdef ode.dVector3 _normal
+      if type(value) != list or type(value) != tuple :
+        raise TypeError("A tuple or list must be provided.")
+      _normal[0] = -(value[0])
+      _normal[1] = -(value[1])
+      _normal[2] = -(value[2])
+      #
+      # If fourth value is provided, set the offset
+      if len(value) == 4: 
+        #stdio.printf("4 Values! using the fourth one as offset")
+        #print value[3]
+        self._offset = value[3]
+      #
+      # Now that we have all of the points set, destroy the old plane and
+      # make a new one with updated position.
+      ode.dGeomDestroy(self._planeID)
+      ode.dNormalize3(_normal)
+      self._planeID = ode.dCreatePlane(self._spaceID, _normal[0], _normal[1], 
_normal[2], self._offset)
+      ode.dGeomSetCategoryBits(self._planeID,GeomScene)
+      ode.dGeomSetData(self._planeID, <void*> self)
+      ode.dWorldSetGravity(self._worldID, value[0], value[1], value[2])
+
+
+  ############################################################################
+  #
+  # General C functions
+  #
+
+  cdef void _render(self) :
+    #gl.glDisable(gl.GL_DEPTH_BUFFER)
+    self._material._coreBind()
+    
+    gl.glVertexPointer  (3,  gl.GL_FLOAT, 48, &self._verts[0].px)
+    gl.glNormalPointer  (    gl.GL_FLOAT, 48, &self._verts[0].nx)
+    gl.glTexCoordPointer(3,  gl.GL_FLOAT, 48, &self._verts[0].tx)
+    #cdef gl.GLfloat  mtx[16]
+    #self._coreGetModelview(mtx)
+    #gl.glPushMatrix()
+    #gl.glMultMatrixf(mtx)
+        
+    gl.glDrawElements   (gl.GL_TRIANGLES, 60, gl.GL_UNSIGNED_SHORT, 
+                         <unsigned short*> self._faces)
+    
+    #gl.glPopMatrix()
+    self._material._coreUnBind()
+    Scene._render(self)
+    #gl.glEnable(gl.GL_DEPTH_BUFFER)
+
+
+  cdef Vert _midpoint(self, Vert a, Vert b):
+    cdef Vert _res
+    #
+    # Get midpoint between two points, (a.x+b.x)/2, etc..
+    x = 0.5*(a.px+b.px)
+    y = 0.5*(a.py+b.py)
+    z = 0.5*(a.pz+b.pz)
+    _res.px = x
+    _res.py = y
+    _res.pz = z
+    return _res

Deleted: trunk/pysoy/src/scenes/Scene.pxi
===================================================================
--- trunk/pysoy/src/scenes/Scene.pxi    2008-04-04 05:40:07 UTC (rev 1223)
+++ trunk/pysoy/src/scenes/Scene.pxi    2008-04-04 05:50:29 UTC (rev 1224)
@@ -1,337 +0,0 @@
-# PySoy's scenes.Scene class
-#
-# Copyright (C) 2006,2007,2008 PySoy Group
-#
-#  This program is free software; you can redistribute it and/or modify
-#  it under the terms of the GNU Affero General Public License as published
-#  by the Free Software Foundation, either version 3 of the License, or
-#  (at your option) any later version.
-#
-#  This program is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#  GNU Affero General Public License for more details.
-#
-#  You should have received a copy of the GNU Affero General Public License
-#  along with this program; if not, see http://www.gnu.org/licenses
-#
-# $Id$
-DEF GeomScene = 1
-DEF GeomBody  = 2
-DEF GeomField = 4
-DEF GeomLight = 8
-DEF GeomGhost = 16
-cdef class Scene (soy._internals.Loopable) :
-  '''PySoy Scene
-
-    Scenes are containers in physics space for bodies, joints, and shapes.
-    Objects in different worlds cannot interact, for example, bodies in two
-    different worlds cannot collide.  Worlds also apply gravity to bodies.
-  '''
-
-  ############################################################################
-  #
-  # Python functions
-  #
-  
-  def __cinit__(self, *args, **kw) :
-    from soy.colors import gray
-    self._worldID      = ode.dWorldCreate()
-    self._spaceID      = ode.dSimpleSpaceCreate(NULL)
-    self._contactGroup = ode.dJointGroupCreate(0)
-    self._bodies       = soy._internals.Children()
-    self._joints       = soy._internals.Children()
-    self._lights       = soy._internals.Children()
-    self._ambient      = gray
-    self._stepSize     = 0.01
-    self._friction     = 0
-    self._prevTime     = _time()
-    self._stepMutex    = py.PyThread_allocate_lock()
-    # a list cor keeping track of the fields in the scene.
-    self._giveFields   = soy._internals.PointerSet()
-    # 
-    self._callFields   = soy._internals.PointerSet()
-    _scenes._append(<void*> self)
-
-
-  def __dealloc__(self) :
-    _scenes._remove(<void*> self)
-    if self._worldID != NULL :
-      ode.dWorldDestroy(self._worldID)
-    if self._spaceID != NULL :
-      ode.dSpaceDestroy(self._spaceID)
-
-
-  def __repr__(self) :
-    report = []
-
-    if self._bodies._current == 1 :
-      report.append('1 body')
-    else:
-      report.append('%d bodies' % self._bodies._current)
-
-    if self._lights._current == 1 :
-      report.append('1 light')
-    else :
-      report.append('%d lights' % self._lights._current)
-
-    return '<Scene with %s>' % ', '.join(report)
-
-  ############################################################################
-  #
-  # C functions
-  #
-  
-  cdef int _loop(self) :
-    cdef int _i, _steps
-    self._updateTime()
-    self._callFields._empty()
-    self._giveFields._empty()
-    #
-    self._bodies._iterStart()
-    for _i from 0 <= _i < self._bodies._current :
-      #
-      # isinstance here == BAD, SLOW!
-      if isinstance(<soy.bodies.Body> self._bodies._list[_i], 
-                    soy.fields.Field) :
-        # Make sure every field is in givefields & _give each one
-        if not self._giveFields._has_key(<void*> self._bodies._list[_i]) :
-          (<soy.fields.Field> self._bodies._list[_i])._give(0)
-          self._giveFields._insert(<void*> self._bodies._list[_i])
-    #
-    for _i from 0 <= _i < self._bodies._current :
-      if isinstance(<soy.bodies.Body> self._bodies._list[_i], 
-                    soy.fields.Field) :
-        # Apply fields; add incompletly applied fields to the list
-        if not (<soy.fields.Field> self._bodies._list[_i])._apply() :
-          pass
-          #self._callFields._insert(self._bodies.list[_i])
-    #
-    # Apply any outstanding fields
-    self._callFields._foreach(_runField, NULL)
-    self._bodies._iterDone()
-    #
-    self._stepLock()
-    _steps = self._steps()
-    for _i from 0 <= _i < _steps :
-      self._updateTime()
-      self._giveFields._foreach(_prerunField, NULL)
-      self._callFields._empty()
-      ode.dSpaceCollide(self._spaceID, <void*> self,
-                        <void(*)(void*, ode.dGeomID, ode.dGeomID)> 
Scene._callback)
-      ode.dWorldQuickStep(self._worldID, self._stepSize)
-      ode.dJointGroupEmpty(self._contactGroup)
-      if _i != 0 :
-        self._callFields._foreach(_runField, NULL)
-    self._stepUnLock()
-    return 1
-
-
-  cdef void _render(self) :
-    cdef int   _i
-    #
-    # Setup scene-level rendering
-    gl.glClear(gl.GL_DEPTH_BUFFER_BIT)
-    gl.glEnable(gl.GL_DEPTH_TEST)
-    gl.glEnable(gl.GL_LIGHTING)
-    gl.glLightModelfv(gl.GL_LIGHT_MODEL_AMBIENT, 
-                      (<soy.colors.Color> self._ambient)._rgba)
-    #
-    # Turn on each light, keep it's iteration locked against mod until done
-    self._lights._iterStart()
-    for _i from 0 <= _i < self._lights._current :
-      # This is a quick hack (gl.GL_LIGHT0 + _i)
-      (<soy.bodies.Light> self._lights._list[_i])._on(gl.GL_LIGHT0 + _i)
-    #
-    # Iterate over bodies
-    self._bodies._iterStart()
-    for _i from 0 <= _i < self._bodies._current :
-      (<soy.bodies.Body> self._bodies._list[_i])._render()
-    self._bodies._iterDone()
-    #
-    # Turn off all lights and finish iteration loop
-    for _i from 0 <= _i < self._lights._current :
-      # This is a quick hack (gl.GL_LIGHT0 + _i)
-      (<soy.bodies.Light> self._lights._list[_i])._off(gl.GL_LIGHT0 + _i)
-    self._lights._iterDone()
-    gl.glDisable(gl.GL_LIGHTING)
-    gl.glDisable(gl.GL_DEPTH_TEST)
-
-
-  cdef void _updateTime(self) :
-    self._time = _time()
-
-
-  cdef int _steps(self) :
-    cdef int     _step
-    cdef double  _lapsTime
-    _lapsTime = _time() - self._prevTime
-    if _lapsTime < ode.dEpsilon :
-      _lapsTime = ode.dEpsilon
-    _step = math.lround(_lapsTime / self._stepSize)
-    if _step > 12 :
-      _step = 12
-    self._prevTime = self._prevTime + (_step * self._stepSize)
-    return _step
-    
-  cdef void _stepLock(self) :
-    py.PyThread_acquire_lock(self._stepMutex,1)
-
-  cdef int _stepTryLock(self) :
-    return py.PyThread_acquire_lock(self._stepMutex,0)
-
-  cdef void _stepUnLock(self) :
-    py.PyThread_release_lock(self._stepMutex)
-
-
-  cdef void _callback(self, ode.dGeomID _geomA, ode.dGeomID _geomB) :
-    cdef int                _contactGeoms, _f, _i
-    cdef ode.dJointID       _joint
-    cdef ode.dContact       _contact
-    cdef ode.dContactGeom   _contactGeom[2]
-    cdef ode.dGeomID        _geomIDs[2]
-    cdef ode.dBodyID        _bodyIDs[2]
-    cdef soy.bodies.Body    _bodyA
-    cdef soy.bodies.Body    _bodyB
-    #
-    # Start by generating up to four contacts between 2 bodies
-    _contactGeoms = ode.dCollide(_geomA, _geomB, 2,
-                                 _contactGeom, sizeof(_contactGeom[0]))
-    #
-    # Don't waste time when there's no collision
-    if _contactGeoms == 0 :
-      return
-    #
-    # This makes case-testing much simpler in the code
-    _geomIDs[0] = _geomA
-    _geomIDs[1] = _geomB
-    #
-    # Scene Check
-    for _i from 0 <= _i < 2 :
-      if ode.dGeomGetCategoryBits(_geomIDs[_i]) == GeomScene :
-        _bodyIDs[_i] = NULL
-        #stdio.printf('Scene Collision %d\n', _i)
-      else :
-        _bodyIDs[_i] = ode.dGeomGetBody(_geomIDs[_i])
-        #stdio.printf('Body Collision %d %d\n', _i, _bodyIDs[_i])
-    #
-    # Ghost Check
-    for _i from 0 <= _i < 2 :
-      if ode.dGeomGetCategoryBits(_geomIDs[_i]) == GeomGhost :
-        #stdio.printf('Ghost Collision\n')
-        _bodyIDs[(_i + 1) % 2] = NULL
-    #
-    # If we ended up with a null-null collision, just return now
-    if _bodyIDs[0] == NULL and _bodyIDs[1] == NULL :
-      #stdio.printf('Both bodies null, aborting\n')
-      return
-    #
-    # Add each joint to the bodies we just determined
-    for _i from 0 <= _i < _contactGeoms :
-      _contact.geom = _contactGeom[_i]
-      _contact.surface.mode = ode.dContactBounce
-      _contact.surface.mu = self._friction
-      _contact.surface.bounce = 0.8
-      _contact.surface.bounce_vel = 0
-      #stdio.printf('Creating joint\n')
-      _joint = ode.dJointCreateContact(self._worldID, self._contactGroup, 
-                                       &_contact)
-      #stdio.printf('Attaching joint\n')
-      ode.dJointAttach(_joint, _bodyIDs[0], _bodyIDs[1])
-      #stdio.printf('Processed contact joint %d\n', _i)
-    return
-
-    '''
-    # This is the old code, mostly for fields.  It needs to be merged into
-    # the above but for now we're just testing Scene and Ghosts
-    if _c > 0 :
-      # Get the Body objects
-      _bo1 = <soy.bodies.Body> ode.dBodyGetData(_b1)
-      _bo2 = <soy.bodies.Body> ode.dBodyGetData(_b2)
-      _f = 0
-      # activate any fields present...
-      if isinstance(_bo1, soy.fields.Field) :
-        _f = 1
-        if not (<soy.fields.Field> _bo1)._exert(_bo2) :
-          self._callFields._insert(<void*> _bo1)
-      if isinstance(_bo2, soy.fields.Field) :
-        _f = 1
-        if not (<soy.fields.Field> _bo2)._exert(_bo1) :
-          self._callFields._insert(<void*> _bo2)
-      # if neither shape is a field
-      if _f == 0 :
-        _ct.geom = _cg
-        # surface parameters should have an exposed interface on 
soy.shapes.Shape
-        # this code should pull parameters from there.
-        _ct.surface.mode = ode.dContactBounce
-        _ct.surface.bounce = 0.8
-        _ct.surface.bounce_vel = 0
-        _j = ode.dJointCreateContact(self._worldID, self._contactGroup, &_ct)
-        ode.dJointAttach(_j, _b1, _b2)
-    '''
-
-  ############################################################################
-  #
-  # Properties
-  #
-  
-  property gravity :
-    '''Scene gravity
-
-    This is a scene-wide pseudo-force drawing all bodies in a single 
-    direction.  This should not be confused with a monopole force or other
-    forces which are often used for gravity in larger scenes.
-
-    Takes a (x,y,z) tuple of numbers, defaults to (0.0, 0.0, 0.0)
-    '''
-    def __get__(self) :
-      cdef ode.dVector3 grav
-      ode.dWorldGetGravity(self._worldID, grav)
-      return (grav[0], grav[1], grav[2])
-    def __set__(self, value) :
-      ode.dWorldSetGravity(self._worldID, value[0], value[1], value[2])
-
-
-  property stepsize :
-    '''Step Size
-
-    This is the fraction of time each "step" calculates for.  Larger steps
-    trade accuracy for speed.
-
-    Takes a float, defaults to .01
-    '''
-    def __get__(self) :
-      return self._stepSize
-    def __set__(self, value) :
-      self._stepLock()
-      self._stepSize = value
-      self._stepUnLock()
-
-
-  property ambient :
-    '''Scene's ambient light
-
-    This is the ambient light for the scene.  When no light is used this is 
-    the only light available in the scene - use it well.
-
-    Defaults to soy.colors.gray
-    '''
-    def __get__(self) :
-      return self._ambient
-    def __set__(self, soy.colors.Color value) :
-      self._ambient = value
-
-  property friction :
-    '''Scene's Friction
-    
-    This is the amount of friction given to ode's contact joint.
-    
-    Defaults to 0 ( Really Slippery )
-    '''
-    def __get__(self) :
-      return self._friction
-    def __set__(self, value) :
-      if isinstance(value, int):
-        self._friction = value
-      else: 
-        raise TypeError("Friction must be an int of some sort")

Copied: trunk/pysoy/src/scenes/Scene.pym (from rev 1220, 
trunk/pysoy/src/scenes/Scene.pxi)
===================================================================
--- trunk/pysoy/src/scenes/Scene.pym                            (rev 0)
+++ trunk/pysoy/src/scenes/Scene.pym    2008-04-04 05:50:29 UTC (rev 1224)
@@ -0,0 +1,337 @@
+# PySoy's scenes.Scene class
+#
+# Copyright (C) 2006,2007,2008 PySoy Group
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU Affero General Public License as published
+#  by the Free Software Foundation, either version 3 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU Affero General Public License for more details.
+#
+#  You should have received a copy of the GNU Affero General Public License
+#  along with this program; if not, see http://www.gnu.org/licenses
+#
+# $Id$
+DEF GeomScene = 1
+DEF GeomBody  = 2
+DEF GeomField = 4
+DEF GeomLight = 8
+DEF GeomGhost = 16
+cdef class Scene (soy._internals.Loopable) :
+  '''PySoy Scene
+
+    Scenes are containers in physics space for bodies, joints, and shapes.
+    Objects in different worlds cannot interact, for example, bodies in two
+    different worlds cannot collide.  Worlds also apply gravity to bodies.
+  '''
+
+  ############################################################################
+  #
+  # Python functions
+  #
+  
+  def __cinit__(self, *args, **kw) :
+    from soy.colors import gray
+    self._worldID      = ode.dWorldCreate()
+    self._spaceID      = ode.dSimpleSpaceCreate(NULL)
+    self._contactGroup = ode.dJointGroupCreate(0)
+    self._bodies       = soy._internals.Children()
+    self._joints       = soy._internals.Children()
+    self._lights       = soy._internals.Children()
+    self._ambient      = gray
+    self._stepSize     = 0.01
+    self._friction     = 0
+    self._prevTime     = _time()
+    self._stepMutex    = py.PyThread_allocate_lock()
+    # a list cor keeping track of the fields in the scene.
+    self._giveFields   = soy._internals.PointerSet()
+    # 
+    self._callFields   = soy._internals.PointerSet()
+    _scenes._append(<void*> self)
+
+
+  def __dealloc__(self) :
+    _scenes._remove(<void*> self)
+    if self._worldID != NULL :
+      ode.dWorldDestroy(self._worldID)
+    if self._spaceID != NULL :
+      ode.dSpaceDestroy(self._spaceID)
+
+
+  def __repr__(self) :
+    report = []
+
+    if self._bodies._current == 1 :
+      report.append('1 body')
+    else:
+      report.append('%d bodies' % self._bodies._current)
+
+    if self._lights._current == 1 :
+      report.append('1 light')
+    else :
+      report.append('%d lights' % self._lights._current)
+
+    return '<Scene with %s>' % ', '.join(report)
+
+  ############################################################################
+  #
+  # C functions
+  #
+  
+  cdef int _loop(self) :
+    cdef int _i, _steps
+    self._updateTime()
+    self._callFields._empty()
+    self._giveFields._empty()
+    #
+    self._bodies._iterStart()
+    for _i from 0 <= _i < self._bodies._current :
+      #
+      # isinstance here == BAD, SLOW!
+      if isinstance(<soy.bodies.Body> self._bodies._list[_i], 
+                    soy.fields.Field) :
+        # Make sure every field is in givefields & _give each one
+        if not self._giveFields._has_key(<void*> self._bodies._list[_i]) :
+          (<soy.fields.Field> self._bodies._list[_i])._give(0)
+          self._giveFields._insert(<void*> self._bodies._list[_i])
+    #
+    for _i from 0 <= _i < self._bodies._current :
+      if isinstance(<soy.bodies.Body> self._bodies._list[_i], 
+                    soy.fields.Field) :
+        # Apply fields; add incompletly applied fields to the list
+        if not (<soy.fields.Field> self._bodies._list[_i])._apply() :
+          pass
+          #self._callFields._insert(self._bodies.list[_i])
+    #
+    # Apply any outstanding fields
+    self._callFields._foreach(_runField, NULL)
+    self._bodies._iterDone()
+    #
+    self._stepLock()
+    _steps = self._steps()
+    for _i from 0 <= _i < _steps :
+      self._updateTime()
+      self._giveFields._foreach(_prerunField, NULL)
+      self._callFields._empty()
+      ode.dSpaceCollide(self._spaceID, <void*> self,
+                        <void(*)(void*, ode.dGeomID, ode.dGeomID)> 
Scene._callback)
+      ode.dWorldQuickStep(self._worldID, self._stepSize)
+      ode.dJointGroupEmpty(self._contactGroup)
+      if _i != 0 :
+        self._callFields._foreach(_runField, NULL)
+    self._stepUnLock()
+    return 1
+
+
+  cdef void _render(self) :
+    cdef int   _i
+    #
+    # Setup scene-level rendering
+    gl.glClear(gl.GL_DEPTH_BUFFER_BIT)
+    gl.glEnable(gl.GL_DEPTH_TEST)
+    gl.glEnable(gl.GL_LIGHTING)
+    gl.glLightModelfv(gl.GL_LIGHT_MODEL_AMBIENT, 
+                      (<soy.colors.Color> self._ambient)._rgba)
+    #
+    # Turn on each light, keep it's iteration locked against mod until done
+    self._lights._iterStart()
+    for _i from 0 <= _i < self._lights._current :
+      # This is a quick hack (gl.GL_LIGHT0 + _i)
+      (<soy.bodies.Light> self._lights._list[_i])._on(gl.GL_LIGHT0 + _i)
+    #
+    # Iterate over bodies
+    self._bodies._iterStart()
+    for _i from 0 <= _i < self._bodies._current :
+      (<soy.bodies.Body> self._bodies._list[_i])._render()
+    self._bodies._iterDone()
+    #
+    # Turn off all lights and finish iteration loop
+    for _i from 0 <= _i < self._lights._current :
+      # This is a quick hack (gl.GL_LIGHT0 + _i)
+      (<soy.bodies.Light> self._lights._list[_i])._off(gl.GL_LIGHT0 + _i)
+    self._lights._iterDone()
+    gl.glDisable(gl.GL_LIGHTING)
+    gl.glDisable(gl.GL_DEPTH_TEST)
+
+
+  cdef void _updateTime(self) :
+    self._time = _time()
+
+
+  cdef int _steps(self) :
+    cdef int     _step
+    cdef double  _lapsTime
+    _lapsTime = _time() - self._prevTime
+    if _lapsTime < ode.dEpsilon :
+      _lapsTime = ode.dEpsilon
+    _step = math.lround(_lapsTime / self._stepSize)
+    if _step > 12 :
+      _step = 12
+    self._prevTime = self._prevTime + (_step * self._stepSize)
+    return _step
+    
+  cdef void _stepLock(self) :
+    py.PyThread_acquire_lock(self._stepMutex,1)
+
+  cdef int _stepTryLock(self) :
+    return py.PyThread_acquire_lock(self._stepMutex,0)
+
+  cdef void _stepUnLock(self) :
+    py.PyThread_release_lock(self._stepMutex)
+
+
+  cdef void _callback(self, ode.dGeomID _geomA, ode.dGeomID _geomB) :
+    cdef int                _contactGeoms, _f, _i
+    cdef ode.dJointID       _joint
+    cdef ode.dContact       _contact
+    cdef ode.dContactGeom   _contactGeom[2]
+    cdef ode.dGeomID        _geomIDs[2]
+    cdef ode.dBodyID        _bodyIDs[2]
+    cdef soy.bodies.Body    _bodyA
+    cdef soy.bodies.Body    _bodyB
+    #
+    # Start by generating up to four contacts between 2 bodies
+    _contactGeoms = ode.dCollide(_geomA, _geomB, 2,
+                                 _contactGeom, sizeof(_contactGeom[0]))
+    #
+    # Don't waste time when there's no collision
+    if _contactGeoms == 0 :
+      return
+    #
+    # This makes case-testing much simpler in the code
+    _geomIDs[0] = _geomA
+    _geomIDs[1] = _geomB
+    #
+    # Scene Check
+    for _i from 0 <= _i < 2 :
+      if ode.dGeomGetCategoryBits(_geomIDs[_i]) == GeomScene :
+        _bodyIDs[_i] = NULL
+        #stdio.printf('Scene Collision %d\n', _i)
+      else :
+        _bodyIDs[_i] = ode.dGeomGetBody(_geomIDs[_i])
+        #stdio.printf('Body Collision %d %d\n', _i, _bodyIDs[_i])
+    #
+    # Ghost Check
+    for _i from 0 <= _i < 2 :
+      if ode.dGeomGetCategoryBits(_geomIDs[_i]) == GeomGhost :
+        #stdio.printf('Ghost Collision\n')
+        _bodyIDs[(_i + 1) % 2] = NULL
+    #
+    # If we ended up with a null-null collision, just return now
+    if _bodyIDs[0] == NULL and _bodyIDs[1] == NULL :
+      #stdio.printf('Both bodies null, aborting\n')
+      return
+    #
+    # Add each joint to the bodies we just determined
+    for _i from 0 <= _i < _contactGeoms :
+      _contact.geom = _contactGeom[_i]
+      _contact.surface.mode = ode.dContactBounce
+      _contact.surface.mu = self._friction
+      _contact.surface.bounce = 0.8
+      _contact.surface.bounce_vel = 0
+      #stdio.printf('Creating joint\n')
+      _joint = ode.dJointCreateContact(self._worldID, self._contactGroup, 
+                                       &_contact)
+      #stdio.printf('Attaching joint\n')
+      ode.dJointAttach(_joint, _bodyIDs[0], _bodyIDs[1])
+      #stdio.printf('Processed contact joint %d\n', _i)
+    return
+
+    '''
+    # This is the old code, mostly for fields.  It needs to be merged into
+    # the above but for now we're just testing Scene and Ghosts
+    if _c > 0 :
+      # Get the Body objects
+      _bo1 = <soy.bodies.Body> ode.dBodyGetData(_b1)
+      _bo2 = <soy.bodies.Body> ode.dBodyGetData(_b2)
+      _f = 0
+      # activate any fields present...
+      if isinstance(_bo1, soy.fields.Field) :
+        _f = 1
+        if not (<soy.fields.Field> _bo1)._exert(_bo2) :
+          self._callFields._insert(<void*> _bo1)
+      if isinstance(_bo2, soy.fields.Field) :
+        _f = 1
+        if not (<soy.fields.Field> _bo2)._exert(_bo1) :
+          self._callFields._insert(<void*> _bo2)
+      # if neither shape is a field
+      if _f == 0 :
+        _ct.geom = _cg
+        # surface parameters should have an exposed interface on 
soy.shapes.Shape
+        # this code should pull parameters from there.
+        _ct.surface.mode = ode.dContactBounce
+        _ct.surface.bounce = 0.8
+        _ct.surface.bounce_vel = 0
+        _j = ode.dJointCreateContact(self._worldID, self._contactGroup, &_ct)
+        ode.dJointAttach(_j, _b1, _b2)
+    '''
+
+  ############################################################################
+  #
+  # Properties
+  #
+  
+  property gravity :
+    '''Scene gravity
+
+    This is a scene-wide pseudo-force drawing all bodies in a single 
+    direction.  This should not be confused with a monopole force or other
+    forces which are often used for gravity in larger scenes.
+
+    Takes a (x,y,z) tuple of numbers, defaults to (0.0, 0.0, 0.0)
+    '''
+    def __get__(self) :
+      cdef ode.dVector3 grav
+      ode.dWorldGetGravity(self._worldID, grav)
+      return (grav[0], grav[1], grav[2])
+    def __set__(self, value) :
+      ode.dWorldSetGravity(self._worldID, value[0], value[1], value[2])
+
+
+  property stepsize :
+    '''Step Size
+
+    This is the fraction of time each "step" calculates for.  Larger steps
+    trade accuracy for speed.
+
+    Takes a float, defaults to .01
+    '''
+    def __get__(self) :
+      return self._stepSize
+    def __set__(self, value) :
+      self._stepLock()
+      self._stepSize = value
+      self._stepUnLock()
+
+
+  property ambient :
+    '''Scene's ambient light
+
+    This is the ambient light for the scene.  When no light is used this is 
+    the only light available in the scene - use it well.
+
+    Defaults to soy.colors.gray
+    '''
+    def __get__(self) :
+      return self._ambient
+    def __set__(self, soy.colors.Color value) :
+      self._ambient = value
+
+  property friction :
+    '''Scene's Friction
+    
+    This is the amount of friction given to ode's contact joint.
+    
+    Defaults to 0 ( Really Slippery )
+    '''
+    def __get__(self) :
+      return self._friction
+    def __set__(self, value) :
+      if isinstance(value, int):
+        self._friction = value
+      else: 
+        raise TypeError("Friction must be an int of some sort")

Deleted: trunk/pysoy/src/scenes/Space.pxi
===================================================================
--- trunk/pysoy/src/scenes/Space.pxi    2008-04-04 05:40:07 UTC (rev 1223)
+++ trunk/pysoy/src/scenes/Space.pxi    2008-04-04 05:50:29 UTC (rev 1224)
@@ -1,39 +0,0 @@
-# PySoy's scenes.Space class
-#
-# Copyright (C) 2006,2007,2008 PySoy Group
-#
-#  This program is free software; you can redistribute it and/or modify
-#  it under the terms of the GNU Affero General Public License as published
-#  by the Free Software Foundation, either version 3 of the License, or
-#  (at your option) any later version.
-#
-#  This program is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#  GNU Affero General Public License for more details.
-#
-#  You should have received a copy of the GNU Affero General Public License
-#  along with this program; if not, see http://www.gnu.org/licenses
-#
-# $Id$
-
-cimport soy.materials
-
-cdef class Space (Scene) :
-  '''soy.scenes.Space
-
-    ''Space is big.  Really, really big.  You just won't believe how vastly, 
-    mind-boggling big it is. I mean you think it's a long way down the
-    street to the chemist's, but that's just peanuts to Space.''
-                                                     ~ Douglas Adams
-
-    Space is a specialized scene class for astronomical environments.
-    Planetary/stellar bodies and a starfield background are implemented 
-    through multi-stage rendering and an optimized octtree for collision are a 
-    few of this classes enhancements.
-
-    If a game includes multiple star systems each system should be implemented
-    as an instance of this class.
-
-    It is currently incomplete.
-  '''

Copied: trunk/pysoy/src/scenes/Space.pym (from rev 1220, 
trunk/pysoy/src/scenes/Space.pxi)
===================================================================
--- trunk/pysoy/src/scenes/Space.pym                            (rev 0)
+++ trunk/pysoy/src/scenes/Space.pym    2008-04-04 05:50:29 UTC (rev 1224)
@@ -0,0 +1,39 @@
+# PySoy's scenes.Space class
+#
+# Copyright (C) 2006,2007,2008 PySoy Group
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU Affero General Public License as published
+#  by the Free Software Foundation, either version 3 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU Affero General Public License for more details.
+#
+#  You should have received a copy of the GNU Affero General Public License
+#  along with this program; if not, see http://www.gnu.org/licenses
+#
+# $Id$
+
+cimport soy.materials
+
+cdef class Space (Scene) :
+  '''soy.scenes.Space
+
+    ''Space is big.  Really, really big.  You just won't believe how vastly, 
+    mind-boggling big it is. I mean you think it's a long way down the
+    street to the chemist's, but that's just peanuts to Space.''
+                                                     ~ Douglas Adams
+
+    Space is a specialized scene class for astronomical environments.
+    Planetary/stellar bodies and a starfield background are implemented 
+    through multi-stage rendering and an optimized octtree for collision are a 
+    few of this classes enhancements.
+
+    If a game includes multiple star systems each system should be implemented
+    as an instance of this class.
+
+    It is currently incomplete.
+  '''

Copied: trunk/pysoy/src/scenes/__init__.pym (from rev 1223, 
trunk/pysoy/src/stubs/Stub.pxi)
===================================================================
--- trunk/pysoy/src/scenes/__init__.pym                         (rev 0)
+++ trunk/pysoy/src/scenes/__init__.pym 2008-04-04 05:50:29 UTC (rev 1224)
@@ -0,0 +1,30 @@
+# PySoy's stubs.Stub
+#
+# Copyright (C) 2006,2007,2008 PySoy Group
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU Affero General Public License as published
+#  by the Free Software Foundation, either version 3 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU Affero General Public License for more details.
+#
+#  You should have received a copy of the GNU Affero General Public License
+#  along with this program; if not, see http://www.gnu.org/licenses
+#
+# $Id$
+
+cimport math
+cimport stdio
+from soy._internals cimport _time
+
+cdef soy._internals.LoopThread _scenes
+_scenes = soy._internals.LoopThread('SceneLoop')
+
+cimport soy.colors
+cimport soy.joints
+cimport soy.bodies
+cimport soy.fields

Deleted: trunk/pysoy/src/scenes/_prerunField.pxi
===================================================================
--- trunk/pysoy/src/scenes/_prerunField.pxi     2008-04-04 05:40:07 UTC (rev 
1223)
+++ trunk/pysoy/src/scenes/_prerunField.pxi     2008-04-04 05:50:29 UTC (rev 
1224)
@@ -1,21 +0,0 @@
-# PySoy's scenes._prerunField function
-#
-# Copyright (C) 2006,2007,2008 PySoy Group
-#
-#  This program is free software; you can redistribute it and/or modify
-#  it under the terms of the GNU Affero General Public License as published
-#  by the Free Software Foundation, either version 3 of the License, or
-#  (at your option) any later version.
-#
-#  This program is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#  GNU Affero General Public License for more details.
-#
-#  You should have received a copy of the GNU Affero General Public License
-#  along with this program; if not, see http://www.gnu.org/licenses
-#
-# $Id$
-
-cdef void _prerunField(void* key, void* value, void* user_data) :
-  (<soy.fields.Field> key)._give(1)

Copied: trunk/pysoy/src/scenes/_prerunField.pym (from rev 1220, 
trunk/pysoy/src/scenes/_prerunField.pxi)
===================================================================
--- trunk/pysoy/src/scenes/_prerunField.pym                             (rev 0)
+++ trunk/pysoy/src/scenes/_prerunField.pym     2008-04-04 05:50:29 UTC (rev 
1224)
@@ -0,0 +1,21 @@
+# PySoy's scenes._prerunField function
+#
+# Copyright (C) 2006,2007,2008 PySoy Group
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU Affero General Public License as published
+#  by the Free Software Foundation, either version 3 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU Affero General Public License for more details.
+#
+#  You should have received a copy of the GNU Affero General Public License
+#  along with this program; if not, see http://www.gnu.org/licenses
+#
+# $Id$
+
+cdef void _prerunField(void* key, void* value, void* user_data) :
+  (<soy.fields.Field> key)._give(1)

Deleted: trunk/pysoy/src/scenes/_runField.pxi
===================================================================
--- trunk/pysoy/src/scenes/_runField.pxi        2008-04-04 05:40:07 UTC (rev 
1223)
+++ trunk/pysoy/src/scenes/_runField.pxi        2008-04-04 05:50:29 UTC (rev 
1224)
@@ -1,21 +0,0 @@
-# PySoy's scenes._runField function
-#
-# Copyright (C) 2006,2007,2008 PySoy Group
-#
-#  This program is free software; you can redistribute it and/or modify
-#  it under the terms of the GNU Affero General Public License as published
-#  by the Free Software Foundation, either version 3 of the License, or
-#  (at your option) any later version.
-#
-#  This program is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#  GNU Affero General Public License for more details.
-#
-#  You should have received a copy of the GNU Affero General Public License
-#  along with this program; if not, see http://www.gnu.org/licenses
-#
-# $Id$
-
-cdef void _runField(void* key, void* value, void* user_data) :
-  (<soy.fields.Field> key)._commit()

Copied: trunk/pysoy/src/scenes/_runField.pym (from rev 1220, 
trunk/pysoy/src/scenes/_runField.pxi)
===================================================================
--- trunk/pysoy/src/scenes/_runField.pym                                (rev 0)
+++ trunk/pysoy/src/scenes/_runField.pym        2008-04-04 05:50:29 UTC (rev 
1224)
@@ -0,0 +1,21 @@
+# PySoy's scenes._runField function
+#
+# Copyright (C) 2006,2007,2008 PySoy Group
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU Affero General Public License as published
+#  by the Free Software Foundation, either version 3 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU Affero General Public License for more details.
+#
+#  You should have received a copy of the GNU Affero General Public License
+#  along with this program; if not, see http://www.gnu.org/licenses
+#
+# $Id$
+
+cdef void _runField(void* key, void* value, void* user_data) :
+  (<soy.fields.Field> key)._commit()

Modified: trunk/pysoy/src/scenes/soy.scenes.pyx
===================================================================
--- trunk/pysoy/src/scenes/soy.scenes.pyx       2008-04-04 05:40:07 UTC (rev 
1223)
+++ trunk/pysoy/src/scenes/soy.scenes.pyx       2008-04-04 05:50:29 UTC (rev 
1224)
@@ -25,20 +25,8 @@
               'by '+'$Author$'[9:-2]
 __version__ = 'Trunk (r'+'$Rev$'[6:-2]+')'
 
-cimport math
-cimport stdio
-from soy._internals cimport _time
-
-cdef soy._internals.LoopThread _scenes
-_scenes = soy._internals.LoopThread('SceneLoop')
-
-cimport soy.colors
-cimport soy.joints
-cimport soy.bodies
-cimport soy.fields
-
-include "_prerunField.pxi"
-include "_runField.pxi"
-include "Scene.pxi"
-include "Planar.pxi"
-include "Landscape.pxi"
+include "_prerunField.pym"
+include "_runField.pym"
+include "Scene.pym"
+include "Planar.pym"
+include "Landscape.pym"

_______________________________________________
PySoy-SVN mailing list
PySoy-SVN@pysoy.org
http://www.pysoy.org/mailman/listinfo/pysoy-svn

Reply via email to