quick draft implementation for SharedMemoryInProcessPhysicsC_API
This commit is contained in:
@@ -29,6 +29,7 @@ SET(App_ExampleBrowser_SRCS
|
||||
../SharedMemory/PhysicsDirect.h
|
||||
../SharedMemory/PhysicsDirectC_API.cpp
|
||||
../SharedMemory/PhysicsDirectC_API.h
|
||||
../SharedMemory/SharedMemoryInProcessPhysicsC_API.cpp
|
||||
../SharedMemory/PhysicsLoopBack.cpp
|
||||
../SharedMemory/PhysicsLoopBack.h
|
||||
../SharedMemory/PhysicsLoopBackC_API.cpp
|
||||
|
||||
@@ -71,6 +71,9 @@ struct ExampleBrowserThreadLocalStorage
|
||||
enum TestExampleBrowserCommunicationEnums
|
||||
{
|
||||
eRequestTerminateExampleBrowser = 13,
|
||||
eExampleBrowserIsUnInitialized,
|
||||
eExampleBrowserIsInitialized,
|
||||
eExampleBrowserInitializationFailed,
|
||||
eExampleBrowserHasTerminated
|
||||
};
|
||||
|
||||
@@ -94,6 +97,11 @@ void ExampleBrowserThreadFunc(void* userPtr,void* lsMemory)
|
||||
clock.reset();
|
||||
if (init)
|
||||
{
|
||||
|
||||
args->m_cs->lock();
|
||||
args->m_cs->setSharedParam(0,eExampleBrowserIsInitialized);
|
||||
args->m_cs->unlock();
|
||||
|
||||
do
|
||||
{
|
||||
float deltaTimeInSeconds = clock.getTimeMicroseconds()/1000000.f;
|
||||
@@ -101,7 +109,13 @@ void ExampleBrowserThreadFunc(void* userPtr,void* lsMemory)
|
||||
exampleBrowser->update(deltaTimeInSeconds);
|
||||
|
||||
} while (!exampleBrowser->requestedExit() && (args->m_cs->getSharedParam(0)!=eRequestTerminateExampleBrowser));
|
||||
} else
|
||||
{
|
||||
args->m_cs->lock();
|
||||
args->m_cs->setSharedParam(0,eExampleBrowserInitializationFailed);
|
||||
args->m_cs->unlock();
|
||||
}
|
||||
|
||||
delete exampleBrowser;
|
||||
args->m_cs->lock();
|
||||
args->m_cs->setSharedParam(0,eExampleBrowserHasTerminated);
|
||||
@@ -153,7 +167,7 @@ btInProcessExampleBrowserInternalData* btCreateInProcessExampleBrowser(int argc,
|
||||
|
||||
|
||||
data->m_args.m_cs = data->m_threadSupport->createCriticalSection();
|
||||
data->m_args.m_cs->setSharedParam(0,100);
|
||||
data->m_args.m_cs->setSharedParam(0,eExampleBrowserIsUnInitialized);
|
||||
data->m_args.m_argc = argc;
|
||||
data->m_args.m_argv = argv2;
|
||||
|
||||
@@ -163,6 +177,10 @@ btInProcessExampleBrowserInternalData* btCreateInProcessExampleBrowser(int argc,
|
||||
data->m_threadSupport->runTask(B3_THREAD_SCHEDULE_TASK, (void*) &data->m_args, i);
|
||||
}
|
||||
|
||||
while (data->m_args.m_cs->getSharedParam(0)==eExampleBrowserIsUnInitialized)
|
||||
{
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
project "App_ExampleBrowser"
|
||||
project "BulletExampleBrowserLib"
|
||||
|
||||
hasCL = findOpenCL("clew")
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
language "C++"
|
||||
|
||||
kind "ConsoleApp"
|
||||
kind "StaticLib"
|
||||
|
||||
includedirs {
|
||||
".",
|
||||
@@ -30,26 +30,20 @@
|
||||
end
|
||||
|
||||
|
||||
links{"gwen", "OpenGL_Window","BulletSoftBody", "BulletInverseDynamicsUtils", "BulletInverseDynamics", "BulletDynamics","BulletCollision","LinearMath","Bullet3Common"}
|
||||
initOpenGL()
|
||||
initGlew()
|
||||
|
||||
if (hasCL) then
|
||||
links {
|
||||
"Bullet3OpenCL_clew",
|
||||
"Bullet3Dynamics",
|
||||
"Bullet3Collision",
|
||||
"Bullet3Geometry",
|
||||
"Bullet3Common",
|
||||
}
|
||||
end
|
||||
|
||||
defines {"INCLUDE_CLOTH_DEMOS"}
|
||||
|
||||
|
||||
|
||||
files {
|
||||
"*.cpp",
|
||||
"OpenGLExampleBrowser.cpp",
|
||||
"OpenGLGuiHelper.cpp",
|
||||
"InProcessExampleBrowser.cpp",
|
||||
"GL_ShapeDrawer.cpp",
|
||||
"OpenGLExampleBrowser.cpp",
|
||||
"../Utils/b3Clock.cpp",
|
||||
"*.h",
|
||||
"GwenGUISupport/*.cpp",
|
||||
"GwenGUISupport/*.h",
|
||||
@@ -60,6 +54,7 @@
|
||||
"../SharedMemory/PhysicsServer.cpp",
|
||||
"../SharedMemory/PhysicsServerSharedMemory.cpp",
|
||||
"../SharedMemory/PhysicsClientSharedMemory.cpp",
|
||||
"../SharedMemory/SharedMemoryInProcessPhysicsC_API.cpp",
|
||||
"../SharedMemory/PhysicsClient.cpp",
|
||||
"../SharedMemory/PosixSharedMemory.cpp",
|
||||
"../SharedMemory/Win32SharedMemory.cpp",
|
||||
@@ -109,7 +104,6 @@
|
||||
"../ThirdPartyLibs/stb_image/*",
|
||||
"../ThirdPartyLibs/Wavefront/tiny_obj_loader.*",
|
||||
"../ThirdPartyLibs/tinyxml/*",
|
||||
"../Utils/b3Clock.*",
|
||||
"../Utils/b3ResourcePath.*",
|
||||
"../GyroscopicDemo/GyroscopicSetup.cpp",
|
||||
"../GyroscopicDemo/GyroscopicSetup.h",
|
||||
@@ -149,8 +143,41 @@ if os.is("Linux") then
|
||||
initX11()
|
||||
end
|
||||
|
||||
if os.is("MacOSX") then
|
||||
links{"Cocoa.framework"}
|
||||
end
|
||||
|
||||
|
||||
project "App_BulletExampleBrowser"
|
||||
|
||||
language "C++"
|
||||
|
||||
kind "ConsoleApp"
|
||||
|
||||
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 {
|
||||
"main.cpp",
|
||||
"ExampleEntries.cpp",
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user