erwin.coumans
2009-02-06 06:09:57 +00:00
parent 5593a23417
commit 24d1fea8b2
16 changed files with 44 additions and 44 deletions

View File

@@ -393,12 +393,13 @@ static DBVT_INLINE btDbvtNode* sort(btDbvtNode* n,btDbvtNode*& r)
return(n); return(n);
} }
// #if 0
static DBVT_INLINE btDbvtNode* walkup(btDbvtNode* n,int count) static DBVT_INLINE btDbvtNode* walkup(btDbvtNode* n,int count)
{ {
while(n&&(count--)) n=n->parent; while(n&&(count--)) n=n->parent;
return(n); return(n);
} }
#endif
// //
// Api // Api

View File

@@ -82,7 +82,7 @@ subject to the following restrictions:
#define DBVT_VIRTUAL_DTOR(a) #define DBVT_VIRTUAL_DTOR(a)
#define DBVT_PREFIX template <typename T> #define DBVT_PREFIX template <typename T>
#define DBVT_IPOLICY T& policy #define DBVT_IPOLICY T& policy
#define DBVT_CHECKTYPE static const ICollide& typechecker=*(T*)0; #define DBVT_CHECKTYPE static const ICollide& typechecker=*(T*)1;(void)typechecker;
#else #else
#define DBVT_VIRTUAL_DTOR(a) virtual ~a() {} #define DBVT_VIRTUAL_DTOR(a) virtual ~a() {}
#define DBVT_VIRTUAL virtual #define DBVT_VIRTUAL virtual

View File

