Author: DavidCzech
Date: 2008-02-22 14:11:07 -0500 (Fri, 22 Feb 2008)
New Revision: 964

Modified:
   trunk/pysoy/src/scenes/Planar.pxi
   trunk/pysoy/src/scenes/Scene.pxi
   trunk/pysoy/src/scenes/soy.scenes.pxd
Log:
More work on #928

Modified: trunk/pysoy/src/scenes/Planar.pxi
===================================================================
--- trunk/pysoy/src/scenes/Planar.pxi   2008-02-22 00:34:55 UTC (rev 963)
+++ trunk/pysoy/src/scenes/Planar.pxi   2008-02-22 19:11:07 UTC (rev 964)
@@ -1,58 +1,66 @@
-# PySoy's scenes.Planar
-#
-# 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 Planar (Scene) :
-  ''' Planar Scene
-
-    This is a scene based on a collision plane of infinite size facing up in 
-    the direction of gravity.
-  '''
-  # Notes
-  # http://www.pysoy.org/ticket/928
-  # axis for gravity
-  # http://www.ode.org/ode-latest-userguide.html#sec_10_7_3
-  # plane and heightfield are the only geoms which collide with everything as 
-  # expected EXCEPT themselves and each other
-  #
-  # Don't try to get the same effect by setting a very high mass/inertia on 
-  # the ``motionless'' body and then resetting it's position/orientation on 
-  # each time step. This can cause unexpected simulation errors.
-
-  def __cinit__(self, *args, **kw) :
-    self._planeID = ode.dCreatePlane(self._spaceID, 0.0, -1.0, 0.0, -1.0)
-    #self._planeID = ode.dCreateBox(self._spaceID, 0.1, 0.1, 0.1)
-    ode.dGeomSetData(self._planeID, <void*> self)
-    stdio.printf("asdf")
-
-  def __delalloc__(self) :
-    ode.dGeomDestroy(self._planeID)
-
-    '''
-  cdef void _coreRender(self) :
-    Scene._coreRender(self)
-    gl.glBegin(gl.GL_TRIANGLE_STRIP)
-    #gl.glNormal3f(0, 1, 0)
-    gl.glVertex3f(1,0,0)
-    gl.glVertex3f(-1,0,0)
-    gl.glVertex3f(0,0,-1)
-    gl.glVertex3f(0,0,1)
-    gl.glVertex3f(1,0,0)
-    gl.glEnd()
-    
-  '''
+# PySoy's scenes.Planar
+#
+# 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$
+DEF GeomScene = 1
+DEF GeomBody = 2
+DEF GeomField = 4
+DEF GeomLight = 8
+
+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.
+  '''
+  # Notes
+  # http://www.pysoy.org/ticket/928
+  # axis for gravity
+  # http://www.ode.org/ode-latest-userguide.html#sec_10_7_3
+  # plane and heightfield are the only geoms which collide with everything as 
+  # expected EXCEPT themselves and each other
+  #
+  # Don't try to get the same effect by setting a very high mass/inertia on 
+  # the ``motionless'' body and then resetting it's position/orientation on 
+  # each time step. This can cause unexpected simulation errors.
+
+  def __cinit__(self, *args, **kw) :
+    self._planeID = ode.dCreatePlane(self._spaceID, 0.0, 1.0, 0.0, 0.0)
+    #self._planeID = ode.dCreateBox(self._spaceID, 0.1, 0.1, 0.1)
+    ode.dGeomSetCategoryBits(self._planeID,GeomScene)
+    ode.dGeomSetCollideBits(self._planeID,GeomBody)
+    ode.dGeomSetData(self._planeID, <void*> self)
+    
+    stdio.printf("%d",ode.dGeomGetCategoryBits(self._planeID))
+    stdio.printf("asdf")
+
+  def __delalloc__(self) :
+    ode.dGeomDestroy(self._planeID)
+
+    '''
+  cdef void _coreRender(self) :
+    Scene._coreRender(self)
+    gl.glBegin(gl.GL_TRIANGLE_STRIP)
+    #gl.glNormal3f(0, 1, 0)
+    gl.glVertex3f(1,0,0)
+    gl.glVertex3f(-1,0,0)
+    gl.glVertex3f(0,0,-1)
+    gl.glVertex3f(0,0,1)
+    gl.glVertex3f(1,0,0)
+    gl.glEnd()
+    
+  '''

Modified: trunk/pysoy/src/scenes/Scene.pxi
===================================================================
--- trunk/pysoy/src/scenes/Scene.pxi    2008-02-22 00:34:55 UTC (rev 963)
+++ trunk/pysoy/src/scenes/Scene.pxi    2008-02-22 19:11:07 UTC (rev 964)
@@ -16,7 +16,10 @@
 #  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
 cdef class Scene (soy._internals.Loopable) :
   '''PySoy Scene
 
@@ -40,6 +43,7 @@
     self._giveFields = soy._internals.PointerSet()
     self._callFields = soy._internals.PointerSet()
     _scenes._append(<void *>self)
+    #dGeomSetCategoryBits(self.someGeom?,GeomScene)
 
 
   def __dealloc__(self) :
@@ -177,7 +181,17 @@
       return
     #
     # Wham!
-    _c = ode.dCollide(_o1, _o2, 1, &_cg, sizeof(_cg))
+    if ode.dGeomGetCategoryBits(_o1) == GeomScene:
+      _c = ode.dCollide(NULL, _o2, 1, &_cg, sizeof(_cg))
+      stdio.printf("CONTACT WITH A SCENE")  
+      stdio.printf("%d",ode.dGeomGetCategoryBits(_o1))
+    elif ode.dGeomGetCategoryBits(_o2) == GeomScene:
+      _c = ode.dCollide(NULL, _o2, 1, &_cg, sizeof(_cg))
+      stdio.printf("CONTACT WITH A SCENE!\n")  
+      stdio.printf("%d",ode.dGeomGetCategoryBits(_o2))
+    else:
+      _c = ode.dCollide(_o1, _o2, 1, &_cg, sizeof(_cg))
+    stdio.printf("CONTACT WITH Something?!\n") 
     if _c > 0 :
       # Get the Body objects
       _bo1 = <soy.bodies._bodies.Body> ode.dBodyGetData(_b1)

Modified: trunk/pysoy/src/scenes/soy.scenes.pxd
===================================================================
--- trunk/pysoy/src/scenes/soy.scenes.pxd       2008-02-22 00:34:55 UTC (rev 
963)
+++ trunk/pysoy/src/scenes/soy.scenes.pxd       2008-02-22 19:11:07 UTC (rev 
964)
@@ -23,6 +23,11 @@
 cimport py
 cimport soy._internals
 
+#DEF Geom = 16
+#DEF GeomLight = 32
+#DEF GeomLight = 64
+
+
 cdef void _prerunField(void*, void*, void*)
 cdef void _runField(void*, void*, void*)
 

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

Reply via email to