Author: ArcRiley
Date: 2008-03-18 16:50:06 -0400 (Tue, 18 Mar 2008)
New Revision: 1167

Modified:
   trunk/pysoy/src/materials/Material.pxi
   trunk/pysoy/src/textures/NormalisationCubeMap.pxi
   trunk/pysoy/src/textures/Texture.pxi
   trunk/pysoy/src/textures/soy.textures.pxd
   trunk/pysoy/src/widgets/Canvas.pxi
Log:
No Ticket :
  * renamed Texture._coreBind to Texture._enable
  * renamed Texture._coreUnBind to Texture._disable
  * added many comments



Modified: trunk/pysoy/src/materials/Material.pxi
===================================================================
--- trunk/pysoy/src/materials/Material.pxi      2008-03-18 20:47:38 UTC (rev 
1166)
+++ trunk/pysoy/src/materials/Material.pxi      2008-03-18 20:50:06 UTC (rev 
1167)
@@ -98,18 +98,20 @@
     cdef gl.GLfloat _diffuse[4]
     cdef gl.GLfloat _specular[4]
     cdef gl.GLfloat _emissive[4]
-
-
+    #
+    # Get each color
     (<soy.colors.Color> self._ambient)._getRGBA(_ambient)
     (<soy.colors.Color> self._diffuse)._getRGBA(_diffuse)
     (<soy.colors.Color> self._specular)._getRGBA(_specular)
     (<soy.colors.Color> self._emissive)._getRGBA(_emissive)
-
+    #
+    #
     if self._shades == 0 :
       gl.glShadeModel(gl.GL_SMOOTH)
     else :
       gl.glShadeModel(gl.GL_FLAT)
-
+    #
+    #
     if self._shadeless:
       gl.glDisable(gl.GL_LIGHTING)
       gl.glColor4f(_diffuse[0], _diffuse[1], _diffuse[2], _diffuse[3])
@@ -121,7 +123,7 @@
       gl.glMaterialfv(gl.GL_FRONT, gl.GL_EMISSION, _emissive)
 
     if self._color :
-      (<soy.textures.Texture> self._color)._coreBind()
+      (<soy.textures.Texture> self._color)._enable()
 
     if self._has_bumpmap():
       gl.glEnable(gl.GL_BLEND)
@@ -132,9 +134,10 @@
       gl.glEnable(gl.GL_BLEND)
       gl.glBlendFunc(self._blend_func_src, self._blend_func_dst)
 
+
   cdef void _coreUnBind(self) :
     if self._color :
-      (<soy.textures.Texture> self._color)._coreUnBind()
+      (<soy.textures.Texture> self._color)._disable()
 
     if self._has_bumpmap():
       gl.glDisable(gl.GL_BLEND)
@@ -152,12 +155,12 @@
     if not _normalisation_cube_map._was_created :
       _normalisation_cube_map._generate(32,32)
     gl.glActiveTexture(gl.GL_TEXTURE0)
-    (<soy.textures.Texture> self._normal)._coreBind()
+    (<soy.textures.Texture> self._normal)._enable()
     gl.glTexEnvi(gl.GL_TEXTURE_ENV, gl.GL_TEXTURE_ENV_MODE, gl.GL_COMBINE);
     gl.glTexEnvi(gl.GL_TEXTURE_ENV, gl.GL_SOURCE0_RGB,  gl.GL_TEXTURE);
     gl.glTexEnvi(gl.GL_TEXTURE_ENV, gl.GL_COMBINE_RGB,  gl.GL_REPLACE);
     gl.glActiveTexture(gl.GL_TEXTURE1)
-    _normalisation_cube_map._coreBind()
+    _normalisation_cube_map._enable()
     gl.glTexEnvi(gl.GL_TEXTURE_ENV, gl.GL_TEXTURE_ENV_MODE, gl.GL_COMBINE);
     gl.glTexEnvi(gl.GL_TEXTURE_ENV, gl.GL_SOURCE0_RGB,  gl.GL_TEXTURE);
     gl.glTexEnvi(gl.GL_TEXTURE_ENV, gl.GL_COMBINE_RGB,  gl.GL_DOT3_RGB);
