Author: ArcRiley
Date: 2008-03-08 20:09:59 -0500 (Sat, 08 Mar 2008)
New Revision: 1108

Removed:
   trunk/pysoy/src/fields/Generic.pxi
Modified:
   trunk/pysoy/src/fields/Buoyancy.pxi
   trunk/pysoy/src/fields/Field.pxi
   trunk/pysoy/src/fields/Monopole.pxi
   trunk/pysoy/src/fields/Shockwave.pxi
   trunk/pysoy/src/fields/Wind.pxi
   trunk/pysoy/src/fields/soy.fields.pxd
   trunk/pysoy/src/fields/soy.fields.pyx
Log:
Ticket #943 :
  * upgraded API for fields
  * removed unused "GENERIC" field file, was this intended as a stub?


Modified: trunk/pysoy/src/fields/Buoyancy.pxi
===================================================================
--- trunk/pysoy/src/fields/Buoyancy.pxi 2008-03-09 00:58:21 UTC (rev 1107)
+++ trunk/pysoy/src/fields/Buoyancy.pxi 2008-03-09 01:09:59 UTC (rev 1108)
@@ -1,4 +1,4 @@
-# PySoy Buoyancy Class
+# PySoy's fields.Buoyancy class
 #
 # Copyright (C) 2006,2007,2008 PySoy Group
 #
@@ -17,8 +17,8 @@
 #
 # $Id$
 
-cdef class Buoyancy(soy.bodies.fields.Field) :
-  '''PySoy Bouyancy
+cdef class Buoyancy (Field) :
+  '''soy.fields.Buoyancy
 
     Adjusts the mass Monopole works based on
   '''
@@ -29,16 +29,16 @@
 
   cdef void _give(self, int _ccycle) :
     cdef int _i
-    cdef soy.bodies._bodies.Body _otherBody
+    cdef soy.bodies.Body _otherBody
     if (self._shape != NULL) ^ (_ccycle == 0) :
       self._affected._iterStart()
       for _i from 0 <= _i < self._affected._current :
-        _otherBody = <soy.bodies._bodies.Body> self._affected._list[_i]
+        _otherBody = <soy.bodies.Body> self._affected._list[_i]
         _otherBody._tags._remove("bmass")
       self._affected._iterDone()
       self._affected.empty()
 
-  cdef int _exert(self, soy.bodies._bodies.Body _otherBody) :
+  cdef int _exert(self, soy.bodies.Body _otherBody) :
     cdef float _radius, _submersion
     cdef soy.shapes.Shape _otherShape
     ode.dBodyGetMass(_otherBody._bodyID, &_otherBody._mass)

Modified: trunk/pysoy/src/fields/Field.pxi
===================================================================
--- trunk/pysoy/src/fields/Field.pxi    2008-03-09 00:58:21 UTC (rev 1107)
+++ trunk/pysoy/src/fields/Field.pxi    2008-03-09 01:09:59 UTC (rev 1108)
@@ -1,4 +1,4 @@
-# PySoy Field Class
+# PySoy's fields.Field class
 #
 # Copyright (C) 2006,2007,2008 PySoy Group
 #
@@ -17,8 +17,8 @@
 #
 # $Id$
 
-cdef class Field(soy.bodies._bodies.Body) :
-  '''PySoy Field
+cdef class Field (soy.bodies.Body) :
+  '''soy.fields.Field
 
     Fields are optionally visible generic objects in 3d space that apply
     forces and other changes to other bodies.
@@ -34,12 +34,12 @@
     if not self._shape :
       # Do we need an iterlock here?
       for _i from 0 <= _i < _scene._bodies._current :
-        if not self._exert(<soy.bodies._bodies.Body> 
+        if not self._exert(<soy.bodies.Body> 
                            _scene._bodies._list[_i]) :
           _r = 0
     return _r
 
-  cdef int _exert(self, soy.bodies._bodies.Body _other) :
+  cdef int _exert(self, soy.bodies.Body _other) :
     return 1
 
   cdef void _give(self, int _data) :

Deleted: trunk/pysoy/src/fields/Generic.pxi
===================================================================
--- trunk/pysoy/src/fields/Generic.pxi  2008-03-09 00:58:21 UTC (rev 1107)
+++ trunk/pysoy/src/fields/Generic.pxi  2008-03-09 01:09:59 UTC (rev 1108)
@@ -1,30 +0,0 @@
-# PySoy GENERIC 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 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 General Public License for more details.
-#
-#  You should have received a copy of the GNU General Public License
-#  along with this program; if not, see http://www.gnu.org/licenses
-#
-# $Id$
-
-cdef class GENERIC(soy.bodies.fields.Field) :
-  '''PySoy GENERIC
-
-     
-  '''
-
-  def __cinit__(self, soy.scenes.Scene parent, *args, **keywords) :
-    return
-
-  cdef int _exert(self, soy.bodies._bodies.Body other) :
-    return 1

Modified: trunk/pysoy/src/fields/Monopole.pxi
===================================================================
--- trunk/pysoy/src/fields/Monopole.pxi 2008-03-09 00:58:21 UTC (rev 1107)
+++ trunk/pysoy/src/fields/Monopole.pxi 2008-03-09 01:09:59 UTC (rev 1108)
@@ -1,4 +1,4 @@
-# PySoy Monopole Class
+# PySoy's fields.Monopole class
 #
 # Copyright (C) 2006,2007,2008 PySoy Group
 #
@@ -17,8 +17,8 @@
 #
 # $Id$
 
-cdef class Monopole(soy.bodies.fields.Field) :
-  '''PySoy Monopole
+cdef class Monopole (Field) :
+  '''soy.fields.Monopole
 
     Monopoles are invisible fields that either attract or repulse other
     bodies in the entire scene based on an inverse square law.
@@ -28,14 +28,14 @@
     self._multiplier = 0
     self._affected = soy._internals.Children()
 
-  cdef int _exert(self, soy.bodies._bodies.Body other) :
+  cdef int _exert(self, soy.bodies.Body other) :
     self._affected._append(<void*> other)
     return 0
 
 
   cdef void _commit(self) :
     cdef int _i
-    cdef soy.bodies._bodies.Body _other
+    cdef soy.bodies.Body _other
     # single dimension distances
     cdef float xd, yd, zd, f, mm2
     # direct distances
@@ -44,7 +44,7 @@
     cdef ode.dMass m2
     self._affected._iterStart()
     for _i from 0 <= _i < self._affected._current :
-      _other = <soy.bodies._bodies.Body> self._affected._list[_i]
+      _other = <soy.bodies.Body> self._affected._list[_i]
       # get distances
       xd = _other._position[0] - self._position[0]
       yd = _other._position[1] - self._position[1]
@@ -60,7 +60,7 @@
         # calculate force
         f = self._multiplier * self._mass.mass * mm2 / d2
         # apply force as a vector
-        ode.dBodyAddForce((<soy.bodies._bodies.Body> 
+        ode.dBodyAddForce((<soy.bodies.Body> 
                           _other)._bodyID, f * xd / d, f * yd / d, f * zd /d)
     self._affected._iterDone()
     self._affected._empty()

Modified: trunk/pysoy/src/fields/Shockwave.pxi
===================================================================
--- trunk/pysoy/src/fields/Shockwave.pxi        2008-03-09 00:58:21 UTC (rev 
1107)
+++ trunk/pysoy/src/fields/Shockwave.pxi        2008-03-09 01:09:59 UTC (rev 
1108)
@@ -1,4 +1,4 @@
-# PySoy Shockwave Class
+# PySoy's fields.Shockwave class
 #
 # Copyright (C) 2006,2007,2008 PySoy Group
 #
@@ -17,8 +17,8 @@
 #
 # $Id$
 
-cdef class Shockwave(soy.bodies.fields.Field) :
-  '''PySoy Shockwave
+cdef class Shockwave (Field) :
+  '''soy.fields.Shockwave
 
     Models an constant-rate expanding shockwave
   '''
