[Python-ogre-commit] SF.net SVN: python-ogre:[818] trunk/python-ogre
Brought to you by:
andy_miller,
roman_yakovenko
From: <and...@us...> - 2008-11-26 04:04:18
|
Revision: 818 http://python-ogre.svn.sourceforge.net/python-ogre/?rev=818&view=rev Author: andy_miller Date: 2008-11-26 04:04:08 +0000 (Wed, 26 Nov 2008) Log Message: ----------- Fix to is64 function as it only works on Linux (uses unam) and broken Windows operations Change to document string when aliasing functions to make it a little easier Updates to Bullet demos Removed tab characters from BuildModule (only want spaces..) Modified Paths: -------------- trunk/python-ogre/BuildModule.py trunk/python-ogre/code_generators/common_utils/__init__.py trunk/python-ogre/code_generators/physx/hand_made_wrappers.py trunk/python-ogre/demos/hydrax/Demo_Hydrax01.py trunk/python-ogre/demos/plugins.cfg trunk/python-ogre/environment.py Added Paths: ----------- trunk/python-ogre/demos/bullet/test01.py trunk/python-ogre/demos/bullet/test03.py Removed Paths: ------------- trunk/python-ogre/demos/bullet/test01.py Modified: trunk/python-ogre/BuildModule.py =================================================================== --- trunk/python-ogre/BuildModule.py 2008-11-24 00:08:28 UTC (rev 817) +++ trunk/python-ogre/BuildModule.py 2008-11-26 04:04:08 UTC (rev 818) @@ -97,7 +97,7 @@ env["LDFLAGS"]+="-Wl,-rpath='$$ORIGIN/../../lib' -Wl,-rpath='$$ORIGIN' -Wl,-z,origin" env["PYTHONPATH"]=PREFIX+"/lib/python"+environment.PythonVersionString+"/site-packages" if environment.is64(): - env["PYTHONPATH"]=PREFIX+"/lib64/python"+environment.PythonVersionString+"/site-packages" + env["PYTHONPATH"]=PREFIX+"/lib64/python"+environment.PythonVersionString+"/site-packages" env["ZZIPLIB_LIBS"]="-lzzip" env["PATH"]=PREFIX+"/bin:" + PATH @@ -264,10 +264,10 @@ exit("Was not able to copy the debian %s." % file) ret = spawnTask( "sed --in-place "+filepath+' ' + \ - ' -e"s|%%SHORTDATE%%|`date +%Y%m%d`|" ' + \ - ' -e"s|%%LONGDATE%%|`date +\'%a, %d %b %Y %H:%m:%S %z\'`|" ' + \ - ' -e"s|%%VERSION%%|'+module.source_version+'|"' - , srcdir) + ' -e"s|%%SHORTDATE%%|`date +%Y%m%d`|" ' + \ + ' -e"s|%%LONGDATE%%|`date +\'%a, %d %b %Y %H:%m:%S %z\'`|" ' + \ + ' -e"s|%%VERSION%%|'+module.source_version+'|"' + , srcdir) if ret != 0: exit("Was not able to update the debian %s." % file) @@ -280,7 +280,7 @@ ' -e "s|%%SHORTDATE%%|`date +%Y%m%d`|" ' + \ ' -e "s|%%LONGDATE%%|`date +\'%a, %d %b %Y %H:%m:%S %z\'`|" ' + \ ' -e "s^%%BUILDDEPS%%^`cat '+os.path.join(debiandir, "control")+' | grep Build-Depends:`^"' + \ - ' -e "s|%%VERSION%%|'+module.source_version+'|g"' + ' -e "s|%%VERSION%%|'+module.source_version+'|g"' , buildbase) # Do some cleanup Modified: trunk/python-ogre/code_generators/common_utils/__init__.py =================================================================== --- trunk/python-ogre/code_generators/common_utils/__init__.py 2008-11-24 00:08:28 UTC (rev 817) +++ trunk/python-ogre/code_generators/common_utils/__init__.py 2008-11-26 04:04:08 UTC (rev 818) @@ -335,6 +335,7 @@ aliases[keyname] = aliases[keyname] + 1 else: aliases[keyname] = 1 + desc = desc + "\\\nWARNING FUNCTION NAME CHANGE - from "+fun.name + " -- " + fun.decl_string +" to " + new_alias + " \\n" print "INFO: Adjusting Alias as multiple overlapping functions:", new_alias print "AUTOFT OK: Tranformed ", fun, "(",new_alias,")" Modified: trunk/python-ogre/code_generators/physx/hand_made_wrappers.py =================================================================== --- trunk/python-ogre/code_generators/physx/hand_made_wrappers.py 2008-11-24 00:08:28 UTC (rev 817) +++ trunk/python-ogre/code_generators/physx/hand_made_wrappers.py 2008-11-26 04:04:08 UTC (rev 818) @@ -240,4 +240,28 @@ # rt = mb.class_( 'NxImplicitScreenMesh' ) # rt.add_wrapper_code(WRAPPER_WRAPPER_DEF_NxImplicitScreenMesh) - \ No newline at end of file +# # virtual ::NxActiveTransform * getActiveTransforms( ::NxU32 & nbTransformsOut ) { +# # namespace bpl = boost::python; +# # if( bpl::override func_getActiveTransforms = this->get_override( "getActiveTransforms" ) ){ +# # bpl::object py_result = bpl::call<bpl::object>( func_getActiveTransforms.ptr(), nbTransformsOut ); +# # nbTransformsOut = boost::python::extract< unsigned int >( pyplus_conv::get_out_argument( py_result, "nbTransformsOut" ) ); +# # return bpl::extract< ::NxActiveTransform * >( pyplus_conv::get_out_argument( py_result, 0 ) ); +# # } +# # else{ +# # return NxScene::getActiveTransforms( nbTransformsOut ); +# # } +# # } +# # +# # static boost::python::tuple default_getActiveTransforms( ::NxScene & inst, unsigned int nbTransformsOut ){ +# # NxActiveTransform * result; +# # if( dynamic_cast< NxScene_wrapper * >( boost::addressof( inst ) ) ){ +# # result = inst.::NxScene::getActiveTransforms(nbTransformsOut); +# # } +# # else{ +# # result = inst.getActiveTransforms(nbTransformsOut); +# # } +# # typedef bp::return_value_policy< bp::reference_existing_object > call_policies_t; +# # return bp::make_tuple( pyplusplus::call_policies::make_object< call_policies_t, ::NxActiveTransform * >( result ) +# # , nbTransformsOut ); +# # } + \ No newline at end of file Deleted: trunk/python-ogre/demos/bullet/test01.py =================================================================== --- trunk/python-ogre/demos/bullet/test01.py 2008-11-24 00:08:28 UTC (rev 817) +++ trunk/python-ogre/demos/bullet/test01.py 2008-11-26 04:04:08 UTC (rev 818) @@ -1,78 +0,0 @@ -import sys -sys.path.insert(0,'..') -import PythonOgreConfig - -import ogre.renderer.OGRE as ogre -import ogre.physics.bullet as bullet -t = bullet.btTransform() -ms = bullet.btDefaultMotionState (t) -s = bullet.btBoxShape(bullet.btVector3(10,10,10)) -body = bullet.btRigidBody(1, ms, s) -print body - - -collisionConfiguration = bullet.btDefaultCollisionConfiguration() -dispatcher = bullet.btCollisionDispatcher (collisionConfiguration) - -worldAabbMin = bullet.btVector3(-1000,-1000,-1000) -worldAabbMax = bullet.btVector3(1000,1000,1000) -maxProxies = 32766 - -broadphase = bullet.btAxisSweep3(worldAabbMin, worldAabbMax, maxProxies) - -solver = bullet.btSequentialImpulseConstraintSolver() - -world = bullet.btDiscreteDynamicsWorld(dispatcher, broadphase , solver, collisionConfiguration) -world.getDispatchInfo().m_enableSPU = True -world.setGravity(bullet.btVector3(0,-10,0)) - -print world -print dir(world) -print solver -print broadphase -print dispatcher -print collisionConfiguration -for x in range (30): - world.stepSimulation( x * 1/30) - -world.stepSimulation(0) -world.stepSimulation(-0.333) - - -class OgreMotionState(bullet.btMotionState): - def __init__(self, initalPosition): - bullet.btMotionState.__init__(self) - self.Pos=initalPosition - self.Position=ogre.Vector3() - self.Quaternion=ogre.Quaternion() - - def getWorldTransform(self, WorldTrans): - print WorldTrans - print WorldTrans.Rotation.x(),WorldTrans.Rotation.y(),WorldTrans.Rotation.z() - print self.Pos.getOrigin() - WorldTrans.setOrigin(self.Pos.getOrigin()) - WorldTrans.setBasis(self.Pos.getBasis()) - - print WorldTrans.Rotation.x(),WorldTrans.Rotation.y(),WorldTrans.Rotation.z() - print WorldTrans - print "Pos", self.Pos - t=self.Pos - print "T", t - t.setOrigin(WorldTrans.getOrigin()) - print "T1", t - - - - - def setWorldTransform(WorldTrans): - print "setWorldTrans", WorldTrans - self.Position=ogre.Vector3(WorldTrans.getOrigin().x(),WorldTrans.getOrigin().y(),WorldTrans.getOrigin().z()) - self.Quaternion=ogre.Quaternion(WorldTrans.getRoation().w(),WorldTrans.getRoation().x(),WorldTrans.getRoation().y(),WorldTrans.getRoation().z()) - print "setWorldTrans", WorldTrans - -shape=bullet.btCapsuleShape(10, 20) -print "Creating motionState" -motionState=OgreMotionState(bullet.btTransform(bullet.btMatrix3x3(1.0,1.0,1.0,-1.0,-1.0,-1.0,2,-2,-1))) -Object=bullet.btRigidBody(10.0, motionState, shape) # ...this should work in my eyes - -#Object=bullet.btRigidBody(bullet.btRigidBodyConstructionInfo()) ...well obviously not in bullet 2.6.9 \ No newline at end of file Added: trunk/python-ogre/demos/bullet/test01.py =================================================================== --- trunk/python-ogre/demos/bullet/test01.py (rev 0) +++ trunk/python-ogre/demos/bullet/test01.py 2008-11-26 04:04:08 UTC (rev 818) @@ -0,0 +1,96 @@ +# +# Updated to calculate a falling sphere: +# http://www.bulletphysics.com/mediawiki-1.5.8/index.php?title=Hello_World +# + +import sys +sys.path.insert(0,'..') +import PythonOgreConfig + +import ogre.renderer.OGRE as ogre +import ogre.physics.bullet as bullet +t = bullet.btTransform() +ms = bullet.btDefaultMotionState (t) +s = bullet.btBoxShape(bullet.btVector3(10,10,10)) +body = bullet.btRigidBody(1, ms, s) +print body + + +collisionConfiguration = bullet.btDefaultCollisionConfiguration() +dispatcher = bullet.btCollisionDispatcher (collisionConfiguration) + +worldAabbMin = bullet.btVector3(-1000,-1000,-1000) +worldAabbMax = bullet.btVector3(1000,1000,1000) +maxProxies = 32766 + +broadphase = bullet.btAxisSweep3(worldAabbMin, worldAabbMax, maxProxies) + +solver = bullet.btSequentialImpulseConstraintSolver() + +world = bullet.btDiscreteDynamicsWorld(dispatcher, broadphase , solver, collisionConfiguration) +world.getDispatchInfo().m_enableSPU = True +world.setGravity(bullet.btVector3(0,-10,0)) + +print world +print dir(world) +print solver +print broadphase +print dispatcher +print collisionConfiguration +for x in range (30): + world.stepSimulation( x * 1/30) + +world.stepSimulation(0) +world.stepSimulation(-0.333) + + +class OgreMotionState(bullet.btMotionState): + def __init__(self, initalPosition): + bullet.btMotionState.__init__(self) + self.Pos=initalPosition + self.Position=ogre.Vector3() + self.Quaternion=ogre.Quaternion() + + def getWorldTransform(self, WorldTrans): + print WorldTrans + print WorldTrans.Rotation.x(),WorldTrans.Rotation.y(),WorldTrans.Rotation.z() + print self.Pos.getOrigin() + WorldTrans.setOrigin(self.Pos.getOrigin()) + WorldTrans.setBasis(self.Pos.getBasis()) + + print WorldTrans.Rotation.x(),WorldTrans.Rotation.y(),WorldTrans.Rotation.z() + print WorldTrans + print "Pos", self.Pos + t=self.Pos + print "T", t + t.setOrigin(WorldTrans.getOrigin()) + print "T1", t + + def setWorldTransform(self, WorldTrans): + #print "setWorldTrans", WorldTrans + self.Position=ogre.Vector3(WorldTrans.getOrigin().x(),WorldTrans.getOrigin().y(),WorldTrans.getOrigin().z()) + self.Quaternion=ogre.Quaternion(WorldTrans.getRotation().w(),WorldTrans.getRotation().x(),WorldTrans.getRotation().y(),WorldTrans.getRotation().z()) + #print "setWorldTrans", WorldTrans + + +mass = 10 +fallInertia = bullet.btVector3(0, 0, 0) +shape=bullet.btSphereShape(1) +shape.calculateLocalInertia(mass, fallInertia) +print "Creating motionState" +motionState=OgreMotionState(bullet.btTransform(bullet.btQuaternion(0, 0, 0, 1), bullet.btVector3(0, 50, 0))) +construct = bullet.btRigidBody.btRigidBodyConstructionInfo(mass, motionState, shape, fallInertia) +Object=bullet.btRigidBody(construct) # ...this should work in my eyes +world.addRigidBody(Object) + +for x in range (90): + world.stepSimulation( x * 1/30) + + pos = Object.getMotionState().Position + print x, "height: " + str(pos.y) + +# note we need to delete the world before the Object as there are issues with the destructor on Objects causing +# virtual functions being called errors +del world + + Copied: trunk/python-ogre/demos/bullet/test03.py (from rev 817, trunk/python-ogre/demos/bullet/test01.py) =================================================================== --- trunk/python-ogre/demos/bullet/test03.py (rev 0) +++ trunk/python-ogre/demos/bullet/test03.py 2008-11-26 04:04:08 UTC (rev 818) @@ -0,0 +1,78 @@ +import sys +sys.path.insert(0,'..') +import PythonOgreConfig + +import ogre.renderer.OGRE as ogre +import ogre.physics.bullet as bullet +t = bullet.btTransform() +ms = bullet.btDefaultMotionState (t) +s = bullet.btBoxShape(bullet.btVector3(10,10,10)) +body = bullet.btRigidBody(1, ms, s) +print body + + +collisionConfiguration = bullet.btDefaultCollisionConfiguration() +dispatcher = bullet.btCollisionDispatcher (collisionConfiguration) + +worldAabbMin = bullet.btVector3(-1000,-1000,-1000) +worldAabbMax = bullet.btVector3(1000,1000,1000) +maxProxies = 32766 + +broadphase = bullet.btAxisSweep3(worldAabbMin, worldAabbMax, maxProxies) + +solver = bullet.btSequentialImpulseConstraintSolver() + +world = bullet.btDiscreteDynamicsWorld(dispatcher, broadphase , solver, collisionConfiguration) +world.getDispatchInfo().m_enableSPU = True +world.setGravity(bullet.btVector3(0,-10,0)) + +print world +print dir(world) +print solver +print broadphase +print dispatcher +print collisionConfiguration +for x in range (30): + world.stepSimulation( x * 1/30) + +world.stepSimulation(0) +world.stepSimulation(-0.333) + + +class OgreMotionState(bullet.btMotionState): + def __init__(self, initalPosition): + bullet.btMotionState.__init__(self) + self.Pos=initalPosition + self.Position=ogre.Vector3() + self.Quaternion=ogre.Quaternion() + + def getWorldTransform(self, WorldTrans): + print WorldTrans + print WorldTrans.Rotation.x(),WorldTrans.Rotation.y(),WorldTrans.Rotation.z() + print self.Pos.getOrigin() + WorldTrans.setOrigin(self.Pos.getOrigin()) + WorldTrans.setBasis(self.Pos.getBasis()) + + print WorldTrans.Rotation.x(),WorldTrans.Rotation.y(),WorldTrans.Rotation.z() + print WorldTrans + print "Pos", self.Pos + t=self.Pos + print "T", t + t.setOrigin(WorldTrans.getOrigin()) + print "T1", t + + + + + def setWorldTransform(WorldTrans): + print "setWorldTrans", WorldTrans + self.Position=ogre.Vector3(WorldTrans.getOrigin().x(),WorldTrans.getOrigin().y(),WorldTrans.getOrigin().z()) + self.Quaternion=ogre.Quaternion(WorldTrans.getRoation().w(),WorldTrans.getRoation().x(),WorldTrans.getRoation().y(),WorldTrans.getRoation().z()) + print "setWorldTrans", WorldTrans + +shape=bullet.btCapsuleShape(10, 20) +print "Creating motionState" +motionState=OgreMotionState(bullet.btTransform(bullet.btMatrix3x3(1.0,1.0,1.0,-1.0,-1.0,-1.0,2,-2,-1))) +Object=bullet.btRigidBody(10.0, motionState, shape) # ...this should work in my eyes + +#Object=bullet.btRigidBody(bullet.btRigidBodyConstructionInfo()) ...well obviously not in bullet 2.6.9 \ No newline at end of file Modified: trunk/python-ogre/demos/hydrax/Demo_Hydrax01.py =================================================================== --- trunk/python-ogre/demos/hydrax/Demo_Hydrax01.py 2008-11-24 00:08:28 UTC (rev 817) +++ trunk/python-ogre/demos/hydrax/Demo_Hydrax01.py 2008-11-26 04:04:08 UTC (rev 818) @@ -179,14 +179,14 @@ # Create our projected grid module self.noise= Hydrax.Perlin() ## Default options (8, 0.085, 0.49, 1.4, 1.27f) self.Module = Hydrax.ProjectedGrid(# Hydrax parent pointer - self.hydrax, - # Noise module - self.noise, - # Base plane - ogre.Plane(ogre.Vector3(0,1,0), ogre.Vector3(0,0,0)), - Hydrax.MaterialManager.NM_VERTEX, - # Projected grid options (Can be updated each frame . setOptions(...)) - Hydrax.ProjectedGrid.Options(264 )) + self.hydrax, + # Noise module + self.noise, + # Base plane + ogre.Plane(ogre.Vector3(0,1,0), ogre.Vector3(0,0,0)), + Hydrax.MaterialManager.NM_VERTEX, + # Projected grid options (Can be updated each frame . setOptions(...)) + Hydrax.ProjectedGrid.Options(264 )) # Set our module self.hydrax.setModule(self.Module) Modified: trunk/python-ogre/demos/plugins.cfg =================================================================== --- trunk/python-ogre/demos/plugins.cfg 2008-11-24 00:08:28 UTC (rev 817) +++ trunk/python-ogre/demos/plugins.cfg 2008-11-26 04:04:08 UTC (rev 818) @@ -1,13 +1,19 @@ # Defines plugins to load ## Use this for Windows +# Define plugin folder +PluginFolder=../../plugins +Plugin=RenderSystem_GL.dll +Plugin=RenderSystem_Direct3D9.dll +Plugin=Plugin_ParticleFX.dll +Plugin=Plugin_BSPSceneManager.dll +Plugin=Plugin_OctreeSceneManager.dll +Plugin=Plugin_CgProgramManager.dll - ## ## NOTE use this for MacOS or Linux -PluginFolder=/home/andy/development/root/usr/lib/OGRE -Plugin=RenderSystem_GL -Plugin=Plugin_ParticleFX -Plugin=Plugin_BSPSceneManager -Plugin=Plugin_OctreeSceneManager -Plugin=Plugin_CgProgramManager +# Plugin=RenderSystem_GL +# Plugin=Plugin_ParticleFX +# Plugin=Plugin_BSPSceneManager +# Plugin=Plugin_OctreeSceneManager +# Plugin=Plugin_CgProgramManager Modified: trunk/python-ogre/environment.py =================================================================== --- trunk/python-ogre/environment.py 2008-11-24 00:08:28 UTC (rev 817) +++ trunk/python-ogre/environment.py 2008-11-26 04:04:08 UTC (rev 818) @@ -42,8 +42,9 @@ return False def is64(): - if os.uname()[4] == 'x86_64': - return True + if isLinux(): + if os.uname()[4] == 'x86_64': # TOFIX - can we use sys.platform for this as uname is linux specific.. + return True return False This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |