From b8a71efeba70d6c3ebc579f5043daa4162da86e8 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 24 Mar 2012 07:52:14 +0000 Subject: style cleanup: follow style guide for/with/if spacing --- .../Physics/Bullet/CcdGraphicController.cpp | 2 +- .../Physics/Bullet/CcdPhysicsController.cpp | 96 +++++++++++----------- .../Physics/Bullet/CcdPhysicsEnvironment.cpp | 82 +++++++++--------- 3 files changed, 90 insertions(+), 90 deletions(-) (limited to 'source/gameengine/Physics/Bullet') diff --git a/source/gameengine/Physics/Bullet/CcdGraphicController.cpp b/source/gameengine/Physics/Bullet/CcdGraphicController.cpp index a5577d5e7d2..92cba6e9afc 100644 --- a/source/gameengine/Physics/Bullet/CcdGraphicController.cpp +++ b/source/gameengine/Physics/Bullet/CcdGraphicController.cpp @@ -131,7 +131,7 @@ void CcdGraphicController::SetPhysicsEnvironment(class PHY_IPhysicsEnvironment* { CcdPhysicsEnvironment* phyEnv = static_cast(env); /* Updates the m_phyEnv's m_cullingTree & m_cullingCache */ - if(getBroadphaseHandle()) { + if (getBroadphaseHandle()) { /* insert into the new physics scene */ Activate(false); m_phyEnv= phyEnv; diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp index 0ece33a7f06..73ba187d732 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp +++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp @@ -207,14 +207,14 @@ bool CcdPhysicsController::CreateSoftbody() psb=new btSoftBody(&worldInfo,(int)hres.mNumOutputVertices, &hres.m_OutputVertices[0],0); - for(int i=0;i<(int)hres.mNumFaces;++i) + for (int i=0;i<(int)hres.mNumFaces;++i) { const int idx[]={ hres.m_Indices[i*3+0], hres.m_Indices[i*3+1], hres.m_Indices[i*3+2]}; - if(idx[0]appendLink( idx[0],idx[1]); - if(idx[1]appendLink( idx[1],idx[2]); - if(idx[2]appendLink( idx[2],idx[0]); + if (idx[0]appendLink( idx[0],idx[1]); + if (idx[1]appendLink( idx[1],idx[2]); + if (idx[2]appendLink( idx[2],idx[0]); psb->appendFace(idx[0],idx[1],idx[2]); } hlib.ReleaseResult(hres); @@ -379,10 +379,10 @@ bool CcdPhysicsController::CreateSoftbody() mmat = rasMesh->GetMeshMaterial(m); slot = mmat->m_baseslot; - for(slot->begin(it); !slot->end(it); slot->next(it)) + for (slot->begin(it); !slot->end(it); slot->next(it)) { int index = 0; - for(i=it.startvertex; igetCollisionShape() == newShape) { proxy = ob->getBroadphaseHandle(); - if(proxy) + if (proxy) dw->getPairCache()->cleanProxyFromPairs(proxy,dw->getDispatcher()); } } @@ -629,7 +629,7 @@ bool CcdPhysicsController::SynchronizeMotionStates(float time) const btVector3& linvel = body->getLinearVelocity(); float len= linvel.length(); - if((m_cci.m_clamp_vel_max>0.0) && (len > m_cci.m_clamp_vel_max)) + if ((m_cci.m_clamp_vel_max>0.0) && (len > m_cci.m_clamp_vel_max)) body->setLinearVelocity(linvel * (m_cci.m_clamp_vel_max / len)); else if ((m_cci.m_clamp_vel_min>0.0) && btFuzzyZero(len)==0 && (len < m_cci.m_clamp_vel_min)) @@ -1644,12 +1644,12 @@ bool CcdShapeConstructionInfo::SetMesh(RAS_MeshObject* meshobj, DerivedMesh* dm, /* If this ever gets confusing, print out an OBJ file for debugging */ #if 0 printf("# vert count %d\n", m_vertexArray.size()); - for(i=0; iGetDeformer():NULL; @@ -1714,21 +1714,21 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject* gameobj, class RA dm = deformer->GetPhysicsMesh(); /* get the mesh from the object if not defined */ - if(meshobj==NULL) { + if (meshobj==NULL) { /* modifier mesh */ - if(dm) + if (dm) meshobj= deformer->GetRasMesh(); /* game object first mesh */ - if(meshobj==NULL) { - if(gameobj->GetMeshCount() > 0) { + if (meshobj==NULL) { + if (gameobj->GetMeshCount() > 0) { meshobj= gameobj->GetMesh(0); } } } - if(dm && deformer->GetRasMesh() == meshobj) + if (dm && deformer->GetRasMesh() == meshobj) { /* * Derived Mesh Update * @@ -1745,7 +1745,7 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject* gameobj, class RA int flen; - if(CustomData_has_layer(&dm->faceData, CD_MTFACE)) + if (CustomData_has_layer(&dm->faceData, CD_MTFACE)) { MTFace *tface = (MTFace *)dm->getTessFaceDataArray(dm, CD_MTFACE); MTFace *tf; @@ -1753,10 +1753,10 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject* gameobj, class RA vector vert_tag_array(numverts, false); vector vert_remap_array(numverts, 0); - for(mf= mface, tf= tface, i=0; i < numpolys; mf++, tf++, i++) { - if(tf->mode & TF_DYNAMIC) + for (mf= mface, tf= tface, i=0; i < numpolys; mf++, tf++, i++) { + if (tf->mode & TF_DYNAMIC) { - if(mf->v4) { + if (mf->v4) { tot_bt_tris+= 2; flen= 4; } else { @@ -1764,11 +1764,11 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject* gameobj, class RA flen= 3; } - for(j=0; jv1 + j)); - if(vert_tag_array[v_orig]==false) + if (vert_tag_array[v_orig]==false) { vert_tag_array[v_orig]= true; vert_remap_array[v_orig]= tot_bt_verts; @@ -1790,13 +1790,13 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject* gameobj, class RA m_polygonIndexArray.resize(tot_bt_tris); int *poly_index_pt= &m_polygonIndexArray[0]; - for(mf= mface, tf= tface, i=0; i < numpolys; mf++, tf++, i++) + for (mf= mface, tf= tface, i=0; i < numpolys; mf++, tf++, i++) { - if(tf->mode & TF_DYNAMIC) + if (tf->mode & TF_DYNAMIC) { int origi = (index)? index[i]: i; - if(mf->v4) { + if (mf->v4) { fv_pt= quad_verts; *poly_index_pt++ = origi; *poly_index_pt++ = origi; @@ -1807,11 +1807,11 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject* gameobj, class RA flen= 3; } - for(; *fv_pt > -1; fv_pt++) + for (; *fv_pt > -1; fv_pt++) { v_orig = (*(&mf->v1 + (*fv_pt))); - if(vert_tag_array[v_orig]) + if (vert_tag_array[v_orig]) { mv= mvert + v_orig; *bt++ = mv->co[0]; @@ -1833,7 +1833,7 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject* gameobj, class RA tot_bt_verts= numverts; - for(mf= mface, i=0; i < numpolys; mf++, i++) { + for (mf= mface, i=0; i < numpolys; mf++, i++) { tot_bt_tris += (mf->v4 ? 2:1); } @@ -1848,14 +1848,14 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject* gameobj, class RA m_triFaceUVcoArray.clear(); - for(mv= mvert, i=0; i < numverts; mv++, i++) { + for (mv= mvert, i=0; i < numverts; mv++, i++) { *bt++ = mv->co[0]; *bt++ = mv->co[1]; *bt++ = mv->co[2]; } - for(mf= mface, i=0; i < numpolys; mf++, i++) { + for (mf= mface, i=0; i < numpolys; mf++, i++) { int origi = (index)? index[i]: i; - if(mf->v4) { + if (mf->v4) { fv_pt= quad_verts; *poly_index_pt++ = origi; *poly_index_pt++ = origi; @@ -1865,7 +1865,7 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject* gameobj, class RA *poly_index_pt++ = origi; } - for(; *fv_pt > -1; fv_pt++) + for (; *fv_pt > -1; fv_pt++) *tri_pt++ = (*(&mf->v1 + (*fv_pt))); } } @@ -1882,7 +1882,7 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject* gameobj, class RA float (*transverts)[3]= NULL; int transverts_tot= 0; /* with deformed meshes - should always be greater then the max orginal index, or we get crashes */ - if(deformer) { + if (deformer) { /* map locations from the deformed array * * Could call deformer->Update(); but rely on redraw updating. @@ -1899,15 +1899,15 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject* gameobj, class RA vector vert_tag_array(numverts, false); vector vert_remap_array(numverts, 0); - for(int p=0; pGetPolygon(p); if (poly->IsCollider()) { - for(i=0; i < poly->VertexCount(); i++) + for (i=0; i < poly->VertexCount(); i++) { v_orig= poly->GetVertex(i)->getOrigIndex(); - if(vert_tag_array[v_orig]==false) + if (vert_tag_array[v_orig]==false) { vert_tag_array[v_orig]= true; vert_remap_array[v_orig]= tot_bt_verts; @@ -1929,7 +1929,7 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject* gameobj, class RA m_polygonIndexArray.resize(tot_bt_tris); - for(int p=0; pGetPolygon(p); @@ -1938,13 +1938,13 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject* gameobj, class RA /* quad or tri loop */ fv_pt= (poly->VertexCount()==3 ? tri_verts:quad_verts); - for(; *fv_pt > -1; fv_pt++) + for (; *fv_pt > -1; fv_pt++) { v_orig= poly->GetVertex(*fv_pt)->getOrigIndex(); - if(vert_tag_array[v_orig]) + if (vert_tag_array[v_orig]) { - if(transverts) { + if (transverts) { /* deformed mesh, using RAS_TexVert locations would be too troublesome * because they are use the gameob as a hash in the material slot */ *bt++ = transverts[v_orig][0]; @@ -1973,19 +1973,19 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject* gameobj, class RA #if 0 /* needs #include */ printf("# vert count %d\n", m_vertexArray.size()); - for(int i=0; im_weldingThreshold = m_weldingThreshold1; bool removeDuplicateVertices=true; // m_vertexArray not in multiple of 3 anymore, use m_triFaceArray - for(unsigned int i=0; i~btBvhTriangleMeshShape(); m_unscaledShape = new(m_unscaledShape) btBvhTriangleMeshShape( indexVertexArrays, true, useBvh ); diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp index ba9724f34ab..337e8019aa7 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp +++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp @@ -1247,7 +1247,7 @@ struct OcclusionBuffer { struct WriteOCL { - static inline bool Process(btScalar& q,btScalar v) { if(q0)&&(t<1)) + if ((t>0)&&(t<1)) { pn[n][0] = a[0]+(b[0]-a[0])*t; pn[n][1] = a[1]+(b[1]-a[1])*t; @@ -1416,7 +1416,7 @@ struct OcclusionBuffer pn[n][3] = a[3]+(b[3]-a[3])*t; ++n; } - if(s[j]>0) pn[n++]=b; + if (s[j]>0) pn[n++]=b; } // ready to test far clipping, start from the modified polygon pi = pn; @@ -1427,21 +1427,21 @@ struct OcclusionBuffer ni = NP; } // now deal with far clipping - for(i=0, m=0;i0) m+=1<0) m+=1<0)&&(t<1)) + if ((t>0)&&(t<1)) { po[n][0] = a[0]+(b[0]-a[0])*t; po[n][1] = a[1]+(b[1]-a[1])*t; @@ -1449,11 +1449,11 @@ struct OcclusionBuffer po[n][3] = a[3]+(b[3]-a[3])*t; ++n; } - if(s[j]<0) po[n++]=b; + if (s[j]<0) po[n++]=b; } return(n); } - for(int i=0;i= 0 && POLICY::Process(*scan,v[0])) + if (dy[0] >= 0 && POLICY::Process(*scan,v[0])) return(true); - if(dy[1] >= 0 && POLICY::Process(*scan,v[1])) + if (dy[1] >= 0 && POLICY::Process(*scan,v[1])) return(true); - if(dy[2] >= 0 && POLICY::Process(*scan,v[2])) + if (dy[2] >= 0 && POLICY::Process(*scan,v[2])) return(true); scan+=m_sizes[0]; v[0] += dzy[0]; v[1] += dzy[1]; v[2] += dzy[2]; @@ -1574,13 +1574,13 @@ struct OcclusionBuffer dx[1] = x[0]-x[1]; dx[2] = x[2]-x[0]; btScalar* scan=&m_buffer[miy*m_sizes[0]+mix]; - for(int ix=mix;ix= 0 && POLICY::Process(*scan,v[0])) + if (dx[0] >= 0 && POLICY::Process(*scan,v[0])) return(true); - if(dx[1] >= 0 && POLICY::Process(*scan,v[1])) + if (dx[1] >= 0 && POLICY::Process(*scan,v[1])) return(true); - if(dx[2] >= 0 && POLICY::Process(*scan,v[2])) + if (dx[2] >= 0 && POLICY::Process(*scan,v[2])) return(true); scan++; v[0] += dzx[0]; v[1] += dzx[1]; v[2] += dzx[2]; @@ -1604,13 +1604,13 @@ struct OcclusionBuffer miy*x[0]+mix*y[2]-x[0]*y[2]-mix*y[0]+x[2]*y[0]-miy*x[2]}; btScalar v=ia*((z[2]*c[0])+(z[0]*c[1])+(z[1]*c[2])); btScalar* scan=&m_buffer[miy*m_sizes[0]]; - for(int iy=miy;iy=0)&&(c[1]>=0)&&(c[2]>=0)) + if ((c[0]>=0)&&(c[1]>=0)&&(c[2]>=0)) { - if(POLICY::Process(scan[ix],v)) + if (POLICY::Process(scan[ix],v)) return(true); } c[0]+=dx[0];c[1]+=dx[1];c[2]+=dx[2];v+=dzx; @@ -1633,7 +1633,7 @@ struct OcclusionBuffer if (n) { project(o,n); - for(int i=2;i(o[0],o[i-1],o[i],face,minarea); } @@ -1685,10 +1685,10 @@ struct OcclusionBuffer transformW(btVector3(c[0]+e[0],c[1]-e[1],c[2]+e[2]),x[5]); transformW(btVector3(c[0]+e[0],c[1]+e[1],c[2]+e[2]),x[6]); transformW(btVector3(c[0]-e[0],c[1]+e[1],c[2]+e[2]),x[7]); - for(int i=0;i<8;++i) + for (int i=0;i<8;++i) { // the box is clipped, it's probably a large box, don't waste our time to check - if((x[i][2]+x[i][3])<=0) return(true); + if ((x[i][2]+x[i][3])<=0) return(true); } static const int d[]={ 1,0,3,2, 4,5,6,7, @@ -1696,13 +1696,13 @@ struct OcclusionBuffer 6,5,1,2, 7,6,2,3, 5,4,0,1}; - for(unsigned int i=0;i<(sizeof(d)/sizeof(d[0]));) + for (unsigned int i=0;i<(sizeof(d)/sizeof(d[0]));) { const btVector4 p[]={ x[d[i++]], x[d[i++]], x[d[i++]], x[d[i++]]}; - if(clipDraw<4,QueryOCL>(p,1.f,0.f)) + if (clipDraw<4,QueryOCL>(p,1.f,0.f)) return(true); } return(false); @@ -2008,7 +2008,7 @@ void CcdPhysicsEnvironment::setConstraintParam(int constraintId,int param,float { //param = 3,4,5 are constraint limits, high limit values btConeTwistConstraint* coneTwist = (btConeTwistConstraint*)typedConstraint; - if(value1<0.0f) + if (value1<0.0f) coneTwist->setLimit(param,btScalar(BT_LARGE_FLOAT)); else coneTwist->setLimit(param,value1); -- cgit v1.2.3