Code-style consistency improvement:

Apply clang-format-all.sh using the _clang-format file through all the cpp/.h files.
make sure not to apply it to certain serialization structures, since some parser expects the * as part of the name, instead of type.
This commit contains no other changes aside from adding and applying clang-format-all.sh
This commit is contained in:
erwincoumans
2018-09-23 14:17:31 -07:00
parent b73b05e9fb
commit ab8f16961e
1773 changed files with 1081087 additions and 474249 deletions

View File

@@ -1,7 +1,6 @@
#ifndef COMMON_MULTI_BODY_SETUP_H
#define COMMON_MULTI_BODY_SETUP_H
#include "../CommonInterfaces/CommonExampleInterface.h"
#include "../CommonInterfaces/CommonGUIHelperInterface.h"
#include "../CommonInterfaces/CommonRenderInterface.h"
@@ -15,14 +14,12 @@
struct CommonOpenCLBase : public CommonExampleInterface
{
struct GUIHelperInterface* m_guiHelper;
struct GpuDemoInternalData* m_clData;
struct GpuDemoInternalData* m_clData;
CommonOpenCLBase (GUIHelperInterface* helper)
:m_guiHelper(helper),
m_clData(0)
CommonOpenCLBase(GUIHelperInterface* helper)
: m_guiHelper(helper),
m_clData(0)
{
m_clData = new GpuDemoInternalData();
}
@@ -37,56 +34,44 @@ struct CommonOpenCLBase : public CommonExampleInterface
{
}
virtual void initCL(int preferredDeviceIndex, int preferredPlatformIndex)
{
// void* glCtx=0;
// void* glDC = 0;
int ciErrNum = 0;
// void* glCtx=0;
// void* glDC = 0;
cl_device_type deviceType = CL_DEVICE_TYPE_GPU;
//if (gAllowCpuOpenCL)
// deviceType = CL_DEVICE_TYPE_ALL;
int ciErrNum = 0;
cl_device_type deviceType = CL_DEVICE_TYPE_GPU;
//if (gAllowCpuOpenCL)
// deviceType = CL_DEVICE_TYPE_ALL;
// if (useInterop)
// {
// m_data->m_clContext = b3OpenCLUtils::createContextFromType(deviceType, &ciErrNum, glCtx, glDC);
// } else
{
m_clData->m_clContext = b3OpenCLUtils::createContextFromType(deviceType, &ciErrNum, 0, 0, preferredDeviceIndex, preferredPlatformIndex, &m_clData->m_platformId);
}
// if (useInterop)
// {
// m_data->m_clContext = b3OpenCLUtils::createContextFromType(deviceType, &ciErrNum, glCtx, glDC);
// } else
{
m_clData->m_clContext = b3OpenCLUtils::createContextFromType(deviceType, &ciErrNum, 0,0,preferredDeviceIndex, preferredPlatformIndex,&m_clData->m_platformId);
}
oclCHECKERROR(ciErrNum, CL_SUCCESS);
int numDev = b3OpenCLUtils::getNumDevices(m_clData->m_clContext);
if (numDev>0)
{
m_clData->m_clDevice= b3OpenCLUtils::getDevice(m_clData->m_clContext,0);
m_clData->m_clQueue = clCreateCommandQueue(m_clData->m_clContext, m_clData->m_clDevice, 0, &ciErrNum);
oclCHECKERROR(ciErrNum, CL_SUCCESS);
b3OpenCLDeviceInfo info;
b3OpenCLUtils::getDeviceInfo(m_clData->m_clDevice,&info);
m_clData->m_clDeviceName = info.m_deviceName;
m_clData->m_clInitialized = true;
}
int numDev = b3OpenCLUtils::getNumDevices(m_clData->m_clContext);
if (numDev > 0)
{
m_clData->m_clDevice = b3OpenCLUtils::getDevice(m_clData->m_clContext, 0);
m_clData->m_clQueue = clCreateCommandQueue(m_clData->m_clContext, m_clData->m_clDevice, 0, &ciErrNum);
oclCHECKERROR(ciErrNum, CL_SUCCESS);
b3OpenCLDeviceInfo info;
b3OpenCLUtils::getDeviceInfo(m_clData->m_clDevice, &info);
m_clData->m_clDeviceName = info.m_deviceName;
m_clData->m_clInitialized = true;
}
}
virtual void exitCL()
{
if (m_clData && m_clData->m_clInitialized)
{
clReleaseCommandQueue(m_clData->m_clQueue);
@@ -95,8 +80,6 @@ struct CommonOpenCLBase : public CommonExampleInterface
}
}
virtual void renderScene()
{
if (m_guiHelper->getRenderInterface())
@@ -105,40 +88,35 @@ struct CommonOpenCLBase : public CommonExampleInterface
}
}
virtual void physicsDebugDraw(int debugDrawFlags)
{
}
virtual bool keyboardCallback(int key, int state)
virtual void physicsDebugDraw(int debugDrawFlags)
{
return false;//don't handle this key
}
virtual bool keyboardCallback(int key, int state)
{
return false; //don't handle this key
}
virtual bool mouseMoveCallback(float x,float y)
virtual bool mouseMoveCallback(float x, float y)
{
return false;
}
virtual bool mouseButtonCallback(int button, int state, float x, float y)
virtual bool mouseButtonCallback(int button, int state, float x, float y)
{
CommonRenderInterface* renderer = m_guiHelper->getRenderInterface();
if (!renderer)
{
b3Assert(0);
return false;
}
CommonWindowInterface* window = m_guiHelper->getAppInterface()->m_window;
if (state==1)
if (state == 1)
{
if(button==0 && (!window->isModifierKeyPressed(B3G_ALT) && !window->isModifierKeyPressed(B3G_CONTROL) ))
if (button == 0 && (!window->isModifierKeyPressed(B3G_ALT) && !window->isModifierKeyPressed(B3G_CONTROL)))
{
/*btVector3 camPos;
renderer->getActiveCamera()->getCameraPosition(camPos);
@@ -148,14 +126,13 @@ struct CommonOpenCLBase : public CommonExampleInterface
pickBody(rayFrom, rayTo);
*/
}
} else
}
else
{
if (button==0)
if (button == 0)
{
// removePickingConstraint();
// removePickingConstraint();
//remove p2p
}
}
@@ -163,9 +140,6 @@ struct CommonOpenCLBase : public CommonExampleInterface
//printf("button=%d, state=%d\n",button,state);
return false;
}
};
};
#endif //COMMON_MULTI_BODY_SETUP_H
#endif //COMMON_MULTI_BODY_SETUP_H

View File

@@ -10,17 +10,16 @@ struct GpuDemoInternalData
cl_device_id m_clDevice;
cl_command_queue m_clQueue;
bool m_clInitialized;
char* m_clDeviceName;
char* m_clDeviceName;
GpuDemoInternalData()
:m_platformId(0),
m_clContext(0),
m_clDevice(0),
m_clQueue(0),
m_clInitialized(false),
m_clDeviceName(0)
: m_platformId(0),
m_clContext(0),
m_clDevice(0),
m_clQueue(0),
m_clInitialized(false),
m_clDeviceName(0)
{
}
};