Changeset 1351
- Timestamp:
- 09/03/08 03:57:06 (3 months ago)
- Location:
- trunk/pysoy
- Files:
-
- 2 removed
- 10 modified
- 1 copied
-
examples/TexBlocks.py (modified) (1 diff)
-
include/soy.actions.pxd (modified) (1 diff)
-
include/soy.atoms.pxd (modified) (2 diffs)
-
include/soy.bodies.pxd (modified) (1 diff)
-
src/actions/Locomotive.pym (deleted)
-
src/actions/Quit.pym (modified) (1 diff)
-
src/actions/Rotate.pym (deleted)
-
src/actions/Torque.pym (copied) (copied from trunk/pysoy/src/actions/Force.pym) (4 diffs, 1 prop)
-
src/actions/soy.actions.pyx (modified) (1 diff)
-
src/atoms/Axis.pym (modified) (1 diff)
-
src/atoms/Vector.pym (modified) (1 diff)
-
src/atoms/soy.atoms.pyx (modified) (1 diff)
-
src/bodies/Body.pym (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pysoy/examples/TexBlocks.py
r1350 r1351 51 51 key = soy.controllers.Keyboard(win) 52 52 marble = bks['Marble'] 53 key['Q'] = soy.actions. Force(marble, soy.atoms.Vector((-100, 0, 0)))54 key['R'] = soy.actions. Force(marble, soy.atoms.Vector(( 0, 100, 0)))55 key['S'] = soy.actions. Force(marble, soy.atoms.Vector(( 100, 0, 0)))56 key['T'] = soy.actions. Force(marble, soy.atoms.Vector(( 0, -100, 0)))57 key['U'] = soy.actions. Force(marble, soy.atoms.Vector(( 0, 0, -100)))58 key['V'] = soy.actions. Force(marble, soy.atoms.Vector(( 0, 0, 100)))53 key['Q'] = soy.actions.Torque(marble, soy.atoms.Axis((-100, 0, 0))) 54 key['R'] = soy.actions.Torque(marble, soy.atoms.Axis(( 0, 100, 0))) 55 key['S'] = soy.actions.Torque(marble, soy.atoms.Axis(( 100, 0, 0))) 56 key['T'] = soy.actions.Torque(marble, soy.atoms.Axis(( 0, -100, 0))) 57 key['U'] = soy.actions.Torque(marble, soy.atoms.Axis(( 0, 0, -100))) 58 key['V'] = soy.actions.Torque(marble, soy.atoms.Axis(( 0, 0, 100))) 59 59 key['q'] = soy.actions.Quit() 60 60 key[ 1 ] = soy.actions.Quit() # 9 = esc key -
trunk/pysoy/include/soy.actions.pxd
r1350 r1351 36 36 cdef object _callback 37 37 38 cdef class Rotate (Action) :39 cdef soy.bodies.Body _ bod40 cdef ode.dVector3 _rotvector38 cdef class Torque (Action) : 39 cdef soy.bodies.Body _target 40 cdef soy.atoms.Axis _vector -
trunk/pysoy/include/soy.atoms.pxd
r1241 r1351 25 25 cimport ode 26 26 27 cdef class Vertex :28 cdef soy._datatypes.VertexList _list29 cdef int _index30 cdef void* _mutex31 32 33 27 cdef class Face : 34 28 cdef soy._datatypes.FaceList _list … … 36 30 cdef void* _mutex 37 31 32 cdef class Vector : 33 cdef ode.dVector3 _position 38 34 39 cdef class Vector : 40 cdef ode.dVector3 _position 35 cdef class Axis (Vector) : 36 cdef float _noop 37 38 cdef class Vertex : 39 cdef soy._datatypes.VertexList _list 40 cdef int _index 41 cdef void* _mutex -
trunk/pysoy/include/soy.bodies.pxd
r1317 r1351 79 79 cdef void _copyFrom ( self, ode.dReal* ) 80 80 cdef void _addForce ( self, ode.dVector3 ) 81 cdef void _add Rotation( self, ode.dVector3 )81 cdef void _addTorque ( self, ode.dVector3 ) 82 82 # WindowLoop functions 83 83 cdef void _calcFogCoords ( self ) nogil -
trunk/pysoy/src/actions/Quit.pym
r1225 r1351 19 19 20 20 cdef class Quit (Action) : 21 ''' PySoyQuit21 '''soy.actions.Quit 22 22 23 23 When called PySoy will quit. There are no arguments to this class. 24 See soy.actions.Action for more information.25 24 ''' 26 25 -
trunk/pysoy/src/actions/Torque.pym
r1350 r1351 1 # PySoy's action. Force class1 # PySoy's action.Torque class 2 2 # 3 3 # Copyright (C) 2006,2007,2008 PySoy Group … … 18 18 # $Id$ 19 19 20 cdef class Force (Action) :21 '''soy.actions. Force20 cdef class Torque (Action) : 21 '''soy.actions.Torque 22 22 23 Adds velocity to a target L{body<soy.bodies.Body>}.23 Adds rotational velocity to a target L{body<soy.bodies.Body>}. 24 24 25 25 @type target : soy.bodies.Body 26 @param target : Body which force will be applied to27 @type vector : soy.atoms. Vector28 @param vector : Vector of forceto be applied26 @param target : Body which torque will be applied to 27 @type vector : soy.atoms.Axis 28 @param vector : Rotational vector to be applied 29 29 ''' 30 30 … … 37 37 if not isinstance(target, soy.bodies.Body) : 38 38 raise TypeError('first argument must be an instance of soy.bodies.Body') 39 if not isinstance(vector, soy.atoms. Vector) :40 raise TypeError('second argument must be an instance of soy.atoms. Vector')39 if not isinstance(vector, soy.atoms.Axis) : 40 raise TypeError('second argument must be an instance of soy.atoms.Axis') 41 41 self._target = target 42 42 self._vector = vector … … 50 50 cdef void _perform(self, unsigned int _duration) : 51 51 # 52 # Body._add Force calls ode.dBodyAddForce on itself with proper locking53 (<soy.bodies.Body> self._target)._add Force(self._vector._position)52 # Body._addTorque calls ode.dBodyAddTorque on itself with proper locking 53 (<soy.bodies.Body> self._target)._addTorque(self._vector._position) -
trunk/pysoy/src/actions/soy.actions.pyx
r1305 r1351 24 24 include "Quit.pym" 25 25 include "Stdout.pym" 26 include "Locomotive.pym" 27 include "Rotate.pym" 26 include "Torque.pym" -
trunk/pysoy/src/atoms/Axis.pym
r1227 r1351 18 18 # $Id$ 19 19 20 '''21 We need an atom class called Axis storing the three axis values ODE22 takes for various functions (joints, rotating a body, etc)23 Testing should be done to ensure the three values constrain to ODE's specs24 and a cdef function should return a dReal[3] for internal use. Lastly, adding25 a function to soy.bodies.Body such as .rotate which accepts an axis and angle,26 applying these to dRFromAxisAndAngle, or axis or two axis arguments to27 dRFrom2Axes, or None for both which sets the body's rotational identity.28 '''29 20 30 cdef class Axis :31 ''' PySoyAxis21 cdef class Axis (Vector) : 22 '''soy.atoms.Axis 32 23 33 An atom class which stores 3 ODE axis values. 34 Body, Bone, Joint. 24 An axis is a rotational L{vector<soy.atoms.Vector>}. 35 25 ''' 36 37 ############################################################################38 #39 # Python functions40 #41 42 def __cinit__(self, *args, **keywords) :43 pass44 45 46 def __dealloc__(self) :47 pass48 49 50 def __repr__(self) :51 return '<%s>' % self.__class__.__name__52 53 54 ############################################################################55 #56 # Properties57 #58 59 property orientation:60 def __get__(self) :61 pass62 63 def __set__(self, vector) :64 pass -
trunk/pysoy/src/atoms/Vector.pym
r1227 r1351 52 52 53 53 def __repr__(self) : 54 return "<Vector at (%f, %f, %f) >" % (self._position[0], 55 self._position[1], 56 self._position[2]) 54 ''' 55 @rtype : string 56 @return : class name and value 57 ''' 58 return '<%s (%f, %f, %f)>' % (self.__class__.__name__, 59 self._position[0], 60 self._position[1], 61 self._position[2]) 57 62 58 63 -
trunk/pysoy/src/atoms/soy.atoms.pyx
r1236 r1351 19 19 20 20 include "__init__.pym" 21 include "Axis.pym" 21 22 include "Face.pym" 22 23 include "Vertex.pym" -
trunk/pysoy/src/bodies/Body.pym
r1305 r1351 448 448 449 449 450 cdef void _add Rotation(self, ode.dVector3 _rotvector) :450 cdef void _addTorque(self, ode.dVector3 _vector) : 451 451 if self._scene is None : 452 452 raise UnboundLocalError('Body is not in a scene') 453 453 self._scene._stepLock() 454 ode.dBodyAddTorque(self._bodyID, _ rotvector[0], _rotvector[1], _rotvector[2])454 ode.dBodyAddTorque(self._bodyID, _vector[0], _vector[1], _vector[2]) 455 455 self._scene._stepUnLock() 456 456
