Author: ArcRiley
Date: 2008-05-19 14:32:51 -0400 (Mon, 19 May 2008)
New Revision: 1274

Added:
   trunk/pysoy/src/materials/Textured.pym
Removed:
   trunk/pysoy/src/materials/Textured.pxi
Modified:
   trunk/pysoy/include/soy.bodies.pxd
   trunk/pysoy/include/soy.fields.pxd
   trunk/pysoy/include/soy.scenes.pxd
   trunk/pysoy/src/bodies/Body.pym
   trunk/pysoy/src/bodies/Camera.pym
   trunk/pysoy/src/fields/Field.pym
   trunk/pysoy/src/fields/Monopole.pym
   trunk/pysoy/src/materials/A.pxi
   trunk/pysoy/src/materials/B.pxi
   trunk/pysoy/src/materials/C.pxi
   trunk/pysoy/src/materials/D.pxi
   trunk/pysoy/src/materials/Material.pxi
   trunk/pysoy/src/materials/P.pxi
   trunk/pysoy/src/materials/R.pxi
   trunk/pysoy/src/materials/S.pxi
   trunk/pysoy/src/materials/V.pxi
   trunk/pysoy/src/scenes/Scene.pym
   trunk/pysoy/src/scenes/_prerunField.pym
   trunk/pysoy/src/scenes/_runField.pym
Log:
'''Pyrex 0.9.8.2 fixes''' :
  * now compiles and runs!
  * Render loop is not set nogil yet - this still needs to be done



Modified: trunk/pysoy/include/soy.bodies.pxd
===================================================================
--- trunk/pysoy/include/soy.bodies.pxd  2008-05-19 07:06:56 UTC (rev 1273)
+++ trunk/pysoy/include/soy.bodies.pxd  2008-05-19 18:32:51 UTC (rev 1274)
@@ -78,7 +78,7 @@
   cdef void                     _copyFrom                ( self, ode.dReal* )
   cdef void                     _addForce                ( self, ode.dVector3 )
   # WindowLoop functions
-  cdef void                     _render                  ( self )         nogil
+  cdef void                     _render                  ( self )        #nogil
   cdef void                     _calcFogCoords           ( self )         nogil
   cdef void                     _getModelviewInv         ( self, float* ) nogil
 
@@ -89,7 +89,7 @@
   cdef int                      _rpt
   cdef double                   _rtimes[16]
   # WindowLoop functions
-  cdef void                     _project                 ( self )         nogil
+  cdef void                     _project                 ( self )        #nogil
 
 
 cdef class Light (Body) :

Modified: trunk/pysoy/include/soy.fields.pxd
===================================================================
--- trunk/pysoy/include/soy.fields.pxd  2008-05-19 07:06:56 UTC (rev 1273)
+++ trunk/pysoy/include/soy.fields.pxd  2008-05-19 18:32:51 UTC (rev 1274)
@@ -26,7 +26,7 @@
   cdef int                      _apply           ( self )                 nogil
   cdef int                      _exert           ( self, 
                                                    soy.bodies.Body )      nogil
-  cdef void                     _commit          ( self )                 
+  cdef void                     _commit          ( self )                 nogil
 
 
 cdef class Monopole (Field) :

Modified: trunk/pysoy/include/soy.scenes.pxd
===================================================================
--- trunk/pysoy/include/soy.scenes.pxd  2008-05-19 07:06:56 UTC (rev 1273)
+++ trunk/pysoy/include/soy.scenes.pxd  2008-05-19 18:32:51 UTC (rev 1274)
@@ -46,8 +46,8 @@
     float uy
     float uz
 
-cdef void _prerunField(void*, void*, void*)
-cdef void _runField(void*, void*, void*)
+cdef void _prerunField(void*, void*, void*) nogil
+cdef void _runField(void*, void*, void*) nogil
 
 cdef class Scene (soy._internals.Loopable) :
   cdef ode.dWorldID               _worldID

Modified: trunk/pysoy/src/bodies/Body.pym
===================================================================
--- trunk/pysoy/src/bodies/Body.pym     2008-05-19 07:06:56 UTC (rev 1273)
+++ trunk/pysoy/src/bodies/Body.pym     2008-05-19 18:32:51 UTC (rev 1274)
@@ -452,7 +452,7 @@
   # WindowLoop Functions
   #
 
