cleaned up, removed warning under MSVC2005 (Level 4)

Mostly related to alignment and unused variables
This commit is contained in:
ejcoumans
2007-04-13 01:37:21 +00:00
parent 2cf026aae3
commit bc3f9535ad
71 changed files with 348 additions and 125 deletions

View File

@@ -26,6 +26,7 @@ ATTRIBUTE_ALIGNED16(class) btBvhTriangleMeshShape : public btTriangleMeshShape
btOptimizedBvh* m_bvh;
bool m_useQuantizedAabbCompression;
bool m_pad[12];////need padding due to alignment
public:

View File

@@ -19,7 +19,7 @@ subject to the following restrictions:
#include "BulletCollision/CollisionShapes/btCollisionMargin.h"
#include "LinearMath/btQuaternion.h"
btCapsuleShape::btCapsuleShape(float radius, float height)
btCapsuleShape::btCapsuleShape(btScalar radius, btScalar height)
{
m_implicitShapeDimensions.setValue(radius,0.5f*height,radius);
}
@@ -46,7 +46,7 @@ btCapsuleShape::btCapsuleShape(float radius, float height)
btVector3 vtx;
btScalar newDot;
float radius = getRadius();
btScalar radius = getRadius();
{
@@ -78,7 +78,7 @@ btCapsuleShape::btCapsuleShape(float radius, float height)
{
float radius = getRadius();
btScalar radius = getRadius();
for (int j=0;j<numVectors;j++)
{
@@ -120,7 +120,7 @@ void btCapsuleShape::calculateLocalInertia(btScalar mass,btVector3& inertia)
ident.setIdentity();
float radius = getRadius();
btScalar radius = getRadius();
btVector3 halfExtents(radius,radius+getHalfHeight(),radius);

View File

@@ -26,7 +26,7 @@ class btCapsuleShape : public btConvexShape
{
public:
btCapsuleShape(float radius,float height);
btCapsuleShape(btScalar radius,btScalar height);
///CollisionShape Interface
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia);
@@ -43,12 +43,12 @@ public:
return "CapsuleShape";
}
float getRadius() const
btScalar getRadius() const
{
return m_implicitShapeDimensions.getX();
}
float getHalfHeight() const
btScalar getHalfHeight() const
{
return m_implicitShapeDimensions.getY();
}

View File

@@ -27,7 +27,7 @@ class btCollisionShape
{
public:
btCollisionShape() :m_tempDebug(0)
btCollisionShape()
{
}
virtual ~btCollisionShape()
@@ -83,10 +83,7 @@ public:
virtual char* getName()const =0 ;
#endif //__SPU__
const char* getExtraDebugInfo() const { return m_tempDebug;}
void setExtraDebugInfo(const char* extraDebugInfo) { m_tempDebug = extraDebugInfo;}
const char * m_tempDebug;
//endif debugging support
virtual void setMargin(btScalar margin) = 0;
virtual btScalar getMargin() const = 0;

View File

@@ -155,13 +155,14 @@ int btConvexHullShape::getNumPlanes() const
return 0;
}
void btConvexHullShape::getPlane(btVector3& planeNormal,btPoint3& planeSupport,int i ) const
void btConvexHullShape::getPlane(btVector3& ,btPoint3& ,int ) const
{
assert(0);
btAssert(0);
}
//not yet
bool btConvexHullShape::isInside(const btPoint3& pt,btScalar tolerance) const
bool btConvexHullShape::isInside(const btPoint3& ,btScalar ) const
{
assert(0);
return false;

View File

@@ -42,6 +42,10 @@ protected:
btScalar m_collisionMargin;
btScalar m_padding[2];
public:
btConvexShape();
@@ -108,7 +112,9 @@ public:
virtual void getPreferredPenetrationDirection(int index, btVector3& penetrationVector) const
{
assert(0);
(void)penetrationVector;
(void)index;
btAssert(0);
}

View File

@@ -48,6 +48,9 @@ public:
virtual void internalProcessTriangleIndex(btVector3* triangle,int partId,int triangleIndex)
{
(void)triangleIndex;
(void)partId;
for (int i=0;i<3;i++)
{
btScalar dot = m_supportVecLocal.dot(triangle[i]);
@@ -158,14 +161,14 @@ int btConvexTriangleMeshShape::getNumEdges() const
return 0;
}
void btConvexTriangleMeshShape::getEdge(int i,btPoint3& pa,btPoint3& pb) const
void btConvexTriangleMeshShape::getEdge(int ,btPoint3& ,btPoint3& ) const
{
assert(0);
btAssert(0);
}
void btConvexTriangleMeshShape::getVertex(int i,btPoint3& vtx) const
void btConvexTriangleMeshShape::getVertex(int ,btPoint3& ) const
{
assert(0);
btAssert(0);
}
int btConvexTriangleMeshShape::getNumPlanes() const
@@ -173,15 +176,15 @@ int btConvexTriangleMeshShape::getNumPlanes() const
return 0;
}
void btConvexTriangleMeshShape::getPlane(btVector3& planeNormal,btPoint3& planeSupport,int i ) const
void btConvexTriangleMeshShape::getPlane(btVector3& ,btPoint3& ,int ) const
{
assert(0);
btAssert(0);
}
//not yet
bool btConvexTriangleMeshShape::isInside(const btPoint3& pt,btScalar tolerance) const
bool btConvexTriangleMeshShape::isInside(const btPoint3& ,btScalar ) const
{
assert(0);
btAssert(0);
return false;
}

View File

@@ -40,9 +40,9 @@ void btEmptyShape::getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aa
}
void btEmptyShape::calculateLocalInertia(btScalar mass,btVector3& inertia)
void btEmptyShape::calculateLocalInertia(btScalar ,btVector3& )
{
assert(0);
btAssert(0);
}

View File

@@ -30,11 +30,10 @@ btHeightfieldTerrainShape::~btHeightfieldTerrainShape()
void btHeightfieldTerrainShape::getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const
void btHeightfieldTerrainShape::getAabb(const btTransform& ,btVector3& aabbMin,btVector3& aabbMax) const
{
aabbMin.setValue(btScalar(-1e30),btScalar(-1e30),btScalar(-1e30));
aabbMax.setValue(btScalar(1e30),btScalar(1e30),btScalar(1e30));
}
@@ -42,13 +41,17 @@ void btHeightfieldTerrainShape::getAabb(const btTransform& t,btVector3& aabbMin,
void btHeightfieldTerrainShape::processAllTriangles(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const
{
(void)callback;
(void)aabbMax;
(void)aabbMin;
/*
btVector3 halfExtents = (aabbMax - aabbMin) * btScalar(0.5);
btVector3 center = (aabbMax + aabbMin) * btScalar(0.5);
//TODO
//this is where the triangles are generated, given AABB and plane equation (normal/constant)
/*
btVector3 tangentDir0,tangentDir1;
//tangentDir0/tangentDir1 can be precalculated
@@ -75,7 +78,7 @@ void btHeightfieldTerrainShape::processAllTriangles(btTriangleCallback* callback
}
void btHeightfieldTerrainShape::calculateLocalInertia(btScalar mass,btVector3& inertia)
void btHeightfieldTerrainShape::calculateLocalInertia(btScalar ,btVector3& inertia)
{
//moving concave objects not supported

View File

@@ -51,6 +51,7 @@ btScalar btMinkowskiSumShape::getMargin() const
void btMinkowskiSumShape::calculateLocalInertia(btScalar mass,btVector3& inertia)
{
assert(0);
(void)mass;
btAssert(0);
inertia.setValue(0,0,0);
}

View File

@@ -38,8 +38,15 @@ void btOptimizedBvh::build(btStridingMeshInterface* triangles, bool useQuantized
struct NodeTriangleCallback : public btInternalTriangleIndexCallback
{
NodeArray& m_triangleNodes;
NodeTriangleCallback& operator=(NodeTriangleCallback& other)
{
m_triangleNodes = other.m_triangleNodes;
return *this;
}
NodeTriangleCallback(NodeArray& triangleNodes)
:m_triangleNodes(triangleNodes)
{
@@ -75,6 +82,13 @@ void btOptimizedBvh::build(btStridingMeshInterface* triangles, bool useQuantized
QuantizedNodeArray& m_triangleNodes;
const btOptimizedBvh* m_optimizedTree; // for quantization
QuantizedNodeTriangleCallback& operator=(QuantizedNodeTriangleCallback& other)
{
m_triangleNodes = other.m_triangleNodes;
m_optimizedTree = other.m_optimizedTree;
return *this;
}
QuantizedNodeTriangleCallback(QuantizedNodeArray& triangleNodes,const btOptimizedBvh* tree)
:m_triangleNodes(triangleNodes),m_optimizedTree(tree)
{
@@ -190,7 +204,7 @@ void btOptimizedBvh::refitPartial(btStridingMeshInterface* meshInterface,const b
bool overlap = testQuantizedAabbAgainstQuantizedAabb(quantizedQueryAabbMin,quantizedQueryAabbMax,subtree.m_quantizedAabbMin,subtree.m_quantizedAabbMax);
if (overlap)
{
updateBvhNodes(meshInterface,subtree.m_rootNodeIndex,subtree.m_rootNodeIndex+subtree.m_subtreeSize);
updateBvhNodes(meshInterface,subtree.m_rootNodeIndex,subtree.m_rootNodeIndex+subtree.m_subtreeSize,i);
subtree.setAabbFromQuantizeNode(m_quantizedContiguousNodes[subtree.m_rootNodeIndex]);
}
@@ -198,9 +212,22 @@ void btOptimizedBvh::refitPartial(btStridingMeshInterface* meshInterface,const b
}
void btOptimizedBvh::updateBvhNodes(btStridingMeshInterface* meshInterface,int firstNode,int endNode)
///just for debugging, to visualize the individual patches/subtrees
#ifdef DEBUG_PATCH_COLORS
btVector3 color[4]=
{
btVector3(255,0,0),
btVector3(0,255,0),
btVector3(0,0,255),
btVector3(0,255,255)
};
#endif //DEBUG_PATCH_COLORS
void btOptimizedBvh::updateBvhNodes(btStridingMeshInterface* meshInterface,int firstNode,int endNode,int index)
{
(void)index;
btAssert(m_useQuantization);
int nodeSubPart=0;
@@ -240,6 +267,13 @@ void btOptimizedBvh::updateBvhNodes(btStridingMeshInterface* meshInterface,int f
int graphicsindex = gfxbase[j];
btScalar* graphicsbase = (btScalar*)(vertexbase+graphicsindex*stride);
#ifdef DEBUG_PATCH_COLORS
btVector3 mycolor = color[index&3];
graphicsbase[8] = mycolor.getX();
graphicsbase[9] = mycolor.getY();
graphicsbase[10] = mycolor.getZ();
#endif //DEBUG_PATCH_COLORS
triangleVerts[j] = btVector3(
graphicsbase[0]*meshScaling.getX(),
@@ -311,7 +345,7 @@ void btOptimizedBvh::refit(btStridingMeshInterface* meshInterface)
setQuantizationValues(aabbMin,aabbMax);
updateBvhNodes(meshInterface,0,m_curNodeIndex);
updateBvhNodes(meshInterface,0,m_curNodeIndex,0);
///now update all subtree headers
@@ -747,6 +781,9 @@ void btOptimizedBvh::walkStacklessQuantizedTreeCacheFriendly(btNodeOverlapCallba
void btOptimizedBvh::reportSphereOverlappingNodex(btNodeOverlapCallback* nodeCallback,const btVector3& aabbMin,const btVector3& aabbMax) const
{
(void)nodeCallback;
(void)aabbMin;
(void)aabbMax;
//not yet, please use aabb
btAssert(0);
}

View File

@@ -74,6 +74,8 @@ ATTRIBUTE_ALIGNED16 (struct) btOptimizedBvhNode
//for child nodes
int m_subPart;
int m_triangleIndex;
int m_padding[5];//bad, due to alignment
};
@@ -89,6 +91,8 @@ public:
int m_rootNodeIndex;
//4 bytes
int m_subtreeSize;
int m_padding[3];
void setAabbFromQuantizeNode(const btQuantizedBvhNode& quantizedNode)
{
@@ -305,7 +309,7 @@ public:
void refitPartial(btStridingMeshInterface* triangles,const btVector3& aabbMin, const btVector3& aabbMax);
void updateBvhNodes(btStridingMeshInterface* meshInterface,int firstNode,int endNode);
void updateBvhNodes(btStridingMeshInterface* meshInterface,int firstNode,int endNode,int index);
QuantizedNodeArray& getQuantizedNodeArray()

View File

@@ -26,11 +26,14 @@ btSphereShape ::btSphereShape (btScalar radius)
btVector3 btSphereShape::localGetSupportingVertexWithoutMargin(const btVector3& vec)const
{
(void)vec;
return btVector3(btScalar(0.),btScalar(0.),btScalar(0.));
}
void btSphereShape::batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
{
(void)vectors;
for (int i=0;i<numVectors;i++)
{
supportVerticesOut[i].setValue(btScalar(0.),btScalar(0.),btScalar(0.));

View File

@@ -34,6 +34,8 @@ btStaticPlaneShape::~btStaticPlaneShape()
void btStaticPlaneShape::getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const
{
(void)t;
/*
btVector3 infvec (btScalar(1e30),btScalar(1e30),btScalar(1e30));
btVector3 center = m_planeNormal*m_planeConstant;
@@ -41,6 +43,7 @@ void btStaticPlaneShape::getAabb(const btTransform& t,btVector3& aabbMin,btVecto
aabbMax = aabbMin;
aabbMin.setMin(center - infvec*m_planeNormal);
aabbMax.setMax(center - infvec*m_planeNormal);
*/
aabbMin.setValue(btScalar(-1e30),btScalar(-1e30),btScalar(-1e30));
aabbMax.setValue(btScalar(1e30),btScalar(1e30),btScalar(1e30));
@@ -85,6 +88,8 @@ void btStaticPlaneShape::processAllTriangles(btTriangleCallback* callback,const
void btStaticPlaneShape::calculateLocalInertia(btScalar mass,btVector3& inertia)
{
(void)mass;
//moving concave objects not supported
inertia.setValue(btScalar(0.),btScalar(0.),btScalar(0.));

View File

@@ -23,6 +23,8 @@ btStridingMeshInterface::~btStridingMeshInterface()
void btStridingMeshInterface::InternalProcessAllTriangles(btInternalTriangleIndexCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const
{
(void)aabbMin;
(void)aabbMax;
int numtotalphysicsverts = 0;
int part,graphicssubparts = getNumSubParts();
const unsigned char * vertexbase;
@@ -99,6 +101,9 @@ void btStridingMeshInterface::calculateAabbBruteForce(btVector3& aabbMin,btVecto
virtual void internalProcessTriangleIndex(btVector3* triangle,int partId,int triangleIndex)
{
(void)partId;
(void)triangleIndex;
m_aabbMin.setMin(triangle[0]);
m_aabbMax.setMax(triangle[0]);
m_aabbMin.setMin(triangle[1]);

View File

@@ -178,17 +178,17 @@ int btBU_Simplex1to4::getNumPlanes() const
}
void btBU_Simplex1to4::getPlane(btVector3& planeNormal,btPoint3& planeSupport,int i) const
void btBU_Simplex1to4::getPlane(btVector3&, btPoint3& ,int ) const
{
}
int btBU_Simplex1to4::getIndex(int i) const
int btBU_Simplex1to4::getIndex(int ) const
{
return 0;
}
bool btBU_Simplex1to4::isInside(const btPoint3& pt,btScalar tolerance) const
bool btBU_Simplex1to4::isInside(const btPoint3& ,btScalar ) const
{
return false;
}

View File

@@ -30,6 +30,7 @@ ATTRIBUTE_ALIGNED16( struct) btIndexedMesh
int m_numVertices;
const unsigned char * m_vertexBase;
int m_vertexStride;
int pad[2];
}
;
@@ -43,6 +44,7 @@ typedef btAlignedObjectArray<btIndexedMesh> IndexedMeshArray;
ATTRIBUTE_ALIGNED16( class) btTriangleIndexVertexArray : public btStridingMeshInterface
{
IndexedMeshArray m_indexedMeshes;
int m_pad[3];
public:
@@ -66,9 +68,9 @@ public:
/// unLockVertexBase finishes the access to a subpart of the triangle mesh
/// make a call to unLockVertexBase when the read and write access (using getLockedVertexIndexBase) is finished
virtual void unLockVertexBase(int subpart) {}
virtual void unLockVertexBase(int subpart) {(void)subpart;}
virtual void unLockReadOnlyVertexBase(int subpart) const {}
virtual void unLockReadOnlyVertexBase(int subpart) const {(void)subpart;}
/// getNumSubParts returns the number of seperate subparts
/// each subpart has a continuous array of vertices and indices
@@ -86,8 +88,8 @@ public:
return m_indexedMeshes;
}
virtual void preallocateVertices(int numverts){}
virtual void preallocateIndices(int numindices){}
virtual void preallocateVertices(int numverts){(void) numverts;}
virtual void preallocateIndices(int numindices){(void) numindices;}
}
;

View File

@@ -24,6 +24,7 @@ btTriangleMesh::btTriangleMesh ()
void btTriangleMesh::getLockedVertexIndexBase(unsigned char **vertexbase, int& numverts,PHY_ScalarType& type, int& stride,unsigned char **indexbase,int & indexstride,int& numfaces,PHY_ScalarType& indicestype,int subpart)
{
(void)subpart;
numverts = m_vertices.size();
*vertexbase = (unsigned char*)&m_vertices[0];
type = PHY_FLOAT;
@@ -38,6 +39,7 @@ void btTriangleMesh::getLockedVertexIndexBase(unsigned char **vertexbase, int& n
void btTriangleMesh::getLockedReadOnlyVertexIndexBase(const unsigned char **vertexbase, int& numverts,PHY_ScalarType& type, int& stride,const unsigned char **indexbase,int & indexstride,int& numfaces,PHY_ScalarType& indicestype,int subpart) const
{
(void)subpart;
numverts = m_vertices.size();
*vertexbase = (unsigned char*)&m_vertices[0];
type = PHY_FLOAT;

View File

@@ -57,16 +57,16 @@ class btTriangleMesh : public btStridingMeshInterface
/// unLockVertexBase finishes the access to a subpart of the triangle mesh
/// make a call to unLockVertexBase when the read and write access (using getLockedVertexIndexBase) is finished
virtual void unLockVertexBase(int subpart) {}
virtual void unLockVertexBase(int subpart) {(void) subpart;}
virtual void unLockReadOnlyVertexBase(int subpart) const {}
virtual void unLockReadOnlyVertexBase(int subpart) const { (void) subpart;}
/// getNumSubParts returns the number of seperate subparts
/// each subpart has a continuous array of vertices and indices
virtual int getNumSubParts() const;
virtual void preallocateVertices(int numverts){}
virtual void preallocateIndices(int numindices){}
virtual void preallocateVertices(int numverts){(void) numverts;}
virtual void preallocateIndices(int numindices){(void) numindices;}
};

View File

@@ -93,6 +93,8 @@ public:
virtual void processTriangle( btVector3* triangle,int partId, int triangleIndex)
{
(void)partId;
(void)triangleIndex;
for (int i=0;i<3;i++)
{
btScalar dot = m_supportVecLocal.dot(triangle[i]);
@@ -176,8 +178,9 @@ void btTriangleMeshShape::processAllTriangles(btTriangleCallback* callback,const
void btTriangleMeshShape::calculateLocalInertia(btScalar mass,btVector3& inertia)
{
(void)mass;
//moving concave objects not supported
assert(0);
btAssert(0);
inertia.setValue(btScalar(0.),btScalar(0.),btScalar(0.));
}

View File

@@ -24,9 +24,9 @@ subject to the following restrictions:
class btTriangleMeshShape : public btConcaveShape
{
protected:
btStridingMeshInterface* m_meshInterface;
btVector3 m_localAabbMin;
btVector3 m_localAabbMax;
btStridingMeshInterface* m_meshInterface;
public:

View File

@@ -111,12 +111,14 @@ public:
virtual void getPlaneEquation(int i, btVector3& planeNormal,btPoint3& planeSupport) const
{
(void)i;
calcNormal(planeNormal);
planeSupport = m_vertices1[0];
}
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia)
{
(void)mass;
btAssert(0);
inertia.setValue(btScalar(0.),btScalar(0.),btScalar(0.));
}