apply clang-format (on Mac, slightly different than running it on Windows)

This commit is contained in:
Erwin Coumans
2018-09-30 11:43:57 -07:00
parent 5bcd43711a
commit 42ae4e81a8
15 changed files with 87 additions and 117 deletions

0
clang-format-all.sh Normal file → Executable file
View File

View File

@@ -1071,7 +1071,6 @@ void OpenGLGuiHelper::setProjectiveTexture(bool useProjectiveTexture)
m_data->m_glApp->m_renderer->setProjectiveTexture(useProjectiveTexture);
}
void OpenGLGuiHelper::copyCameraImageData(const float viewMatrix[16], const float projectionMatrix[16],
unsigned char* pixelsRGBA, int rgbaBufferSizeInPixels,
float* depthBuffer, int depthBufferSizeInPixels,
@@ -1079,8 +1078,6 @@ void OpenGLGuiHelper::copyCameraImageData(const float viewMatrix[16], const floa
int startPixelIndex, int destinationWidth,
int destinationHeight, int* numPixelsCopied)
{
int sourceWidth = btMin(destinationWidth, (int)(m_data->m_glApp->m_window->getWidth() * m_data->m_glApp->m_window->getRetinaScale()));
int sourceHeight = btMin(destinationHeight, (int)(m_data->m_glApp->m_window->getHeight() * m_data->m_glApp->m_window->getRetinaScale()));
m_data->m_glApp->setViewport(sourceWidth, sourceHeight);
@@ -1200,7 +1197,8 @@ void OpenGLGuiHelper::copyCameraImageData(const float viewMatrix[16], const floa
{
int segMask = sourceRgbaPixelBuffer[sourcePixelIndex + 0] + 256 * (sourceRgbaPixelBuffer[sourcePixelIndex + 1]) + 256 * 256 * (sourceRgbaPixelBuffer[sourcePixelIndex + 2]);
m_data->m_segmentationMaskBuffer[i + j * destinationWidth] = segMask;
} else
}
else
{
m_data->m_segmentationMaskBuffer[i + j * destinationWidth] = -1;
}
@@ -1211,7 +1209,6 @@ void OpenGLGuiHelper::copyCameraImageData(const float viewMatrix[16], const floa
}
}
getRenderInterface()->setActiveCamera(oldCam);
if (1)
@@ -1222,8 +1219,6 @@ void OpenGLGuiHelper::copyCameraImageData(const float viewMatrix[16], const floa
getRenderInterface()->updateCamera(dg.upAxis);
m_data->m_glApp->m_window->startRendering();
}
}
if (pixelsRGBA)
{

View File

@@ -309,7 +309,6 @@ SimpleOpenGL3App::SimpleOpenGL3App(const char* title, int width, int height, boo
m_data = new SimpleInternalData;
if (windowType == 0)
{
m_window = new b3gDefaultOpenGLWindow();
@@ -925,7 +924,6 @@ SimpleOpenGL3App::~SimpleOpenGL3App()
delete m_data;
}
void SimpleOpenGL3App::setViewport(int width, int height)
{
m_data->m_customViewPortWidth = width;
@@ -933,7 +931,8 @@ void SimpleOpenGL3App::setViewport(int width, int height)
if (width >= 0)
{
glViewport(0, 0, width, height);
} else
}
else
{
glViewport(0, 0, m_window->getRetinaScale() * m_instancingRenderer->getScreenWidth(), m_window->getRetinaScale() * m_instancingRenderer->getScreenHeight());
}

View File

@@ -1726,7 +1726,6 @@ struct PhysicsServerCommandProcessorInternalData
}
#endif //ENABLE_STATIC_GRPC_PLUGIN
#ifdef STATIC_EGLRENDERER_PLUGIN
{
bool initPlugin = false;
@@ -1735,15 +1734,12 @@ struct PhysicsServerCommandProcessorInternalData
}
#endif //STATIC_EGLRENDERER_PLUGIN
#ifndef SKIP_STATIC_TINYRENDERER_PLUGIN
{
int renderPluginId = m_pluginManager.registerStaticLinkedPlugin("tinyRendererPlugin", initPlugin_tinyRendererPlugin, exitPlugin_tinyRendererPlugin, executePluginCommand_tinyRendererPlugin, 0, 0, getRenderInterface_tinyRendererPlugin, 0, 0);
m_pluginManager.selectPluginRenderer(renderPluginId);
}
#endif
}
m_vrControllerEvents.init();
@@ -2743,15 +2739,12 @@ bool PhysicsServerCommandProcessor::processImportedObjects(const char* fileName,
if (mb)
mb->setUserIndex2(bodyUniqueId);
if (mb)
{
bodyHandle->m_multiBody = mb;
m_data->m_sdfRecentLoadedBodies.push_back(bodyUniqueId);
int segmentationMask = bodyUniqueId;
{
@@ -3557,10 +3550,8 @@ bool PhysicsServerCommandProcessor::processRequestCameraImageCommand(const struc
}
segmentationMaskBuffer[i] = segMask;
}
}
handled = true;
m_data->m_guiHelper->debugDisplayCameraImageData(viewMat,
projMat, pixelRGBA, numRequestedPixels,

View File

@@ -100,7 +100,6 @@ struct EGLRendererVisualShapeConverterInternalData
btAlignedObjectArray<unsigned char> m_segmentationMaskSourceRgbaPixelBuffer;
btAlignedObjectArray<float> m_segmentationMaskSourceDepthBuffer;
btAlignedObjectArray<int> m_graphicsIndexToSegmentationMask;
btHashMap<btHashInt, EGLRendererObjectArray*> m_swRenderInstances;
@@ -805,8 +804,6 @@ void EGLRendererVisualShapeConverter::convertVisualShapes(
}
}
m_data->m_instancingRenderer->writeTransforms();
}
}
@@ -1001,15 +998,12 @@ void EGLRendererVisualShapeConverter::copyCameraImageDataGL(
int sourceWidth = btMin(destinationWidth, (int)(m_data->m_window->getWidth() * m_data->m_window->getRetinaScale()));
int sourceHeight = btMin(destinationHeight, (int)(m_data->m_window->getHeight() * m_data->m_window->getRetinaScale()));
int numTotalPixels = (*widthPtr) * (*heightPtr);
int numRemainingPixels = numTotalPixels - startPixelIndex;
int numBytesPerPixel = 4; //RGBA
int numRequestedPixels = btMin(rgbaBufferSizeInPixels, numRemainingPixels);
if (numRequestedPixels)
{
if (startPixelIndex == 0)
{
glViewport(0, 0, sourceWidth, sourceHeight);
@@ -1069,12 +1063,9 @@ void EGLRendererVisualShapeConverter::copyCameraImageDataGL(
b3Assert(glstat == GL_NO_ERROR);
}
}
}
}
m_data->m_rgbaPixelBuffer1.resize((*widthPtr) * (*heightPtr) * numBytesPerPixel);
m_data->m_depthBuffer1.resize((*widthPtr) * (*heightPtr));
//rescale and flip
@@ -1141,13 +1132,10 @@ void EGLRendererVisualShapeConverter::copyCameraImageDataGL(
glstat = glGetError();
b3Assert(glstat == GL_NO_ERROR);
}
}
}
}
m_data->m_segmentationMaskBuffer.resize(destinationWidth * destinationHeight, -1);
//rescale and flip
@@ -1172,7 +1160,8 @@ void EGLRendererVisualShapeConverter::copyCameraImageDataGL(
{
int segMask = m_data->m_segmentationMaskSourceRgbaPixelBuffer[sourcePixelIndex + 0] + 256 * (m_data->m_segmentationMaskSourceRgbaPixelBuffer[sourcePixelIndex + 1]) + 256 * 256 * (m_data->m_segmentationMaskSourceRgbaPixelBuffer[sourcePixelIndex + 2]);
m_data->m_segmentationMaskBuffer[i + j * destinationWidth] = segMask;
} else
}
else
{
m_data->m_segmentationMaskBuffer[i + j * destinationWidth] = -1;
}
@@ -1181,7 +1170,6 @@ void EGLRendererVisualShapeConverter::copyCameraImageDataGL(
}
}
glViewport(0, 0, m_data->m_window->getWidth() * m_data->m_window->getRetinaScale(), m_data->m_window->getHeight() * m_data->m_window->getRetinaScale());
}
if (pixelsRGBA)
{
@@ -1204,7 +1192,6 @@ void EGLRendererVisualShapeConverter::copyCameraImageDataGL(
BT_PROFILE("copy segmentation mask buffer pixels");
for (int i = 0; i < numRequestedPixels; i++)
{
int graphicsIndexSegMask = m_data->m_segmentationMaskBuffer[i + startPixelIndex];
int segMask = -1;
if (graphicsIndexSegMask >= 0 && graphicsIndexSegMask < m_data->m_graphicsIndexToSegmentationMask.size())
@@ -1227,8 +1214,6 @@ void EGLRendererVisualShapeConverter::copyCameraImageDataGL(
*numPixelsCopied = numRequestedPixels;
}
}
}
void EGLRendererVisualShapeConverter::copyCameraImageData(unsigned char* pixelsRGBA, int rgbaBufferSizeInPixels,

View File

@@ -799,7 +799,7 @@ extern "C"
};
#endif
#ifndef stbtt_vertex // you can predefine this to use different values
#ifndef stbtt_vertex // you can predefine this to use different values \
// (we share this with other code at RAD)
#define stbtt_vertex_type short // can't use stbtt_int16 because that's not visible in the header file
typedef struct

View File

@@ -707,7 +707,7 @@ extern "C"
};
#endif
#ifndef stbtt_vertex // you can predefine this to use different values
#ifndef stbtt_vertex // you can predefine this to use different values \
// (we share this with other code at RAD)
#define stbtt_vertex_type short // can't use stbtt_int16 because that's not visible in the header file
typedef struct