@@ -29,7 +29,7 @@
   def __dealloc__(self) :
     ode.dSpaceDestroy (self._space)
 
-  cdef int _exert(self, soy.bodies._bodies.Body other) :
+  cdef int _exert(self, soy.bodies.Body other) :
     cdef float depth, force, dx, dy, dz, d
     stdio.printf("begin exert\n")
     # Give up if not active
@@ -55,9 +55,9 @@
       dz = force * dz / d
       # Apply the force vector either at the center of pressure or the generic 
center
       if other._tags._has_key('cpx') and other._tags._has_key('cpy') and 
other._tags._has_key('cpz') :
-        ode.dBodyAddForceAtRelPos((<soy.bodies._bodies.Body> other)._bodyID, 
dx, dy, dz, other._tags._lookup('cpx'), other._tags._lookup('cpy'), 
other._tags._lookup('cpz'))
+        ode.dBodyAddForceAtRelPos((<soy.bodies.Body> other)._bodyID, dx, dy, 
dz, other._tags._lookup('cpx'), other._tags._lookup('cpy'), 
other._tags._lookup('cpz'))
       else :
-        ode.dBodyAddForce((<soy.bodies._bodies.Body> other)._bodyID, dx, dy, 
dz)
+        ode.dBodyAddForce((<soy.bodies.Body> other)._bodyID, dx, dy, dz)
       stdio.printf("exert done\n")
       return 1
 

