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,8 +13,6 @@ subject to the following restrictions:
3. This notice may not be removed or altered from any source distribution.
*/
#include "RigidBodySoftContact.h"
#include "btBulletDynamicsCommon.h"
@@ -29,19 +27,15 @@ subject to the following restrictions:
#include "BulletDynamics/MLCPSolvers/btMLCPSolver.h"
#include "BulletDynamics/MLCPSolvers/btSolveProjectedGaussSeidel.h"
struct RigidBodySoftContact : public CommonRigidBodyBase
{
RigidBodySoftContact(struct GUIHelperInterface* helper)
:CommonRigidBodyBase(helper)
: CommonRigidBodyBase(helper)
{
}
virtual ~RigidBodySoftContact()
{
}
{
}
virtual void initPhysics();
virtual void renderScene();
void resetCamera()
@@ -49,19 +43,13 @@ struct RigidBodySoftContact : public CommonRigidBodyBase
float dist = 3;
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]);
}
};
void RigidBodySoftContact::initPhysics()
{
m_guiHelper->setUpAxis(1);
//createEmptyDynamicsWorld();
@@ -71,7 +59,7 @@ void RigidBodySoftContact::initPhysics()
//m_collisionConfiguration->setConvexConvexMultipointIterations();
///use the default collision dispatcher. For parallel processing you can use a diffent dispatcher (see Extras/BulletMultiThreaded)
m_dispatcher = new btCollisionDispatcher(m_collisionConfiguration);
m_dispatcher = new btCollisionDispatcher(m_collisionConfiguration);
m_broadphase = new btDbvtBroadphase();
@@ -84,84 +72,76 @@ void RigidBodySoftContact::initPhysics()
m_dynamicsWorld->setGravity(btVector3(0, -10, 0));
}
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);
m_dynamicsWorld->getSolverInfo().m_erp2 = 0.f;
m_dynamicsWorld->getSolverInfo().m_globalCfm = 0.f;
m_dynamicsWorld->getSolverInfo().m_numIterations = 3;
m_dynamicsWorld->getSolverInfo().m_solverMode = SOLVER_SIMD;// | SOLVER_RANDMIZE_ORDER;
m_dynamicsWorld->getSolverInfo().m_solverMode = SOLVER_SIMD; // | SOLVER_RANDMIZE_ORDER;
m_dynamicsWorld->getSolverInfo().m_splitImpulse = false;
///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.)));
//groundShape->initializePolyhedralFeatures();
// btCollisionShape* groundShape = new btStaticPlaneShape(btVector3(0,1,0),50);
// btCollisionShape* groundShape = new btStaticPlaneShape(btVector3(0,1,0),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.);
btRigidBody* body = createRigidBody(mass,groundTransform,groundShape, btVector4(0,0,1,1));
body->setContactStiffnessAndDamping(300,10);
}
btRigidBody* body = createRigidBody(mass, groundTransform, groundShape, btVector4(0, 0, 1, 1));
body->setContactStiffnessAndDamping(300, 10);
}
{
//create a few dynamic rigidbodies
// Re-using the same collision is better for memory usage and performance
//btBoxShape* colShape = createBoxShape(btVector3(1,1,1));
btCollisionShape* childShape = new btSphereShape(btScalar(0.5));
btCompoundShape* colShape = new btCompoundShape();
colShape->addChildShape(btTransform::getIdentity(),childShape);
colShape->addChildShape(btTransform::getIdentity(), childShape);
m_collisionShapes.push_back(colShape);
/// Create Dynamic Objects
btTransform startTransform;
startTransform.setIdentity();
startTransform.setRotation(btQuaternion(btVector3(1,1,1),SIMD_PI/10.));
btScalar mass(1.f);
startTransform.setRotation(btQuaternion(btVector3(1, 1, 1), SIMD_PI / 10.));
btScalar mass(1.f);
//rigidbody is dynamic if and only if mass is non zero, otherwise static
bool isDynamic = (mass != 0.f);
btVector3 localInertia(0,0,0);
btVector3 localInertia(0, 0, 0);
if (isDynamic)
colShape->calculateLocalInertia(mass,localInertia);
colShape->calculateLocalInertia(mass, localInertia);
for (int k=0;k<ARRAY_SIZE_Y;k++)
for (int k = 0; k < ARRAY_SIZE_Y; k++)
{
for (int i=0;i<ARRAY_SIZE_X;i++)
for (int i = 0; i < ARRAY_SIZE_X; i++)
{
for(int j = 0;j<ARRAY_SIZE_Z;j++)
for (int j = 0; j < ARRAY_SIZE_Z; j++)
{
startTransform.setOrigin(btVector3(
btScalar(2.0*i+0.1),
btScalar(3+2.0*k),
btScalar(2.0*j)));
btScalar(2.0 * i + 0.1),
btScalar(3 + 2.0 * k),
btScalar(2.0 * j)));
btRigidBody* body;
body = createRigidBody(mass,startTransform,colShape);
body = createRigidBody(mass, startTransform, colShape);
//body->setAngularVelocity(btVector3(1,1,1));
}
}
}
@@ -170,23 +150,12 @@ void RigidBodySoftContact::initPhysics()
m_guiHelper->autogenerateGraphicsObjects(m_dynamicsWorld);
}
void RigidBodySoftContact::renderScene()
{
CommonRigidBodyBase::renderScene();
}
CommonExampleInterface* RigidBodySoftContactCreateFunc(CommonExampleOptions& options)
CommonExampleInterface* RigidBodySoftContactCreateFunc(CommonExampleOptions& options)
{
return new RigidBodySoftContact(options.m_guiHelper);
}

View File

@@ -16,7 +16,6 @@ subject to the following restrictions:
#ifndef RIGID_BODY_SOFT_CONTACT_H
#define RIGID_BODY_SOFT_CONTACT_H
class CommonExampleInterface* RigidBodySoftContactCreateFunc(struct CommonExampleOptions& options);
class CommonExampleInterface* RigidBodySoftContactCreateFunc(struct CommonExampleOptions& options);
#endif //RIGID_BODY_SOFT_CONTACT_H
#endif //RIGID_BODY_SOFT_CONTACT_H