@@ -168,10 +171,10 @@
     if not self._has_bumpmap() :
       return
     gl.glActiveTexture(gl.GL_TEXTURE0)
-    (<soy.textures.Texture> self._normal)._coreUnBind()
+    (<soy.textures.Texture> self._normal)._disable()
     gl.glTexEnvi(gl.GL_TEXTURE_ENV, gl.GL_TEXTURE_ENV_MODE, gl.GL_MODULATE)
     gl.glActiveTexture(gl.GL_TEXTURE1)
-    _normalisation_cube_map._coreUnBind()
+    _normalisation_cube_map._disable()
     gl.glActiveTexture(gl.GL_TEXTURE0)
 
   property color :

Modified: trunk/pysoy/src/textures/NormalisationCubeMap.pxi
===================================================================
--- trunk/pysoy/src/textures/NormalisationCubeMap.pxi   2008-03-18 20:47:38 UTC 
(rev 1166)
+++ trunk/pysoy/src/textures/NormalisationCubeMap.pxi   2008-03-18 20:50:06 UTC 
(rev 1167)
@@ -2,7 +2,6 @@
 
 cdef class NormalisationCubeMap(Texture):
   def __cinit__(self):
-    self._mutex = py.PyThread_allocate_lock()
     self._was_created = 0
 
   def generate(self,x,y):
@@ -195,16 +194,18 @@
     gl.glTexParameteri(self._textureTarget, gl.GL_TEXTURE_WRAP_R  , 
gl.GL_CLAMP_TO_EDGE);
 
 
+  ##########################################################################
+  #
+  # WindowLoop Functions
+  #
 
-  cdef void _coreBind(self):
+  cdef void _enable(self):
     py.PyThread_acquire_lock(self._mutex,1)
-
     gl.glEnable(self._textureTarget)
     gl.glBindTexture(self._textureTarget, self._textureID)
 
-  cdef void _coreUnBind(self):
+
+  cdef void _disable(self):
     gl.glDisable(self._textureTarget)
     gl.glBindTexture(self._textureTarget, 0)
-
     py.PyThread_release_lock(self._mutex)
-

Modified: trunk/pysoy/src/textures/Texture.pxi
===================================================================
--- trunk/pysoy/src/textures/Texture.pxi        2008-03-18 20:47:38 UTC (rev 
1166)
+++ trunk/pysoy/src/textures/Texture.pxi        2008-03-18 20:50:06 UTC (rev 
1167)
@@ -22,6 +22,12 @@
 
     The base texture class which all others inherit
   '''
+
+  ############################################################################
+  #
+  # Python functions
+  #
+
   def __cinit__(self, *args, **keywords) :
     self._mutex = py.PyThread_allocate_lock()
     self._iFormats[1] = gl.GL_LUMINANCE8
@@ -39,6 +45,7 @@
     self._resize(0,0,0,0)
     py.PyThread_free_lock(self._mutex)
 
+
   ##########################################################################
   #
   # Properties
@@ -60,22 +67,27 @@
     def __del__(self) :
       self._aspect = 0.0
 
+
   property channels :
     def __get__(self) :
       return self._chans
 
+
   property width :
     def __get__(self) :
       return self._width
 
+
   property height :
     def __get__(self) :
       return self._height
 
+
   property depth :
     def __get__(self) :
       return self._depth
 
+
   property size :
     '''Texture's size
 
@@ -96,7 +108,7 @@
 
   ##########################################################################
   #
-  # General Functions
+  # General C Functions
   #
 
   cdef void _resize(self, int c, int x, int y, int z) :
@@ -139,11 +151,11 @@
 
   ##########################################################################
   #
-  # _coreLoop Functions
+  # WindowLoop Functions
   #
 
-  cdef void _coreBind(self) :
-    py.PyThread_acquire_lock(self._mutex,1)
+  cdef void _enable(self) :
+    py.PyThread_acquire_lock(self._mutex, 1)
     if self._textureTarget == gl.GL_TEXTURE_1D :
       gl.glEnable(gl.GL_TEXTURE_1D)
     elif self._textureTarget == gl.GL_TEXTURE_2D :