-  cdef void _render(self) nogil :
+  cdef void _render(self) :
     cdef gl.GLfloat _mtx[16]
     #
     ######################################

Modified: trunk/pysoy/src/bodies/Camera.pym
===================================================================
--- trunk/pysoy/src/bodies/Camera.pym   2008-05-19 07:06:56 UTC (rev 1273)
+++ trunk/pysoy/src/bodies/Camera.pym   2008-05-19 18:32:51 UTC (rev 1274)
@@ -111,7 +111,7 @@
   # WindowLoop Functions
   #
 
-  cdef void _project(self) nogil :
+  cdef void _project(self) :
     cdef gl.GLfloat  _mtx[16]
     #
     # Bail now if in the abyss

Modified: trunk/pysoy/src/fields/Field.pym
===================================================================
--- trunk/pysoy/src/fields/Field.pym    2008-05-19 07:06:56 UTC (rev 1273)
+++ trunk/pysoy/src/fields/Field.pym    2008-05-19 18:32:51 UTC (rev 1274)
@@ -86,7 +86,7 @@
     return
 
 
-  cdef void _commit(self) :
+  cdef void _commit(self) nogil :
     # This function is called by the physics cycle after every call to _exert
     # has been done
     return

Modified: trunk/pysoy/src/fields/Monopole.pym
===================================================================
--- trunk/pysoy/src/fields/Monopole.pym 2008-05-19 07:06:56 UTC (rev 1273)
+++ trunk/pysoy/src/fields/Monopole.pym 2008-05-19 18:32:51 UTC (rev 1274)
@@ -43,9 +43,9 @@
     return 0
 
 
-  cdef void _commit(self) :
+  cdef void _commit(self) nogil :
     cdef int _i
-    cdef soy.bodies.Body _other
+    cdef void* _other
     # single dimension distances
     cdef float xd, yd, zd, f, mm2
     # direct distances
@@ -54,27 +54,28 @@
     cdef ode.dMass m2
     self._affected._iterStart()
     for _i from 0 <= _i < self._affected._current :
-      _other = <soy.bodies.Body> self._affected._list[_i]
+      _other = self._affected._list[_i]
       # get distances
-      xd = _other._position[0] - self._position[0]
-      yd = _other._position[1] - self._position[1]
-      zd = _other._position[2] - self._position[2]
+      xd = (<soy.bodies.Body> _other)._position[0] - self._position[0]
+      yd = (<soy.bodies.Body> _other)._position[1] - self._position[1]
+      zd = (<soy.bodies.Body> _other)._position[2] - self._position[2]
       # calculate direct distances
       d2 = powf(xd, 2) + powf(yd, 2) + powf(zd, 2)
       if d2 != 0 :
         d = powf(d2, 0.5)
         # get other mass
-        mm2 = _other._mass.mass
-        if _other._tags._has_key("bmass") :
-          mm2 = _other._tags._lookup("bmass")
+        mm2 = (<soy.bodies.Body> _other)._mass.mass
+        if (<soy.bodies.Body> _other)._tags._has_key("bmass") :
+          mm2 = (<soy.bodies.Body> _other)._tags._lookup("bmass")
         # calculate force
         f = self._multiplier * self._mass.mass * mm2 / d2
         # apply force as a vector
-        ode.dBodyAddForce((<soy.bodies.Body> 
-                          _other)._bodyID, f * xd / d, f * yd / d, f * zd /d)
+        ode.dBodyAddForce((<soy.bodies.Body> _other)._bodyID,
+                          f * xd / d, f * yd / d, f * zd /d)
     self._affected._iterDone()
     self._affected._empty()
   
+
   ############################################################################
   #
   # Properties

Modified: trunk/pysoy/src/materials/A.pxi
===================================================================
--- trunk/pysoy/src/materials/A.pxi     2008-05-19 07:06:56 UTC (rev 1273)
+++ trunk/pysoy/src/materials/A.pxi     2008-05-19 18:32:51 UTC (rev 1274)
@@ -23,6 +23,7 @@
      This default material is intended to look like green aventurine
   '''
   def __init__(self) :
+    import soy.colors
     self.ambient = soy.colors.aventurine
     self.diffuse = soy.colors.aventurine
     self.specular = soy.colors.teal

Modified: trunk/pysoy/src/materials/B.pxi
===================================================================
--- trunk/pysoy/src/materials/B.pxi     2008-05-19 07:06:56 UTC (rev 1273)
+++ trunk/pysoy/src/materials/B.pxi     2008-05-19 18:32:51 UTC (rev 1274)
@@ -23,6 +23,7 @@
      This default material is intended to look like the igneous rock - basalt
   '''
   def __init__(self) :
