Author: ArcRiley
Date: 2008-02-07 05:21:20 -0500 (Thu, 07 Feb 2008)
New Revision: 831

Modified:
   trunk/pysoy/src/meshes/Liquid.pxi
Log:
fixed indentation


Modified: trunk/pysoy/src/meshes/Liquid.pxi
===================================================================
--- trunk/pysoy/src/meshes/Liquid.pxi   2008-02-07 09:46:28 UTC (rev 830)
+++ trunk/pysoy/src/meshes/Liquid.pxi   2008-02-07 10:21:20 UTC (rev 831)
@@ -5,147 +5,115 @@
 cimport soy.scenes
 
 cdef class Liquid(Mesh):
-    def __cinit__(self, liquid_size=(1,1,1), fog_color=soy.colors.Blue(), 
liquid_mat=soy.materials.StainlessSteel()   ):
-        self._liquid_mat = liquid_mat
+  def __cinit__(self, liquid_size=(1,1,1), fog_color=soy.colors.Blue(), 
liquid_mat=soy.materials.StainlessSteel()   ):
+    self._liquid_mat = liquid_mat
+    self._liquid_size[0] = liquid_size[0]
+    self._liquid_size[1] = liquid_size[1]
+    self._liquid_size[2] = liquid_size[2]
+    self._fog_color = fog_color
 
-        self._liquid_size[0] = liquid_size[0]
-        self._liquid_size[1] = liquid_size[1]
-        self._liquid_size[2] = liquid_size[2]
+  cdef void _coreRender_surf(self):
+    cdef float half_size[3]
+    half_size[0] = self._liquid_size[0]/2.0
+    half_size[1] = self._liquid_size[1]/2.0
+    half_size[2] = self._liquid_size[2]/2.0
+    gl.glBegin(gl.GL_TRIANGLES)
+    gl.glNormal3f(0, 1, 0) #LIQUID FACE
+    gl.glTexCoord2f(0,1)
+    gl.glVertex3f(-half_size[0], half_size[1], half_size[2] )
+    gl.glTexCoord2f(1,1)
+    gl.glVertex3f( half_size[0], half_size[1], half_size[2] )
+    gl.glTexCoord2f(1,0)
+    gl.glVertex3f( half_size[0], half_size[1],-half_size[2] )
+    gl.glTexCoord2f(1,0)
+    gl.glVertex3f( half_size[0], half_size[1],-half_size[2] )
+    gl.glTexCoord2f(0,0)
+    gl.glVertex3f(-half_size[0], half_size[1],-half_size[2] )
+    gl.glTexCoord2f(0,1)
+    gl.glVertex3f(-half_size[0], half_size[1], half_size[2] )
+    gl.glEnd()
 
-        self._fog_color = fog_color
+  cdef void _coreRender_bottom(self):
+    cdef float half_size[3]
+    cdef gl.GLfloat _diffuse[4]
+    half_size[0] = self._liquid_size[0]/2.0
+    half_size[1] = self._liquid_size[1]/2.0
+    half_size[2] = self._liquid_size[2]/2.0
+    (<soy.colors.Color> self._fog_color)._getRGBA(_diffuse)
+    gl.glDisable(gl.GL_LIGHTING)
+    gl.glColor3f(_diffuse[0], _diffuse[1], _diffuse[2])
+    gl.glBegin(gl.GL_TRIANGLES)
+    gl.glNormal3f(0, 1, 0) #LIQUID FACE
+    gl.glVertex3f(-1000, -half_size[1], 1000 )
+    gl.glVertex3f( 1000, -half_size[1], 1000 )
+    gl.glVertex3f( 1000, -half_size[1],-1000 )
+    gl.glVertex3f( 1000, -half_size[1],-1000 )
+    gl.glVertex3f(-1000, -half_size[1],-1000 )
+    gl.glVertex3f(-1000, -half_size[1], 1000 )
+    gl.glEnd()
+    gl.glEnable(gl.GL_LIGHTING)
 
-    cdef void _coreRender_surf(self):
-        cdef float half_size[3]
-        half_size[0] = self._liquid_size[0]/2.0
-        half_size[1] = self._liquid_size[1]/2.0
-        half_size[2] = self._liquid_size[2]/2.0
 