@@ -193,7 +205,8 @@
     #if max_size > self._width or max_size > self._height :
     #  raise ValueError('Image size exceeds max texture size, which is %d 
pixels for each side'%max_size)
 
-  cdef void _coreUnBind(self) :
+
+  cdef void _disable(self) :
     if self._textureTarget == gl.GL_TEXTURE_1D :
       gl.glDisable(gl.GL_TEXTURE_1D)
     elif self._textureTarget == gl.GL_TEXTURE_2D :
@@ -205,6 +218,12 @@
       gl.glLoadIdentity()
     py.PyThread_release_lock(self._mutex)
 
+
+  ##########################################################################
+  #
+  # TransportLoop Functions
+  #
+
   cdef int _coreLoad(self, void *_data, int _size) :
     if self._state == 0 :
       self._state = self._coreLoadPacket0(<unsigned char*> _data, _size)
@@ -224,6 +243,7 @@
     else :
       return -1
 
+
   cdef int _coreLoadPacket1(self, unsigned char *_data, int _size) :
     '''
     Currently craptacularly common code crying for completion

Modified: trunk/pysoy/src/textures/soy.textures.pxd
===================================================================
--- trunk/pysoy/src/textures/soy.textures.pxd   2008-03-18 20:47:38 UTC (rev 
1166)
+++ trunk/pysoy/src/textures/soy.textures.pxd   2008-03-18 20:50:06 UTC (rev 
1167)
@@ -39,18 +39,18 @@
   cdef float        _aspect
   cdef int          _update
   cdef gl.GLubyte  *_texels
-  #
   # Lookup Arrays
   cdef int          _iFormats[5]
   cdef int          _oFormats[5]
-  #
-  # C functions
-  cdef int          _coreLoadPacket0(self, unsigned char*, int) 
-  cdef int          _coreLoadPacket1(self, unsigned char*, int) 
-  cdef void         _coreBind(self)
-  cdef void         _coreUnBind(self)
+  # General C functions
   cdef void         _resize(self, int, int, int, int)
   cdef int          _squareup(self, int)
+  # WindowLoop functions
+  cdef void         _enable(self)
+  cdef void         _disable(self)
+  # TransportLoop functions
+  cdef int          _coreLoadPacket0(self, unsigned char*, int) 
+  cdef int          _coreLoadPacket1(self, unsigned char*, int) 
 
 
 cdef class Print (Texture) :
@@ -60,6 +60,7 @@
   cdef soy.colors.Color       _foreground
   cdef object                 _text
   cdef object                 _font
+  # General C functions
   cdef void                   _draw     ( self )
 
          
@@ -74,7 +75,4 @@
 
 cdef class NormalisationCubeMap(Texture):
   cdef int                    _was_created
-  cdef void                   _generate(self,int,int)
-  cdef void                   _coreBind(self)
-  cdef void                   _coreUnBind(self)
-
+  cdef void                   _generate(self, int, int)

Modified: trunk/pysoy/src/widgets/Canvas.pxi
===================================================================
--- trunk/pysoy/src/widgets/Canvas.pxi  2008-03-18 20:47:38 UTC (rev 1166)
+++ trunk/pysoy/src/widgets/Canvas.pxi  2008-03-18 20:50:06 UTC (rev 1167)
@@ -74,7 +74,7 @@
   cdef void _render(self) :
     if not self._texture :
       return
-    (<soy.textures.Texture> self._texture)._coreBind()
+    (<soy.textures.Texture> self._texture)._enable()
 
     if (<soy.textures.Texture> self._texture)._chans & 1:
       gl.glDisable(gl.GL_BLEND)
@@ -105,5 +105,4 @@
     else:
       gl.glDisable(gl.GL_BLEND)
 
-
-    (<soy.textures.Texture> self._texture)._coreUnBind()
+    (<soy.textures.Texture> self._texture)._disable()

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

Reply via email to