View File

@@ -292,8 +292,8 @@ btCollisionShape* btCollisionWorldImporter::convertCollisionShape(btCollisionSha
}
break;
}
#endif //SUPPORT_GIMPACT_SHAPE_IMPORT
//The btCapsuleShape* API has issue passing the margin/scaling/halfextents unmodified through the API
#endif //SUPPORT_GIMPACT_SHAPE_IMPORT \
//The btCapsuleShape* API has issue passing the margin/scaling/halfextents unmodified through the API \
//so deal with this
case CAPSULE_SHAPE_PROXYTYPE:
{

View File

@@ -347,7 +347,7 @@ int main()
#endif // _WIN32
gladLoaderLoadGL();
#endif
#endif //B3_USE_GLFW
#endif //B3_USE_GLFW \
//we ned to call glGetError twice, because of some Ubuntu/Intel/OpenGL issue
GLuint err = glGetError();

View File

@@ -4428,7 +4428,7 @@ UnitTestImpl::UnitTestImpl(UnitTest* parent)
: parent_(parent),
#ifdef _MSC_VER
#pragma warning(push) // Saves the current warning state.
#pragma warning(disable : 4355) // Temporarily disables warning 4355
#pragma warning(disable : 4355) // Temporarily disables warning 4355 \
// (using this in initializer).
default_global_test_part_result_reporter_(this),
default_per_thread_test_part_result_reporter_(this),