Skip to content

Commit

Permalink
Merge branch 'master' into cmake-option-per-extra
Browse files Browse the repository at this point in the history
  • Loading branch information
al-tu committed Apr 14, 2021
2 parents 7aff26b + 5ae9a15 commit f04768e
Show file tree
Hide file tree
Showing 311 changed files with 57,956 additions and 268 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ OPTION(BUILD_SHARED_LIBS "Use shared libraries" OFF)
OPTION(USE_SOFT_BODY_MULTI_BODY_DYNAMICS_WORLD "Use btSoftMultiBodyDynamicsWorld" ON)
OPTION(USE_OPENVR "Use OpenVR for virtual reality" OFF)

OPTION(ENABLE_VHACD "Use VHACD in BulletRobotics and pybullet" ON)

OPTION(BULLET2_MULTITHREADING "Build Bullet 2 libraries with mutex locking around certain operations (required for multi-threading)" OFF)
IF (BULLET2_MULTITHREADING)
OPTION(BULLET2_USE_OPEN_MP_MULTITHREADING "Build Bullet 2 with support for multi-threading with OpenMP (requires a compiler with OpenMP support)" OFF)
Expand Down
160 changes: 98 additions & 62 deletions Extras/BulletRobotics/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ INCLUDE_DIRECTORIES(
${BULLET_PHYSICS_SOURCE_DIR}/examples/ThirdPartyLibs/enet/include
${BULLET_PHYSICS_SOURCE_DIR}/examples/ThirdPartyLibs/clsocket/src
)
ADD_DEFINITIONS(-DSTATIC_LINK_SPD_PLUGIN)



