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

@@ -13,23 +13,20 @@ subject to the following restrictions:
3. This notice may not be removed or altered from any source distribution.
*/
#include "CompoundBoxes.h"
#include "btBulletDynamicsCommon.h"
#include "LinearMath/btVector3.h"
#include "LinearMath/btAlignedObjectArray.h"
#include "LinearMath/btAlignedObjectArray.h"
#include "../CommonInterfaces/CommonRigidBodyBase.h"
struct CompoundBoxesExample : public CommonRigidBodyBase
{
CompoundBoxesExample(struct GUIHelperInterface* helper)
:CommonRigidBodyBase(helper)
: CommonRigidBodyBase(helper)
{
}
virtual ~CompoundBoxesExample(){}
virtual ~CompoundBoxesExample() {}
virtual void initPhysics();
virtual void renderScene();
void resetCamera()
@@ -37,8 +34,8 @@ struct CompoundBoxesExample : public CommonRigidBodyBase
float dist = 41;
float pitch = -35;
float yaw = 52;
float targetPos[3]={0,0.46,0};
m_guiHelper->resetCamera(dist,yaw,pitch,targetPos[0],targetPos[1],targetPos[2]);
float targetPos[3] = {0, 0.46, 0};
m_guiHelper->resetCamera(dist, yaw, pitch, targetPos[0], targetPos[1], targetPos[2]);
}
};
@@ -47,36 +44,35 @@ void CompoundBoxesExample::initPhysics()
m_guiHelper->setUpAxis(1);
createEmptyDynamicsWorld();
m_guiHelper->createPhysicsDebugDrawer(m_dynamicsWorld);
if (m_dynamicsWorld->getDebugDrawer())
m_dynamicsWorld->getDebugDrawer()->setDebugMode(btIDebugDraw::DBG_DrawWireframe+btIDebugDraw::DBG_DrawContactPoints);
m_dynamicsWorld->getDebugDrawer()->setDebugMode(btIDebugDraw::DBG_DrawWireframe + btIDebugDraw::DBG_DrawContactPoints);
///create a few basic rigid bodies
btBoxShape* groundShape = createBoxShape(btVector3(btScalar(50.),btScalar(50.),btScalar(50.)));
btBoxShape* groundShape = createBoxShape(btVector3(btScalar(50.), btScalar(50.), btScalar(50.)));
m_collisionShapes.push_back(groundShape);
btTransform groundTransform;
groundTransform.setIdentity();
groundTransform.setOrigin(btVector3(0,-50,0));
groundTransform.setOrigin(btVector3(0, -50, 0));
{
btScalar mass(0.);
createRigidBody(mass,groundTransform,groundShape, btVector4(0,0,1,1));
createRigidBody(mass, groundTransform, groundShape, btVector4(0, 0, 1, 1));
}
{
//create a few dynamic rigidbodies
// Re-using the same collision is better for memory usage and performance
btBoxShape* cube = createBoxShape(btVector3(0.5,0.5,0.5));
btBoxShape* cube = createBoxShape(btVector3(0.5, 0.5, 0.5));
m_collisionShapes.push_back(cube);
// create a new compound shape for making an L-beam from `cube`s
btCompoundShape* compoundShape = new btCompoundShape();
btTransform transform;
// add cubes in an L-beam fashion to the compound shape
transform.setIdentity();
transform.setOrigin(btVector3(0, 0, 0));
@@ -90,8 +86,7 @@ void CompoundBoxesExample::initPhysics()
transform.setOrigin(btVector3(0, 0, 1));
compoundShape->addChildShape(transform, cube);
btScalar masses[3]={1, 1, 1};
btScalar masses[3] = {1, 1, 1};
btTransform principal;
btVector3 inertia;
compoundShape->calculatePrincipalAxisTransform(masses, principal, inertia);
@@ -103,9 +98,9 @@ void CompoundBoxesExample::initPhysics()
// less efficient way to add the entire compund shape
// to a new compund shape as a child
compound2->addChildShape(principal.inverse(), compoundShape);
#else
#else
// recompute the shift to make sure the compound shape is re-aligned
for (int i=0; i < compoundShape->getNumChildShapes(); i++)
for (int i = 0; i < compoundShape->getNumChildShapes(); i++)
compound2->addChildShape(compoundShape->getChildTransform(i) * principal.inverse(),
compoundShape->getChildShape(i));
#endif
@@ -113,23 +108,18 @@ void CompoundBoxesExample::initPhysics()
transform.setIdentity();
transform.setOrigin(btVector3(0, 10, 0));
createRigidBody(1.0, transform, compound2);
createRigidBody(1.0, transform, compound2);
}
m_guiHelper->autogenerateGraphicsObjects(m_dynamicsWorld);
}
void CompoundBoxesExample::renderScene()
{
CommonRigidBodyBase::renderScene();
CommonRigidBodyBase::renderScene();
}
CommonExampleInterface* ET_CompoundBoxesCreateFunc(CommonExampleOptions& options)
CommonExampleInterface* ET_CompoundBoxesCreateFunc(CommonExampleOptions& options)
{
return new CompoundBoxesExample(options.m_guiHelper);
}