diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-09-16 08:58:18 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-09-16 08:58:18 +0400 |
commit | 2fb82920059257fd7ac8e33bfe53de13e7ed53bd (patch) | |
tree | cb8de3a839cb9878d0869d4e436a235346109c16 /source/gameengine/Physics | |
parent | c2a1dcf6218cbd56126a5deb1aeaf212d67e54cb (diff) |
style cleanup
Diffstat (limited to 'source/gameengine/Physics')
8 files changed, 32 insertions, 33 deletions
diff --git a/source/gameengine/Physics/Bullet/CcdGraphicController.h b/source/gameengine/Physics/Bullet/CcdGraphicController.h index 60ff475832b..15edfeb5759 100644 --- a/source/gameengine/Physics/Bullet/CcdGraphicController.h +++ b/source/gameengine/Physics/Bullet/CcdGraphicController.h @@ -33,7 +33,7 @@ class CcdPhysicsEnvironment; class btCollisionObject; ///CcdGraphicController is a graphic object that supports view frustrum culling and occlusion -class CcdGraphicController : public PHY_IGraphicController +class CcdGraphicController : public PHY_IGraphicController { public: CcdGraphicController(CcdPhysicsEnvironment* phyEnv, PHY_IMotionState* motionState); diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp index ed2b9cfcb0b..81bf66d9536 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp +++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp @@ -787,7 +787,7 @@ void CcdPhysicsController::PostProcessReplica(class PHY_IMotionState* motionsta if (oldbody->getActivationState() == DISABLE_DEACTIVATION) body->setActivationState(DISABLE_DEACTIVATION); } - } + } // sensor object are added when needed if (!m_cci.m_bSensor) m_cci.m_physicsEnv->addCcdPhysicsController(this); @@ -806,7 +806,7 @@ void CcdPhysicsController::PostProcessReplica(class PHY_IMotionState* motionsta m_sumoObj = new SM_Object( orgsumoobject->getShapeHandle(), - orgsumoobject->getMaterialProps(), + orgsumoobject->getMaterialProps(), orgsumoobject->getShapeProps(), dynaparent); @@ -1142,7 +1142,7 @@ void CcdPhysicsController::ApplyForce(float forceX,float forceY,float forceZ,bo btTransform xform = m_object->getWorldTransform(); if (local) - { + { force = xform.getBasis()*force; } btRigidBody* body = GetRigidBody(); @@ -1661,7 +1661,7 @@ bool CcdShapeConstructionInfo::SetMesh(RAS_MeshObject* meshobj, DerivedMesh* dm, } if (vert_tag_array[mf->v3]==true) { /* *** v3 *** */ vert_tag_array[mf->v3]= false; - *bt++ = v3->co[0]; + *bt++ = v3->co[0]; *bt++ = v3->co[1]; *bt++ = v3->co[2]; } @@ -1693,7 +1693,7 @@ bool CcdShapeConstructionInfo::SetMesh(RAS_MeshObject* meshobj, DerivedMesh* dm, if (vert_tag_array[mf->v4]==true) { /* *** v4 *** */ vert_tag_array[mf->v4]= false; *bt++ = v4->co[0]; - *bt++ = v4->co[1]; + *bt++ = v4->co[1]; *bt++ = v4->co[2]; } } @@ -2089,7 +2089,7 @@ bool CcdShapeConstructionInfo::SetProxy(CcdShapeConstructionInfo* shapeInfo) btCollisionShape* CcdShapeConstructionInfo::CreateBulletShape(btScalar margin, bool useGimpact, bool useBvh) { btCollisionShape* collisionShape = 0; - btCompoundShape* compoundShape = 0; + btCompoundShape* compoundShape = 0; if (m_shapeType == PHY_SHAPE_PROXY && m_shapeProxy != NULL) return m_shapeProxy->CreateBulletShape(margin, useGimpact, useBvh); @@ -2138,7 +2138,7 @@ btCollisionShape* CcdShapeConstructionInfo::CreateBulletShape(btScalar margin, b // One possible optimization is to use directly the btBvhTriangleMeshShape when the scale is 1,1,1 // and btScaledBvhTriangleMeshShape otherwise. if (useGimpact) - { + { btTriangleIndexVertexArray* indexVertexArrays = new btTriangleIndexVertexArray( m_polygonIndexArray.size(), &m_triFaceArray[0], diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.h b/source/gameengine/Physics/Bullet/CcdPhysicsController.h index 94dc796df23..2204f224e7d 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsController.h +++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.h @@ -171,7 +171,7 @@ public: btVector3 m_halfExtend; btTransform m_childTrans; btVector3 m_childScale; - void* m_userData; + void* m_userData; btAlignedObjectArray<btScalar> m_vertexArray; // Contains both vertex array for polytope shape and // triangle array for concave mesh shape. Each vertex is 3 consecutive values // In this case a triangle is made of 3 consecutive points @@ -397,7 +397,7 @@ class btCollisionObject; class btSoftBody; ///CcdPhysicsController is a physics object that supports continuous collision detection and time of impact based physics resolution. -class CcdPhysicsController : public PHY_IPhysicsController +class CcdPhysicsController : public PHY_IPhysicsController { protected: btCollisionObject* m_object; diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp index 5d28bf47401..55bbc0d33b9 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp +++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp @@ -303,13 +303,13 @@ static void DrawAabb(btIDebugDraw* debugDrawer,const btVector3& from,const btVec { for (j=0;j<3;j++) { - pa = btVector3(edgecoord[0]*halfExtents[0], edgecoord[1]*halfExtents[1], + pa = btVector3(edgecoord[0]*halfExtents[0], edgecoord[1]*halfExtents[1], edgecoord[2]*halfExtents[2]); pa+=center; int othercoord = j%3; edgecoord[othercoord]*=-1.f; - pb = btVector3(edgecoord[0]*halfExtents[0], edgecoord[1]*halfExtents[1], + pb = btVector3(edgecoord[0]*halfExtents[0], edgecoord[1]*halfExtents[1], edgecoord[2]*halfExtents[2]); pb+=center; @@ -484,9 +484,8 @@ void CcdPhysicsEnvironment::updateCcdPhysicsController(CcdPhysicsController* ctr body->getCollisionShape()->calculateLocalInertia(newMass, inertia); body->setMassProps(newMass, inertia); m_dynamicsWorld->addRigidBody(body, newCollisionGroup, newCollisionMask); - } - else - { + } + else { m_dynamicsWorld->addCollisionObject(obj, newCollisionGroup, newCollisionMask); } } @@ -605,7 +604,7 @@ bool CcdPhysicsEnvironment::proceedDeltaTime(double curTime,float timeStep,float float subStep = timeStep / float(m_numTimeSubSteps); i = m_dynamicsWorld->stepSimulation(interval,25,subStep);//perform always a full simulation step -//uncomment next line to see where Bullet spend its time (printf in console) +//uncomment next line to see where Bullet spend its time (printf in console) //CProfileManager::dumpAll(); processFhSprings(curTime,i*subStep); @@ -1084,7 +1083,7 @@ static bool GetHitTriangle(btCollisionShape* shape, CcdShapeConstructionInfo* sh btScalar* graphicsbase = (btScalar*)(vertexbase+graphicsindex*stride); - triangle[j] = btVector3(graphicsbase[0]*meshScaling.getX(),graphicsbase[1]*meshScaling.getY(),graphicsbase[2]*meshScaling.getZ()); + triangle[j] = btVector3(graphicsbase[0]*meshScaling.getX(),graphicsbase[1]*meshScaling.getY(),graphicsbase[2]*meshScaling.getZ()); } meshInterface->unLockReadOnlyVertexBase(0); return true; @@ -1248,7 +1247,7 @@ PHY_IPhysicsController* CcdPhysicsEnvironment::rayTest(PHY_IRayCastFilterCallbac result.m_hitNormal[1] = rayCallback.m_hitNormalWorld.getY(); result.m_hitNormal[2] = rayCallback.m_hitNormalWorld.getZ(); filterCallback.reportHit(&result); - } + } return result.m_controller; @@ -1391,7 +1390,7 @@ struct OcclusionBuffer static bool project(btVector4* p,int n) { for (int i=0;i<n;++i) - { + { p[i][2]=1/p[i][3]; p[i][0]*=p[i][2]; p[i][1]*=p[i][2]; @@ -1611,7 +1610,7 @@ struct OcclusionBuffer const int a=x[2]*y[0]+x[0]*y[1]-x[2]*y[1]-x[0]*y[2]+x[1]*y[2]-x[1]*y[0]; const btScalar ia=1/(btScalar)a; const btScalar dzx=ia*(y[2]*(z[1]-z[0])+y[1]*(z[0]-z[2])+y[0]*(z[2]-z[1])); - const btScalar dzy=ia*(x[2]*(z[0]-z[1])+x[0]*(z[1]-z[2])+x[1]*(z[2]-z[0]))-(dzx*width); + const btScalar dzy=ia*(x[2]*(z[0]-z[1])+x[0]*(z[1]-z[2])+x[1]*(z[2]-z[0]))-(dzx*width); int c[]={ miy*x[1]+mix*y[0]-x[1]*y[0]-mix*y[1]+x[0]*y[1]-miy*x[0], miy*x[2]+mix*y[1]-x[2]*y[1]-mix*y[2]+x[1]*y[2]-miy*x[1], miy*x[0]+mix*y[2]-x[0]*y[2]-mix*y[0]+x[2]*y[0]-miy*x[2]}; @@ -1674,7 +1673,7 @@ struct OcclusionBuffer const float* c, const float* d, const float face) - { + { btVector4 p[4]; transformM(a,p[0]); transformM(b,p[1]); @@ -1744,7 +1743,7 @@ struct DbvtCullingCallback : btDbvt::ICollide Process(node); } void Process(const btDbvtNode* leaf) - { + { btBroadphaseProxy* proxy=(btBroadphaseProxy*)leaf->data; // the client object is a graphic controller CcdGraphicController* ctrl = static_cast<CcdGraphicController*>(proxy->m_clientObject); @@ -1817,11 +1816,11 @@ bool CcdPhysicsEnvironment::cullingTest(PHY_CullingCallback callback, void* user dispatcher.m_ocb = &gOcb; // occlusion culling, the direction of the view is taken from the first plan which MUST be the near plane btDbvt::collideOCL(m_cullingTree->m_sets[1].m_root,planes_n,planes_o,planes_n[0],nplanes,dispatcher); - btDbvt::collideOCL(m_cullingTree->m_sets[0].m_root,planes_n,planes_o,planes_n[0],nplanes,dispatcher); + btDbvt::collideOCL(m_cullingTree->m_sets[0].m_root,planes_n,planes_o,planes_n[0],nplanes,dispatcher); } else { btDbvt::collideKDOP(m_cullingTree->m_sets[1].m_root,planes_n,planes_o,nplanes,dispatcher); - btDbvt::collideKDOP(m_cullingTree->m_sets[0].m_root,planes_n,planes_o,nplanes,dispatcher); + btDbvt::collideKDOP(m_cullingTree->m_sets[0].m_root,planes_n,planes_o,nplanes,dispatcher); } return true; } diff --git a/source/gameengine/Physics/common/PHY_DynamicTypes.h b/source/gameengine/Physics/common/PHY_DynamicTypes.h index 69bbc7745e0..6994706ce2d 100644 --- a/source/gameengine/Physics/common/PHY_DynamicTypes.h +++ b/source/gameengine/Physics/common/PHY_DynamicTypes.h @@ -32,11 +32,11 @@ struct PHY__Vector2 operator const float* () const { return &m_vec[0]; - } + } operator float* () { return &m_vec[0]; - } + } }; struct PHY__Vector3 @@ -46,11 +46,11 @@ struct PHY__Vector3 operator const float* () const { return &m_vec[0]; - } + } operator float* () { return &m_vec[0]; - } + } }; struct PHY__Vector4 @@ -75,11 +75,11 @@ struct PHY__Vector4 operator const float* () const { return &m_vec[0]; - } + } operator float* () { return &m_vec[0]; - } + } }; //typedef float PHY__Vector3[4]; diff --git a/source/gameengine/Physics/common/PHY_IController.h b/source/gameengine/Physics/common/PHY_IController.h index 239ac3366e1..729abd8ec04 100644 --- a/source/gameengine/Physics/common/PHY_IController.h +++ b/source/gameengine/Physics/common/PHY_IController.h @@ -45,7 +45,7 @@ class PHY_IPhysicsEnvironment; controlled by the physics engine. This includes the physics objects and the graphics object for view frustrum and occlusion culling. */ -class PHY_IController +class PHY_IController { public: virtual ~PHY_IController(); diff --git a/source/gameengine/Physics/common/PHY_IMotionState.h b/source/gameengine/Physics/common/PHY_IMotionState.h index 2eb2a9f39cf..72ff37468ee 100644 --- a/source/gameengine/Physics/common/PHY_IMotionState.h +++ b/source/gameengine/Physics/common/PHY_IMotionState.h @@ -43,7 +43,7 @@ class PHY_IMotionState { - public: + public: virtual ~PHY_IMotionState(); virtual void getWorldPosition(float& posX,float& posY,float& posZ)=0; diff --git a/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h b/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h index 30d63e6695d..3f8699d25d2 100644 --- a/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h +++ b/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h @@ -48,7 +48,7 @@ class PHY_IPhysicsController; */ struct PHY_RayCastResult { - PHY_IPhysicsController* m_controller; + PHY_IPhysicsController* m_controller; PHY__Vector3 m_hitPoint; PHY__Vector3 m_hitNormal; const RAS_MeshObject* m_meshObject; // !=NULL for mesh object (only for Bullet controllers) |