-        gl.glBegin(gl.GL_TRIANGLES)
+  cdef void _coreRender(self, void* body):
+    cdef soy.scenes.Scene  _scene
+    cdef int                i
+    cdef ode.dReal          *pos
+    cdef gl.GLfloat _diffuse[4]
+    cdef float half_size[3]
+    pos = <ode.dReal *> ode.dBodyGetPosition((<soy.bodies._bodies.Body> 
body)._bodyID)
+    (<soy.colors.Color> self._fog_color)._getRGBA(_diffuse)
+    half_size[0] = self._liquid_size[0]/2.0
+    half_size[1] = self._liquid_size[1]/2.0
+    half_size[2] = self._liquid_size[2]/2.0
+    gl.glClearStencil(0)
+    gl.glEnable(gl.GL_STENCIL_TEST)
+    gl.glClear(gl.GL_STENCIL_BUFFER_BIT)
+    gl.glStencilFunc(gl.GL_NEVER, 0, 0)
+    gl.glStencilOp(gl.GL_INCR, gl.GL_INCR, gl.GL_INCR)
+    self._coreRender_surf()
+    gl.glStencilFunc(gl.GL_EQUAL, 1, 1)
+    gl.glStencilOp(gl.GL_KEEP, gl.GL_KEEP, gl.GL_KEEP)
+    gl.glDisable(gl.GL_DEPTH_TEST)
+    self._coreRender_bottom()
+    gl.glEnable(gl.GL_DEPTH_TEST)
+    #
+    #RENDER BODIES
+    _scene = ( <soy.bodies._bodies.Body> body)._scene
+    gl.glEnable(gl.GL_FOG)
+    gl.glEnableClientState(gl.GL_FOG_COORDINATE_ARRAY_EXT)
+    gl.glFogi(gl.GL_FOG_MODE, gl.GL_LINEAR)
+    gl.glFogfv(gl.GL_FOG_COLOR, _diffuse)
+    gl.glFogf(gl.GL_FOG_START, pos[1] + half_size[1])
+    gl.glFogf(gl.GL_FOG_END, pos[1] - half_size[1])
+    gl.glHint(gl.GL_FOG_HINT, gl.GL_NICEST)
+    gl.glFogi(gl.GL_FOG_COORDINATE_SOURCE_EXT, gl.GL_FOG_COORDINATE_EXT)
+    gl.glPushMatrix()
+    gl.glTranslatef(-pos[0],-pos[1], -pos[2])
+    for i from 0 <= i < _scene._bodies.current:
+      if body != (<void*> _scene._bodies.list[i]):
+        (<soy.bodies._bodies.Body> 
_scene._bodies.list[i])._createVerticalFogCoords()
+        (<soy.bodies._bodies.Body> _scene._bodies.list[i])._coreRender()
+    gl.glPopMatrix()
 
-        gl.glNormal3f(0, 1, 0) #LIQUID FACE
+    gl.glDisableClientState(gl.GL_FOG_COORDINATE_ARRAY_EXT)
+    gl.glDisable(gl.GL_FOG)
+    #
+    #RENDER SURFACE
+    self._liquid_mat._bind()
+    self._coreRender_surf()
+    self._liquid_mat._unbind()
+    gl.glDisable(gl.GL_STENCIL_TEST)
 
-        gl.glTexCoord2f(0,1)
-        gl.glVertex3f(-half_size[0], half_size[1], half_size[2] )
-        gl.glTexCoord2f(1,1)
-        gl.glVertex3f( half_size[0], half_size[1], half_size[2] )
-        gl.glTexCoord2f(1,0)
-        gl.glVertex3f( half_size[0], half_size[1],-half_size[2] )
+  property size:
+    def __get__(self):
+      return (self._liquid_size[0], self._liquid_size[1], self._liquid_size[2])
+    def __set__(self, newval):
+      self._liquid_size[0] = newval[0]
+      self._liquid_size[1] = newval[1]
+      self._liquid_size[2] = newval[2]
 
