Author: ArcRiley
Date: 2007-06-22 12:59:46 -0400 (Fri, 22 Jun 2007)
New Revision: 248

Added:
   trunk/pysoy/src/materials/
   trunk/pysoy/src/materials/Material.pxi
   trunk/pysoy/src/materials/S.pxi
   trunk/pysoy/src/materials/soy.materials.pxd
   trunk/pysoy/src/materials/soy.materials.pyx
Removed:
   trunk/pysoy/src/_internals/Material.pxi
Modified:
   trunk/pysoy/scripts/__init__.py
   trunk/pysoy/setup.py
   trunk/pysoy/src/_internals/soy._internals.pxd
   trunk/pysoy/src/_internals/soy._internals.pyx
   trunk/pysoy/src/bodies._bodies/Mesh.pxi
   trunk/pysoy/src/bodies._bodies/soy.bodies._bodies.pxd
Log:
moving Material to it's own extension for future presets (ala soy.colors)



Modified: trunk/pysoy/scripts/__init__.py
===================================================================
--- trunk/pysoy/scripts/__init__.py     2007-06-22 07:13:42 UTC (rev 247)
+++ trunk/pysoy/scripts/__init__.py     2007-06-22 16:59:46 UTC (rev 248)
@@ -25,5 +25,6 @@
 import atoms
 import bodies
 import colors
+import materials
 import textures
 import widgets

Modified: trunk/pysoy/setup.py
===================================================================
--- trunk/pysoy/setup.py        2007-06-22 07:13:42 UTC (rev 247)
+++ trunk/pysoy/setup.py        2007-06-22 16:59:46 UTC (rev 248)
@@ -28,13 +28,14 @@
 
 version = 'Trunk'
 modules = {
-  '_internals'       : ['GL'],
+  '_internals'       : [],
   'atoms'            : [],
   'bodies._bodies'   : ['GLEW','GL','ode'],
   'bodies.fields'    : ['GL','ode'],
   'bodies.joints'    : ['GL','ode'],
   'colors'           : ['GL'],  
-  'textures'         : [],  
+  'materials'        : ['GL'],
+  'textures'         : ['GL'],  
   'widgets'          : ['GLEW','GL','GLU'], 
 }
 

Deleted: trunk/pysoy/src/_internals/Material.pxi
===================================================================
--- trunk/pysoy/src/_internals/Material.pxi     2007-06-22 07:13:42 UTC (rev 
247)
+++ trunk/pysoy/src/_internals/Material.pxi     2007-06-22 16:59:46 UTC (rev 
248)
@@ -1,67 +0,0 @@
-# PySoy _internals.Material class
-#
-# Copyright (C) 2007 Team PySoy
-#
-#  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
-#  or write to the Free Software Foundation,Inc., 51 Franklin Street,
-#  Fifth Floor, Boston, MA 02110-1301  USA
-#
-# $Id$
-
-cimport gl
-cimport stdio
-cimport soy.colors
-cimport soy.textures
-
-cdef class Material :
-  '''PySoy Material
-
-     shared material for many visible objects
-  '''
-  def __new__(self, color=None) :
-    if color :
-      self._color = color
-    else :
-      self._color = soy.colors.White()
-
-  def __repr__(self) :
-    return '<Material>'
-
-  cdef void _render(self) :
-    #cdef float rgba
-    if self._colorTex :
-      #gl.glBindTexture(<soy.textures.Texture>self._color._textureTarget,
-      #                 <soy.textures.Texture>self._color._textureID)
-      pass #for now
-    else :
-      #rgba = (<soy.colors.Color> self._color)._getRGBA()
-      #stdio.printf('%f %f %f %f\n', rgba[0], rgba[1], rgba[2], rgba[3])
-      gl.glMaterialfv(gl.GL_FRONT, gl.GL_AMBIENT_AND_DIFFUSE, 
-                      (<soy.colors.Color> self._color)._getRGBA())
-
-  property color :
-    def __get__(self) :
-      return self._color
-    def __set__(self, val) :
-      if isinstance(val, soy.colors.Color) :
-        self._color=val
-        self._colorTex=0
-      elif isinstance(val, soy.textures.Texture) :
-        self._color=val
-        self._colorTex=1
-      else :
-        raise TypeError('must be EITHER a soy.color OR a soy.texture')
-    def __del__(self) :
-      self._color=soy.colors.White()
-      self._colorTex=0

Modified: trunk/pysoy/src/_internals/soy._internals.pxd
===================================================================
--- trunk/pysoy/src/_internals/soy._internals.pxd       2007-06-22 07:13:42 UTC 
(rev 247)
+++ trunk/pysoy/src/_internals/soy._internals.pxd       2007-06-22 16:59:46 UTC 
(rev 248)
@@ -42,8 +42,3 @@
 
 cdef class FaceList :
   cdef object _mesh