+    import soy.colors
     self.ambient = soy.colors.basalt
     self.diffuse = soy.colors.basalt
     self.specular = soy.colors.basalt

Modified: trunk/pysoy/src/materials/C.pxi
===================================================================
--- trunk/pysoy/src/materials/C.pxi     2008-05-19 07:06:56 UTC (rev 1273)
+++ trunk/pysoy/src/materials/C.pxi     2008-05-19 18:32:51 UTC (rev 1274)
@@ -23,6 +23,7 @@
      This default material is intended to look like copper
   '''
   def __init__(self) :
+    import soy.colors
     self.ambient = soy.colors.copper
     self.diffuse = soy.colors.copper
     self.specular = soy.colors.yellow
@@ -35,6 +36,7 @@
      This default material is intended to look like the crystal of Copper(II) 
Sulfate
   '''
   def __init__(self) :
+    import soy.colors
     self.ambient = soy.colors.copperSulfate
     self.diffuse = soy.colors.copperSulfate
     self.specular = soy.colors.veryLightBlueGreen

Modified: trunk/pysoy/src/materials/D.pxi
===================================================================
--- trunk/pysoy/src/materials/D.pxi     2008-05-19 07:06:56 UTC (rev 1273)
+++ trunk/pysoy/src/materials/D.pxi     2008-05-19 18:32:51 UTC (rev 1274)
@@ -23,6 +23,7 @@
      This default material is intended to look like dark wood
   '''
   def __init__(self) :
+    import soy.colors
     self.ambient = soy.colors.darkWood
     self.diffuse = soy.colors.darkWood
     self.specular = soy.colors.darkWood

Modified: trunk/pysoy/src/materials/Material.pxi
===================================================================
--- trunk/pysoy/src/materials/Material.pxi      2008-05-19 07:06:56 UTC (rev 
1273)
+++ trunk/pysoy/src/materials/Material.pxi      2008-05-19 18:32:51 UTC (rev 
1274)
@@ -31,6 +31,7 @@
   def __cinit__(self, color=None, ambient=None, diffuse=None, specular=None,
                 shininess=0.5,
                 normal=None, normalisation_cube_map=None) :
+    import soy.colors
     if color :
       self._color = color
     else :

Modified: trunk/pysoy/src/materials/P.pxi
===================================================================
--- trunk/pysoy/src/materials/P.pxi     2008-05-19 07:06:56 UTC (rev 1273)
+++ trunk/pysoy/src/materials/P.pxi     2008-05-19 18:32:51 UTC (rev 1274)
@@ -23,6 +23,7 @@
      This material is intended to look like Yule Marble
   '''
   def __init__(self):
+    import soy.colors
     self.ambient = soy.colors.white
     self.diffuse = soy.colors.white
     self.specular = soy.colors.lightPink

Modified: trunk/pysoy/src/materials/R.pxi
===================================================================
--- trunk/pysoy/src/materials/R.pxi     2008-05-19 07:06:56 UTC (rev 1273)
+++ trunk/pysoy/src/materials/R.pxi     2008-05-19 18:32:51 UTC (rev 1274)
@@ -23,6 +23,7 @@
      This default material is intended to look like rhodonite, a pink gem.
   '''
   def __init__(self):
+    import soy.colors
     self.ambient = soy.colors.deepPink
     self.diffuse = soy.colors.pink
     self.specular = soy.colors.lightPink

Modified: trunk/pysoy/src/materials/S.pxi
===================================================================
--- trunk/pysoy/src/materials/S.pxi     2008-05-19 07:06:56 UTC (rev 1273)
+++ trunk/pysoy/src/materials/S.pxi     2008-05-19 18:32:51 UTC (rev 1274)
@@ -23,6 +23,7 @@
      This default material is intended to look like stainless steel.
   '''
   def __init__(self) :
+    import soy.colors
     self.ambient = soy.colors.stainlessSteel
     self.diffuse = soy.colors.stainlessSteel
     self.specular = soy.colors.white