-        gl.glTexCoord2f(1,0)
-        gl.glVertex3f( half_size[0], half_size[1],-half_size[2] )
-        gl.glTexCoord2f(0,0)
-        gl.glVertex3f(-half_size[0], half_size[1],-half_size[2] )
-        gl.glTexCoord2f(0,1)
-        gl.glVertex3f(-half_size[0], half_size[1], half_size[2] )
-
-        gl.glEnd()
-
-    cdef void _coreRender_bottom(self):
-        cdef float half_size[3]
-        cdef gl.GLfloat _diffuse[4]
-
-        half_size[0] = self._liquid_size[0]/2.0
-        half_size[1] = self._liquid_size[1]/2.0
-        half_size[2] = self._liquid_size[2]/2.0
-        
-        (<soy.colors.Color> self._fog_color)._getRGBA(_diffuse)
-
-        gl.glDisable(gl.GL_LIGHTING)
-        gl.glColor3f(_diffuse[0], _diffuse[1], _diffuse[2])
-
-        gl.glBegin(gl.GL_TRIANGLES)
-
-        gl.glNormal3f(0, 1, 0) #LIQUID FACE
-
-        gl.glVertex3f(-1000, -half_size[1], 1000 )
-        gl.glVertex3f( 1000, -half_size[1], 1000 )
-        gl.glVertex3f( 1000, -half_size[1],-1000 )
-
-        gl.glVertex3f( 1000, -half_size[1],-1000 )
-        gl.glVertex3f(-1000, -half_size[1],-1000 )
-        gl.glVertex3f(-1000, -half_size[1], 1000 )
-
-        gl.glEnd()
-        gl.glEnable(gl.GL_LIGHTING)
-
-
-    cdef void _coreRender(self, void* body):
-        cdef soy.scenes.Scene  _scene
-        cdef int                i
-        cdef ode.dReal          *pos
-        cdef gl.GLfloat _diffuse[4]
-        cdef float half_size[3]
-
-        pos = <ode.dReal *> ode.dBodyGetPosition((<soy.bodies._bodies.Body> 
body)._bodyID)
-        (<soy.colors.Color> self._fog_color)._getRGBA(_diffuse)
-        half_size[0] = self._liquid_size[0]/2.0
-        half_size[1] = self._liquid_size[1]/2.0
-        half_size[2] = self._liquid_size[2]/2.0
-
-        gl.glClearStencil(0)
-        gl.glEnable(gl.GL_STENCIL_TEST)
-        gl.glClear(gl.GL_STENCIL_BUFFER_BIT)
-
-        gl.glStencilFunc(gl.GL_NEVER, 0, 0)
-        gl.glStencilOp(gl.GL_INCR, gl.GL_INCR, gl.GL_INCR)
-
-        self._coreRender_surf()
-
-        gl.glStencilFunc(gl.GL_EQUAL, 1, 1)
-        gl.glStencilOp(gl.GL_KEEP, gl.GL_KEEP, gl.GL_KEEP)
-
-
-        gl.glDisable(gl.GL_DEPTH_TEST)
-        self._coreRender_bottom()
-        gl.glEnable(gl.GL_DEPTH_TEST)
-
-        #RENDER BODIES
-
-        _scene = ( <soy.bodies._bodies.Body> body)._scene
-
-        gl.glEnable(gl.GL_FOG)
-        gl.glEnableClientState(gl.GL_FOG_COORDINATE_ARRAY_EXT)
-        gl.glFogi(gl.GL_FOG_MODE, gl.GL_LINEAR)
-        gl.glFogfv(gl.GL_FOG_COLOR, _diffuse)
-        gl.glFogf(gl.GL_FOG_START, pos[1] + half_size[1])
-        gl.glFogf(gl.GL_FOG_END, pos[1] - half_size[1])
-        gl.glHint(gl.GL_FOG_HINT, gl.GL_NICEST)
-        gl.glFogi(gl.GL_FOG_COORDINATE_SOURCE_EXT, gl.GL_FOG_COORDINATE_EXT)
-
-        gl.glPushMatrix()
-        gl.glTranslatef(-pos[0],-pos[1], -pos[2])
-        for i from 0 <= i < _scene._bodies.current:
-            if body != (<void*> _scene._bodies.list[i]):
-                (<soy.bodies._bodies.Body> 
_scene._bodies.list[i])._createVerticalFogCoords()
-                (<soy.bodies._bodies.Body> 
_scene._bodies.list[i])._coreRender()
-        gl.glPopMatrix()
-
-        gl.glDisableClientState(gl.GL_FOG_COORDINATE_ARRAY_EXT)
-        gl.glDisable(gl.GL_FOG)
-
-        #RENDER SURFACE
-
-        self._liquid_mat._bind()
-        self._coreRender_surf()
-        self._liquid_mat._unbind()
-
-        gl.glDisable(gl.GL_STENCIL_TEST)
-
-    property size:
-        def __get__(self):
-            return (self._liquid_size[0], self._liquid_size[1], 
self._liquid_size[2])
-        def __set__(self, newval):
-            self._liquid_size[0] = newval[0]
-            self._liquid_size[1] = newval[1]
-            self._liquid_size[2] = newval[2]
-
-    property liquid_mat:
-        def __get__(self):
-            return self._liquid_mat
-        def __set__(self, newval):
-            self._liquid_mat = newval
-
-
-
-
-
+  property liquid_mat:
+    def __get__(self):
+      return self._liquid_mat
+    def __set__(self, newval):
+      self._liquid_mat = newval

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

Reply via email to