SET(BulletRobotics_INCLUDES
../../examples/CommonInterfaces/Common2dCanvasInterface.h
Expand Down Expand Up @@ -94,69 +97,102 @@ SET(BulletRobotics_INCLUDES
)

SET(BulletRobotics_SRCS ${BulletRobotics_INCLUDES}
../../examples/OpenGLWindow/SimpleCamera.cpp

../../examples/TinyRenderer/geometry.cpp
../../examples/TinyRenderer/model.cpp
../../examples/TinyRenderer/tgaimage.cpp
../../examples/TinyRenderer/our_gl.cpp
../../examples/TinyRenderer/TinyRenderer.cpp

../../examples/SharedMemory/plugins/collisionFilterPlugin/collisionFilterPlugin.cpp
../../examples/SharedMemory/plugins/pdControlPlugin/pdControlPlugin.cpp
../../examples/SharedMemory/b3RobotSimulatorClientAPI_NoGUI.cpp
../../examples/SharedMemory/b3RobotSimulatorClientAPI_NoDirect.cpp
../../examples/SharedMemory/IKTrajectoryHelper.cpp
../../examples/SharedMemory/plugins/tinyRendererPlugin/tinyRendererPlugin.cpp
../../examples/SharedMemory/plugins/tinyRendererPlugin/TinyRendererVisualShapeConverter.cpp
../../examples/SharedMemory/InProcessMemory.cpp
../../examples/SharedMemory/PhysicsClient.cpp
../../examples/SharedMemory/PhysicsServer.cpp
../../examples/SharedMemory/PhysicsServerSharedMemory.cpp
../../examples/SharedMemory/PhysicsDirect.cpp
../../examples/SharedMemory/PhysicsDirectC_API.cpp
../../examples/SharedMemory/PhysicsServerCommandProcessor.cpp
../../examples/SharedMemory/b3PluginManager.cpp
../../examples/SharedMemory/PhysicsClientSharedMemory.cpp
../../examples/SharedMemory/PhysicsClientSharedMemory_C_API.cpp
../../examples/SharedMemory/PhysicsClientC_API.cpp
../../examples/SharedMemory/Win32SharedMemory.cpp
../../examples/SharedMemory/PosixSharedMemory.cpp

../../examples/Utils/b3ResourcePath.cpp
../../examples/Utils/RobotLoggingUtil.cpp
../../examples/Utils/b3Clock.cpp
../../examples/Utils/b3ResourcePath.cpp
../../examples/Utils/ChromeTraceUtil.cpp

../../examples/ThirdPartyLibs/tinyxml2/tinyxml2.cpp
../../examples/ThirdPartyLibs/Wavefront/tiny_obj_loader.cpp
../../examples/ThirdPartyLibs/stb_image/stb_image.cpp
../../examples/ThirdPartyLibs/BussIK/Jacobian.cpp
../../examples/ThirdPartyLibs/BussIK/LinearR2.cpp
../../examples/ThirdPartyLibs/BussIK/LinearR3.cpp
../../examples/ThirdPartyLibs/BussIK/LinearR4.cpp
../../examples/ThirdPartyLibs/BussIK/MatrixRmn.cpp
../../examples/ThirdPartyLibs/BussIK/Misc.cpp
../../examples/ThirdPartyLibs/BussIK/Node.cpp
../../examples/ThirdPartyLibs/BussIK/Tree.cpp
../../examples/ThirdPartyLibs/BussIK/VectorRn.cpp

../../examples/Importers/ImportColladaDemo/LoadMeshFromCollada.cpp
../../examples/Importers/ImportObjDemo/LoadMeshFromObj.cpp
../../examples/Importers/ImportObjDemo/Wavefront2GLInstanceGraphicsShape.cpp
../../examples/Importers/ImportMJCFDemo/BulletMJCFImporter.cpp
../../examples/Importers/ImportURDFDemo/BulletUrdfImporter.cpp
../../examples/Importers/ImportURDFDemo/MyMultiBodyCreator.cpp
../../examples/Importers/ImportURDFDemo/URDF2Bullet.cpp
../../examples/Importers/ImportURDFDemo/UrdfParser.cpp
../../examples/Importers/ImportURDFDemo/urdfStringSplit.cpp
../../examples/Importers/ImportMeshUtility/b3ImportMeshUtility.cpp

../../examples/MultiThreading/b3PosixThreadSupport.cpp
../../examples/MultiThreading/b3Win32ThreadSupport.cpp
../../examples/MultiThreading/b3ThreadSupportInterface.cpp
../../examples/SharedMemory/plugins/stablePDPlugin/SpAlg.cpp
../../examples/SharedMemory/plugins/stablePDPlugin/SpAlg.h
../../examples/SharedMemory/plugins/stablePDPlugin/Shape.cpp
../../examples/SharedMemory/plugins/stablePDPlugin/Shape.h
../../examples/SharedMemory/plugins/stablePDPlugin/RBDUtil.cpp
../../examples/SharedMemory/plugins/stablePDPlugin/RBDUtil.h
../../examples/SharedMemory/plugins/stablePDPlugin/RBDModel.cpp
../../examples/SharedMemory/plugins/stablePDPlugin/RBDModel.h
../../examples/SharedMemory/plugins/stablePDPlugin/MathUtil.cpp
../../examples/SharedMemory/plugins/stablePDPlugin/MathUtil.h
../../examples/SharedMemory/plugins/stablePDPlugin/KinTree.cpp
../../examples/SharedMemory/plugins/stablePDPlugin/KinTree.h
../../examples/SharedMemory/plugins/stablePDPlugin/BulletConversion.cpp
../../examples/SharedMemory/plugins/stablePDPlugin/BulletConversion.h

../../examples/OpenGLWindow/SimpleCamera.cpp

../../examples/TinyRenderer/geometry.cpp
../../examples/TinyRenderer/model.cpp
../../examples/TinyRenderer/tgaimage.cpp
../../examples/TinyRenderer/our_gl.cpp
../../examples/TinyRenderer/TinyRenderer.cpp

../../examples/SharedMemory/plugins/collisionFilterPlugin/collisionFilterPlugin.cpp
../../examples/SharedMemory/plugins/pdControlPlugin/pdControlPlugin.cpp
../../examples/SharedMemory/b3RobotSimulatorClientAPI_NoGUI.cpp
../../examples/SharedMemory/b3RobotSimulatorClientAPI_NoDirect.cpp
../../examples/SharedMemory/IKTrajectoryHelper.cpp
../../examples/SharedMemory/plugins/tinyRendererPlugin/tinyRendererPlugin.cpp
../../examples/SharedMemory/plugins/tinyRendererPlugin/TinyRendererVisualShapeConverter.cpp
../../examples/SharedMemory/InProcessMemory.cpp
../../examples/SharedMemory/PhysicsClient.cpp
../../examples/SharedMemory/PhysicsServer.cpp
../../examples/SharedMemory/PhysicsServerSharedMemory.cpp
../../examples/SharedMemory/PhysicsDirect.cpp
../../examples/SharedMemory/PhysicsDirectC_API.cpp
../../examples/SharedMemory/PhysicsServerCommandProcessor.cpp
../../examples/SharedMemory/b3PluginManager.cpp
../../examples/SharedMemory/PhysicsClientSharedMemory.cpp
../../examples/SharedMemory/PhysicsClientSharedMemory_C_API.cpp
../../examples/SharedMemory/PhysicsClientC_API.cpp
../../examples/SharedMemory/Win32SharedMemory.cpp
../../examples/SharedMemory/PosixSharedMemory.cpp

../../examples/Utils/b3ResourcePath.cpp
../../examples/Utils/RobotLoggingUtil.cpp
../../examples/Utils/b3Clock.cpp
../../examples/Utils/b3ResourcePath.cpp
../../examples/Utils/ChromeTraceUtil.cpp

../../examples/ThirdPartyLibs/tinyxml2/tinyxml2.cpp
../../examples/ThirdPartyLibs/Wavefront/tiny_obj_loader.cpp
../../examples/ThirdPartyLibs/stb_image/stb_image.cpp
../../examples/ThirdPartyLibs/BussIK/Jacobian.cpp
../../examples/ThirdPartyLibs/BussIK/LinearR2.cpp
../../examples/ThirdPartyLibs/BussIK/LinearR3.cpp
../../examples/ThirdPartyLibs/BussIK/LinearR4.cpp
../../examples/ThirdPartyLibs/BussIK/MatrixRmn.cpp
../../examples/ThirdPartyLibs/BussIK/Misc.cpp
../../examples/ThirdPartyLibs/BussIK/Node.cpp
../../examples/ThirdPartyLibs/BussIK/Tree.cpp
../../examples/ThirdPartyLibs/BussIK/VectorRn.cpp

../../examples/Importers/ImportColladaDemo/LoadMeshFromCollada.cpp
../../examples/Importers/ImportObjDemo/LoadMeshFromObj.cpp
../../examples/Importers/ImportObjDemo/Wavefront2GLInstanceGraphicsShape.cpp
../../examples/Importers/ImportMJCFDemo/BulletMJCFImporter.cpp
../../examples/Importers/ImportURDFDemo/BulletUrdfImporter.cpp
../../examples/Importers/ImportURDFDemo/MyMultiBodyCreator.cpp
../../examples/Importers/ImportURDFDemo/URDF2Bullet.cpp
../../examples/Importers/ImportURDFDemo/UrdfParser.cpp
../../examples/Importers/ImportURDFDemo/urdfStringSplit.cpp
../../examples/Importers/ImportMeshUtility/b3ImportMeshUtility.cpp

../../examples/MultiThreading/b3PosixThreadSupport.cpp
../../examples/MultiThreading/b3Win32ThreadSupport.cpp
../../examples/MultiThreading/b3ThreadSupportInterface.cpp


)

IF(ENABLE_VHACD)
ADD_DEFINITIONS(-DBT_ENABLE_VHACD)
SET(BulletRobotics_SRCS ${BulletRobotics_SRCS}
../../Extras/VHACD/test/src/main_vhacd.cpp
../../Extras/VHACD/src/VHACD.cpp
../../Extras/VHACD/src/vhacdICHull.cpp
../../Extras/VHACD/src/vhacdManifoldMesh.cpp
../../Extras/VHACD/src/vhacdMesh.cpp
../../Extras/VHACD/src/vhacdVolume.cpp
)
INCLUDE_DIRECTORIES(
../../Extras/VHACD/inc
../../Extras/VHACD/public
)
ENDIF(ENABLE_VHACD)

IF(BUILD_CLSOCKET)
ADD_DEFINITIONS(-DBT_ENABLE_CLSOCKET)
Expand Down
15 changes: 0 additions & 15 deletions Extras/BulletRoboticsGUI/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -94,21 +94,6 @@ SET(BulletRoboticsGUI_INCLUDES
)

SET(BulletRoboticsGUI_SRCS ${BulletRoboticsGUI_INCLUDES}

../../examples/SharedMemory/plugins/stablePDPlugin/SpAlg.cpp
../../examples/SharedMemory/plugins/stablePDPlugin/SpAlg.h
../../examples/SharedMemory/plugins/stablePDPlugin/Shape.cpp
../../examples/SharedMemory/plugins/stablePDPlugin/Shape.h
../../examples/SharedMemory/plugins/stablePDPlugin/RBDUtil.cpp
../../examples/SharedMemory/plugins/stablePDPlugin/RBDUtil.h
../../examples/SharedMemory/plugins/stablePDPlugin/RBDModel.cpp
../../examples/SharedMemory/plugins/stablePDPlugin/RBDModel.h
../../examples/SharedMemory/plugins/stablePDPlugin/MathUtil.cpp
../../examples/SharedMemory/plugins/stablePDPlugin/MathUtil.h
../../examples/SharedMemory/plugins/stablePDPlugin/KinTree.cpp
../../examples/SharedMemory/plugins/stablePDPlugin/KinTree.h
../../examples/SharedMemory/plugins/stablePDPlugin/BulletConversion.cpp
../../examples/SharedMemory/plugins/stablePDPlugin/BulletConversion.h
../../examples/ExampleBrowser/InProcessExampleBrowser.cpp
../../examples/SharedMemory/GraphicsServerExample.cpp
../../examples/SharedMemory/GraphicsClientExample.cpp
Expand Down
12 changes: 6 additions & 6 deletions Extras/Serialize/BulletFileLoader/bFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -643,8 +643,8 @@ char *bFile::readStruct(char *head, bChunkInd &dataChunk)
if ((strcmp(oldType, "btShortIntIndexData") == 0))
{
int allocLen = 2;
char *dataAlloc = new char[(dataChunk.nr * allocLen) + 1];
memset(dataAlloc, 0, (dataChunk.nr * allocLen) + 1);
char *dataAlloc = new char[(dataChunk.nr * allocLen) + sizeof(void*)];
memset(dataAlloc, 0, (dataChunk.nr * allocLen) + sizeof(void*));
short *dest = (short *)dataAlloc;
const short *src = (short *)head;
for (int i = 0; i < dataChunk.nr; i++)
Expand Down Expand Up @@ -682,8 +682,8 @@ char *bFile::readStruct(char *head, bChunkInd &dataChunk)
// numBlocks * length

int allocLen = (curLen);
char *dataAlloc = new char[(dataChunk.nr * allocLen) + 1];
memset(dataAlloc, 0, (dataChunk.nr * allocLen));
char *dataAlloc = new char[(dataChunk.nr * allocLen) + sizeof(void*)];
memset(dataAlloc, 0, (dataChunk.nr * allocLen) + sizeof(void*));

// track allocated
addDataBlock(dataAlloc);
Expand Down Expand Up @@ -719,8 +719,8 @@ char *bFile::readStruct(char *head, bChunkInd &dataChunk)
#endif //
}

char *dataAlloc = new char[(dataChunk.len) + 1];
memset(dataAlloc, 0, dataChunk.len + 1);
char *dataAlloc = new char[(dataChunk.len) + sizeof(void*)];
memset(dataAlloc, 0, dataChunk.len + sizeof(void*));

// track allocated
addDataBlock(dataAlloc);
Expand Down
31 changes: 17 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ This is the official C++ source code repository of the Bullet Physics SDK: real-

![PyBullet](https://pybullet.org/wordpress/wp-content/uploads/2019/03/cropped-pybullet.png)

## Issues ##
The Issue tracker was flooded with support questions and is closed until it is cleaned up. Use the [PyBullet forums](http://pybullet.org) to discuss with others.

## PyBullet ##
New in Bullet 2.85: pybullet Python bindings, improved support for robotics and VR. Use pip install pybullet and checkout the [PyBullet Quickstart Guide](https://docs.google.com/document/d/10sXEhzFRSnvFcl3XxNGhnD4N2SedqwdAvK3dsihxVUA/edit#heading=h.2ye70wns7io3).
It is highly recommended to use PyBullet Python bindings for improved support for robotics, reinforcement learning and VR. Use pip install pybullet and checkout the [PyBullet Quickstart Guide](https://docs.google.com/document/d/10sXEhzFRSnvFcl3XxNGhnD4N2SedqwdAvK3dsihxVUA/edit#heading=h.2ye70wns7io3).

Installation is simple:
```
Expand Down Expand Up @@ -63,7 +66,7 @@ You can download and install Bullet using the [vcpkg](https://github.com/Microso
cd vcpkg
./bootstrap-vcpkg.sh
./vcpkg integrate install
vcpkg install bullet3
./vcpkg install bullet3

The Bullet port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please [create an issue or pull request](https://github.com/Microsoft/vcpkg) on the vcpkg repository.

Expand Down Expand Up @@ -91,35 +94,35 @@ p.connect(p.SHARED_MEMORY) #or (p.TCP, "localhost", 6667) or (p.UDP, "192.168.86
Make sure cmake is installed (sudo apt-get install cmake, brew install cmake, or https://cmake.org)

In a terminal type:

./build_cmake_pybullet_double.sh

```
./build_cmake_pybullet_double.sh
```
This script will invoke cmake and build in the build_cmake directory. You can find pybullet in Bullet/examples/pybullet.
The BulletExampleBrowser binary will be in Bullet/examples/ExampleBrowser.

You can also build Bullet using premake. There are premake executables in the build3 folder.
Depending on your system (Linux 32bit, 64bit or Mac OSX) use one of the following lines
Using premake:
```
cd build3
./premake4_linux --double gmake
./premake4_linux64 --double gmake
./premake4_osx --double --enable_pybullet gmake
cd build3
./premake4_linux --double gmake
./premake4_linux64 --double gmake
./premake4_osx --double --enable_pybullet gmake
```
Then
```
cd gmake
make
cd gmake
make
```

Note that on Linux, you need to use cmake to build pybullet, since the compiler has issues of mixing shared and static libraries.

**Mac OSX Xcode**

Click on build3/xcode4.command or in a terminal window execute

./premake_osx xcode4

```
./premake_osx xcode4
```
## Usage

The App_ExampleBrowser executables will be located in the bin folder.
Expand Down
4 changes: 2 additions & 2 deletions examples/DeformableDemo/DeformableSelfCollision.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class DeformableSelfCollision : public CommonDeformableBodyBase
m_dynamicsWorld->stepSimulation(deltaTime, 4, internalTimeStep);
}

void addCloth(btVector3 origin);
void addCloth(const btVector3& origin);

virtual void renderScene()
{
Expand Down Expand Up @@ -126,7 +126,7 @@ void DeformableSelfCollision::initPhysics()
getDeformableDynamicsWorld()->setLineSearch(false);
m_guiHelper->autogenerateGraphicsObjects(m_dynamicsWorld);
}
void DeformableSelfCollision::addCloth(btVector3 origin)
void DeformableSelfCollision::addCloth(const btVector3& origin)
// create a piece of cloth
{
const btScalar s = 0.6;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
#include "GwenParameterInterface.h"
#include "gwenInternalData.h"
#include <cstring>

#ifdef _WIN32
#define safe_printf _snprintf
#else
#define safe_printf snprintf
#endif
struct MyButtonEventHandler : public Gwen::Event::Handler
{
Gwen::Controls::Button* m_buttonControl;
Expand Down Expand Up @@ -85,7 +89,7 @@ struct MySliderEventHandler : public Gwen::Event::Handler
if (m_showValue)
{
char txt[1024];
snprintf(txt, sizeof(txt), "%s : %.3f", m_variableName, val);
safe_printf(txt, sizeof(txt), "%s : %.3f", m_variableName, val);
m_label->SetText(txt);
}
}
Expand Down Expand Up @@ -231,7 +235,7 @@ void GwenParameterInterface::registerSliderFloatParameter(SliderParams& params)
}
pSlider->SetValue(*params.m_paramValuePointer); //dimensions[i] );
char labelName[1024];
snprintf(labelName, sizeof(labelName), "%s", params.m_name); //axisNames[0]);
safe_printf(labelName, sizeof(labelName), "%s", params.m_name); //axisNames[0]);
MySliderEventHandler<btScalar>* handler = new MySliderEventHandler<btScalar>(labelName, label, pSlider, params.m_paramValuePointer, params.m_callback, params.m_userPointer);
handler->m_showValue = params.m_showValues;
m_paramInternalData->m_sliderEventHandlers.push_back(handler);
Expand Down
Loading

0 comments on commit f04768e

Please sign in to comment.