[Python-ogre-commit] SF.net SVN: python-ogre:[773] trunk/python-ogre
Brought to you by:
andy_miller,
roman_yakovenko
|
From: <and...@us...> - 2008-10-24 02:56:46
|
Revision: 773
http://python-ogre.svn.sourceforge.net/python-ogre/?rev=773&view=rev
Author: andy_miller
Date: 2008-10-24 02:56:40 +0000 (Fri, 24 Oct 2008)
Log Message:
-----------
Physx updates
Modified Paths:
--------------
trunk/python-ogre/code_generators/ogre/generate_code.py
trunk/python-ogre/code_generators/physx/generate_code.py
trunk/python-ogre/code_generators/physx/hand_made_wrappers.py
trunk/python-ogre/environment.py
Added Paths:
-----------
trunk/python-ogre/demos/physx/
trunk/python-ogre/demos/physx/NxBoxes.py
trunk/python-ogre/demos/physx/Utilities.py
trunk/python-ogre/demos/physx/physx_01.py
Modified: trunk/python-ogre/code_generators/ogre/generate_code.py
===================================================================
--- trunk/python-ogre/code_generators/ogre/generate_code.py 2008-10-21 10:25:36 UTC (rev 772)
+++ trunk/python-ogre/code_generators/ogre/generate_code.py 2008-10-24 02:56:40 UTC (rev 773)
@@ -90,6 +90,22 @@
pygccxml.declarations.smart_pointer_traits = my_smart_ptr
+
+# # # I defined new class - internal_type_traits, which provides access to
+# # # internal types.
+# # #
+# # # @staticmethod
+# # # def value_type( type ):
+# # # if my_smart_ptr.is_smart_pointer( type ):
+# # # return declarations.internal_type_traits.get_by_name(
+# # # type, "value_type" )
+# # #
+# # # The new class allows you to handle cases, where "value_type" has
+# # # different name. In case of auto_ptr it is "element_type".
+# # #
+# # # The new code is committed to SVN
+# # #
+
HACK = True
MAIN_NAMESPACE = 'Ogre'
Modified: trunk/python-ogre/code_generators/physx/generate_code.py
===================================================================
--- trunk/python-ogre/code_generators/physx/generate_code.py 2008-10-21 10:25:36 UTC (rev 772)
+++ trunk/python-ogre/code_generators/physx/generate_code.py 2008-10-24 02:56:40 UTC (rev 773)
@@ -85,6 +85,7 @@
excludes = ['NxCreatePMap' # refrences TriangleMEsh, however they don't expose the destructor
,'NxGetValue' # unresolved external
+ ,'NxCreatePhysicsSDK','NxCreatePhysicsSDKWithID' # hand wrapped to return sdk + errorcode
]
for e in excludes:
print "Excluding:", e
@@ -117,6 +118,7 @@
if not "const" in o.decl_string:
o.exclude()
print "Excluding Operator:", o
+
############################################################
##
## And there are things that manually need to be INCLUDED
@@ -160,7 +162,13 @@
def create_output( size ):
return [ ft.output( i ) for i in range( size ) ]
-
+# f=main_ns.free_function( "NxCreatePhysicsSDK")
+# f.add_transformation(ft.output('errorCode'))
+# f.documentation = docit ("","", "tuple - SDK, ErrorCode")
+# f=main_ns.free_function( "NxCreatePhysicsSDKWithID")
+# f.add_transformation(ft.output('errorCode'))
+# f.documentation = docit ("","", "tuple - SDK, ErrorCode")
+
###############################################################################
##
## Now for the AUTOMATIC stuff that should just work
Modified: trunk/python-ogre/code_generators/physx/hand_made_wrappers.py
===================================================================
--- trunk/python-ogre/code_generators/physx/hand_made_wrappers.py 2008-10-21 10:25:36 UTC (rev 772)
+++ trunk/python-ogre/code_generators/physx/hand_made_wrappers.py 2008-10-24 02:56:40 UTC (rev 773)
@@ -9,6 +9,60 @@
}
"""
+WRAPPER_DEFINITION_Utility = \
+"""
+unsigned int NxUtility_NX_PHYSICS_SDK_VERSION( void ) {
+ return NX_PHYSICS_SDK_VERSION;
+ }
+
+boost::python::tuple
+NxUtility_NX_PHYSICS_SDK_VERSION_TUPLE ( void ) {
+ return ( boost::python::make_tuple( NX_PHYSICS_SDK_VERSION,
+ NX_SDK_VERSION_MAJOR,
+ NX_SDK_VERSION_MINOR,
+ NX_SDK_VERSION_BUGFIX
+ ) );
+}
+
+boost::python::tuple NxUtility_NxCreatePhysicsSDK( ::NxU32 sdkVersion, ::NxUserAllocator * allocator=0, ::NxUserOutputStream * outputStream=0, ::NxPhysicsSDKDesc const & desc=::NxPhysicsSDKDesc( ) ){
+ NxSDKCreateError errorCode2;
+ ::NxPhysicsSDK * result = ::NxCreatePhysicsSDK(sdkVersion, allocator, outputStream, desc, &errorCode2);
+ typedef bp::return_value_policy< bp::reference_existing_object > call_policies_t;
+ return bp::make_tuple( pyplusplus::call_policies::make_object< call_policies_t, ::NxPhysicsSDK * >( result )
+ , errorCode2 );
+}
+
+boost::python::tuple NxUtility_NxCreatePhysicsSDKWithID( ::NxU32 sdkVersion, char * companyNameStr, char * appNameStr, char * appVersionStr, char * appUserDefinedStr, ::NxUserAllocator * allocator=0, ::NxUserOutputStream * outputStream=0, ::NxPhysicsSDKDesc const & desc=::NxPhysicsSDKDesc( ) ){
+ NxSDKCreateError errorCode2;
+ ::NxPhysicsSDK * result = ::NxCreatePhysicsSDKWithID(sdkVersion, companyNameStr, appNameStr, appVersionStr, appUserDefinedStr, allocator, outputStream, desc, &errorCode2);
+ typedef bp::return_value_policy< bp::reference_existing_object > call_policies_t;
+ return bp::make_tuple( pyplusplus::call_policies::make_object< call_policies_t, ::NxPhysicsSDK * >( result )
+ , errorCode2 );
+}
+
+
+"""
+WRAPPER_REGISTRATION_Utility = [
+ 'bp::def( "NX_PHYSICS_SDK_VERSION", &::NxUtility_NX_PHYSICS_SDK_VERSION,\
+ "Python-Ogre Hand Wrapped\\nReturns the SDK Version");',
+
+ 'bp::def( "NX_PHYSICS_SDK_VERSION_TUPLE", &::NxUtility_NX_PHYSICS_SDK_VERSION_TUPLE,\
+ "Python-Ogre Hand Wrapped\\nReturns the SDK Version, A tuple of version,major,minor,bugfix");',
+
+ """bp::def( "NxCreatePhysicsSDK", &::NxUtility_NxCreatePhysicsSDK,
+ ( bp::arg("sdkVersion"), bp::arg("allocator")=bp::object(), bp::arg("outputStream")=bp::object(), bp::arg("desc")=::NxPhysicsSDKDesc( ) ),
+ "Python-Ogre Hand Wrapped (PhysX) Modified Function Call\\n\\
+ Input: \\n\\
+ Output: tuple - SDK, ErrorCode\\n"); """,
+
+ """bp::def( "NxCreatePhysicsSDKWithID", &::NxUtility_NxCreatePhysicsSDKWithID,
+ ( bp::arg("sdkVersion"), bp::arg("companyNameStr"), bp::arg("appNameStr"), bp::arg("appVersionStr"), bp::arg("appUserDefinedStr"), bp::arg("allocator")=bp::object(), bp::arg("outputStream")=bp::object(), bp::arg("desc")=::NxPhysicsSDKDesc( ) ),
+ "Python-Ogre Hand Wrapped (PhysX) Modified Function Call\\n\\
+ Input: \\n\\
+ Output: tuple - SDK, ErrorCode\\n"); """
+
+ ]
+
WRAPPER_DEFINITION_NxActor = \
"""
bp::object NxActor_getShapes( ) {
@@ -110,6 +164,9 @@
def apply( mb ):
global_ns = mb.global_ns
+
+ mb.add_declaration_code( WRAPPER_DEFINITION_Utility )
+ apply_reg (mb, WRAPPER_REGISTRATION_Utility )
# I'm going to do some automated hand wrapping here
getSizeFunctions={'getEmitters':'getNbEmitters', 'getScreenSurfaceMeshes':'getNbScreenSurfaceMeshes',
Added: trunk/python-ogre/demos/physx/NxBoxes.py
===================================================================
--- trunk/python-ogre/demos/physx/NxBoxes.py (rev 0)
+++ trunk/python-ogre/demos/physx/NxBoxes.py 2008-10-24 02:56:40 UTC (rev 773)
@@ -0,0 +1,337 @@
+## ===============================================================================
+##
+## AGEIA PhysX SDK Sample Program
+##
+## Title: Boxes Sample
+## Description: This sample program shows how to create some simple dynamic objects
+## with the AGEIA PhysX SDK.
+##
+## ===============================================================================
+
+#include <stdio.h>
+#include <GL/glut.h>
+
+#include "NxPhysics.h"
+#include "ErrorStream.h"
+#include "PerfRenderer.h"
+#include "Utilities.h"
+#include "SamplesVRDSettings.h"
+
+## Physics
+static NxPhysicsSDK* gPhysicsSDK = None
+static NxScene* gScene = None
+static PerfRenderer gPerfRenderer
+
+## Rendering
+static NxVec3 gEye(50.0, 50.0f, 50.0f)
+static NxVec3 gDir(-0.6,-0.2f,-0.7f)
+static NxVec3 gViewY
+static int gMouseX = 0
+static int gMouseY = 0
+
+static bool InitNx()
+
+ ## Initialize PhysicsSDK
+ NxPhysicsSDKDesc desc
+ NxSDKCreateError errorCode = NXCE_NO_ERROR
+ gPhysicsSDK = NxCreatePhysicsSDK(NX_PHYSICS_SDK_VERSION, None, new ErrorStream(), desc, &errorCode)
+ if(gPhysicsSDK == None) :
+
+ printf("\nSDK create error (%d - %s).\nUnable to initialize the PhysX SDK, exiting the sample.\n\n", errorCode, getNxSDKCreateError(errorCode))
+ return False
+
+#if SAMPLES_USE_VRD:
+ ## The settings for the VRD host and port are found in SampleCommonCode/SamplesVRDSettings.h
+ if (gPhysicsSDK->getFoundationSDK().getRemoteDebugger()):
+ gPhysicsSDK->getFoundationSDK().getRemoteDebugger()->connect(SAMPLES_VRD_HOST, SAMPLES_VRD_PORT, SAMPLES_VRD_EVENTMASK)
+#endif
+
+ gPhysicsSDK->setParameter(NX_SKIN_WIDTH, 0.05)
+
+ ## Create a scene
+ NxSceneDesc sceneDesc
+ sceneDesc.gravity = NxVec3(0.0, -9.81f, 0.0f)
+ gScene = gPhysicsSDK->createScene(sceneDesc)
+ if(gScene == None) :
+
+ printf("\nError: Unable to create a PhysX scene, exiting the sample.\n\n")
+ return False
+
+
+ ## Set default material
+ NxMaterial* defaultMaterial = gScene->getMaterialFromIndex(0)
+ defaultMaterial->setRestitution(0.0)
+ defaultMaterial->setStaticFriction(0.5)
+ defaultMaterial->setDynamicFriction(0.5)
+
+ ## Create ground plane
+ NxPlaneShapeDesc planeDesc
+ NxActorDesc actorDesc
+ actorDesc.shapes.pushBack(&planeDesc)
+ gScene->createActor(actorDesc)
+
+ return True
+
+
+static void ExitNx()
+
+ if(gPhysicsSDK != None):
+
+ if(gScene != None) gPhysicsSDK->releaseScene(*gScene) :
+ gScene = None
+ NxReleasePhysicsSDK(gPhysicsSDK)
+ gPhysicsSDK = None
+
+
+
+static void CreateCube( NxVec3& pos, int size=2, const NxVec3* initialVelocity=None)
+
+ if(gScene == None) return :
+
+ ## Create body
+ NxBodyDesc bodyDesc
+ bodyDesc.angularDamping = 0.5
+ if(initialVelocity) bodyDesc.linearVelocity = *initialVelocity :
+
+ NxBoxShapeDesc boxDesc
+ boxDesc.dimensions = NxVec3((float)size, (float)size, (float)size)
+
+ NxActorDesc actorDesc
+ actorDesc.shapes.pushBack(&boxDesc)
+ actorDesc.body = &bodyDesc
+ actorDesc.density = 10.0
+ actorDesc.globalPose.t = pos
+ gScene->createActor(actorDesc)->userData = (void*)size_t(size)
+ ##printf("Total: %d actors\n", gScene->getNbActors())
+
+
+static void CreateCubeFromEye(int size)
+
+ NxVec3 t = gEye
+ NxVec3 vel = gDir
+ vel.normalize()
+ vel*=200.0
+ CreateCube(t, size, &vel)
+
+
+static void CreateStack(int size)
+
+ float cubeSize = 2.0
+ float spacing = -2.0*gPhysicsSDK->getParameter(NX_SKIN_WIDTH)
+ NxVec3 pos(0.0, cubeSize, 0.0f)
+ float offset = -size * (cubeSize * 2.0 + spacing) * 0.5f
+ while(size)
+
+ for(int i=0 i<size;i++)
+
+ pos.x = offset + (float)i * (cubeSize * 2.0 + spacing)
+ CreateCube(pos, (int)cubeSize)
+
+
+ offset += cubeSize
+ pos.y += (cubeSize * 2.0 + spacing)
+ size--
+
+
+
+static void CreateTower(int size)
+
+ float cubeSize = 2.0
+ float spacing = 0.01
+ NxVec3 pos(0.0, cubeSize, 0.0f)
+ while(size)
+
+ CreateCube(pos, (int)cubeSize)
+ pos.y += (cubeSize * 2.0 + spacing)
+ size--
+
+
+
+static void KeyboardCallback(unsigned char key, int x, int y)
+
+ switch(key)
+
+ case 27:
+ exit(0)
+ break
+ case '0':
+ gPerfRenderer.toggleEnable()
+ break
+ case ' ':
+ CreateCube(NxVec3(0.0, 20.0f, 0.0f),1)
+ break
+ case 's':
+ case 'S':
+ CreateStack(10)
+ break
+ case 'b':
+ case 'B':
+ CreateStack(30)
+ break
+ case 't':
+ case 'T':
+ CreateTower(30)
+ break
+ case 'w':
+ case 'W':
+ CreateCubeFromEye(8)
+ break
+ case 'q':
+ case 'Q':
+
+ NxActor** actors = gScene->getActors()
+ if(gScene->getNbActors() > 1){:
+ gScene->releaseActor(*actors[gScene->getNbActors()-1])
+
+
+ break
+ case GLUT_KEY_UP: case '8': gEye += gDir*2.0 break;
+ case GLUT_KEY_DOWN: case '2': gEye -= gDir*2.0 break;
+ case GLUT_KEY_LEFT: case '4': gEye -= gViewY*2.0 break;
+ case GLUT_KEY_RIGHT: case '6': gEye += gViewY*2.0 break;
+
+
+
+static void ArrowKeyCallback(int key, int x, int y)
+
+ KeyboardCallback(key,x,y)
+
+
+static void MouseCallback(int button, int state, int x, int y)
+
+ gMouseX = x
+ gMouseY = y
+
+
+static void MotionCallback(int x, int y)
+
+ int dx = gMouseX - x
+ int dy = gMouseY - y
+
+ gDir.normalize()
+ gViewY.cross(gDir, NxVec3(0,1,0))
+
+ NxQuat qx(NxPiF32 * dx * 20/ 180.0, NxVec3(0,1,0))
+ qx.rotate(gDir)
+ NxQuat qy(NxPiF32 * dy * 20/ 180.0, gViewY)
+ qy.rotate(gDir)
+
+ gMouseX = x
+ gMouseY = y
+
+
+static void RenderCallback()
+
+ if(gScene == None) return :
+
+ ## Start simulation (non blocking)
+ gScene->simulate(1.0/60.0f)
+
+ ## Clear buffers
+ glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT)
+
+ ## Setup projection matrix
+ glMatrixMode(GL_PROJECTION)
+ glLoadIdentity()
+ gluPerspective(60.0, (float)glutGet(GLUT_WINDOW_WIDTH)/(float)glutGet(GLUT_WINDOW_HEIGHT), 1.0f, 10000.0f)
+ gluLookAt(gEye.x, gEye.y, gEye.z, gEye.x + gDir.x, gEye.y + gDir.y, gEye.z + gDir.z, 0.0, 1.0f, 0.0f)
+
+ ## Setup modelview matrix
+ glMatrixMode(GL_MODELVIEW)
+ glLoadIdentity()
+
+ ## Render all actors
+ int nbActors = gScene->getNbActors()
+ NxActor** actors = gScene->getActors()
+ while(nbActors--)
+
+ NxActor* actor = *actors++
+ if(!actor->userData) continue :
+
+ ## Render actor
+ glPushMatrix()
+ float glMat[16]
+ actor->getGlobalPose().getColumnMajor44(glMat)
+ glMultMatrixf(glMat)
+ glColor4(1.0f, 1.0f, 1.0f, 1.0f)
+ glutSolidCube(float(size_t(actor->userData))*2.0)
+ glPopMatrix()
+
+ ## Render shadow
+ glPushMatrix()
+ static float shadowMat[]={ 1,0,0,0, 0,0,0,0, 0,0,1,0, 0,0,0,1 }
+ glMultMatrixf(shadowMat)
+ glMultMatrixf(glMat)
+ glDisable(GL_LIGHTING)
+ glColor4(0.1f, 0.2f, 0.3f, 1.0f)
+ glutSolidCube(float(size_t(actor->userData))*2.0)
+ glEnable(GL_LIGHTING)
+ glPopMatrix()
+
+
+ ## Fetch simulation results
+ gScene->flushStream()
+ gScene->fetchResults(NX_RIGID_BODY_FINISHED, True)
+
+ ## Print profile results (if enabled)
+ gPerfRenderer.render(gScene->readProfileData(True), glutGet(GLUT_WINDOW_WIDTH), glutGet(GLUT_WINDOW_HEIGHT))
+
+ glutSwapBuffers()
+
+
+static void ReshapeCallback(int width, int height)
+
+ glViewport(0, 0, width, height)
+
+
+static void IdleCallback()
+
+ glutPostRedisplay()
+
+
+int main(int argc, char** argv)
+
+ ## Initialize glut
+ printf("Use the arrow keys or 2, 4, 6 and 8 to move the camera.\n")
+ printf("Use the mouse to rotate the camera.\n")
+ printf("Press the keys w, t, s, b and space to create various things.\n")
+ printf("Press q to destroy the last thing created.\n")
+ printf("Press 0 to toggle the frame rate display.\n")
+ glutInit(&argc, argv)
+ glutInitWindowSize(512, 512)
+ glutInitDisplayMode(GLUT_RGB|GLUT_DOUBLE|GLUT_DEPTH)
+ int mainHandle = glutCreateWindow("SampleBoxes")
+ glutSetWindow(mainHandle)
+ glutDisplayFunc(RenderCallback)
+ glutReshapeFunc(ReshapeCallback)
+ glutIdleFunc(IdleCallback)
+ glutKeyboardFunc(KeyboardCallback)
+ glutSpecialFunc(ArrowKeyCallback)
+ glutMouseFunc(MouseCallback)
+ glutMotionFunc(MotionCallback)
+ MotionCallback(0,0)
+ atexit(ExitNx)
+
+ ## Setup default render states
+ glClearColor(0.3, 0.4f, 0.5f, 1.0)
+ glEnable(GL_DEPTH_TEST)
+ glEnable(GL_COLOR_MATERIAL)
+
+ ## Setup lighting
+ glEnable(GL_LIGHTING)
+ float ambientColor[] = { 0.0, 0.1f, 0.2f, 0.0f }
+ float diffuseColor[] = { 1.0, 1.0f, 1.0f, 0.0f }
+ float specularColor[] = { 0.0, 0.0f, 0.0f, 0.0f }
+ float position[] = { 100.0, 100.0f, 400.0f, 1.0f }
+ glLightfv(GL_LIGHT0, GL_AMBIENT, ambientColor)
+ glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuseColor)
+ glLightfv(GL_LIGHT0, GL_SPECULAR, specularColor)
+ glLightfv(GL_LIGHT0, GL_POSITION, position)
+ glEnable(GL_LIGHT0)
+
+ ## Initialize physics scene and start the application main loop if scene was created
+ if (InitNx()):
+ glutMainLoop()
+
+ return 0
+
Added: trunk/python-ogre/demos/physx/Utilities.py
===================================================================
--- trunk/python-ogre/demos/physx/Utilities.py (rev 0)
+++ trunk/python-ogre/demos/physx/Utilities.py 2008-10-24 02:56:40 UTC (rev 773)
@@ -0,0 +1,43 @@
+import ogre.physics.physx as physx
+
+def getNxSDKCreateError(errorCode):
+ """ convert an errorCode to a useful string message
+ """
+ if errorCode == physx.NXCE_NO_ERROR: return "NXCE_NO_ERROR"
+ if errorCode == physx.NXCE_PHYSX_NOT_FOUND: return "NXCE_PHYSX_NOT_FOUND"
+ if errorCode == physx.NXCE_WRONG_VERSION: return "NXCE_WRONG_VERSION"
+ if errorCode == physx.NXCE_DESCRIPTOR_INVALID: return "NXCE_DESCRIPTOR_INVALID"
+ if errorCode == physx.NXCE_CONNECTION_ERROR: return "NXCE_CONNECTION_ERROR"
+ if errorCode == physx.NXCE_RESET_ERROR: return "NXCE_RESET_ERROR"
+ if errorCode == physx.NXCE_IN_USE_ERROR: return "NXCE_IN_USE_ERROR"
+ return "Unknown error"
+
+def RemoveFileFromPath(path):
+ print "RemoveFileFromPath not yet implemented!!!!!"
+# char *ls = 0
+# while(*path)
+# if(*path == '\\' || *path == '/') ls = path :
+# path++
+# if(ls) *ls = 0 :
+
+def void SetCWDToEXE():
+ print "SetCWDToEXE not yet implemented!!!!!!"
+# char exepath[1024] = {0}
+# GetModuleFileNameA(0, exepath, sizeof(exepath))
+# assert(exepath[0])
+# RemoveFileFromPath(exepath)
+# _chdir(exepath)
+
+def isProcessorBigEndian():
+ print "isProcessorBigEndian not yet implemented!!!!!!"
+ return False
+
+## PT: those functions are useful for internal profiling during dev. They should not be used
+## in the final code, so don't bother porting them to other platforms.
+
+def StartProfile( val):
+ print "StartProfile not yet implemented!!!!!!!!!"
+
+def EndProfile(val):
+ print "EndProfile not yet implemented!!!!!!!!!"
+
Added: trunk/python-ogre/demos/physx/physx_01.py
===================================================================
--- trunk/python-ogre/demos/physx/physx_01.py (rev 0)
+++ trunk/python-ogre/demos/physx/physx_01.py 2008-10-24 02:56:40 UTC (rev 773)
@@ -0,0 +1,107 @@
+##
+## Simple test code for Physx
+##
+import ogre.physics.PhysX as physics
+import sys
+
+class MyOutputStream ( physics.NxUserOutputStream ):
+ def __init__( self):
+# return
+ physics.NxUserOutputStream.__init__( self )
+
+ def reportError (self, code, message, file, line):
+
+ if code < physics.NXE_DB_INFO:
+ MessageBox(NULL, message, "SDK Error", MB_OK),
+ sys.exit(1)
+
+ def reportAssertViolation (self, message, file, line):
+# //this should not get hit by
+# // a properly debugged SDK!
+# assert(0);
+ return physics.NX_AR_CONTINUE
+
+ def print1 (self,message):
+ print "SDK says: %s\n", message
+
+# myOutputStream = MyOutputStream ()
+
+# print myOutputStream
+
+def InitNx ( ) :
+
+ gDefaultGravity = physics.NxVec3(0.0,-9.8,0.0)
+ gCookingInitialized = False
+
+ # Initialize PhysicsSDK
+ desc = physics.NxPhysicsSDKDesc()
+
+ gPhysicsSDK, errorCode = physics.NxCreatePhysicsSDK(physics.NX_PHYSICS_SDK_VERSION(),desc=desc)
+ if gPhysicsSDK == None :
+ print "\nSDK create error (%d - %s).\nUnable to initialize the PhysX SDK, exiting the sample.\n\n" % (errorCode,"test")
+ return False
+
+
+# #if SAMPLES_USE_VRD
+# # The settings for the VRD host and port are found in SampleCommonCode/SamplesVRDSettings.h
+# if (gPhysicsSDK.getFoundationSDK().getRemoteDebugger() && !gPhysicsSDK.getFoundationSDK().getRemoteDebugger().isConnected())
+# gPhysicsSDK.getFoundationSDK().getRemoteDebugger().connect(SAMPLES_VRD_HOST, SAMPLES_VRD_PORT, SAMPLES_VRD_EVENTMASK)
+# #endif
+
+ if not gCookingInitialized:
+ gCookingInitialized = True
+ if not physics.InitCooking():
+ print "\nError: Unable to initialize the cooking library, exiting the sample.\n\n"
+ return False
+
+ # Set the physics parameters
+ gPhysicsSDK.setParameter(physics.NX_SKIN_WIDTH, -0.01)
+
+ # Set the debug visualization parameters
+ gPhysicsSDK.setParameter(physics.NX_VISUALIZATION_SCALE, 1)
+ gPhysicsSDK.setParameter(physics.NX_VISUALIZE_COLLISION_SHAPES, 1)
+ gPhysicsSDK.setParameter(physics.NX_VISUALIZE_JOINT_LIMITS, 1)
+ gPhysicsSDK.setParameter(physics.NX_VISUALIZE_JOINT_LOCAL_AXES, 1)
+
+
+ # Create the scene
+ sceneDesc = physics.NxSceneDesc()
+ sceneDesc.gravity = gDefaultGravity
+ gScene = gPhysicsSDK.createScene(sceneDesc)
+
+ # Create the default material
+ m = physic.NxMaterialDesc ()
+ m.restitution = 0.5
+ m.staticFriction = 0.2
+ m.dynamicFriction = 0.2
+ mat = gScene.getMaterialFromIndex(0)
+ mat.loadFromDesc(m)
+
+# switch(gSceneNr) {
+# case 1 : SetupAnimalScene() break
+# case 2 : SetupWheelScene() break
+# case 3 : SetupPalmScene() break
+# case 4 : SetupGrassScene() break
+# case 5 : SetupRegularScene() break
+# case 6 : SetupBunnyScene() break
+# case 7 : SetupPumpkinScene() break
+#
+# # Insert new cases here
+# }
+#
+# if (gSoftBodies.size() > 0)
+# gSelectedSoftBody = gSoftBodies[0].getNxSoftBody()
+# else
+# gSelectedSoftBody = None
+#
+# if (gScene.getNbActors() > 0)
+# gSelectedActor = *gScene.getActors()
+# else
+# gSelectedActor = None
+#
+# UpdateTime()
+
+ return True
+
+if __name__ == "__main__":
+ print InitNx()
\ No newline at end of file
Modified: trunk/python-ogre/environment.py
===================================================================
--- trunk/python-ogre/environment.py 2008-10-21 10:25:36 UTC (rev 772)
+++ trunk/python-ogre/environment.py 2008-10-24 02:56:40 UTC (rev 773)
@@ -1381,12 +1381,14 @@
,Config.PATH_LIB_Ogre_OgreMain
]
source = [
- ["wget", "http://www.openal.org/openal_webstf/downloads/openal-0.0.8.tar.gz",downloadPath],
+# ["wget", "http://www.openal.org/openal_webstf/downloads/openal-0.0.8.tar.gz",downloadPath],
+ ["wget", "http://connect.creativelabs.com/openal/Downloads/openal-soft-1.5.304.tar.bz2",downloadPath],
["wget", "http://downloads.xiph.org/releases/ogg/libogg-1.1.3.tar.gz",downloadPath],
["wget", "http://downloads.xiph.org/releases/vorbis/libvorbis-1.2.0.tar.gz",downloadPath],
]
buildCmds = [
- [0, "tar zxf " + os.path.join(downloadPath, "openal-0.0.8.tar.gz"), ''],
+# [0, "tar zxf " + os.path.join(downloadPath, "openal-0.0.8.tar.gz"), ''],
+ [0, "tar jxf " + os.path.join(downloadPath, "openal-soft-1.5.304.tar.bz2"), ''],
[0, "tar zxf " + os.path.join(downloadPath, "libogg-1.1.3.tar.gz"), ''],
[0, "tar zxf " + os.path.join(downloadPath, "libvorbis-1.2.0.tar.gz"), ''],
[0, "./configure --prefix=%s\nmake\nmake install" % PREFIX, os.path.join(os.getcwd(), "libogg-1.1.3")],
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|