quick draft implementation for SharedMemoryInProcessPhysicsC_API

This commit is contained in:
erwincoumans
2016-03-07 14:56:16 -08:00
parent b130be46f7
commit 9be978337f
8 changed files with 187 additions and 24 deletions

View File

@@ -141,4 +141,52 @@ project ("Test_PhysicsServerLoopBack")
}
project ("Test_PhysicsServerInProcessExampleBrowser")
language "C++"
kind "ConsoleApp"
includedirs {"../../src", "../../examples",
"../../examples/ThirdPartyLibs"}
defines {"PHYSICS_IN_PROCESS_EXAMPLE_BROWSER"}
-- links {
-- "BulletExampleBrowserLib",
-- "BulletFileLoader",
-- "BulletWorldImporter",
-- "Bullet3Common",
-- "BulletDynamics",
-- "BulletCollision",
-- "LinearMath"
-- }
hasCL = findOpenCL("clew")
links{"BulletExampleBrowserLib","gwen", "OpenGL_Window","BulletSoftBody", "BulletInverseDynamicsUtils", "BulletInverseDynamics", "BulletDynamics","BulletCollision","LinearMath","Bullet3Common"}
initOpenGL()
initGlew()
includedirs {
".",
"../../src",
"../ThirdPartyLibs",
}
if os.is("MacOSX") then
links{"Cocoa.framework"}
end
if (hasCL) then
links {
"Bullet3OpenCL_clew",
"Bullet3Dynamics",
"Bullet3Collision",
"Bullet3Geometry",
"Bullet3Common",
}
end
files {
"test.c",
"../../examples/ExampleBrowser/ExampleEntries.cpp",
}

View File

@@ -9,6 +9,9 @@
#include "SharedMemory/PhysicsDirectC_API.h"
#endif //PHYSICS_SERVER_DIRECT
#ifdef PHYSICS_IN_PROCESS_EXAMPLE_BROWSER
#include "SharedMemory/SharedMemoryInProcessPhysicsC_API.h"
#endif//PHYSICS_IN_PROCESS_EXAMPLE_BROWSER
#include "SharedMemory/SharedMemoryPublic.h"
#include "Bullet3Common/b3Logging.h"
@@ -17,6 +20,7 @@
#include <stdio.h>
int main(int argc, char* argv[])
{
int i, dofCount , posVarCount, ret ,numJoints ;
@@ -40,7 +44,11 @@ int main(int argc, char* argv[])
#ifdef PHYSICS_SERVER_DIRECT
sm = b3ConnectPhysicsDirect();
#else//PHYSICS_SERVER_DIRECT
#endif
#ifdef PHYSICS_IN_PROCESS_EXAMPLE_BROWSER
sm = b3CreateInProcessPhysicsServerAndConnect(argc,argv);
#else
sm = b3ConnectSharedMemory(SHARED_MEMORY_KEY);
#endif //PHYSICS_SERVER_DIRECT
@@ -61,8 +69,8 @@ int main(int argc, char* argv[])
b3SharedMemoryCommandHandle command = b3LoadUrdfCommandInit(sm, urdfFileName);
//setting the initial position, orientation and other arguments are optional
startPosX =2;
startPosY =3;
startPosX =0;
startPosY =0;
startPosZ = 1;
ret = b3LoadUrdfCommandSetStartPosition(command, startPosX,startPosY,startPosZ);
statusHandle = b3SubmitClientCommandAndWaitStatus(sm, command);