mirror of
https://github.com/bulletphysics/bullet3
synced 2024-12-05 01:50:05 +00:00
apply clang-format (on Mac, slightly different than running it on Windows)
This commit is contained in:
parent
5bcd43711a
commit
42ae4e81a8
0
clang-format-all.sh
Normal file → Executable file
0
clang-format-all.sh
Normal file → Executable file
@ -991,7 +991,7 @@ void OpenGLGuiHelper::setVisualizerFlag(int flag, int enable)
|
|||||||
getRenderInterface()->setPlaneReflectionShapeIndex(enable);
|
getRenderInterface()->setPlaneReflectionShapeIndex(enable);
|
||||||
}
|
}
|
||||||
if (m_data->m_visualizerFlagCallback)
|
if (m_data->m_visualizerFlagCallback)
|
||||||
(m_data->m_visualizerFlagCallback)(flag, enable!=0);
|
(m_data->m_visualizerFlagCallback)(flag, enable != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenGLGuiHelper::resetCamera(float camDist, float yaw, float pitch, float camPosX, float camPosY, float camPosZ)
|
void OpenGLGuiHelper::resetCamera(float camDist, float yaw, float pitch, float camPosX, float camPosY, float camPosZ)
|
||||||
@ -1071,7 +1071,6 @@ void OpenGLGuiHelper::setProjectiveTexture(bool useProjectiveTexture)
|
|||||||
m_data->m_glApp->m_renderer->setProjectiveTexture(useProjectiveTexture);
|
m_data->m_glApp->m_renderer->setProjectiveTexture(useProjectiveTexture);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void OpenGLGuiHelper::copyCameraImageData(const float viewMatrix[16], const float projectionMatrix[16],
|
void OpenGLGuiHelper::copyCameraImageData(const float viewMatrix[16], const float projectionMatrix[16],
|
||||||
unsigned char* pixelsRGBA, int rgbaBufferSizeInPixels,
|
unsigned char* pixelsRGBA, int rgbaBufferSizeInPixels,
|
||||||
float* depthBuffer, int depthBufferSizeInPixels,
|
float* depthBuffer, int depthBufferSizeInPixels,
|
||||||
@ -1079,8 +1078,6 @@ void OpenGLGuiHelper::copyCameraImageData(const float viewMatrix[16], const floa
|
|||||||
int startPixelIndex, int destinationWidth,
|
int startPixelIndex, int destinationWidth,
|
||||||
int destinationHeight, int* numPixelsCopied)
|
int destinationHeight, int* numPixelsCopied)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
int sourceWidth = btMin(destinationWidth, (int)(m_data->m_glApp->m_window->getWidth() * m_data->m_glApp->m_window->getRetinaScale()));
|
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()));
|
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);
|
m_data->m_glApp->setViewport(sourceWidth, sourceHeight);
|
||||||
@ -1176,7 +1173,7 @@ void OpenGLGuiHelper::copyCameraImageData(const float viewMatrix[16], const floa
|
|||||||
BT_PROFILE("getScreenPixelsSegmentationMask");
|
BT_PROFILE("getScreenPixelsSegmentationMask");
|
||||||
m_data->m_glApp->getScreenPixels(&(sourceRgbaPixelBuffer[0]), sourceRgbaPixelBuffer.size(), &sourceDepthBuffer[0], sizeof(float) * sourceDepthBuffer.size());
|
m_data->m_glApp->getScreenPixels(&(sourceRgbaPixelBuffer[0]), sourceRgbaPixelBuffer.size(), &sourceDepthBuffer[0], sizeof(float) * sourceDepthBuffer.size());
|
||||||
}
|
}
|
||||||
m_data->m_segmentationMaskBuffer.resize(destinationWidth * destinationHeight,-1);
|
m_data->m_segmentationMaskBuffer.resize(destinationWidth * destinationHeight, -1);
|
||||||
|
|
||||||
//rescale and flip
|
//rescale and flip
|
||||||
{
|
{
|
||||||
@ -1196,11 +1193,12 @@ void OpenGLGuiHelper::copyCameraImageData(const float viewMatrix[16], const floa
|
|||||||
if (segmentationMaskBuffer)
|
if (segmentationMaskBuffer)
|
||||||
{
|
{
|
||||||
float depth = sourceDepthBuffer[sourceDepthIndex];
|
float depth = sourceDepthBuffer[sourceDepthIndex];
|
||||||
if (depth<1)
|
if (depth < 1)
|
||||||
{
|
{
|
||||||
int segMask = sourceRgbaPixelBuffer[sourcePixelIndex + 0]+256*(sourceRgbaPixelBuffer[sourcePixelIndex + 1])+256*256*(sourceRgbaPixelBuffer[sourcePixelIndex + 2]);
|
int segMask = sourceRgbaPixelBuffer[sourcePixelIndex + 0] + 256 * (sourceRgbaPixelBuffer[sourcePixelIndex + 1]) + 256 * 256 * (sourceRgbaPixelBuffer[sourcePixelIndex + 2]);
|
||||||
m_data->m_segmentationMaskBuffer[i + j * destinationWidth] = segMask;
|
m_data->m_segmentationMaskBuffer[i + j * destinationWidth] = segMask;
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
m_data->m_segmentationMaskBuffer[i + j * destinationWidth] = -1;
|
m_data->m_segmentationMaskBuffer[i + j * destinationWidth] = -1;
|
||||||
}
|
}
|
||||||
@ -1211,7 +1209,6 @@ void OpenGLGuiHelper::copyCameraImageData(const float viewMatrix[16], const floa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
getRenderInterface()->setActiveCamera(oldCam);
|
getRenderInterface()->setActiveCamera(oldCam);
|
||||||
|
|
||||||
if (1)
|
if (1)
|
||||||
@ -1222,8 +1219,6 @@ void OpenGLGuiHelper::copyCameraImageData(const float viewMatrix[16], const floa
|
|||||||
getRenderInterface()->updateCamera(dg.upAxis);
|
getRenderInterface()->updateCamera(dg.upAxis);
|
||||||
m_data->m_glApp->m_window->startRendering();
|
m_data->m_glApp->m_window->startRendering();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
if (pixelsRGBA)
|
if (pixelsRGBA)
|
||||||
{
|
{
|
||||||
@ -1255,7 +1250,7 @@ void OpenGLGuiHelper::copyCameraImageData(const float viewMatrix[16], const floa
|
|||||||
*numPixelsCopied = numRequestedPixels;
|
*numPixelsCopied = numRequestedPixels;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_data->m_glApp->setViewport(-1,-1);
|
m_data->m_glApp->setViewport(-1, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct MyConvertPointerSizeT
|
struct MyConvertPointerSizeT
|
||||||
|
@ -66,7 +66,7 @@ struct SimpleInternalData
|
|||||||
int m_customViewPortWidth;
|
int m_customViewPortWidth;
|
||||||
int m_customViewPortHeight;
|
int m_customViewPortHeight;
|
||||||
SimpleInternalData()
|
SimpleInternalData()
|
||||||
:m_fontTextureId(0),
|
: m_fontTextureId(0),
|
||||||
m_largeFontTextureId(0),
|
m_largeFontTextureId(0),
|
||||||
m_fontStash(0),
|
m_fontStash(0),
|
||||||
m_fontStash2(0),
|
m_fontStash2(0),
|
||||||
@ -309,7 +309,6 @@ SimpleOpenGL3App::SimpleOpenGL3App(const char* title, int width, int height, boo
|
|||||||
|
|
||||||
m_data = new SimpleInternalData;
|
m_data = new SimpleInternalData;
|
||||||
|
|
||||||
|
|
||||||
if (windowType == 0)
|
if (windowType == 0)
|
||||||
{
|
{
|
||||||
m_window = new b3gDefaultOpenGLWindow();
|
m_window = new b3gDefaultOpenGLWindow();
|
||||||
@ -925,24 +924,24 @@ SimpleOpenGL3App::~SimpleOpenGL3App()
|
|||||||
delete m_data;
|
delete m_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SimpleOpenGL3App::setViewport(int width, int height)
|
void SimpleOpenGL3App::setViewport(int width, int height)
|
||||||
{
|
{
|
||||||
m_data->m_customViewPortWidth=width;
|
m_data->m_customViewPortWidth = width;
|
||||||
m_data->m_customViewPortHeight=height;
|
m_data->m_customViewPortHeight = height;
|
||||||
if (width>=0)
|
if (width >= 0)
|
||||||
{
|
{
|
||||||
glViewport(0,0,width,height);
|
glViewport(0, 0, width, height);
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
glViewport(0,0,m_window->getRetinaScale()*m_instancingRenderer->getScreenWidth(),m_window->getRetinaScale()*m_instancingRenderer->getScreenHeight());
|
glViewport(0, 0, m_window->getRetinaScale() * m_instancingRenderer->getScreenWidth(), m_window->getRetinaScale() * m_instancingRenderer->getScreenHeight());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SimpleOpenGL3App::getScreenPixels(unsigned char* rgbaBuffer, int bufferSizeInBytes, float* depthBuffer, int depthBufferSizeInBytes)
|
void SimpleOpenGL3App::getScreenPixels(unsigned char* rgbaBuffer, int bufferSizeInBytes, float* depthBuffer, int depthBufferSizeInBytes)
|
||||||
{
|
{
|
||||||
int width = m_data->m_customViewPortWidth>=0? m_data->m_customViewPortWidth : (int)m_window->getRetinaScale() * m_instancingRenderer->getScreenWidth();
|
int width = m_data->m_customViewPortWidth >= 0 ? m_data->m_customViewPortWidth : (int)m_window->getRetinaScale() * m_instancingRenderer->getScreenWidth();
|
||||||
int height = m_data->m_customViewPortHeight >=0? m_data->m_customViewPortHeight: (int)m_window->getRetinaScale() * m_instancingRenderer->getScreenHeight();
|
int height = m_data->m_customViewPortHeight >= 0 ? m_data->m_customViewPortHeight : (int)m_window->getRetinaScale() * m_instancingRenderer->getScreenHeight();
|
||||||
|
|
||||||
b3Assert((width * height * 4) == bufferSizeInBytes);
|
b3Assert((width * height * 4) == bufferSizeInBytes);
|
||||||
if ((width * height * 4) == bufferSizeInBytes)
|
if ((width * height * 4) == bufferSizeInBytes)
|
||||||
|
@ -1726,7 +1726,6 @@ struct PhysicsServerCommandProcessorInternalData
|
|||||||
}
|
}
|
||||||
#endif //ENABLE_STATIC_GRPC_PLUGIN
|
#endif //ENABLE_STATIC_GRPC_PLUGIN
|
||||||
|
|
||||||
|
|
||||||
#ifdef STATIC_EGLRENDERER_PLUGIN
|
#ifdef STATIC_EGLRENDERER_PLUGIN
|
||||||
{
|
{
|
||||||
bool initPlugin = false;
|
bool initPlugin = false;
|
||||||
@ -1735,15 +1734,12 @@ struct PhysicsServerCommandProcessorInternalData
|
|||||||
}
|
}
|
||||||
#endif //STATIC_EGLRENDERER_PLUGIN
|
#endif //STATIC_EGLRENDERER_PLUGIN
|
||||||
|
|
||||||
|
|
||||||
#ifndef SKIP_STATIC_TINYRENDERER_PLUGIN
|
#ifndef SKIP_STATIC_TINYRENDERER_PLUGIN
|
||||||
{
|
{
|
||||||
int renderPluginId = m_pluginManager.registerStaticLinkedPlugin("tinyRendererPlugin", initPlugin_tinyRendererPlugin, exitPlugin_tinyRendererPlugin, executePluginCommand_tinyRendererPlugin, 0, 0, getRenderInterface_tinyRendererPlugin, 0, 0);
|
int renderPluginId = m_pluginManager.registerStaticLinkedPlugin("tinyRendererPlugin", initPlugin_tinyRendererPlugin, exitPlugin_tinyRendererPlugin, executePluginCommand_tinyRendererPlugin, 0, 0, getRenderInterface_tinyRendererPlugin, 0, 0);
|
||||||
m_pluginManager.selectPluginRenderer(renderPluginId);
|
m_pluginManager.selectPluginRenderer(renderPluginId);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_vrControllerEvents.init();
|
m_vrControllerEvents.init();
|
||||||
@ -2743,15 +2739,12 @@ bool PhysicsServerCommandProcessor::processImportedObjects(const char* fileName,
|
|||||||
if (mb)
|
if (mb)
|
||||||
mb->setUserIndex2(bodyUniqueId);
|
mb->setUserIndex2(bodyUniqueId);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (mb)
|
if (mb)
|
||||||
{
|
{
|
||||||
bodyHandle->m_multiBody = mb;
|
bodyHandle->m_multiBody = mb;
|
||||||
|
|
||||||
m_data->m_sdfRecentLoadedBodies.push_back(bodyUniqueId);
|
m_data->m_sdfRecentLoadedBodies.push_back(bodyUniqueId);
|
||||||
|
|
||||||
|
|
||||||
int segmentationMask = bodyUniqueId;
|
int segmentationMask = bodyUniqueId;
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -2760,13 +2753,13 @@ bool PhysicsServerCommandProcessor::processImportedObjects(const char* fileName,
|
|||||||
{
|
{
|
||||||
graphicsIndex = mb->getBaseCollider()->getUserIndex();
|
graphicsIndex = mb->getBaseCollider()->getUserIndex();
|
||||||
}
|
}
|
||||||
if (graphicsIndex>=0)
|
if (graphicsIndex >= 0)
|
||||||
{
|
{
|
||||||
if (m_data->m_graphicsIndexToSegmentationMask.size()<(graphicsIndex+1))
|
if (m_data->m_graphicsIndexToSegmentationMask.size() < (graphicsIndex + 1))
|
||||||
{
|
{
|
||||||
m_data->m_graphicsIndexToSegmentationMask.resize(graphicsIndex+1);
|
m_data->m_graphicsIndexToSegmentationMask.resize(graphicsIndex + 1);
|
||||||
}
|
}
|
||||||
m_data->m_graphicsIndexToSegmentationMask[graphicsIndex]= segmentationMask;
|
m_data->m_graphicsIndexToSegmentationMask[graphicsIndex] = segmentationMask;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2813,15 +2806,15 @@ bool PhysicsServerCommandProcessor::processImportedObjects(const char* fileName,
|
|||||||
{
|
{
|
||||||
graphicsIndex = mb->getLinkCollider(i)->getUserIndex();
|
graphicsIndex = mb->getLinkCollider(i)->getUserIndex();
|
||||||
}
|
}
|
||||||
if (graphicsIndex>=0)
|
if (graphicsIndex >= 0)
|
||||||
{
|
{
|
||||||
int linkIndex = i;
|
int linkIndex = i;
|
||||||
if (m_data->m_graphicsIndexToSegmentationMask.size()<(graphicsIndex+1))
|
if (m_data->m_graphicsIndexToSegmentationMask.size() < (graphicsIndex + 1))
|
||||||
{
|
{
|
||||||
m_data->m_graphicsIndexToSegmentationMask.resize(graphicsIndex+1);
|
m_data->m_graphicsIndexToSegmentationMask.resize(graphicsIndex + 1);
|
||||||
}
|
}
|
||||||
int segmentationMask = bodyUniqueId + ((linkIndex + 1) << 24);
|
int segmentationMask = bodyUniqueId + ((linkIndex + 1) << 24);
|
||||||
m_data->m_graphicsIndexToSegmentationMask[graphicsIndex]= segmentationMask;
|
m_data->m_graphicsIndexToSegmentationMask[graphicsIndex] = segmentationMask;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2860,13 +2853,13 @@ bool PhysicsServerCommandProcessor::processImportedObjects(const char* fileName,
|
|||||||
{
|
{
|
||||||
graphicsIndex = rb->getUserIndex();
|
graphicsIndex = rb->getUserIndex();
|
||||||
}
|
}
|
||||||
if (graphicsIndex>=0)
|
if (graphicsIndex >= 0)
|
||||||
{
|
{
|
||||||
if (m_data->m_graphicsIndexToSegmentationMask.size()<(graphicsIndex+1))
|
if (m_data->m_graphicsIndexToSegmentationMask.size() < (graphicsIndex + 1))
|
||||||
{
|
{
|
||||||
m_data->m_graphicsIndexToSegmentationMask.resize(graphicsIndex+1);
|
m_data->m_graphicsIndexToSegmentationMask.resize(graphicsIndex + 1);
|
||||||
}
|
}
|
||||||
m_data->m_graphicsIndexToSegmentationMask[graphicsIndex]= segmentationMask;
|
m_data->m_graphicsIndexToSegmentationMask[graphicsIndex] = segmentationMask;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3524,9 +3517,9 @@ bool PhysicsServerCommandProcessor::processRequestCameraImageCommand(const struc
|
|||||||
this->m_data->m_guiHelper->setProjectiveTexture(false);
|
this->m_data->m_guiHelper->setProjectiveTexture(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((flags & (ER_SEGMENTATION_MASK_OBJECT_AND_LINKINDEX + ER_SEGMENTATION_MASK))==0)
|
if ((flags & (ER_SEGMENTATION_MASK_OBJECT_AND_LINKINDEX + ER_SEGMENTATION_MASK)) == 0)
|
||||||
{
|
{
|
||||||
segmentationMaskBuffer=0;
|
segmentationMaskBuffer = 0;
|
||||||
}
|
}
|
||||||
m_data->m_guiHelper->copyCameraImageData(viewMat,
|
m_data->m_guiHelper->copyCameraImageData(viewMat,
|
||||||
projMat, pixelRGBA, numRequestedPixels,
|
projMat, pixelRGBA, numRequestedPixels,
|
||||||
@ -3540,11 +3533,11 @@ bool PhysicsServerCommandProcessor::processRequestCameraImageCommand(const struc
|
|||||||
|
|
||||||
if (segmentationMaskBuffer)
|
if (segmentationMaskBuffer)
|
||||||
{
|
{
|
||||||
for (int i=0;i<numPixelsCopied;i++)
|
for (int i = 0; i < numPixelsCopied; i++)
|
||||||
{
|
{
|
||||||
int graphicsSegMask = segmentationMaskBuffer[i];
|
int graphicsSegMask = segmentationMaskBuffer[i];
|
||||||
int segMask = -1;
|
int segMask = -1;
|
||||||
if ((graphicsSegMask >= 0) && (graphicsSegMask<m_data->m_graphicsIndexToSegmentationMask.size()))
|
if ((graphicsSegMask >= 0) && (graphicsSegMask < m_data->m_graphicsIndexToSegmentationMask.size()))
|
||||||
{
|
{
|
||||||
segMask = m_data->m_graphicsIndexToSegmentationMask[graphicsSegMask];
|
segMask = m_data->m_graphicsIndexToSegmentationMask[graphicsSegMask];
|
||||||
}
|
}
|
||||||
@ -3557,10 +3550,8 @@ bool PhysicsServerCommandProcessor::processRequestCameraImageCommand(const struc
|
|||||||
}
|
}
|
||||||
segmentationMaskBuffer[i] = segMask;
|
segmentationMaskBuffer[i] = segMask;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
handled = true;
|
handled = true;
|
||||||
m_data->m_guiHelper->debugDisplayCameraImageData(viewMat,
|
m_data->m_guiHelper->debugDisplayCameraImageData(viewMat,
|
||||||
projMat, pixelRGBA, numRequestedPixels,
|
projMat, pixelRGBA, numRequestedPixels,
|
||||||
|
@ -746,7 +746,7 @@ enum EnumRendererAuxFlags
|
|||||||
{
|
{
|
||||||
ER_SEGMENTATION_MASK_OBJECT_AND_LINKINDEX = 1,
|
ER_SEGMENTATION_MASK_OBJECT_AND_LINKINDEX = 1,
|
||||||
ER_USE_PROJECTIVE_TEXTURE = 2,
|
ER_USE_PROJECTIVE_TEXTURE = 2,
|
||||||
ER_SEGMENTATION_MASK=4,
|
ER_SEGMENTATION_MASK = 4,
|
||||||
};
|
};
|
||||||
|
|
||||||
///flags to pick the IK solver and other options
|
///flags to pick the IK solver and other options
|
||||||
|
@ -100,7 +100,6 @@ struct EGLRendererVisualShapeConverterInternalData
|
|||||||
btAlignedObjectArray<unsigned char> m_segmentationMaskSourceRgbaPixelBuffer;
|
btAlignedObjectArray<unsigned char> m_segmentationMaskSourceRgbaPixelBuffer;
|
||||||
btAlignedObjectArray<float> m_segmentationMaskSourceDepthBuffer;
|
btAlignedObjectArray<float> m_segmentationMaskSourceDepthBuffer;
|
||||||
|
|
||||||
|
|
||||||
btAlignedObjectArray<int> m_graphicsIndexToSegmentationMask;
|
btAlignedObjectArray<int> m_graphicsIndexToSegmentationMask;
|
||||||
btHashMap<btHashInt, EGLRendererObjectArray*> m_swRenderInstances;
|
btHashMap<btHashInt, EGLRendererObjectArray*> m_swRenderInstances;
|
||||||
|
|
||||||
@ -795,18 +794,16 @@ void EGLRendererVisualShapeConverter::convertVisualShapes(
|
|||||||
int segmentationMask = bodyUniqueId + ((linkIndex + 1) << 24);
|
int segmentationMask = bodyUniqueId + ((linkIndex + 1) << 24);
|
||||||
{
|
{
|
||||||
int graphicsIndex = visuals->m_graphicsInstanceId;
|
int graphicsIndex = visuals->m_graphicsInstanceId;
|
||||||
if (graphicsIndex>=0)
|
if (graphicsIndex >= 0)
|
||||||
{
|
{
|
||||||
if (m_data->m_graphicsIndexToSegmentationMask.size()<(graphicsIndex+1))
|
if (m_data->m_graphicsIndexToSegmentationMask.size() < (graphicsIndex + 1))
|
||||||
{
|
{
|
||||||
m_data->m_graphicsIndexToSegmentationMask.resize(graphicsIndex+1);
|
m_data->m_graphicsIndexToSegmentationMask.resize(graphicsIndex + 1);
|
||||||
}
|
}
|
||||||
m_data->m_graphicsIndexToSegmentationMask[graphicsIndex]= segmentationMask;
|
m_data->m_graphicsIndexToSegmentationMask[graphicsIndex] = segmentationMask;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
m_data->m_instancingRenderer->writeTransforms();
|
m_data->m_instancingRenderer->writeTransforms();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -998,21 +995,18 @@ void EGLRendererVisualShapeConverter::copyCameraImageDataGL(
|
|||||||
|
|
||||||
int destinationWidth = *widthPtr;
|
int destinationWidth = *widthPtr;
|
||||||
int destinationHeight = *heightPtr;
|
int destinationHeight = *heightPtr;
|
||||||
int sourceWidth = btMin(destinationWidth, (int)( m_data->m_window->getWidth() * m_data->m_window->getRetinaScale()));
|
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 sourceHeight = btMin(destinationHeight, (int)(m_data->m_window->getHeight() * m_data->m_window->getRetinaScale()));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int numTotalPixels = (*widthPtr) * (*heightPtr);
|
int numTotalPixels = (*widthPtr) * (*heightPtr);
|
||||||
int numRemainingPixels = numTotalPixels - startPixelIndex;
|
int numRemainingPixels = numTotalPixels - startPixelIndex;
|
||||||
int numBytesPerPixel = 4; //RGBA
|
int numBytesPerPixel = 4; //RGBA
|
||||||
int numRequestedPixels = btMin(rgbaBufferSizeInPixels, numRemainingPixels);
|
int numRequestedPixels = btMin(rgbaBufferSizeInPixels, numRemainingPixels);
|
||||||
if (numRequestedPixels)
|
if (numRequestedPixels)
|
||||||
{
|
{
|
||||||
|
if (startPixelIndex == 0)
|
||||||
if (startPixelIndex==0)
|
|
||||||
{
|
{
|
||||||
glViewport(0,0,sourceWidth,sourceHeight);
|
glViewport(0, 0, sourceWidth, sourceHeight);
|
||||||
m_data->m_window->endRendering();
|
m_data->m_window->endRendering();
|
||||||
m_data->m_window->startRendering();
|
m_data->m_window->startRendering();
|
||||||
/*
|
/*
|
||||||
@ -1069,12 +1063,9 @@ void EGLRendererVisualShapeConverter::copyCameraImageDataGL(
|
|||||||
b3Assert(glstat == GL_NO_ERROR);
|
b3Assert(glstat == GL_NO_ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
m_data->m_rgbaPixelBuffer1.resize((*widthPtr) * (*heightPtr) * numBytesPerPixel);
|
m_data->m_rgbaPixelBuffer1.resize((*widthPtr) * (*heightPtr) * numBytesPerPixel);
|
||||||
m_data->m_depthBuffer1.resize((*widthPtr) * (*heightPtr));
|
m_data->m_depthBuffer1.resize((*widthPtr) * (*heightPtr));
|
||||||
//rescale and flip
|
//rescale and flip
|
||||||
@ -1141,14 +1132,11 @@ void EGLRendererVisualShapeConverter::copyCameraImageDataGL(
|
|||||||
glstat = glGetError();
|
glstat = glGetError();
|
||||||
b3Assert(glstat == GL_NO_ERROR);
|
b3Assert(glstat == GL_NO_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_data->m_segmentationMaskBuffer.resize(destinationWidth * destinationHeight, -1);
|
||||||
m_data->m_segmentationMaskBuffer.resize(destinationWidth * destinationHeight,-1);
|
|
||||||
|
|
||||||
//rescale and flip
|
//rescale and flip
|
||||||
{
|
{
|
||||||
@ -1168,11 +1156,12 @@ void EGLRendererVisualShapeConverter::copyCameraImageDataGL(
|
|||||||
if (segmentationMaskBuffer)
|
if (segmentationMaskBuffer)
|
||||||
{
|
{
|
||||||
float depth = m_data->m_segmentationMaskSourceDepthBuffer[sourceDepthIndex];
|
float depth = m_data->m_segmentationMaskSourceDepthBuffer[sourceDepthIndex];
|
||||||
if (depth<1)
|
if (depth < 1)
|
||||||
{
|
{
|
||||||
int segMask = m_data->m_segmentationMaskSourceRgbaPixelBuffer[sourcePixelIndex + 0]+256*(m_data->m_segmentationMaskSourceRgbaPixelBuffer[sourcePixelIndex + 1])+256*256*(m_data->m_segmentationMaskSourceRgbaPixelBuffer[sourcePixelIndex + 2]);
|
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;
|
m_data->m_segmentationMaskBuffer[i + j * destinationWidth] = segMask;
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
m_data->m_segmentationMaskBuffer[i + j * destinationWidth] = -1;
|
m_data->m_segmentationMaskBuffer[i + j * destinationWidth] = -1;
|
||||||
}
|
}
|
||||||
@ -1180,8 +1169,7 @@ 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());
|
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)
|
if (pixelsRGBA)
|
||||||
{
|
{
|
||||||
@ -1204,10 +1192,9 @@ void EGLRendererVisualShapeConverter::copyCameraImageDataGL(
|
|||||||
BT_PROFILE("copy segmentation mask buffer pixels");
|
BT_PROFILE("copy segmentation mask buffer pixels");
|
||||||
for (int i = 0; i < numRequestedPixels; i++)
|
for (int i = 0; i < numRequestedPixels; i++)
|
||||||
{
|
{
|
||||||
|
|
||||||
int graphicsIndexSegMask = m_data->m_segmentationMaskBuffer[i + startPixelIndex];
|
int graphicsIndexSegMask = m_data->m_segmentationMaskBuffer[i + startPixelIndex];
|
||||||
int segMask = -1;
|
int segMask = -1;
|
||||||
if (graphicsIndexSegMask>=0 && graphicsIndexSegMask< m_data->m_graphicsIndexToSegmentationMask.size())
|
if (graphicsIndexSegMask >= 0 && graphicsIndexSegMask < m_data->m_graphicsIndexToSegmentationMask.size())
|
||||||
{
|
{
|
||||||
segMask = m_data->m_graphicsIndexToSegmentationMask[graphicsIndexSegMask];
|
segMask = m_data->m_graphicsIndexToSegmentationMask[graphicsIndexSegMask];
|
||||||
}
|
}
|
||||||
@ -1227,8 +1214,6 @@ void EGLRendererVisualShapeConverter::copyCameraImageDataGL(
|
|||||||
*numPixelsCopied = numRequestedPixels;
|
*numPixelsCopied = numRequestedPixels;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void EGLRendererVisualShapeConverter::copyCameraImageData(unsigned char* pixelsRGBA, int rgbaBufferSizeInPixels,
|
void EGLRendererVisualShapeConverter::copyCameraImageData(unsigned char* pixelsRGBA, int rgbaBufferSizeInPixels,
|
||||||
|
@ -799,7 +799,7 @@ extern "C"
|
|||||||
};
|
};
|
||||||
#endif
|
#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)
|
// (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
|
#define stbtt_vertex_type short // can't use stbtt_int16 because that's not visible in the header file
|
||||||
typedef struct
|
typedef struct
|
||||||
|
@ -707,7 +707,7 @@ extern "C"
|
|||||||
};
|
};
|
||||||
#endif
|
#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)
|
// (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
|
#define stbtt_vertex_type short // can't use stbtt_int16 because that's not visible in the header file
|
||||||
typedef struct
|
typedef struct
|
||||||
|
@ -292,8 +292,8 @@ btCollisionShape* btCollisionWorldImporter::convertCollisionShape(btCollisionSha
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif //SUPPORT_GIMPACT_SHAPE_IMPORT
|
#endif //SUPPORT_GIMPACT_SHAPE_IMPORT \
|
||||||
//The btCapsuleShape* API has issue passing the margin/scaling/halfextents unmodified through the API
|
//The btCapsuleShape* API has issue passing the margin/scaling/halfextents unmodified through the API \
|
||||||
//so deal with this
|
//so deal with this
|
||||||
case CAPSULE_SHAPE_PROXYTYPE:
|
case CAPSULE_SHAPE_PROXYTYPE:
|
||||||
{
|
{
|
||||||
|
@ -347,7 +347,7 @@ int main()
|
|||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
gladLoaderLoadGL();
|
gladLoaderLoadGL();
|
||||||
#endif
|
#endif
|
||||||
#endif //B3_USE_GLFW
|
#endif //B3_USE_GLFW \
|
||||||
//we ned to call glGetError twice, because of some Ubuntu/Intel/OpenGL issue
|
//we ned to call glGetError twice, because of some Ubuntu/Intel/OpenGL issue
|
||||||
|
|
||||||
GLuint err = glGetError();
|
GLuint err = glGetError();
|
||||||
|
@ -4428,7 +4428,7 @@ UnitTestImpl::UnitTestImpl(UnitTest* parent)
|
|||||||
: parent_(parent),
|
: parent_(parent),
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning(push) // Saves the current warning state.
|
#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).
|
// (using this in initializer).
|
||||||
default_global_test_part_result_reporter_(this),
|
default_global_test_part_result_reporter_(this),
|
||||||
default_per_thread_test_part_result_reporter_(this),
|
default_per_thread_test_part_result_reporter_(this),
|
||||||
|
Loading…
Reference in New Issue
Block a user