Author: JaroslawTworek Date: 2008-01-13 23:44:54 +0000 (Sun, 13 Jan 2008) New Revision: 770
Added: trunk/pysoy/src/meshes/Billboard.pxi Modified: trunk/pysoy/src/meshes/soy.meshes.pxd trunk/pysoy/src/meshes/soy.meshes.pyx Log: Implemented Billboard mesh type (GHOP #322) Added: trunk/pysoy/src/meshes/Billboard.pxi =================================================================== --- trunk/pysoy/src/meshes/Billboard.pxi (rev 0) +++ trunk/pysoy/src/meshes/Billboard.pxi 2008-01-13 23:44:54 UTC (rev 770) @@ -0,0 +1,56 @@ +# PySoy meshes.Billboard 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 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 + +cdef class Billboard( Mesh): + '''PySoy meshes.Billboard + + This mesh rendering quad always facing the camera + ''' + def __cinit__(self, material, *args, **kwargs): + self._material = material + cdef void _render(self, void* _body): + cdef float mmat[16] + + self._material._bind() + gl.glPushMatrix() + + gl.glGetFloatv(gl.GL_MODELVIEW_MATRIX, mmat) + #UP = (mmat[0], mmat[4], mmat[8]) + #RIGHT = (mmat[1], mmat[5], mmat[9]) + + gl.glBegin(gl.GL_QUADS) + + gl.glVertex3f(mmat[0] - mmat[1] , + mmat[4] - mmat[5], + mmat[8] - mmat[9]) + + gl.glVertex3f(mmat[0] + mmat[1] , + mmat[4] + mmat[5], + mmat[8] + mmat[9]) + + gl.glVertex3f(-mmat[0] + mmat[1] , + -mmat[4] + mmat[5], + -mmat[8] + mmat[9]) + + gl.glVertex3f(-mmat[0] - mmat[1] , + -mmat[4] - mmat[5], + -mmat[8] - mmat[9]) + gl.glEnd() + + gl.glPopMatrix() + self._material._unbind() + Modified: trunk/pysoy/src/meshes/soy.meshes.pxd =================================================================== --- trunk/pysoy/src/meshes/soy.meshes.pxd 2008-01-13 06:14:16 UTC (rev 769) +++ trunk/pysoy/src/meshes/soy.meshes.pxd 2008-01-13 23:44:54 UTC (rev 770) @@ -40,4 +40,9 @@ cdef void _renderRay ( self, soy.shapes.Shape ) cdef class Axis(Mesh): - cdef void _render ( self, void* ) \ No newline at end of file + cdef void _render ( self, void* ) + +cdef class Billboard(Mesh): + cdef soy.materials.Material _material + cdef void _render (self, void* ) + Modified: trunk/pysoy/src/meshes/soy.meshes.pyx =================================================================== --- trunk/pysoy/src/meshes/soy.meshes.pyx 2008-01-13 06:14:16 UTC (rev 769) +++ trunk/pysoy/src/meshes/soy.meshes.pyx 2008-01-13 23:44:54 UTC (rev 770) @@ -25,4 +25,6 @@ include "Mesh.pxi" include "Shape.pxi" -include "Axis.pxi" \ No newline at end of file +include "Axis.pxi" +include "Billboard.pxi" + _______________________________________________ PySoy-SVN mailing list [email protected] http://www.pysoy.org/mailman/listinfo/pysoy-svn