@@ -211,9 +211,6 @@ void btDbvtBroadphase::getAabb(btBroadphaseProxy* absproxy,btVector3& aabbMin, b
aabbMax = proxy->m_aabbMax; aabbMax = proxy->m_aabbMax;
} }
void btDbvtBroadphase::rayTest(const btVector3& rayFrom,const btVector3& rayTo, btBroadphaseRayCallback& rayCallback,const btVector3& aabbMin,const btVector3& aabbMax)
{
struct BroadphaseRayTester : btDbvt::ICollide struct BroadphaseRayTester : btDbvt::ICollide
{ {
btBroadphaseRayCallback& m_rayCallback; btBroadphaseRayCallback& m_rayCallback;
@@ -228,6 +225,8 @@ void btDbvtBroadphase::rayTest(const btVector3& rayFrom,const btVector3& rayTo,
} }
}; };
void btDbvtBroadphase::rayTest(const btVector3& rayFrom,const btVector3& rayTo, btBroadphaseRayCallback& rayCallback,const btVector3& aabbMin,const btVector3& aabbMax)
{
BroadphaseRayTester callback(rayCallback); BroadphaseRayTester callback(rayCallback);
m_sets[0].rayTestInternal( m_sets[0].m_root, m_sets[0].rayTestInternal( m_sets[0].m_root,

View File

@@ -469,7 +469,6 @@ void btQuantizedBvh::walkStacklessTreeAgainstRay(btNodeOverlapCallback* nodeCall
rayAabbMax += aabbMax; rayAabbMax += aabbMax;
#ifdef RAYAABB2 #ifdef RAYAABB2
btVector3 rayFrom = raySource;
btVector3 rayDir = (rayTarget-raySource); btVector3 rayDir = (rayTarget-raySource);
rayDir.normalize (); rayDir.normalize ();
lambda_max = rayDir.dot(rayTarget-raySource); lambda_max = rayDir.dot(rayTarget-raySource);
@@ -558,7 +557,6 @@ void btQuantizedBvh::walkStacklessQuantizedTreeAgainstRay(btNodeOverlapCallback*
btScalar lambda_max = 1.0; btScalar lambda_max = 1.0;
#ifdef RAYAABB2 #ifdef RAYAABB2
btVector3 rayFrom = raySource;
btVector3 rayDirection = (rayTarget-raySource); btVector3 rayDirection = (rayTarget-raySource);
rayDirection.normalize (); rayDirection.normalize ();
lambda_max = rayDirection.dot(rayTarget-raySource); lambda_max = rayDirection.dot(rayTarget-raySource);
@@ -817,12 +815,13 @@ void btQuantizedBvh::assignInternalNodeFromLeafNode(int internalNode,int leafNod
//PCK: include //PCK: include
#include <new> #include <new>
#if 0
//PCK: consts //PCK: consts
static const unsigned BVH_ALIGNMENT = 16; static const unsigned BVH_ALIGNMENT = 16;
static const unsigned BVH_ALIGNMENT_MASK = BVH_ALIGNMENT-1; static const unsigned BVH_ALIGNMENT_MASK = BVH_ALIGNMENT-1;
static const unsigned BVH_ALIGNMENT_BLOCKS = 2; static const unsigned BVH_ALIGNMENT_BLOCKS = 2;
#endif
unsigned int btQuantizedBvh::getAlignmentSerializationPadding() unsigned int btQuantizedBvh::getAlignmentSerializationPadding()
@@ -1146,3 +1145,4 @@ m_bulletVersion(BT_BULLET_VERSION)

View File

@@ -664,7 +664,7 @@ struct btSingleRayCallback : public btBroadphaseRayCallback
{ {
//RigidcollisionObject* collisionObject = ctrl->GetRigidcollisionObject(); //RigidcollisionObject* collisionObject = ctrl->GetRigidcollisionObject();
//btVector3 collisionObjectAabbMin,collisionObjectAabbMax; //btVector3 collisionObjectAabbMin,collisionObjectAabbMax;
#if 0
#ifdef RECALCULATE_AABB #ifdef RECALCULATE_AABB
btVector3 collisionObjectAabbMin,collisionObjectAabbMax; btVector3 collisionObjectAabbMin,collisionObjectAabbMax;
collisionObject->getCollisionShape()->getAabb(collisionObject->getWorldTransform(),collisionObjectAabbMin,collisionObjectAabbMax); collisionObject->getCollisionShape()->getAabb(collisionObject->getWorldTransform(),collisionObjectAabbMin,collisionObjectAabbMax);
@@ -672,6 +672,7 @@ struct btSingleRayCallback : public btBroadphaseRayCallback
//getBroadphase()->getAabb(collisionObject->getBroadphaseHandle(),collisionObjectAabbMin,collisionObjectAabbMax); //getBroadphase()->getAabb(collisionObject->getBroadphaseHandle(),collisionObjectAabbMin,collisionObjectAabbMax);
const btVector3& collisionObjectAabbMin = collisionObject->getBroadphaseHandle()->m_aabbMin; const btVector3& collisionObjectAabbMin = collisionObject->getBroadphaseHandle()->m_aabbMin;
const btVector3& collisionObjectAabbMax = collisionObject->getBroadphaseHandle()->m_aabbMax; const btVector3& collisionObjectAabbMax = collisionObject->getBroadphaseHandle()->m_aabbMax;
#endif
#endif #endif
//btScalar hitLambda = m_resultCallback.m_closestHitFraction; //btScalar hitLambda = m_resultCallback.m_closestHitFraction;
//culling already done by broadphase //culling already done by broadphase

View File

@@ -29,7 +29,6 @@ m_sharedManifold(ci.m_manifold)
m_ownsManifold = false; m_ownsManifold = false;
btCollisionObject* colObj = m_isSwapped? body1 : body0; btCollisionObject* colObj = m_isSwapped? body1 : body0;
btCollisionObject* otherObj = m_isSwapped? body0 : body1;
assert (colObj->getCollisionShape()->isCompound()); assert (colObj->getCollisionShape()->isCompound());
btCompoundShape* compoundShape = static_cast<btCompoundShape*>(colObj->getCollisionShape()); btCompoundShape* compoundShape = static_cast<btCompoundShape*>(colObj->getCollisionShape());
@@ -209,7 +208,6 @@ void btCompoundCollisionAlgorithm::processCollision (btCollisionObject* body0,bt
///note that we should actually recursively traverse all children, btCompoundShape can nested more then 1 level deep ///note that we should actually recursively traverse all children, btCompoundShape can nested more then 1 level deep
///so we should add a 'refreshManifolds' in the btCollisionAlgorithm ///so we should add a 'refreshManifolds' in the btCollisionAlgorithm
{ {
int numChildren = m_childCollisionAlgorithms.size();
int i; int i;
btManifoldArray manifoldArray; btManifoldArray manifoldArray;
for (i=0;i<m_childCollisionAlgorithms.size();i++) for (i=0;i<m_childCollisionAlgorithms.size();i++)
@@ -341,3 +339,4 @@ btScalar btCompoundCollisionAlgorithm::calculateTimeOfImpact(btCollisionObject*
} }

View File

@@ -78,7 +78,7 @@ void btSphereSphereCollisionAlgorithm::processCollision (btCollisionObject* col0
} }
///point on A (worldspace) ///point on A (worldspace)
btVector3 pos0 = col0->getWorldTransform().getOrigin() - radius0 * normalOnSurfaceB; ///btVector3 pos0 = col0->getWorldTransform().getOrigin() - radius0 * normalOnSurfaceB;
///point on B (worldspace) ///point on B (worldspace)
btVector3 pos1 = col1->getWorldTransform().getOrigin() + radius1* normalOnSurfaceB; btVector3 pos1 = col1->getWorldTransform().getOrigin() + radius1* normalOnSurfaceB;

View File

@@ -154,7 +154,6 @@ btVector3 btConvexShape::localGetSupportVertexWithoutMarginNonVirtual (const btV
btVector3 vec0(localDir.getX(),localDir.getY(),localDir.getZ()); btVector3 vec0(localDir.getX(),localDir.getY(),localDir.getZ());
btCapsuleShape* capsuleShape = (btCapsuleShape*)this; btCapsuleShape* capsuleShape = (btCapsuleShape*)this;
btVector3 halfExtents = capsuleShape->getImplicitShapeDimensions();
btScalar halfHeight = capsuleShape->getHalfHeight(); btScalar halfHeight = capsuleShape->getHalfHeight();
int capsuleUpAxis = capsuleShape->getUpAxis(); int capsuleUpAxis = capsuleShape->getUpAxis();
@@ -301,8 +300,8 @@ void btConvexShape::getAabbNonVirtual (const btTransform& t, btVector3& aabbMin,
case SPHERE_SHAPE_PROXYTYPE: case SPHERE_SHAPE_PROXYTYPE:
{ {
btSphereShape* sphereShape = (btSphereShape*)this; btSphereShape* sphereShape = (btSphereShape*)this;
float radius = sphereShape->getImplicitShapeDimensions().getX();// * convexShape->getLocalScaling().getX(); btScalar radius = sphereShape->getImplicitShapeDimensions().getX();// * convexShape->getLocalScaling().getX();
float margin = radius + sphereShape->getMarginNonVirtual(); btScalar margin = radius + sphereShape->getMarginNonVirtual();
const btVector3& center = t.getOrigin(); const btVector3& center = t.getOrigin();
btVector3 extent(margin,margin,margin); btVector3 extent(margin,margin,margin);
aabbMin = center - extent; aabbMin = center - extent;
@@ -314,7 +313,7 @@ void btConvexShape::getAabbNonVirtual (const btTransform& t, btVector3& aabbMin,
case BOX_SHAPE_PROXYTYPE: case BOX_SHAPE_PROXYTYPE:
{ {
btBoxShape* convexShape = (btBoxShape*)this; btBoxShape* convexShape = (btBoxShape*)this;
float margin=convexShape->getMarginNonVirtual(); btScalar margin=convexShape->getMarginNonVirtual();
btVector3 halfExtents = convexShape->getImplicitShapeDimensions(); btVector3 halfExtents = convexShape->getImplicitShapeDimensions();
halfExtents += btVector3(margin,margin,margin); halfExtents += btVector3(margin,margin,margin);
btMatrix3x3 abs_b = t.getBasis().absolute(); btMatrix3x3 abs_b = t.getBasis().absolute();

View File

@@ -238,7 +238,7 @@ void btHeightfieldTerrainShape::getVertex(int x,int y,btVector3& vertex) const
static inline int static inline int
getQuantized getQuantized
( (
float x btScalar x
) )
{ {
if (x < 0.0) { if (x < 0.0) {

View File

@@ -82,7 +82,7 @@ bool btTriangleIndexVertexArray::hasPremadeAabb() const
return (m_hasAabb == 1); return (m_hasAabb == 1);
} }
void btTriangleIndexVertexArray::setPremadeAabb(const btVector3& aabbMin, const btVector3& aabbMax ) void btTriangleIndexVertexArray::setPremadeAabb(const btVector3& aabbMin, const btVector3& aabbMax ) const
{ {
m_aabbMin = aabbMin; m_aabbMin = aabbMin;
m_aabbMax = aabbMax; m_aabbMax = aabbMax;
@@ -95,3 +95,4 @@ void btTriangleIndexVertexArray::getPremadeAabb(btVector3* aabbMin, btVector3* a
*aabbMax = m_aabbMax; *aabbMax = m_aabbMax;
} }

View File

@@ -52,9 +52,9 @@ ATTRIBUTE_ALIGNED16( class) btTriangleIndexVertexArray : public btStridingMeshIn
protected: protected:
IndexedMeshArray m_indexedMeshes; IndexedMeshArray m_indexedMeshes;
int m_pad[2]; int m_pad[2];
int m_hasAabb; // using int instead of bool to maintain alignment mutable int m_hasAabb; // using int instead of bool to maintain alignment
btVector3 m_aabbMin; mutable btVector3 m_aabbMin;
btVector3 m_aabbMax; mutable btVector3 m_aabbMax;
public: public:
@@ -106,7 +106,7 @@ public:
virtual void preallocateIndices(int numindices){(void) numindices;} virtual void preallocateIndices(int numindices){(void) numindices;}
virtual bool hasPremadeAabb() const; virtual bool hasPremadeAabb() const;
virtual void setPremadeAabb(const btVector3& aabbMin, const btVector3& aabbMax ); virtual void setPremadeAabb(const btVector3& aabbMin, const btVector3& aabbMax ) const;
virtual void getPremadeAabb(btVector3* aabbMin, btVector3* aabbMax ) const; virtual void getPremadeAabb(btVector3* aabbMin, btVector3* aabbMax ) const;
} }

View File

@@ -111,9 +111,9 @@ int btTriangleMesh::findOrAddVertex(const btVector3& vertex, bool removeDuplicat
} }
} }
} }
m_3componentVertices.push_back(vertex.getX()); m_3componentVertices.push_back((float)vertex.getX());
m_3componentVertices.push_back(vertex.getY()); m_3componentVertices.push_back((float)vertex.getY());
m_3componentVertices.push_back(vertex.getZ()); m_3componentVertices.push_back((float)vertex.getZ());
m_indexedMeshes[0].m_numVertices++; m_indexedMeshes[0].m_numVertices++;
m_indexedMeshes[0].m_vertexBase = (unsigned char*)&m_3componentVertices[0]; m_indexedMeshes[0].m_vertexBase = (unsigned char*)&m_3componentVertices[0];
return (m_3componentVertices.size()/3)-1; return (m_3componentVertices.size()/3)-1;

View File

@@ -1045,12 +1045,12 @@ public:
} }
//! call when reading child shapes //! call when reading child shapes
virtual void lockChildShapes() virtual void lockChildShapes() const
{ {
btAssert(0); btAssert(0);
} }
virtual void unlockChildShapes() virtual void unlockChildShapes() const
{ {
btAssert(0); btAssert(0);
} }

View File

@@ -110,8 +110,7 @@ GUINT GIM_BOX_TREE::_sort_and_calc_splitting_index(
splitIndex = startIndex+ (numIndices>>1); splitIndex = startIndex+ (numIndices>>1);
} }
bool unbal = (splitIndex==startIndex) || (splitIndex == (endIndex)); btAssert(!(splitIndex==startIndex) || (splitIndex == (endIndex)));
btAssert(!unbal);
return splitIndex; return splitIndex;
} }
@@ -180,3 +179,4 @@ void GIM_BOX_TREE::build_tree(
_build_sub_tree(primitive_boxes, 0, primitive_boxes.size()); _build_sub_tree(primitive_boxes, 0, primitive_boxes.size());
} }

View File

@@ -107,7 +107,7 @@ enum GIM_SCALAR_TYPES
///returns a clamped number ///returns a clamped number
#define GIM_CLAMP(number,minval,maxval) (number<minval?minval:(number>maxval?maxval:number)) #define GIM_CLAMP(number,minval,maxval) (number<minval?minval:(number>maxval?maxval:number))
#define GIM_GREATER(x, y) fabsf(x) > (y) #define GIM_GREATER(x, y) btFabs(x) > (y)
///Swap numbers ///Swap numbers
#define GIM_SWAP_NUMBERS(a,b){ \ #define GIM_SWAP_NUMBERS(a,b){ \

View File

@@ -275,7 +275,7 @@ if 0.0<= u+v <=1.0 then they are inside of triangle
} }
else else
{ {
float sumuv; btScalar sumuv;
sumuv = u+v; sumuv = u+v;
if(sumuv<-G_EPSILON) if(sumuv<-G_EPSILON)
{ {