fix win32 (non-glut) cmake build.

add partId/index to btCollisionObjectWrapper to be able to recognize recursive shape indices (a btCompoundShape with a btGimpactShape child shape etc)
This commit is contained in:
erwin.coumans
2012-11-10 01:42:35 +00:00
parent c4db79791c
commit 9eddd42347
14 changed files with 173 additions and 42 deletions

View File

@@ -83,6 +83,10 @@ ELSE (USE_GLUT)
Win32FractureDemo.cpp
FractureDemo.cpp
FractureDemo.h
btFractureBody.h
btFractureBody.cpp
btFractureDynamicsWorld.cpp
btFractureDynamicsWorld.h
${BULLET_PHYSICS_SOURCE_DIR}/build/bullet.rc
)

View File

@@ -40,7 +40,7 @@ subject to the following restrictions:
#ifdef _WINDOWS
#define BT_ACTIVE_ALT VK_LMENU
#define BT_ACTIVE_SHIFT VK_LSHIFT
#else
#define BT_KEY_K 'k'
#define BT_KEY_LEFT GLUT_KEY_LEFT

View File

@@ -44,6 +44,69 @@ static int quitRequest = 0;
// WinMain
#ifdef USE_AMD_OPENCL
#include "btOpenCLUtils.h"
#include <LinearMath/btScalar.h>
cl_context g_cxMainContext;
cl_device_id g_cdDevice;
cl_command_queue g_cqCommandQue;
// Returns true if OpenCL is initialized properly, false otherwise.
bool initCL( void* glCtx, void* glDC )
{
const char* vendorSDK = btOpenCLUtils::getSdkVendorName();
printf("This program was compiled using the %s OpenCL SDK\n",vendorSDK);
int ciErrNum = 0;
#ifdef BT_USE_CLEW
ciErrNum = clewInit( "OpenCL.dll" );
if ( ciErrNum != CLEW_SUCCESS ) {
return false;
}
#endif
#if defined(CL_PLATFORM_MINI_CL)
cl_device_type deviceType = CL_DEVICE_TYPE_CPU;
#elif defined(CL_PLATFORM_AMD)
cl_device_type deviceType = CL_DEVICE_TYPE_GPU;
#elif defined(CL_PLATFORM_NVIDIA)
cl_device_type deviceType = CL_DEVICE_TYPE_GPU;
#else
cl_device_type deviceType = CL_DEVICE_TYPE_CPU;
#endif
g_cxMainContext = btOpenCLUtils::createContextFromType(deviceType, &ciErrNum, glCtx, glDC);
oclCHECKERROR(ciErrNum, CL_SUCCESS);
int numDev = btOpenCLUtils::getNumDevices(g_cxMainContext);
if (!numDev)
return false;
g_cdDevice = btOpenCLUtils::getDevice(g_cxMainContext,0);
btOpenCLDeviceInfo clInfo;
btOpenCLUtils::getDeviceInfo(g_cdDevice,clInfo);
btOpenCLUtils::printDeviceInfo(g_cdDevice);
// create a command-queue
g_cqCommandQue = clCreateCommandQueue(g_cxMainContext, g_cdDevice, 0, &ciErrNum);
oclCHECKERROR(ciErrNum, CL_SUCCESS);
return true;
}
#endif //#ifdef USE_AMD_OPENCL
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int iCmdShow)
{
@@ -56,7 +119,12 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
float theta = 0.0f;
gDemoApplication = createDemo();
#ifdef USE_AMD_OPENCL
bool initialized = initCL(0,0);
btAssert(initialized);
#endif //USE_AMD_OPENCL
// register window class
wc.style = CS_OWNDC;

View File

@@ -14,12 +14,12 @@ subject to the following restrictions:
3. This notice may not be removed or altered from any source distribution.
*/
#include "BasicDemo.h"
#include "RaytestDemo.h"
///The 'createDemo' function is called from Bullet/Demos/OpenGL/Win32AppMain.cpp to instantiate this particular demo
DemoApplication* createDemo()
{
return new BasicDemo();
return new RaytestDemo();
}
#endif

View File

@@ -14,12 +14,12 @@ subject to the following restrictions:
3. This notice may not be removed or altered from any source distribution.
*/
#include "BasicDemo.h"
#include "VoronoiFractureDemo.h"
///The 'createDemo' function is called from Bullet/Demos/OpenGL/Win32AppMain.cpp to instantiate this particular demo
DemoApplication* createDemo()
{
return new BasicDemo();
return new VoronoiFractureDemo();
}
#endif