Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-10-22 12:15:51 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-10-22 12:15:51 +0400
commitddc2dbc2a47ed2439a62e82ad6fba7d8c9dcae28 (patch)
treea7ca593a96652e6f0a784b5c6e37ab2c35b07159 /source/gameengine/Physics/Bullet
parent30fd258a0b407419a369fbb2818c49df6b70968e (diff)
style cleanup
Diffstat (limited to 'source/gameengine/Physics/Bullet')
-rw-r--r--source/gameengine/Physics/Bullet/CcdPhysicsController.cpp62
-rw-r--r--source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp92
2 files changed, 77 insertions, 77 deletions
diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
index 29a9b6481e9..568c11a0be4 100644
--- a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
+++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
@@ -1520,10 +1520,10 @@ bool CcdShapeConstructionInfo::SetMesh(RAS_MeshObject* meshobj, DerivedMesh* dm,
// only add polygons that have the collision flag set
if (poly->IsCollider())
{
- if (vert_tag_array[mf->v1]==false) {vert_tag_array[mf->v1]= true;tot_bt_verts++;}
- if (vert_tag_array[mf->v2]==false) {vert_tag_array[mf->v2]= true;tot_bt_verts++;}
- if (vert_tag_array[mf->v3]==false) {vert_tag_array[mf->v3]= true;tot_bt_verts++;}
- if (mf->v4 && vert_tag_array[mf->v4]==false) {vert_tag_array[mf->v4]= true;tot_bt_verts++;}
+ if (vert_tag_array[mf->v1] == false) {vert_tag_array[mf->v1] = true; tot_bt_verts++;}
+ if (vert_tag_array[mf->v2] == false) {vert_tag_array[mf->v2] = true; tot_bt_verts++;}
+ if (vert_tag_array[mf->v3] == false) {vert_tag_array[mf->v3] = true; tot_bt_verts++;}
+ if (mf->v4 && vert_tag_array[mf->v4] == false) {vert_tag_array[mf->v4] = true; tot_bt_verts++;}
}
}
@@ -1542,7 +1542,7 @@ bool CcdShapeConstructionInfo::SetMesh(RAS_MeshObject* meshobj, DerivedMesh* dm,
if (vert_tag_array[mf->v1]==true)
{
const float* vtx = mvert[mf->v1].co;
- vert_tag_array[mf->v1]= false;
+ vert_tag_array[mf->v1] = false;
*bt++ = vtx[0];
*bt++ = vtx[1];
*bt++ = vtx[2];
@@ -1550,7 +1550,7 @@ bool CcdShapeConstructionInfo::SetMesh(RAS_MeshObject* meshobj, DerivedMesh* dm,
if (vert_tag_array[mf->v2]==true)
{
const float* vtx = mvert[mf->v2].co;
- vert_tag_array[mf->v2]= false;
+ vert_tag_array[mf->v2] = false;
*bt++ = vtx[0];
*bt++ = vtx[1];
*bt++ = vtx[2];
@@ -1558,7 +1558,7 @@ bool CcdShapeConstructionInfo::SetMesh(RAS_MeshObject* meshobj, DerivedMesh* dm,
if (vert_tag_array[mf->v3]==true)
{
const float* vtx = mvert[mf->v3].co;
- vert_tag_array[mf->v3]= false;
+ vert_tag_array[mf->v3] = false;
*bt++ = vtx[0];
*bt++ = vtx[1];
*bt++ = vtx[2];
@@ -1566,7 +1566,7 @@ bool CcdShapeConstructionInfo::SetMesh(RAS_MeshObject* meshobj, DerivedMesh* dm,
if (mf->v4 && vert_tag_array[mf->v4]==true)
{
const float* vtx = mvert[mf->v4].co;
- vert_tag_array[mf->v4]= false;
+ vert_tag_array[mf->v4] = false;
*bt++ = vtx[0];
*bt++ = vtx[1];
*bt++ = vtx[2];
@@ -1588,13 +1588,13 @@ bool CcdShapeConstructionInfo::SetMesh(RAS_MeshObject* meshobj, DerivedMesh* dm,
if (poly->IsCollider())
{
if (vert_tag_array[mf->v1]==false)
- {vert_tag_array[mf->v1]= true;vert_remap_array[mf->v1]= tot_bt_verts;tot_bt_verts++;}
+ {vert_tag_array[mf->v1] = true;vert_remap_array[mf->v1] = tot_bt_verts;tot_bt_verts++;}
if (vert_tag_array[mf->v2]==false)
- {vert_tag_array[mf->v2]= true;vert_remap_array[mf->v2]= tot_bt_verts;tot_bt_verts++;}
+ {vert_tag_array[mf->v2] = true;vert_remap_array[mf->v2] = tot_bt_verts;tot_bt_verts++;}
if (vert_tag_array[mf->v3]==false)
- {vert_tag_array[mf->v3]= true;vert_remap_array[mf->v3]= tot_bt_verts;tot_bt_verts++;}
+ {vert_tag_array[mf->v3] = true;vert_remap_array[mf->v3] = tot_bt_verts;tot_bt_verts++;}
if (mf->v4 && vert_tag_array[mf->v4]==false)
- {vert_tag_array[mf->v4]= true;vert_remap_array[mf->v4]= tot_bt_verts;tot_bt_verts++;}
+ {vert_tag_array[mf->v4] = true;vert_remap_array[mf->v4] = tot_bt_verts;tot_bt_verts++;}
tot_bt_tris += (mf->v4 ? 2:1); /* a quad or a tri */
}
}
@@ -1629,9 +1629,9 @@ bool CcdShapeConstructionInfo::SetMesh(RAS_MeshObject* meshobj, DerivedMesh* dm,
MVert *v3= &mvert[mf->v3];
// the face indices
- tri_pt[0]= vert_remap_array[mf->v1];
- tri_pt[1]= vert_remap_array[mf->v2];
- tri_pt[2]= vert_remap_array[mf->v3];
+ tri_pt[0] = vert_remap_array[mf->v1];
+ tri_pt[1] = vert_remap_array[mf->v2];
+ tri_pt[2] = vert_remap_array[mf->v3];
tri_pt= tri_pt+3;
if (tf)
{
@@ -1650,19 +1650,19 @@ bool CcdShapeConstructionInfo::SetMesh(RAS_MeshObject* meshobj, DerivedMesh* dm,
// the vertex location
if (vert_tag_array[mf->v1]==true) { /* *** v1 *** */
- vert_tag_array[mf->v1]= false;
+ vert_tag_array[mf->v1] = false;
*bt++ = v1->co[0];
*bt++ = v1->co[1];
*bt++ = v1->co[2];
}
if (vert_tag_array[mf->v2]==true) { /* *** v2 *** */
- vert_tag_array[mf->v2]= false;
+ vert_tag_array[mf->v2] = false;
*bt++ = v2->co[0];
*bt++ = v2->co[1];
*bt++ = v2->co[2];
}
if (vert_tag_array[mf->v3]==true) { /* *** v3 *** */
- vert_tag_array[mf->v3]= false;
+ vert_tag_array[mf->v3] = false;
*bt++ = v3->co[0];
*bt++ = v3->co[1];
*bt++ = v3->co[2];
@@ -1672,9 +1672,9 @@ bool CcdShapeConstructionInfo::SetMesh(RAS_MeshObject* meshobj, DerivedMesh* dm,
{
MVert *v4= &mvert[mf->v4];
- tri_pt[0]= vert_remap_array[mf->v1];
- tri_pt[1]= vert_remap_array[mf->v3];
- tri_pt[2]= vert_remap_array[mf->v4];
+ tri_pt[0] = vert_remap_array[mf->v1];
+ tri_pt[1] = vert_remap_array[mf->v3];
+ tri_pt[2] = vert_remap_array[mf->v4];
tri_pt= tri_pt+3;
if (tf)
{
@@ -1692,8 +1692,8 @@ bool CcdShapeConstructionInfo::SetMesh(RAS_MeshObject* meshobj, DerivedMesh* dm,
poly_index_pt++;
// the vertex location
- if (vert_tag_array[mf->v4]==true) { /* *** v4 *** */
- vert_tag_array[mf->v4]= false;
+ 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[2];
@@ -1832,8 +1832,8 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject* gameobj, class RA
if (vert_tag_array[v_orig]==false)
{
- vert_tag_array[v_orig]= true;
- vert_remap_array[v_orig]= tot_bt_verts;
+ vert_tag_array[v_orig] = true;
+ vert_remap_array[v_orig] = tot_bt_verts;
tot_bt_verts++;
}
}
@@ -1880,7 +1880,7 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject* gameobj, class RA
*bt++ = mv->co[1];
*bt++ = mv->co[2];
- vert_tag_array[v_orig]= false;
+ vert_tag_array[v_orig] = false;
}
*tri_pt++ = vert_remap_array[v_orig];
uv_pt->uv[0] = tf->uv[*fv_pt][0];
@@ -1941,7 +1941,7 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject* gameobj, class RA
/* transverts are only used for deformed RAS_Meshes, the RAS_TexVert data
* is too hard to get at, see below for details */
- float (*transverts)[3]= NULL;
+ 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) {
@@ -1971,8 +1971,8 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject* gameobj, class RA
v_orig= poly->GetVertex(i)->getOrigIndex();
if (vert_tag_array[v_orig]==false)
{
- vert_tag_array[v_orig]= true;
- vert_remap_array[v_orig]= tot_bt_verts;
+ vert_tag_array[v_orig] = true;
+ vert_remap_array[v_orig] = tot_bt_verts;
tot_bt_verts++;
}
}
@@ -2025,14 +2025,14 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject* gameobj, class RA
*bt++ = xyz[2];
}
- vert_tag_array[v_orig]= false;
+ vert_tag_array[v_orig] = false;
}
*tri_pt++ = vert_remap_array[v_orig];
}
}
- m_polygonIndexArray[p]= p; /* dumb counting */
+ m_polygonIndexArray[p] = p; /* dumb counting */
}
}
diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
index 6ba03606bf2..e43ddb303e9 100644
--- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
+++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
@@ -1517,8 +1517,8 @@ struct OcclusionBuffer
return(true);
}
}
- } else if (width == 1)
- {
+ }
+ else if (width == 1) {
// Degenerated in at least 2 vertical lines
// The algorithm below doesn't work when face has a single pixel width
// We cannot use general formulas because the plane is degenerated.
@@ -1529,16 +1529,16 @@ struct OcclusionBuffer
if (y[0] > y[1]) { ytmp=y[1];y[1]=y[0];y[0]=ytmp;ztmp=z[1];z[1]=z[0];z[0]=ztmp; }
if (y[0] > y[2]) { ytmp=y[2];y[2]=y[0];y[0]=ytmp;ztmp=z[2];z[2]=z[0];z[0]=ztmp; }
if (y[1] > y[2]) { ytmp=y[2];y[2]=y[1];y[1]=ytmp;ztmp=z[2];z[2]=z[1];z[1]=ztmp; }
- int dy[]={ y[0]-y[1],
- y[1]-y[2],
- y[2]-y[0]};
+ int dy[] = {y[0] - y[1],
+ y[1] - y[2],
+ y[2] - y[0]};
btScalar dzy[3];
- dzy[0] = (dy[0]) ? (z[0]-z[1])/dy[0] : btScalar(0.f);
- dzy[1] = (dy[1]) ? (z[1]-z[2])/dy[1] : btScalar(0.f);
- dzy[2] = (dy[2]) ? (z[2]-z[0])/dy[2] : btScalar(0.f);
- btScalar v[3] = { dzy[0]*(miy-y[0])+z[0],
- dzy[1]*(miy-y[1])+z[1],
- dzy[2]*(miy-y[2])+z[2] };
+ dzy[0] = (dy[0]) ? (z[0] - z[1]) / dy[0] : btScalar(0.f);
+ dzy[1] = (dy[1]) ? (z[1] - z[2]) / dy[1] : btScalar(0.f);
+ dzy[2] = (dy[2]) ? (z[2] - z[0]) / dy[2] : btScalar(0.f);
+ btScalar v[3] = {dzy[0] * (miy - y[0]) + z[0],
+ dzy[1] * (miy - y[1]) + z[1],
+ dzy[2] * (miy - y[2]) + z[2]};
dy[0] = y[1]-y[0];
dy[1] = y[0]-y[1];
dy[2] = y[2]-y[0];
@@ -1566,16 +1566,16 @@ struct OcclusionBuffer
if (x[0] > x[1]) { xtmp=x[1];x[1]=x[0];x[0]=xtmp;ztmp=z[1];z[1]=z[0];z[0]=ztmp; }
if (x[0] > x[2]) { xtmp=x[2];x[2]=x[0];x[0]=xtmp;ztmp=z[2];z[2]=z[0];z[0]=ztmp; }
if (x[1] > x[2]) { xtmp=x[2];x[2]=x[1];x[1]=xtmp;ztmp=z[2];z[2]=z[1];z[1]=ztmp; }
- int dx[]={ x[0]-x[1],
- x[1]-x[2],
- x[2]-x[0]};
+ int dx[] = {x[0] - x[1],
+ x[1] - x[2],
+ x[2] - x[0]};
btScalar dzx[3];
dzx[0] = (dx[0]) ? (z[0]-z[1])/dx[0] : btScalar(0.f);
dzx[1] = (dx[1]) ? (z[1]-z[2])/dx[1] : btScalar(0.f);
dzx[2] = (dx[2]) ? (z[2]-z[0])/dx[2] : btScalar(0.f);
- btScalar v[3] = { dzx[0]*(mix-x[0])+z[0],
- dzx[1]*(mix-x[1])+z[1],
- dzx[2]*(mix-x[2])+z[2] };
+ btScalar v[3] = {dzx[0] * (mix - x[0]) + z[0],
+ dzx[1] * (mix - x[1]) + z[1],
+ dzx[2] * (mix - x[2]) + z[2]};
dx[0] = x[1]-x[0];
dx[1] = x[0]-x[1];
dx[2] = x[2]-x[0];
@@ -1592,24 +1592,24 @@ struct OcclusionBuffer
v[0] += dzx[0]; v[1] += dzx[1]; v[2] += dzx[2];
dx[0]--; dx[1]++, dx[2]--;
}
- } else
- {
+ }
+ else {
// general case
- const int dx[]={ y[0]-y[1],
- y[1]-y[2],
- y[2]-y[0]};
- const int dy[]={ x[1]-x[0]-dx[0]*width,
- x[2]-x[1]-dx[1]*width,
- x[0]-x[2]-dx[2]*width};
- 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);
- 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]};
- btScalar v=ia*((z[2]*c[0])+(z[0]*c[1])+(z[1]*c[2]));
- btScalar* scan=&m_buffer[miy*m_sizes[0]];
+ const int dx[] = {y[0] - y[1],
+ y[1] - y[2],
+ y[2] - y[0]};
+ const int dy[] = {x[1] - x[0] - dx[0] * width,
+ x[2] - x[1] - dx[1] * width,
+ x[0] - x[2] - dx[2] * width};
+ 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);
+ 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]};
+ 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<mxy;++iy)
{
for (int ix=mix;ix<mxx;++ix)
@@ -1696,18 +1696,18 @@ struct OcclusionBuffer
// 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);
}
- static const int d[]={ 1,0,3,2,
- 4,5,6,7,
- 4,7,3,0,
- 6,5,1,2,
- 7,6,2,3,
- 5,4,0,1};
+ static const int d[] = {1,0,3,2,
+ 4,5,6,7,
+ 4,7,3,0,
+ 6,5,1,2,
+ 7,6,2,3,
+ 5,4,0,1};
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++]]};
+ const btVector4 p[] = {x[d[i++]],
+ x[d[i++]],
+ x[d[i++]],
+ x[d[i++]]};
if (clipDraw<4,QueryOCL>(p,1.f,0.f))
return(true);
}
@@ -1966,8 +1966,8 @@ void CcdPhysicsEnvironment::setConstraintParam(int constraintId,int param,float
btGeneric6DofConstraint* genCons = (btGeneric6DofConstraint*)typedConstraint;
int transMotorIndex = param-6;
btTranslationalLimitMotor* transMotor = genCons->getTranslationalLimitMotor();
- transMotor->m_targetVelocity[transMotorIndex]= value0;
- transMotor->m_maxMotorForce[transMotorIndex]=value1;
+ transMotor->m_targetVelocity[transMotorIndex] = value0;
+ transMotor->m_maxMotorForce[transMotorIndex] = value1;
transMotor->m_enableMotor[transMotorIndex] = (value1>0.f);
break;
}