-
-cdef class Material :
-  cdef object _color
-  cdef int    _colorTex
-  cdef void   _render(self)

Modified: trunk/pysoy/src/_internals/soy._internals.pyx
===================================================================
--- trunk/pysoy/src/_internals/soy._internals.pyx       2007-06-22 07:13:42 UTC 
(rev 247)
+++ trunk/pysoy/src/_internals/soy._internals.pyx       2007-06-22 16:59:46 UTC 
(rev 248)
@@ -34,5 +34,4 @@
 
 include "Children.pxi"
 include "FaceList.pxi"
-include "Material.pxi"
 include "VertexList.pxi"

Modified: trunk/pysoy/src/bodies._bodies/Mesh.pxi
===================================================================
--- trunk/pysoy/src/bodies._bodies/Mesh.pxi     2007-06-22 07:13:42 UTC (rev 
247)
+++ trunk/pysoy/src/bodies._bodies/Mesh.pxi     2007-06-22 16:59:46 UTC (rev 
248)
@@ -120,7 +120,7 @@
     gl.glNormalPointer  (    gl.GL_FLOAT, 36, &self._verts[0].nx)
     gl.glVertexPointer  (3,  gl.GL_FLOAT, 36, &self._verts[0].px)
     for i from 0 <= i < self._nmate :
-      (<soy._internals.Material> self._mates[i].mat)._render()
+      (<soy.materials.Material> self._mates[i].mat)._render()
       gl.glDrawElements (gl.GL_TRIANGLES, self._mates[i].length*3, 
                          gl.GL_UNSIGNED_SHORT, 
                          self._faces + self._mates[i].offset)
@@ -140,7 +140,7 @@
     gl.glNormalPointer  (    gl.GL_FLOAT, 36, <float*> 12)
     gl.glVertexPointer  (3,  gl.GL_FLOAT, 36, <float*>  0)
     for i from 0 <= i < self._nmate :
-      (<soy._internals.Material> self._mates[i].mat)._render()
+      (<soy.materials.Material> self._mates[i].mat)._render()
       gl.glDrawElements (gl.GL_TRIANGLES, self._mates[i].length*3, 
                          gl.GL_UNSIGNED_SHORT, 
                          (<Face *> 0) + self._mates[i].offset)
@@ -254,9 +254,9 @@
     self._nface = 6
     self._nvert = 5
     import soy.colors
-    self.mat0 = soy._internals.Material(color=soy.colors.BlueViolet())
-    self.mat1 = soy._internals.Material(color=soy.colors.YellowGreen())
-    self.mat2 = soy._internals.Material(color=soy.colors.GoldenRod())
+    self.mat0 = soy.materials.Material(color=soy.colors.BlueViolet())
+    self.mat1 = soy.materials.Material(color=soy.colors.YellowGreen())
+    self.mat2 = soy.materials.Material(color=soy.colors.GoldenRod())
 
     self._mates[0].mat = <void *>self.mat0
     self._mates[1].mat = <void *>self.mat1

Modified: trunk/pysoy/src/bodies._bodies/soy.bodies._bodies.pxd
===================================================================
--- trunk/pysoy/src/bodies._bodies/soy.bodies._bodies.pxd       2007-06-22 
07:13:42 UTC (rev 247)
+++ trunk/pysoy/src/bodies._bodies/soy.bodies._bodies.pxd       2007-06-22 
16:59:46 UTC (rev 248)
@@ -25,6 +25,7 @@
 cimport stdio
 cimport soy._core
 cimport soy._internals
+cimport soy.materials
 cimport soy.textures
 
 cdef struct Face :
@@ -117,6 +118,6 @@
   cdef void             _allocMates  (self, int)
 
 cdef class Pyramid (Mesh) :
-  cdef soy._internals.Material mat0
-  cdef soy._internals.Material mat1
-  cdef soy._internals.Material mat2
+  cdef soy.materials.Material mat0
+  cdef soy.materials.Material mat1
+  cdef soy.materials.Material mat2


Property changes on: trunk/pysoy/src/materials
___________________________________________________________________
Name: svn:ignore
   + soy.materials.c