Deleted: trunk/pysoy/src/materials/Textured.pxi
===================================================================
--- trunk/pysoy/src/materials/Textured.pxi      2008-05-19 07:06:56 UTC (rev 
1273)
+++ trunk/pysoy/src/materials/Textured.pxi      2008-05-19 18:32:51 UTC (rev 
1274)
@@ -1,237 +0,0 @@
-# PySoy's materials.Textured 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: Material.pxi 1206 2008-03-22 18:42:26Z ArcRiley $
-
-cdef class Textured(Material) :
-  '''soy.materials.Textured
-
-    Textured materials support one or more basic textures in addition to the
-    standard Material colors (ambient, diffuse, specular, emission) which
-    are multiplied by the texture color to provide light-based shading.
-    
-    Currently .colormap and .glowmap are supported.
-  '''
-
-  ############################################################################
-  #
-  # Python functions
-  #
-
-  def __cinit__(self, 
-                soy.colors.Color ambient=None,
-                soy.colors.Color diffuse=None,
-                soy.colors.Color specular=None,
-                soy.colors.Color emissive=None,
-                float shininess=0.5,
-                soy.textures.Texture colormap=None,
-                soy.textures.Texture glowmap=None) :
-    ######################################
-    #
-    # import soy.colors locally for setting defaults
-    #
-    import soy.colors
-    #
-    ######################################
-    #
-    # assign each color as argument or default
-    #
-    # None should never be stored in these values so that
-    # we can use ._rgba without testing each first in _render
-    #
-    if ambient :
-      self._ambient = ambient
-    else :
-      self._ambient = soy.colors.white
-    if diffuse :
-      self._diffuse = diffuse
-    else :
-      self._diffuse = soy.colors.white
-    if specular :
-      self._specular = specular
-    else :
-      self._specular = soy.colors.white
-    if emissive :
-      self._emissive = emissive
-    else :
-      self._emissive = soy.colors.black
-    #
-    ######################################
-    #
-    # shininess is the size of the specularity dot
-    #
-    self._shininess = shininess
-    #
-    ######################################
-    #
-    # store the texture arguments
-    #
-    self._colormap = colormap
-    self._glowmap  = glowmap
-    #
-    ######################################
-
-
-  ############################################################################
-  #
-  # Properties
-  #
-
-  property colormap :
-    '''soy.materials.Textured.colormap
-
-    When a texture is assigned to this property a colormap texture is rendered.
-
-    In OpenGL terms, this texture is set GL_MODULATE to the lit material color
-    which provides it's shading.  Textures with an alpha component will be
-    translucent to the material's lit color, so to achieve actual translucency
-    this material's colors (ambient/diffuse) must also be translucent.
-
-    Default is None (disabled).
-    '''
-    
-    def __get__(self) :
-      return self._colormap
-
-    def __set__(self, soy.textures.Texture _value) :
-      self._colormap = _value
-
-    def __del__(self) :
-      self._colormap = None
-
-
-  property glowmap :
-    '''soy.materials.Textured.glowmap
-
-    When a texture is assigned to this property a glowmap texture is rendered.
-
-    In OpenGL terms, this texture is set GL_ADD.
-
-    Default is None (disabled).
-    '''
-    
-    def __get__(self) :
-      return self._glowmap
-
-    def __set__(self, soy.textures.Texture _value) :
-      self._glowmap = _value
-
-    def __del__(self) :
-      self._glowmap = None
-
-
-  ############################################################################
-  #
-  # General C functions
-  #
-  cdef int _isTransparent(self):
-    #
-    # textures are only translucent to the colors, so if either lack
-    # translucency this check will return False
-    # 
-    if self._colormap is not None and self._colormap._chans %2 == 1 :
-      return 0
-    if self._ambient._rgba[3] != 1.0 :
-      return 1
-    if self._diffuse._rgba[3] != 1.0 :
-      return 1
-    return 0
-
-
-  ############################################################################
-  #
-  # WindowLoop functions
-  #
-
-  cdef int _render(self, int _pass, float* _texcoords, float* _tslvs) nogil :
-    cdef int _i, _unit=0
-    ######################################
-    #
-    # Textured materials are 1-pass
-    #
-    if _pass == 0 :
-      ####################################
-      #
-      # number of shades, currently just 0 or 1
-      #
-      if self._shades == 0 :
-        gl.glShadeModel(gl.GL_SMOOTH)
-      else :
-        gl.glShadeModel(gl.GL_FLAT)
-      #
-      ####################################
-      #
-      # lit material colors and settings
-      #
-      gl.glMaterialfv(gl.GL_FRONT, gl.GL_AMBIENT,   self._ambient._rgba) 
-      gl.glMaterialfv(gl.GL_FRONT, gl.GL_DIFFUSE,   self._diffuse._rgba) 
-      gl.glMaterialfv(gl.GL_FRONT, gl.GL_SPECULAR,  self._specular._rgba) 
-      gl.glMaterialfv(gl.GL_FRONT, gl.GL_EMISSION,  self._emissive._rgba) 
-      gl.glMaterialf (gl.GL_FRONT, gl.GL_SHININESS, self._shininess)    
-      #
-      ####################################
-      #
-      # render the colormap
-      #
-      if self._colormap is not None :
-        gl.glActiveTexture(_texunits[_unit])
-        gl.glEnableClientState(gl.GL_TEXTURE_COORD_ARRAY)
-        gl.glTexCoordPointer(3,  gl.GL_FLOAT, 48, _texcoords)
-        gl.glTexEnvi(gl.GL_TEXTURE_ENV, gl.GL_TEXTURE_ENV_MODE, gl.GL_MODULATE)
-        self._colormap._enable()
-        _unit += 1
-      #
-      ####################################
-      #
-      # render the glowmap
-      #
-      if self._glowmap is not None :
-        gl.glActiveTexture(_texunits[_unit])
-        gl.glEnableClientState(gl.GL_TEXTURE_COORD_ARRAY)
-        gl.glTexCoordPointer(3,  gl.GL_FLOAT, 48, _texcoords)
-        gl.glTexEnvi(gl.GL_TEXTURE_ENV, gl.GL_TEXTURE_ENV_MODE, gl.GL_ADD)
-        gl.glEnable(gl.GL_BLEND)
-        gl.glBlendFunc(gl.GL_ONE, gl.GL_ONE)
-        self._glowmap._enable()
-        _unit += 1
-      #
-      ####################################
-      #
-      # disable what we're not using and return
-      #
-      #
-      for _i from _unit <= _i < 4 :
-        gl.glActiveTexture(_texunits[_i])
-        gl.glDisableClientState(gl.GL_TEXTURE_COORD_ARRAY)
-      return 1
-    #
-    ######################################
-    #
-    # disable textures from last pass
-    #
-    else :
-      _unit = 0
-      if self._colormap is not None :
-        gl.glActiveTexture(_texunits[_unit])
-        self._colormap._disable()
-        _unit += 1
-      if self._glowmap is not None :
-        gl.glActiveTexture(_texunits[_unit])
-        self._glowmap._disable()
-      return 0
-    #
-    ######################################

