Author: ArcRiley
Date: 2008-02-06 06:29:58 -0500 (Wed, 06 Feb 2008)
New Revision: 817
Modified:
trunk/pysoy/examples/bumpmap_example.py
trunk/pysoy/scripts/__init__.py
trunk/pysoy/setup.py
trunk/pysoy/src/_core-common/_coreLoop.pxi
trunk/pysoy/src/_core-w32/soy._core.pxd
trunk/pysoy/src/_core-w32/soy._core.pyx
trunk/pysoy/src/_core-x11/soy._core.pxd
trunk/pysoy/src/_core-x11/soy._core.pyx
trunk/pysoy/src/_datatypes/VertexList.pxi
trunk/pysoy/src/_datatypes/soy._datatypes.pyx
trunk/pysoy/src/bodies._bodies/Body.pxi
trunk/pysoy/src/bodies._bodies/Camera.pxi
trunk/pysoy/src/bodies._bodies/soy.bodies._bodies.pxd
trunk/pysoy/src/bodies.fields/Buoyancy.pxi
trunk/pysoy/src/bodies.fields/Generic.pxi
trunk/pysoy/src/bodies.fields/Monopole.pxi
trunk/pysoy/src/bodies.fields/Shockwave.pxi
trunk/pysoy/src/bodies.fields/Wind.pxi
trunk/pysoy/src/bodies.fields/soy.bodies.fields.pxd
trunk/pysoy/src/bodies.fields/soy.bodies.fields.pyx
trunk/pysoy/src/bodies.lights/Light.pxi
trunk/pysoy/src/bodies.lights/soy.bodies.lights.pyx
trunk/pysoy/src/joints/Joint.pxi
trunk/pysoy/src/joints/soy.joints.pxd
trunk/pysoy/src/meshes/Liquid.pxi
trunk/pysoy/src/scenes/Scene.pxi
trunk/pysoy/src/scenes/_getScenes.pxi
trunk/pysoy/src/scenes/soy.scenes.pxd
trunk/pysoy/src/scenes/soy.scenes.pyx
Log:
A ton of work on #903, getting cyclical import error
Modified: trunk/pysoy/examples/bumpmap_example.py
===================================================================
--- trunk/pysoy/examples/bumpmap_example.py 2008-02-06 10:31:15 UTC (rev
816)
+++ trunk/pysoy/examples/bumpmap_example.py 2008-02-06 11:29:58 UTC (rev
817)
@@ -51,10 +51,10 @@
def main():
- sce = soy.Scene()
+ sce = soy.scenes.Scene()
cam = soy.bodies.Camera(sce)
- cam.position = (0,0,5)
+ cam.position = (0,0,3)
lig = soy.bodies.lights.Light(sce)
lig.position = (-5, -5, -5)
@@ -69,11 +69,12 @@
test_mesh = create_quad_mesh(decal_mat)
test_mesh_b = soy.bodies.Body(sce, mesh=test_mesh)
- test_mesh_b.rotation = (.1,.05,.5)
+ test_mesh_b.rotation = (.0,.0,1)
scr = soy.Screen()
- win = soy.Window(scr, 'Bumpmap example', background=soy.colors.Black(),
- size = (1024,768))
+ win = soy.Window(scr, title='Bumpmap example',
+ background=soy.colors.Black(),
+ size = (1024,768))
pro = soy.widgets.Projector(win, camera=cam)
Modified: trunk/pysoy/scripts/__init__.py
===================================================================
--- trunk/pysoy/scripts/__init__.py 2008-02-06 10:31:15 UTC (rev 816)
+++ trunk/pysoy/scripts/__init__.py 2008-02-06 11:29:58 UTC (rev 817)
@@ -17,7 +17,7 @@
#
# $Id$
-from _core import Scene, Screen, Window, \
+from _core import Screen, Window, \
__author__, __credits__, __date__, __doc__, __version__
import _datatypes
import _internals
@@ -29,6 +29,8 @@
import joints
import materials
import meshes
+import scenes
+import shapes
import textures
import transports
import widgets
Modified: trunk/pysoy/setup.py
===================================================================
--- trunk/pysoy/setup.py 2008-02-06 10:31:15 UTC (rev 816)
+++ trunk/pysoy/setup.py 2008-02-06 11:29:58 UTC (rev 817)
@@ -39,6 +39,7 @@
'materials' : ['GL','GLEW'],
'meshes' : ['GLEW','GL','GLU','ode'],
'textures' : ['GLEW','GL', 'ogg', 'theora', 'cairo'],
+ 'scenes' : ['GL', 'ode'],
'shapes' : ['ode'],
'transports' : ['ogg'],
'widgets' : ['GLEW','GL','GLU'],
Modified: trunk/pysoy/src/_core-common/_coreLoop.pxi
===================================================================
--- trunk/pysoy/src/_core-common/_coreLoop.pxi 2008-02-06 10:31:15 UTC (rev
816)
+++ trunk/pysoy/src/_core-common/_coreLoop.pxi 2008-02-06 11:29:58 UTC (rev
817)
@@ -25,7 +25,9 @@
cdef void _coreLoop() :
cdef int i, j
cdef int _step, _maxstep
- cdef Scene _scene
+ cdef soy.scenes.Scene _scene
+ cdef soy._internals.Children _scenes
+ _scenes = <soy._internals.Children> soy.scenes._getScenes()
while (1) :
_transports.lock()
for i from 0 <= i < _transports.current :
@@ -42,7 +44,7 @@
_scenes.lock()
_maxstep = 0
for i from 0 <= i < _scenes.current :
- _scene = <Scene> _scenes.list[i]
+ _scene = <soy.scenes.Scene> _scenes.list[i]
_scene._updateTime()
# Clear outdated lists
_callfields._empty()
Modified: trunk/pysoy/src/_core-w32/soy._core.pxd
===================================================================
--- trunk/pysoy/src/_core-w32/soy._core.pxd 2008-02-06 10:31:15 UTC (rev
816)
+++ trunk/pysoy/src/_core-w32/soy._core.pxd 2008-02-06 11:29:58 UTC (rev
817)
@@ -33,31 +33,6 @@
cdef soy._datatypes.AsyncQueue _get_queue ( )
-cdef class Scene :
- cdef ode.dWorldID _worldID
- cdef ode.dSpaceID _spaceID
- cdef soy._internals.Children _bodies
- cdef soy._internals.Children _joints
- cdef soy._internals.Children _lights
- cdef soy.colors.Color _ambient
- cdef ode.dReal _stepSize
- cdef double _prevTime
- cdef double _time
- # _coreloop methods
- cdef void _render(self)
- cdef int _steps(self)
- cdef void _updateTime(self)
-
-#cdef class Scene :
-# cdef soy._internals.Children _bodies
-# cdef soy._internals.Children _joints
-# cdef ode.dWorldID _worldID
-# cdef ode.dSpaceID _spaceID
-# cdef ode.dReal _stepsize
-# cdef double _time
-# cdef void _render(self)
-# cdef void _updateTime(self)
-
cdef class Screen :
cdef int _screenID
cdef object _fullScreen
Modified: trunk/pysoy/src/_core-w32/soy._core.pyx
===================================================================
--- trunk/pysoy/src/_core-w32/soy._core.pyx 2008-02-06 10:31:15 UTC (rev
816)
+++ trunk/pysoy/src/_core-w32/soy._core.pyx 2008-02-06 11:29:58 UTC (rev
817)
@@ -28,11 +28,11 @@
cimport soy.joints
cimport soy.bodies.fields
cimport soy.bodies._bodies
+cimport soy.scenes
cimport soy.widgets
import soy.colors
include "../_core-common/_Transports.pxi"
-include "../_core-common/Scene.pxi"
include "_windowproc.pxi"
include "Screen.pxi"
include "Window.pxi"
Modified: trunk/pysoy/src/_core-x11/soy._core.pxd
===================================================================
--- trunk/pysoy/src/_core-x11/soy._core.pxd 2008-02-06 10:31:15 UTC (rev
816)
+++ trunk/pysoy/src/_core-x11/soy._core.pxd 2008-02-06 11:29:58 UTC (rev
817)
@@ -34,22 +34,6 @@
cdef soy._datatypes.AsyncQueue _get_queue ( )
-cdef class Scene :
- cdef ode.dWorldID _worldID
- cdef ode.dSpaceID _spaceID
- cdef soy._internals.Children _bodies
- cdef soy._internals.Children _joints
- cdef soy._internals.Children _lights
- cdef soy.colors.Color _ambient
- cdef ode.dReal _stepSize
- cdef double _prevTime
- cdef double _time
- # _coreloop methods
- cdef void _render(self)
- cdef int _steps(self)
- cdef void _updateTime(self)
-
-
cdef class Screen :
cdef glx.Screen *_screen
cdef int _screenID
Modified: trunk/pysoy/src/_core-x11/soy._core.pyx
===================================================================
--- trunk/pysoy/src/_core-x11/soy._core.pyx 2008-02-06 10:31:15 UTC (rev
816)
+++ trunk/pysoy/src/_core-x11/soy._core.pyx 2008-02-06 11:29:58 UTC (rev
817)
@@ -28,11 +28,11 @@
cimport soy.joints
cimport soy.bodies.fields
cimport soy.bodies._bodies
+cimport soy.scenes
cimport soy.widgets
import soy.colors
include "../_core-common/_Transports.pxi"
-include "../_core-common/Scene.pxi"
include "_sleep.pxi"
include "_time.pxi"
include "Screen.pxi"
Modified: trunk/pysoy/src/_datatypes/VertexList.pxi
===================================================================
--- trunk/pysoy/src/_datatypes/VertexList.pxi 2008-02-06 10:31:15 UTC (rev
816)
+++ trunk/pysoy/src/_datatypes/VertexList.pxi 2008-02-06 11:29:58 UTC (rev
817)
@@ -21,11 +21,6 @@
# rather as part of it's parent Mesh. Parent must be in __cinit__ as
# it's parent holds the data this class works on.
-cimport stdlib
-cimport soy._core
-cimport soy.bodies._bodies
-cimport soy.bodies.lights
-
cdef class VertexList (Datatype) :
'''PySoy VertexList
@@ -207,7 +202,7 @@
cdef void _calculateTSLV(self, void* body):
cdef soy.bodies._bodies.Body _body
- cdef soy._core.Scene _scene
+ cdef soy.scenes.Scene _scene
cdef soy.bodies.lights.Light _light
cdef ode.dVector3 _light_pos
cdef float _inv_mm[16]
Modified: trunk/pysoy/src/_datatypes/soy._datatypes.pyx
===================================================================
--- trunk/pysoy/src/_datatypes/soy._datatypes.pyx 2008-02-06 10:31:15 UTC
(rev 816)
+++ trunk/pysoy/src/_datatypes/soy._datatypes.pyx 2008-02-06 11:29:58 UTC
(rev 817)
@@ -26,9 +26,13 @@
'by '+'$Author$'[9:-2]
__version__ = 'Trunk (r'+'$Rev$'[6:-2]+')'
+cimport stdlib
cimport soy.atoms
+cimport soy.bodies._bodies
+cimport soy.bodies.lights
cimport soy.materials
cimport soy.meshes
+cimport soy.scenes
include "AsyncQueue.pxi"
include "Datatype.pxi"
Modified: trunk/pysoy/src/bodies._bodies/Body.pxi
===================================================================
--- trunk/pysoy/src/bodies._bodies/Body.pxi 2008-02-06 10:31:15 UTC (rev
816)
+++ trunk/pysoy/src/bodies._bodies/Body.pxi 2008-02-06 11:29:58 UTC (rev
817)
@@ -102,7 +102,7 @@
else :
return None
def __set__(self, newscene) :
- if not (isinstance(newscene, soy._core.Scene) or newscene==None) :
+ if not (isinstance(newscene, soy.scenes.Scene) or newscene==None) :
raise TypeError('not an instance of soy.Scene')
if self._isActive() :
self._scene._bodies.lock()
@@ -112,7 +112,8 @@
if self._shape :
if self._scene :
ode.dSpaceRemove(self._scene._spaceID, self._shape._geomID)
- ode.dSpaceAdd((<soy._core.Scene> newscene)._spaceID,
self._shape._geomID)
+ ode.dSpaceAdd((<soy.scenes.Scene> newscene)._spaceID,
+ self._shape._geomID)
if newscene != None :
self._scene = newscene
self._scene._bodies.lock()
Modified: trunk/pysoy/src/bodies._bodies/Camera.pxi
===================================================================
--- trunk/pysoy/src/bodies._bodies/Camera.pxi 2008-02-06 10:31:15 UTC (rev
816)
+++ trunk/pysoy/src/bodies._bodies/Camera.pxi 2008-02-06 11:29:58 UTC (rev
817)
@@ -24,7 +24,7 @@
be rendered through. It must be attached to a soy.widgets.Projector or
other rendering class to be activated.
'''
- def __cinit__(self, soy._core.Scene parent,wireframe=0, *args, **keywords) :
+ def __cinit__(self, soy.scenes.Scene parent,wireframe=0, *args, **keywords) :
self._fovy = 45.0
self.mass = 0
self._wire = wireframe
Modified: trunk/pysoy/src/bodies._bodies/soy.bodies._bodies.pxd
===================================================================
--- trunk/pysoy/src/bodies._bodies/soy.bodies._bodies.pxd 2008-02-06
10:31:15 UTC (rev 816)
+++ trunk/pysoy/src/bodies._bodies/soy.bodies._bodies.pxd 2008-02-06
11:29:58 UTC (rev 817)
@@ -20,15 +20,15 @@
cimport ode
cimport py
cimport stdio
-cimport soy._core
cimport soy._internals
cimport soy._datatypes
cimport soy.meshes
+cimport soy.scenes
cimport soy.shapes
cdef class Body :
cdef ode.dBodyID _bodyID
- cdef soy._core.Scene _scene
+ cdef soy.scenes.Scene _scene
cdef soy.meshes.Mesh _mesh
cdef soy.shapes.Shape _shape
# for loading/saving
Modified: trunk/pysoy/src/bodies.fields/Buoyancy.pxi
===================================================================
--- trunk/pysoy/src/bodies.fields/Buoyancy.pxi 2008-02-06 10:31:15 UTC (rev
816)
+++ trunk/pysoy/src/bodies.fields/Buoyancy.pxi 2008-02-06 11:29:58 UTC (rev
817)
@@ -23,7 +23,7 @@
Adjusts the mass Monopole works based on
'''
- def __cinit__(self, soy._core.Scene parent, *args, **keywords) :
+ def __cinit__(self, soy.scenes.Scene parent, *args, **keywords) :
self._affected = soy._internals.Children()
self._density = 0
Modified: trunk/pysoy/src/bodies.fields/Generic.pxi
===================================================================
--- trunk/pysoy/src/bodies.fields/Generic.pxi 2008-02-06 10:31:15 UTC (rev
816)
+++ trunk/pysoy/src/bodies.fields/Generic.pxi 2008-02-06 11:29:58 UTC (rev
817)
@@ -23,7 +23,7 @@
'''
- def __cinit__(self, soy._core.Scene parent, *args, **keywords) :
+ def __cinit__(self, soy.scenes.Scene parent, *args, **keywords) :
return
cdef int _exert(self, soy.bodies._bodies.Body other) :
Modified: trunk/pysoy/src/bodies.fields/Monopole.pxi
===================================================================
--- trunk/pysoy/src/bodies.fields/Monopole.pxi 2008-02-06 10:31:15 UTC (rev
816)
+++ trunk/pysoy/src/bodies.fields/Monopole.pxi 2008-02-06 11:29:58 UTC (rev
817)
@@ -24,7 +24,7 @@
bodies in the entire scene based on an inverse square law.
'''
- def __cinit__(self, soy._core.Scene parent, *args, **keywords) :
+ def __cinit__(self, soy.scenes.Scene parent, *args, **keywords) :
self._multiplier = 0
self._affected = soy._internals.Children()
Modified: trunk/pysoy/src/bodies.fields/Shockwave.pxi
===================================================================
--- trunk/pysoy/src/bodies.fields/Shockwave.pxi 2008-02-06 10:31:15 UTC (rev
816)
+++ trunk/pysoy/src/bodies.fields/Shockwave.pxi 2008-02-06 11:29:58 UTC (rev
817)
@@ -23,7 +23,7 @@
Models an constant-rate expanding shockwave
'''
- def __cinit__(self, soy._core.Scene parent, *args, **keywords) :
+ def __cinit__(self, soy.scenes.Scene parent, *args, **keywords) :
self._space = ode.dHashSpaceCreate(NULL)
def __dealloc__(self) :
Modified: trunk/pysoy/src/bodies.fields/Wind.pxi
===================================================================
--- trunk/pysoy/src/bodies.fields/Wind.pxi 2008-02-06 10:31:15 UTC (rev
816)
+++ trunk/pysoy/src/bodies.fields/Wind.pxi 2008-02-06 11:29:58 UTC (rev
817)
@@ -23,7 +23,7 @@
Affects bodies according to their tags 'cd' and 'cpx','cpy','cpz'
'''
- def __cinit__(self, soy._core.Scene parent, *args, **keywords) :
+ def __cinit__(self, soy.scenes.Scene parent, *args, **keywords) :
return
# TODO incomplete: needs area measurements rather than assumptions
Modified: trunk/pysoy/src/bodies.fields/soy.bodies.fields.pxd
===================================================================
--- trunk/pysoy/src/bodies.fields/soy.bodies.fields.pxd 2008-02-06 10:31:15 UTC
(rev 816)
+++ trunk/pysoy/src/bodies.fields/soy.bodies.fields.pxd 2008-02-06 11:29:58 UTC
(rev 817)
@@ -20,7 +20,6 @@
cimport gl
cimport ode
cimport stdio
-cimport soy._core
cimport soy._internals
cimport soy.bodies._bodies
cimport soy.shapes
Modified: trunk/pysoy/src/bodies.fields/soy.bodies.fields.pyx
===================================================================
--- trunk/pysoy/src/bodies.fields/soy.bodies.fields.pyx 2008-02-06 10:31:15 UTC
(rev 816)
+++ trunk/pysoy/src/bodies.fields/soy.bodies.fields.pyx 2008-02-06 11:29:58 UTC
(rev 817)
@@ -24,6 +24,8 @@
'by '+'$Author$'[9:-2]
__version__ = 'Trunk (r'+'$Rev$'[6:-2]+')'
+cimport soy.scenes
+
include "Field.pxi"
include "Monopole.pxi"
include "Wind.pxi"
Modified: trunk/pysoy/src/bodies.lights/Light.pxi
===================================================================
--- trunk/pysoy/src/bodies.lights/Light.pxi 2008-02-06 10:31:15 UTC (rev
816)
+++ trunk/pysoy/src/bodies.lights/Light.pxi 2008-02-06 11:29:58 UTC (rev
817)
@@ -74,7 +74,7 @@
else :
return None
def __set__(self, newscene) :
- if not (isinstance(newscene, soy._core.Scene) or newscene==None) :
+ if not (isinstance(newscene, soy.scenes.Scene) or newscene==None) :
raise TypeError('not an instance of soy.Scene')
if self._isActive() :
self._scene._bodies.lock()
@@ -87,7 +87,7 @@
if self._shape :
if self._scene :
ode.dSpaceRemove(self._scene._spaceID, self._shape._geomID)
- ode.dSpaceAdd((<soy._core.Scene> newscene)._spaceID,
self._shape._geomID)
+ ode.dSpaceAdd((<soy.scenes.Scene> newscene)._spaceID,
self._shape._geomID)
if newscene != None :
self._scene = newscene
self._scene._bodies.lock()
Modified: trunk/pysoy/src/bodies.lights/soy.bodies.lights.pyx
===================================================================
--- trunk/pysoy/src/bodies.lights/soy.bodies.lights.pyx 2008-02-06 10:31:15 UTC
(rev 816)
+++ trunk/pysoy/src/bodies.lights/soy.bodies.lights.pyx 2008-02-06 11:29:58 UTC
(rev 817)
@@ -23,4 +23,6 @@
'by '+'$Author$'[9:-2]
__version__ = 'Trunk (r'+'$Rev$'[6:-2]+')'
+cimport soy.scenes
+
include "Light.pxi"
Modified: trunk/pysoy/src/joints/Joint.pxi
===================================================================
--- trunk/pysoy/src/joints/Joint.pxi 2008-02-06 10:31:15 UTC (rev 816)
+++ trunk/pysoy/src/joints/Joint.pxi 2008-02-06 11:29:58 UTC (rev 817)
@@ -23,7 +23,7 @@
This is the "Null" joint which all other joints inherit from
'''
- def __cinit__(self, soy._core.Scene parent,
+ def __cinit__(self, soy.scenes.Scene parent,
soy.bodies._bodies.Body body1, soy.bodies._bodies.Body body2,
*args, **keywords) :
self._scene = parent
Modified: trunk/pysoy/src/joints/soy.joints.pxd
===================================================================
--- trunk/pysoy/src/joints/soy.joints.pxd 2008-02-06 10:31:15 UTC (rev
816)
+++ trunk/pysoy/src/joints/soy.joints.pxd 2008-02-06 11:29:58 UTC (rev
817)
@@ -18,11 +18,11 @@
# $Id $
cimport ode
-cimport soy._core
cimport soy.bodies._bodies
+cimport soy.scenes
cdef class Joint :
- cdef soy._core.Scene _scene
+ cdef soy.scenes.Scene _scene
cdef ode.dJointID _jointID
cdef soy.bodies._bodies.Body _body1
cdef soy.bodies._bodies.Body _body2
Modified: trunk/pysoy/src/meshes/Liquid.pxi
===================================================================
--- trunk/pysoy/src/meshes/Liquid.pxi 2008-02-06 10:31:15 UTC (rev 816)
+++ trunk/pysoy/src/meshes/Liquid.pxi 2008-02-06 11:29:58 UTC (rev 817)
@@ -1,8 +1,8 @@
import soy.colors
cimport soy.bodies._bodies
-cimport soy._core
cimport soy._internals
+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() ):
@@ -70,7 +70,7 @@
cdef void _render(self, void* body):
- cdef soy._core.Scene _scene
+ cdef soy.scenes.Scene _scene
cdef int i
cdef ode.dReal *pos
cdef gl.GLfloat _diffuse[4]
Modified: trunk/pysoy/src/scenes/Scene.pxi
===================================================================
--- trunk/pysoy/src/scenes/Scene.pxi 2008-02-06 10:31:15 UTC (rev 816)
+++ trunk/pysoy/src/scenes/Scene.pxi 2008-02-06 11:29:58 UTC (rev 817)
@@ -19,9 +19,6 @@
cimport soy.bodies.lights
-cdef soy._internals.Children _scenes
-_scenes = soy._internals.Children()
-
cdef class Scene :
'''PySoy Scene
Modified: trunk/pysoy/src/scenes/_getScenes.pxi
===================================================================
--- trunk/pysoy/src/scenes/_getScenes.pxi 2008-02-06 10:31:15 UTC (rev
816)
+++ trunk/pysoy/src/scenes/_getScenes.pxi 2008-02-06 11:29:58 UTC (rev
817)
@@ -1,4 +1,4 @@
-# PySoy scenes.Scene Class
+# PySoy scenes._getScenes function
#
# Copyright (C) 2006,2007,2008 PySoy Group
#
@@ -17,145 +17,9 @@
#
# $Id$
-cimport soy.bodies.lights
-
cdef soy._internals.Children _scenes
_scenes = soy._internals.Children()
-cdef class Scene :
- '''PySoy Scene
+cdef void* _getScenes() :
+ return <void*> _scenes
- Scenes are containers in physics space for bodies, joints, and shapes.
- Objects in different worlds cannot interact, for example, bodies in two
- different worlds cannot collide. Worlds also apply gravity to bodies.
- '''
-
- def __cinit__(self, *args, **kw) :
- global _scenes
- self._bodies = soy._internals.Children()
- self._joints = soy._internals.Children()
- self._lights = soy._internals.Children()
- self._worldID = ode.dWorldCreate()
- self._spaceID = ode.dSimpleSpaceCreate(NULL)
- self._stepSize = 0.01
- self._prevTime = _time()
- self._ambient = soy.colors.Gray()
- _scenes.lock()
- _scenes.append(<void *>self)
- _scenes.unlock()
-
-
- def __dealloc__(self) :
- global _scenes
- _scenes.lock()
- _scenes.remove(<void *>self)
- _scenes.unlock()
- if self._worldID != NULL :
- ode.dWorldDestroy(self._worldID)
- if self._spaceID != NULL :
- ode.dSpaceDestroy(self._spaceID)
-
-
- def __repr__(self) :
- report = []
- if self._bodies.current == 1 :
- report.append('1 body')
- elif self._bodies.current > 1 :
- report.append('%d bodies' % self._bodies.current)
-
- if self._lights.current == 1 :
- report.append('1 light')
- elif self._bodies.current > 1 :
- report.append('%d lights' % self._lights.current)
-
- if report == [] : return '<Empty Scene>'
- else : return '<Scene with %s>' % ', '.join(report)
-
-
- cdef void _render(self) :
- cdef int i
- cdef float _ambientLight[4]
-
- gl.glEnable(gl.GL_LIGHTING)
- (<soy.colors.Color> self._ambient)._getRGBA(_ambientLight)
- gl.glLightModelfv(gl.GL_LIGHT_MODEL_AMBIENT, _ambientLight)
- self._lights.lock()
- 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)
- self._lights.unlock()
- self._bodies.lock()
- for i from 0 <= i < self._bodies.current :
- (<soy.bodies._bodies.Body> self._bodies.list[i])._render()
- self._bodies.unlock()
- self._lights.lock()
- 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.unlock()
- gl.glDisable(gl.GL_LIGHTING)
-
-
- cdef void _updateTime(self) :
- self._time = _time()
-
-
- cdef int _steps(self) :
- cdef int _step
- cdef double _lapsTime
- _lapsTime = _time() - self._prevTime
- if _lapsTime < ode.dEpsilon :
- _lapsTime = ode.dEpsilon
- _step = lround(_lapsTime / self._stepSize)
- if _step > 12 :
- _step = 12
- self._prevTime = self._prevTime + (_step * self._stepSize)
- return _step
-
-
- property gravity :
- '''Scene gravity
-
- This is a scene-wide pseudo-force drawing all bodies in a single
- direction. This should not be confused with a monopole force or other
- forces which are often used for gravity in larger scenes.
-
- Takes a (x,y,z) tuple of numbers, defaults to (0.0, 0.0, 0.0)
- '''
- def __get__(self) :
- cdef ode.dVector3 grav
- ode.dWorldGetGravity(self._worldID, grav)
- return (grav[0], grav[1], grav[2])
- def __set__(self, value) :
- ode.dWorldSetGravity(self._worldID, value[0], value[1], value[2])
-
-
- property stepsize :
- '''Step Size
-
- This is the fraction of time each "step" calculates for. Larger steps
- trade accuracy for speed.
-
- Takes a float, defaults to .01
- '''
- def __get__(self) :
- return self._stepSize
- def __set__(self, value) :
- global _scenes
- _scenes.lock()
- self._stepSize = value
- _scenes.unlock()
-
-
- property ambient :
- '''Scene's ambient light
-
- This is the ambient light for the scene. When no light is used this is
- the only light available in the scene - use it well.
-
- Defaults to soy.colors.Gray().
- '''
- def __get__(self) :
- return self._ambient
- def __set__(self, soy.colors.Color value) :
- self._ambient = value
Modified: trunk/pysoy/src/scenes/soy.scenes.pxd
===================================================================
--- trunk/pysoy/src/scenes/soy.scenes.pxd 2008-02-06 10:31:15 UTC (rev
816)
+++ trunk/pysoy/src/scenes/soy.scenes.pxd 2008-02-06 11:29:58 UTC (rev
817)
@@ -25,13 +25,9 @@
cimport soy._datatypes
cimport soy._internals
cimport soy.colors
-cimport soy.textures
-cdef void _sleep ( unsigned int )
-cdef double _time ( )
+cdef void* _getScenes ( )
-cdef soy._datatypes.AsyncQueue _get_queue ( )
-
cdef class Scene :
cdef ode.dWorldID _worldID
cdef ode.dSpaceID _spaceID
@@ -48,16 +44,3 @@
cdef void _updateTime(self)
-cdef extern from "sys/time.h" :
- cdef struct timeval :
- long int tv_sec
- long int tv_usec
- int gettimeofday (timeval *tv, void *tz )
-
-cdef extern from "math.h" :
- long int lround (double x)
- long int lroundf (float x)
- float fabsf (float number)
-
-cdef extern from "unistd.h" :
- void usleep(unsigned long usec)
Modified: trunk/pysoy/src/scenes/soy.scenes.pyx
===================================================================
--- trunk/pysoy/src/scenes/soy.scenes.pyx 2008-02-06 10:31:15 UTC (rev
816)
+++ trunk/pysoy/src/scenes/soy.scenes.pyx 2008-02-06 11:29:58 UTC (rev
817)
@@ -25,13 +25,13 @@
'by '+'$Author$'[9:-2]
__version__ = 'Trunk (r'+'$Rev$'[6:-2]+')'
+#from soy._core cimport _time
+
cimport soy.joints
cimport soy.bodies.fields
cimport soy.bodies._bodies
-cimport soy.widgets
import soy.colors
-include "../_core-common/_Transports.pxi"
-include "../_core-common/Scene.pxi"
-include "_sleep.pxi"
-include "_time.pxi"
+include "_getScenes.pxi"
+
+include "Scene.pxi"
_______________________________________________
PySoy-SVN mailing list
[email protected]
http://www.pysoy.org/mailman/listinfo/pysoy-svn