Modified: trunk/pysoy/src/fields/Wind.pxi
===================================================================
--- trunk/pysoy/src/fields/Wind.pxi     2008-03-09 00:58:21 UTC (rev 1107)
+++ trunk/pysoy/src/fields/Wind.pxi     2008-03-09 01:09:59 UTC (rev 1108)
@@ -1,4 +1,4 @@
-# PySoy Wind Class
+# PySoy's fields.Wind class
 #
 # Copyright (C) 2006,2007,2008 PySoy Group
 #
@@ -17,8 +17,8 @@
 #
 # $Id$
 
-cdef class Wind(soy.bodies.fields.Field) :
-  '''PySoy Wind
+cdef class Wind (Field) :
+  '''soy.fields.Wind
 
     Affects bodies according to their tags 'cd' and 'cpx','cpy','cpz'
   '''
@@ -27,7 +27,7 @@
     return
 
   # TODO incomplete: needs area measurements rather than assumptions
-  cdef int _exert(self, soy.bodies._bodies.Body other) :
+  cdef int _exert(self, soy.bodies.Body other) :
     cdef float dx, dy, dz, d2, r, f
     if other._tags._has_key('cd') :
       dx = self._vx - other._linearVel[0]
@@ -38,9 +38,9 @@
         f = 0.5 * self._density * d2 * other._tags._lookup('cd')
         r = f / powf(d2, 0.5)
         if other._tags._has_key('cpx') and other._tags._has_key('cpy') and 
other._tags._has_key('cpz') :
-          ode.dBodyAddForceAtRelPos((<soy.bodies._bodies.Body> other)._bodyID, 
r * dx, r * dy, r * dz, other._tags._lookup('cpx'), other._tags._lookup('cpy'), 
other._tags._lookup('cpz'))
+          ode.dBodyAddForceAtRelPos((<soy.bodies.Body> other)._bodyID, r * dx, 
r * dy, r * dz, other._tags._lookup('cpx'), other._tags._lookup('cpy'), 
other._tags._lookup('cpz'))
         else : 
-          ode.dBodyAddForce((<soy.bodies._bodies.Body> other)._bodyID, r * dx, 
r * dy, r * dz)
+          ode.dBodyAddForce((<soy.bodies.Body> other)._bodyID, r * dx, r * dy, 
r * dz)
     return 1
 
   property vector :

Modified: trunk/pysoy/src/fields/soy.fields.pxd
===================================================================
--- trunk/pysoy/src/fields/soy.fields.pxd       2008-03-09 00:58:21 UTC (rev 
1107)
+++ trunk/pysoy/src/fields/soy.fields.pxd       2008-03-09 01:09:59 UTC (rev 
1108)
@@ -1,4 +1,4 @@
-# PySoy Forces Declarations
+# PySoy's fields Declarations
 #
 # Copyright (C) 2006,2007,2008 PySoy Group
 #
@@ -17,30 +17,28 @@
 #
 #  $Id$
 
-cimport gl
 cimport ode
-cimport stdio
 cimport soy._internals
-cimport soy.bodies._bodies
+cimport soy.bodies
 
-cdef class Field(soy.bodies._bodies.Body) :
+cdef class Field (soy.bodies.Body) :
   cdef void             _give(self, int ccyle)
   cdef int              _apply(self)
-  cdef int              _exert(self, soy.bodies._bodies.Body other)
+  cdef int              _exert(self, soy.bodies.Body other)
   cdef void             _commit(self)
   cdef void             _render(self)
 
-cdef class Monopole(soy.bodies.fields.Field) :
+cdef class Monopole (Field) :
   cdef soy._internals.Children  _affected
   cdef float                   _multiplier
 
-cdef class Wind(soy.bodies.fields.Field) :
+cdef class Wind (Field) :
   cdef float            _density
   cdef float            _vx
   cdef float            _vy
   cdef float            _vz
 
-cdef class Shockwave(soy.bodies.fields.Field) :
+cdef class Shockwave (Field) :
   cdef ode.dSpaceID             _space
   cdef float                    _radius
   cdef double                   _t0
@@ -50,7 +48,7 @@
   cdef float                    _length
   cdef float                    _energy
 
-cdef class Buoyancy(soy.bodies.fields.Field) :
+cdef class Buoyancy (Field) :
   cdef soy._internals.Children  _affected
   cdef float                    _density
 

Modified: trunk/pysoy/src/fields/soy.fields.pyx
===================================================================
--- trunk/pysoy/src/fields/soy.fields.pyx       2008-03-09 00:58:21 UTC (rev 
1107)
+++ trunk/pysoy/src/fields/soy.fields.pyx       2008-03-09 01:09:59 UTC (rev 
1108)
@@ -24,6 +24,7 @@
               'by '+'$Author$'[9:-2]
 __version__ = 'Trunk (r'+'$Rev$'[6:-2]+')'
 
+cimport stdio
 cimport soy.scenes
 cimport soy.shapes
 import soy.shapes

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

Reply via email to