Copied: trunk/pysoy/src/materials/Textured.pym (from rev 1273, 
trunk/pysoy/src/materials/Textured.pxi)
===================================================================
--- trunk/pysoy/src/materials/Textured.pym                              (rev 0)
+++ trunk/pysoy/src/materials/Textured.pym      2008-05-19 18:32:51 UTC (rev 
1274)
@@ -0,0 +1,237 @@
+# PySoy's materials.Textured 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: Material.pxi 1206 2008-03-22 18:42:26Z ArcRiley $
+
+cdef class Textured(Material) :
+  '''soy.materials.Textured
+
+    Textured materials support one or more basic textures in addition to the
+    standard Material colors (ambient, diffuse, specular, emission) which
+    are multiplied by the texture color to provide light-based shading.
+    
+    Currently .colormap and .glowmap are supported.
+  '''
+
+  ############################################################################
+  #
+  # Python functions
+  #
+
+  def __cinit__(self, 
+                soy.colors.Color ambient=None,
+                soy.colors.Color diffuse=None,
+                soy.colors.Color specular=None,
+                soy.colors.Color emissive=None,
+                float shininess=0.5,
+                soy.textures.Texture colormap=None,
+                soy.textures.Texture glowmap=None) :
+    ######################################
+    #
+    # import soy.colors locally for setting defaults
+    #
+    import soy.colors
+    #
+    ######################################
+    #
+    # assign each color as argument or default
+    #
+    # None should never be stored in these values so that
+    # we can use ._rgba without testing each first in _render
+    #
+    if ambient :
+      self._ambient = ambient
+    else :
+      self._ambient = soy.colors.white
+    if diffuse :
+      self._diffuse = diffuse
+    else :
+      self._diffuse = soy.colors.white
+    if specular :
+      self._specular = specular
+    else :
+      self._specular = soy.colors.white
+    if emissive :
+      self._emissive = emissive
+    else :
+      self._emissive = soy.colors.black
+    #
+    ######################################
+    #
+    # shininess is the size of the specularity dot
+    #
+    self._shininess = shininess
+    #
+    ######################################
+    #
+    # store the texture arguments
+    #
+    self._colormap = colormap
+    self._glowmap  = glowmap
+    #
+    ######################################
+
+
+  ############################################################################
+  #
+  # Properties
+  #
+
+  property colormap :
+    '''soy.materials.Textured.colormap
+
+    When a texture is assigned to this property a colormap texture is rendered.
+
+    In OpenGL terms, this texture is set GL_MODULATE to the lit material color
+    which provides it's shading.  Textures with an alpha component will be
+    translucent to the material's lit color, so to achieve actual translucency
+    this material's colors (ambient/diffuse) must also be translucent.
+
+    Default is None (disabled).
+    '''
+    
+    def __get__(self) :
+      return self._colormap
+
+    def __set__(self, soy.textures.Texture _value) :
+      self._colormap = _value
+
+    def __del__(self) :
+      self._colormap = None
+
+
+  property glowmap :
+    '''soy.materials.Textured.glowmap
+
+    When a texture is assigned to this property a glowmap texture is rendered.
+
+    In OpenGL terms, this texture is set GL_ADD.
+
+    Default is None (disabled).
+    '''
+    
+    def __get__(self) :
+      return self._glowmap
+
+    def __set__(self, soy.textures.Texture _value) :
+      self._glowmap = _value
+
+    def __del__(self) :
+      self._glowmap = None
+
+
+  ############################################################################
+  #
+  # General C functions
+  #
+  cdef int _isTransparent(self):
+    #
+    # textures are only translucent to the colors, so if either lack
+    # translucency this check will return False
+    # 
+    if self._colormap is not None and self._colormap._chans %2 == 1 :
+      return 0
+    if self._ambient._rgba[3] != 1.0 :
+      return 1
+    if self._diffuse._rgba[3] != 1.0 :
+      return 1
+    return 0
+
+
+  ############################################################################
+  #
+  # WindowLoop functions
+  #
+
+  cdef int _render(self, int _pass, float* _texcoords, float* _tslvs) nogil :
+    cdef int _i, _unit=0
+    ######################################
+    #
+    # Textured materials are 1-pass
+    #
+    if _pass == 0 :
+      ####################################
+      #
+      # number of shades, currently just 0 or 1
+      #
+      if self._shades == 0 :
+        gl.glShadeModel(gl.GL_SMOOTH)
+      else :
+        gl.glShadeModel(gl.GL_FLAT)
+      #
+      ####################################
+      #
+      # lit material colors and settings
+      #
+      gl.glMaterialfv(gl.GL_FRONT, gl.GL_AMBIENT,   self._ambient._rgba) 
+      gl.glMaterialfv(gl.GL_FRONT, gl.GL_DIFFUSE,   self._diffuse._rgba) 
+      gl.glMaterialfv(gl.GL_FRONT, gl.GL_SPECULAR,  self._specular._rgba) 
+      gl.glMaterialfv(gl.GL_FRONT, gl.GL_EMISSION,  self._emissive._rgba) 
+      gl.glMaterialf (gl.GL_FRONT, gl.GL_SHININESS, self._shininess)    
+      #
+      ####################################
+      #
+      # render the colormap
+      #
+      if self._colormap is not None :
+        gl.glActiveTexture(_texunits[_unit])
+        gl.glEnableClientState(gl.GL_TEXTURE_COORD_ARRAY)
+        gl.glTexCoordPointer(3,  gl.GL_FLOAT, 48, _texcoords)
+        gl.glTexEnvi(gl.GL_TEXTURE_ENV, gl.GL_TEXTURE_ENV_MODE, gl.GL_MODULATE)
+        self._colormap._enable()
+        _unit += 1
+      #
+      ####################################
+      #
+      # render the glowmap
+      #
+      if self._glowmap is not None :
+        gl.glActiveTexture(_texunits[_unit])
+        gl.glEnableClientState(gl.GL_TEXTURE_COORD_ARRAY)
+        gl.glTexCoordPointer(3,  gl.GL_FLOAT, 48, _texcoords)
+        gl.glTexEnvi(gl.GL_TEXTURE_ENV, gl.GL_TEXTURE_ENV_MODE, gl.GL_ADD)
+        gl.glEnable(gl.GL_BLEND)
+        gl.glBlendFunc(gl.GL_ONE, gl.GL_ONE)
+        self._glowmap._enable()
+        _unit += 1
+      #
+      ####################################
+      #
+      # disable what we're not using and return
+      #
+      #
+      for _i from _unit <= _i < 4 :
+        gl.glActiveTexture(_texunits[_i])
+        gl.glDisableClientState(gl.GL_TEXTURE_COORD_ARRAY)
+      return 1
+    #
+    ######################################
+    #
+    # disable textures from last pass
+    #
+    else :
+      _unit = 0
+      if self._colormap is not None :
+        gl.glActiveTexture(_texunits[_unit])
+        self._colormap._disable()
+        _unit += 1
+      if self._glowmap is not None :
+        gl.glActiveTexture(_texunits[_unit])
+        self._glowmap._disable()
+      return 0
+    #
+    ######################################