Copied: trunk/pysoy/src/materials/Material.pxi (from rev 247, 
trunk/pysoy/src/_internals/Material.pxi)
===================================================================
--- trunk/pysoy/src/materials/Material.pxi                              (rev 0)
+++ trunk/pysoy/src/materials/Material.pxi      2007-06-22 16:59:46 UTC (rev 
248)
@@ -0,0 +1,67 @@
+# PySoy materials.Material class
+#
+# Copyright (C) 2007 Team PySoy
+#
+#  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
+#  or write to the Free Software Foundation,Inc., 51 Franklin Street,
+#  Fifth Floor, Boston, MA 02110-1301  USA
+#
+# $Id$
+
+cimport gl
+cimport stdio
+cimport soy.colors
+cimport soy.textures
+
+cdef class Material :
+  '''PySoy Material
+
+     shared material for many visible objects
+  '''
+  def __new__(self, color=None) :
+    if color :
+      self._color = color
+    else :
+      self._color = soy.colors.White()
+
+  def __repr__(self) :
+    return '<Material>'
+
+  cdef void _render(self) :
+    #cdef float rgba
+    if self._colorTex :
+      #gl.glBindTexture(<soy.textures.Texture>self._color._textureTarget,
+      #                 <soy.textures.Texture>self._color._textureID)
+      pass #for now
+    else :
+      #rgba = (<soy.colors.Color> self._color)._getRGBA()
+      #stdio.printf('%f %f %f %f\n', rgba[0], rgba[1], rgba[2], rgba[3])
+      gl.glMaterialfv(gl.GL_FRONT, gl.GL_AMBIENT_AND_DIFFUSE, 
+                      (<soy.colors.Color> self._color)._getRGBA())
+
+  property color :
+    def __get__(self) :
+      return self._color
+    def __set__(self, val) :
+      if isinstance(val, soy.colors.Color) :
+        self._color=val
+        self._colorTex=0
+      elif isinstance(val, soy.textures.Texture) :
+        self._color=val
+        self._colorTex=1
+      else :
+        raise TypeError('must be EITHER a soy.color OR a soy.texture')
+    def __del__(self) :
+      self._color=soy.colors.White()
+      self._colorTex=0

Added: trunk/pysoy/src/materials/S.pxi
===================================================================
--- trunk/pysoy/src/materials/S.pxi                             (rev 0)
+++ trunk/pysoy/src/materials/S.pxi     2007-06-22 16:59:46 UTC (rev 248)
@@ -0,0 +1,25 @@
+# PySoy materials.S* classes
+#
+# Copyright (C) 2007 Team PySoy
+#
+#  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
+#  or write to the Free Software Foundation,Inc., 51 Franklin Street,
+#  Fifth Floor, Boston, MA 02110-1301  USA
+#
+# $Id$
+
+cdef class Steel (Material) :
+  def __init__(self) :
+    self.color = soy.colors.Silver()
+    # specularity, etc


Property changes on: trunk/pysoy/src/materials/S.pxi
___________________________________________________________________
Name: svn:keywords
   + Id

Added: trunk/pysoy/src/materials/soy.materials.pxd
===================================================================
--- trunk/pysoy/src/materials/soy.materials.pxd                         (rev 0)
+++ trunk/pysoy/src/materials/soy.materials.pxd 2007-06-22 16:59:46 UTC (rev 
248)
@@ -0,0 +1,27 @@
+# PySoy materials declarations
+#
+# Copyright (C) 2007 Team PySoy
+#
+#  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
+#  or write to the Free Software Foundation,Inc., 51 Franklin Street,
+#  Fifth Floor, Boston, MA 02110-1301  USA
+#
+# $Id$
+
+cimport gl
+
+cdef class Material :
+  cdef object _color
+  cdef int    _colorTex
+  cdef void   _render(self)


Property changes on: trunk/pysoy/src/materials/soy.materials.pxd
___________________________________________________________________
Name: svn:keywords
   + Id

Added: trunk/pysoy/src/materials/soy.materials.pyx
===================================================================
--- trunk/pysoy/src/materials/soy.materials.pyx                         (rev 0)
+++ trunk/pysoy/src/materials/soy.materials.pyx 2007-06-22 16:59:46 UTC (rev 
248)
@@ -0,0 +1,29 @@
+'''PySoy materials
+
+This module contains the base Material class and several predefines.
+'''
+__credits__ = '''Copyright (C) 2007 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
+    or write to the Free Software Foundation,Inc., 51 Franklin Street,
+    Fifth Floor, Boston, MA 02110-1301  USA
+'''
+__author__  = '''Maintained by ArcRiley'''
+__date__    = 'Last change on '+ \
+              '$Date$'[7:-20]+ \
+              'by '+'$Author$'[9:-2]
+__version__ = 'Trunk (r'+'$Rev$'[6:-2]+')'
+
+include "Material.pxi"
+include "S.pxi"


Property changes on: trunk/pysoy/src/materials/soy.materials.pyx
___________________________________________________________________
Name: svn:keywords
   + Author Date Rev

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

Reply via email to