Author: JaroslawTworek
Date: 2008-01-14 02:14:00 +0000 (Mon, 14 Jan 2008)
New Revision: 778

Modified:
   trunk/pysoy/examples/steel_billboard.py
   trunk/pysoy/include/gl.pxd
   trunk/pysoy/src/meshes/Billboard.pxi
Log:
Enabled textures on billboards


Modified: trunk/pysoy/examples/steel_billboard.py
===================================================================
--- trunk/pysoy/examples/steel_billboard.py     2008-01-14 02:10:52 UTC (rev 
777)
+++ trunk/pysoy/examples/steel_billboard.py     2008-01-14 02:14:00 UTC (rev 
778)
@@ -3,16 +3,6 @@
 import soy
 from time import sleep
 
-class MyAppController(soy.controllers.Keyboard):
-    def __init__(self, window):
-        soy.controllers.Keyboard.__init__(self,window)
-    def _eventKeyDown(self, _cde, _sym) :
-        print "Key down %s" % str(_cde)
-
-    def _eventKeyUp(self, _cde, _sym) :
-        print "Key up %s" % str(_cde)
-
-
 def main():
     sce = soy.Scene()
 
@@ -34,8 +24,9 @@
     lig = soy.bodies.lights.Light(sce)
     lig.position = (-10.0,10.0,2.0)
 
-    axis = soy.meshes.Axis()
-    bil = soy.meshes.Billboard(material=soy.materials.StainlessSteel())
+    lava = soy.transports.File('media/lava.soy')['gimp']
+    lavam = soy.materials.Material(lava)
+    bil = soy.meshes.Billboard(material=lavam)
     axis_b = soy.bodies.Body(sce, mesh= bil )
     axis_b.rotation = (1.0,0.5,0.2)
 
@@ -51,8 +42,6 @@
 
     pro = soy.widgets.Projector(win, camera=cam)
 
-    my_con = MyAppController(win)
-
     key = soy.controllers.Keyboard(win)
     key['q'] = soy.actions.Quit()
     key[ 1 ] = soy.actions.Quit() # 9 = esc key

Modified: trunk/pysoy/include/gl.pxd
===================================================================
--- trunk/pysoy/include/gl.pxd  2008-01-14 02:10:52 UTC (rev 777)
+++ trunk/pysoy/include/gl.pxd  2008-01-14 02:14:00 UTC (rev 778)
@@ -1019,6 +1019,7 @@
   cdef void glEnd()
   cdef void glVertex2f( GLfloat, GLfloat y )
   cdef void glVertex3f( GLfloat, GLfloat, GLfloat z )
+  cdef void glTexCoord2f( GLfloat x, GLfloat y)
   cdef void glNormal3f( GLfloat, GLfloat, GLfloat z )
   cdef void glColor3f(  GLfloat r, GLfloat g, GLfloat b )
   cdef void glColor3ub( GLubyte r, GLubyte g, GLubyte b )

Modified: trunk/pysoy/src/meshes/Billboard.pxi
===================================================================
--- trunk/pysoy/src/meshes/Billboard.pxi        2008-01-14 02:10:52 UTC (rev 
777)
+++ trunk/pysoy/src/meshes/Billboard.pxi        2008-01-14 02:14:00 UTC (rev 
778)
@@ -38,18 +38,22 @@
 
         gl.glBegin(gl.GL_QUADS)
 
+        gl.glTexCoord2f( 1.0, 0.0)
         gl.glVertex3f( ( mmat[0] * self._size[1] - mmat[1] * self._size[0]) ,
                        ( mmat[4] * self._size[1] - mmat[5] * self._size[0]),
                        ( mmat[8] * self._size[1] - mmat[9] * self._size[0]))
 
+        gl.glTexCoord2f( 1.0, 1.0)
         gl.glVertex3f( ( mmat[0] * self._size[1] + mmat[1] * self._size[0]) ,
                        ( mmat[4] * self._size[1] + mmat[5] * self._size[0]),
                        ( mmat[8] * self._size[1] + mmat[9] * self._size[0]))
 
+        gl.glTexCoord2f( 0.0, 1.0)
         gl.glVertex3f( (-mmat[0] * self._size[1] + mmat[1] * self._size[0]) ,
                        (-mmat[4] * self._size[1] + mmat[5] * self._size[0]),
                        (-mmat[8] * self._size[1] + mmat[9] * self._size[0]))
 
+        gl.glTexCoord2f( 0.0, 0.0)
         gl.glVertex3f( (-mmat[0] * self._size[1] - mmat[1] * self._size[0]) ,
                        (-mmat[4] * self._size[1] - mmat[5] * self._size[0]),
                        (-mmat[8] * self._size[1] - mmat[9] * self._size[0]))

_______________________________________________
PySoy-SVN mailing list
[email protected]
http://www.pysoy.org/mailman/listinfo/pysoy-svn

Reply via email to