Property changes on: trunk/pysoy/src/materials/Textured.pym
___________________________________________________________________
Added: svn:mergeinfo
   + 

Modified: trunk/pysoy/src/materials/V.pxi
===================================================================
--- trunk/pysoy/src/materials/V.pxi     2008-05-19 07:06:56 UTC (rev 1273)
+++ trunk/pysoy/src/materials/V.pxi     2008-05-19 18:32:51 UTC (rev 1274)
@@ -23,6 +23,7 @@
      This class is intended to look like Red Velvet
   '''
   def __init__(self) :
+    import soy.colors
     self.ambient = soy.colors.red
     self.diffuse = soy.colors.red
     self.specular = soy.colors.red

Modified: trunk/pysoy/src/scenes/Scene.pym
===================================================================
--- trunk/pysoy/src/scenes/Scene.pym    2008-05-19 07:06:56 UTC (rev 1273)
+++ trunk/pysoy/src/scenes/Scene.pym    2008-05-19 18:32:51 UTC (rev 1274)
@@ -113,7 +113,8 @@
       self._giveFields._foreach(_prerunField, NULL)
       self._callFields._empty()
       ode.dSpaceCollide(self._spaceID, <void*> self,
-                        <void(*)(void*, ode.dGeomID, ode.dGeomID)> 
Scene._callback)
+                        <void(*)(void*, ode.dGeomID, ode.dGeomID) nogil>
+                        Scene._callback)
       ode.dWorldQuickStep(self._worldID, self._stepSize)
       ode.dJointGroupEmpty(self._contactGroup)
       if _i != 0 :

Modified: trunk/pysoy/src/scenes/_prerunField.pym
===================================================================
--- trunk/pysoy/src/scenes/_prerunField.pym     2008-05-19 07:06:56 UTC (rev 
1273)
+++ trunk/pysoy/src/scenes/_prerunField.pym     2008-05-19 18:32:51 UTC (rev 
1274)
@@ -17,5 +17,5 @@
 #
 # $Id$
 
-cdef void _prerunField(void* key, void* value, void* user_data) :
+cdef void _prerunField(void* key, void* value, void* user_data) nogil :
   (<soy.fields.Field> key)._give(1)

Modified: trunk/pysoy/src/scenes/_runField.pym
===================================================================
--- trunk/pysoy/src/scenes/_runField.pym        2008-05-19 07:06:56 UTC (rev 
1273)
+++ trunk/pysoy/src/scenes/_runField.pym        2008-05-19 18:32:51 UTC (rev 
1274)
@@ -17,5 +17,5 @@
 #
 # $Id$
 
-cdef void _runField(void* key, void* value, void* user_data) :
+cdef void _runField(void* key, void* value, void* user_data) nogil :
   (<soy.fields.Field> key)._commit()

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

Reply via email to