Author: ArcRiley Date: 2008-03-04 19:15:28 -0500 (Tue, 04 Mar 2008) New Revision: 1037
Modified: trunk/pysoy/src/scenes/Scene.pxi Log: Ticket #901 : * some cleanup on Scene Modified: trunk/pysoy/src/scenes/Scene.pxi =================================================================== --- trunk/pysoy/src/scenes/Scene.pxi 2008-03-04 23:08:38 UTC (rev 1036) +++ trunk/pysoy/src/scenes/Scene.pxi 2008-03-05 00:15:28 UTC (rev 1037) @@ -56,18 +56,18 @@ def __repr__(self) : report = [] - if self._bodies.current == 1 : + + if self._bodies._current == 1 : report.append('1 body') - elif self._bodies.current > 1 : - report.append('%d bodies' % self._bodies.current) + else: + report.append('%d bodies' % self._bodies._current) - if self._lights.current == 1 : + if self._lights._current == 1 : report.append('1 light') - elif self._bodies.current > 1 : - report.append('%d lights' % self._lights.current) + else : + report.append('%d lights' % self._lights._current) - if report == [] : return '<Empty Scene>' - else : return '<Scene with %s>' % ', '.join(report) + return '<Scene with %s>' % ', '.join(report) cdef int _loop(self) : @@ -77,19 +77,21 @@ self._giveFields._empty() # self._bodies._iterStart() - for _i from 0 <= _i < self._bodies.current : - if isinstance(<soy.bodies._bodies.Body> self._bodies.list[_i], + for _i from 0 <= _i < self._bodies._current : + # + # isinstance here == BAD, SLOW! + if isinstance(<soy.bodies._bodies.Body> self._bodies._list[_i], soy.bodies.fields.Field) : # Make sure every field is in givefields & _give each one - if not self._giveFields._has_key(<void*> self._bodies.list[_i]) : - (<soy.bodies.fields.Field> self._bodies.list[_i])._give(0) - self._giveFields._insert(<void*> self._bodies.list[_i]) + if not self._giveFields._has_key(<void*> self._bodies._list[_i]) : + (<soy.bodies.fields.Field> self._bodies._list[_i])._give(0) + self._giveFields._insert(<void*> self._bodies._list[_i]) # - for _i from 0 <= _i < self._bodies.current : - if isinstance(<soy.bodies._bodies.Body> self._bodies.list[_i], + for _i from 0 <= _i < self._bodies._current : + if isinstance(<soy.bodies._bodies.Body> self._bodies._list[_i], soy.bodies.fields.Field) : # Apply fields; add incompletly applied fiels to the list - if not (<soy.bodies.fields.Field> self._bodies.list[_i])._apply() : + if not (<soy.bodies.fields.Field> self._bodies._list[_i])._apply() : pass #self._callFields._insert(self._bodies.list[_i]) # @@ -115,7 +117,7 @@ return 1 cdef void _coreRender(self) : - cdef int i + cdef int _i cdef float _ambientLight[4] gl.glClear(gl.GL_DEPTH_BUFFER_BIT) @@ -126,20 +128,20 @@ # # Turn on each light, keep it's iteration locked against mod until done self._lights._iterStart() - for i from 0 <= i < self._lights.current : - # This is a quick hack (gl.GL_LIGHT0+i) - (<soy.bodies.lights.Light> self._lights.list[i])._on(gl.GL_LIGHT0+i) + for _i from 0 <= _i < self._lights._current : + # This is a quick hack (gl.GL_LIGHT0 + _i) + (<soy.bodies.lights.Light> self._lights._list[_i])._on(gl.GL_LIGHT0 + _i) # # Iterate over bodies self._bodies._iterStart() - for i from 0 <= i < self._bodies.current : - (<soy.bodies._bodies.Body> self._bodies.list[i])._coreRender() + for _i from 0 <= _i < self._bodies._current : + (<soy.bodies._bodies.Body> self._bodies._list[_i])._coreRender() self._bodies._iterDone() # # Turn off all lights and finish iteration loop - for i from 0 <= i < self._lights.current : - # This is a quick hack (gl.GL_LIGHT0+i) - (<soy.bodies.lights.Light> self._lights.list[i])._off(gl.GL_LIGHT0+i) + for _i from 0 <= _i < self._lights._current : + # This is a quick hack (gl.GL_LIGHT0 + _i) + (<soy.bodies.lights.Light> self._lights._list[_i])._off(gl.GL_LIGHT0 + _i) self._lights._iterDone() gl.glDisable(gl.GL_LIGHTING) gl.glDisable(gl.GL_DEPTH_TEST) _______________________________________________ PySoy-SVN mailing list PySoy-SVN@pysoy.org http://www.pysoy.org/mailman/listinfo/pysoy-svn