mirror of
https://github.com/bulletphysics/bullet3
synced 2024-12-16 14:40:05 +00:00
Merge pull request #216 from erwincoumans/master
fix more warnings in BulletCollision, and fix CMakeLists for Linux
This commit is contained in:
commit
60ab931dbd
@ -6,7 +6,6 @@ INCLUDE_DIRECTORIES(
|
||||
${BULLET_PHYSICS_SOURCE_DIR}/btgui/lua-5.2.3/src
|
||||
)
|
||||
|
||||
|
||||
SET(App_AllBullet2Demos_SRCS
|
||||
main.cpp
|
||||
BulletDemoInterface.h
|
||||
@ -93,7 +92,13 @@ ELSE(WIN32)
|
||||
MESSAGE(${COCOA})
|
||||
link_libraries(${COCOA})
|
||||
ELSE(APPLE)
|
||||
LINK_LIBRARIES( pthread GLEW)
|
||||
ADD_DEFINITIONS("-DGLEW_INIT_OPENGL11_FUNCTIONS=1")
|
||||
ADD_DEFINITIONS("-DGLEW_STATIC")
|
||||
ADD_DEFINITIONS("-DGLEW_DYNAMIC_LOAD_ALL_GLX_FUNCTIONS=1")
|
||||
INCLUDE_DIRECTORIES(
|
||||
${BULLET_PHYSICS_SOURCE_DIR}/btgui/OpenGLWindow/GlewWindows
|
||||
)
|
||||
LINK_LIBRARIES( pthread dl)
|
||||
ENDIF(APPLE)
|
||||
ENDIF(WIN32)
|
||||
|
||||
|
@ -50,7 +50,16 @@ ELSE(WIN32)
|
||||
MESSAGE(${COCOA})
|
||||
link_libraries(${COCOA})
|
||||
ELSE(APPLE)
|
||||
LINK_LIBRARIES( GLEW X11 pthread dl)
|
||||
SET(App_Bullet3_OpenCL_Demos_SRCS ${App_Bullet3_OpenCL_Demos_SRCS} ${App_Bullet3_OpenCL_Demos_Common_SRCS} ../../btgui/OpenGLWindow/GlewWindows/glew.c)
|
||||
|
||||
INCLUDE_DIRECTORIES(
|
||||
${BULLET_PHYSICS_SOURCE_DIR}/btgui/OpenGLWindow/GlewWindows
|
||||
)
|
||||
ADD_DEFINITIONS("-DGLEW_INIT_OPENGL11_FUNCTIONS=1")
|
||||
ADD_DEFINITIONS("-DGLEW_STATIC")
|
||||
ADD_DEFINITIONS("-DGLEW_DYNAMIC_LOAD_ALL_GLX_FUNCTIONS=1")
|
||||
|
||||
LINK_LIBRARIES( X11 pthread dl)
|
||||
ENDIF(APPLE)
|
||||
ENDIF(WIN32)
|
||||
|
||||
|
@ -27,7 +27,15 @@ ELSE(WIN32)
|
||||
MESSAGE(${COCOA})
|
||||
link_libraries(${COCOA})
|
||||
ELSE(APPLE)
|
||||
LINK_LIBRARIES( GLEW X11 pthread dl Xext)
|
||||
|
||||
INCLUDE_DIRECTORIES(
|
||||
${BULLET_PHYSICS_SOURCE_DIR}/btgui/OpenGLWindow/GlewWindows
|
||||
)
|
||||
ADD_DEFINITIONS("-DGLEW_INIT_OPENGL11_FUNCTIONS=1")
|
||||
ADD_DEFINITIONS("-DGLEW_STATIC")
|
||||
ADD_DEFINITIONS("-DGLEW_DYNAMIC_LOAD_ALL_GLX_FUNCTIONS=1")
|
||||
|
||||
LINK_LIBRARIES( X11 pthread dl Xext)
|
||||
ENDIF(APPLE)
|
||||
ENDIF(WIN32)
|
||||
|
||||
|
@ -32,7 +32,14 @@ ENDIF(APPLE)
|
||||
|
||||
#no Linux detection?
|
||||
IF(NOT WIN32 AND NOT APPLE)
|
||||
SET(OpenGLWindow_SRCS ${OpenGLWindowLinux_CPP} ${OpenGLWindowCommon_CPP} )
|
||||
INCLUDE_DIRECTORIES(
|
||||
${BULLET_PHYSICS_SOURCE_DIR}/btgui/OpenGLWindow/GlewWindows
|
||||
)
|
||||
ADD_DEFINITIONS(-DGLEW_STATIC)
|
||||
ADD_DEFINITIONS("-DGLEW_INIT_OPENGL11_FUNCTIONS=1")
|
||||
ADD_DEFINITIONS("-DGLEW_DYNAMIC_LOAD_ALL_GLX_FUNCTIONS=1")
|
||||
|
||||
SET(OpenGLWindow_SRCS ${OpenGLWindowLinux_CPP} ${BULLET_PHYSICS_SOURCE_DIR}/btgui/OpenGLWindow/GlewWindows/glew.c ${OpenGLWindowCommon_CPP} )
|
||||
ENDIF()
|
||||
|
||||
|
||||
|
@ -38,8 +38,9 @@ static DBVT_INLINE btDbvtVolume merge( const btDbvtVolume& a,
|
||||
const btDbvtVolume& b)
|
||||
{
|
||||
#if (DBVT_MERGE_IMPL==DBVT_IMPL_SSE)
|
||||
ATTRIBUTE_ALIGNED16(char locals[sizeof(btDbvtAabbMm)]);
|
||||
btDbvtVolume& res=*(btDbvtVolume*)locals;
|
||||
ATTRIBUTE_ALIGNED16( char locals[sizeof(btDbvtAabbMm)]);
|
||||
btDbvtVolume* ptr = (btDbvtVolume*) locals;
|
||||
btDbvtVolume& res=*ptr;
|
||||
#else
|
||||
btDbvtVolume res;
|
||||
#endif
|
||||
@ -250,7 +251,8 @@ static btDbvtVolume bounds( const tNodeArray& leaves)
|
||||
{
|
||||
#if DBVT_MERGE_IMPL==DBVT_IMPL_SSE
|
||||
ATTRIBUTE_ALIGNED16(char locals[sizeof(btDbvtVolume)]);
|
||||
btDbvtVolume& volume=*(btDbvtVolume*)locals;
|
||||
btDbvtVolume* ptr = (btDbvtVolume*) locals;
|
||||
btDbvtVolume& volume=*ptr;
|
||||
volume=leaves[0]->volume;
|
||||
#else
|
||||
btDbvtVolume volume=leaves[0]->volume;
|
||||
|
@ -31,11 +31,10 @@ btCollisionObject::btCollisionObject()
|
||||
m_activationState1(1),
|
||||
m_deactivationTime(btScalar(0.)),
|
||||
m_friction(btScalar(0.5)),
|
||||
m_rollingFriction(0.0f),
|
||||
m_restitution(btScalar(0.)),
|
||||
m_rollingFriction(0.0f),
|
||||
m_internalType(CO_COLLISION_OBJECT),
|
||||
m_userObjectPointer(0),
|
||||
m_userIndex(-1),
|
||||
m_hitFraction(btScalar(1.)),
|
||||
m_ccdSweptSphereRadius(btScalar(0.)),
|
||||
m_ccdMotionThreshold(btScalar(0.)),
|
||||
|
@ -292,7 +292,7 @@ void btCollisionWorld::rayTestSingleInternal(const btTransform& rayFromTrans,con
|
||||
btGjkConvexCast gjkConvexCaster(castShape,convexShape,&simplexSolver);
|
||||
|
||||
//btContinuousConvexCollision convexCaster(castShape,convexShape,&simplexSolver,0);
|
||||
bool condition = true;
|
||||
|
||||
btConvexCast* convexCasterPtr = 0;
|
||||
//use kF_UseSubSimplexConvexCastRaytest by default
|
||||
if (resultCallback.m_flags & btTriangleRaycastCallback::kF_UseGjkConvexCastRaytest)
|
||||
@ -1245,7 +1245,10 @@ public:
|
||||
void btCollisionWorld::debugDrawObject(const btTransform& worldTransform, const btCollisionShape* shape, const btVector3& color)
|
||||
{
|
||||
// Draw a small simplex at the center of the object
|
||||
if (getDebugDrawer() && getDebugDrawer()->getDebugMode() & btIDebugDraw::DBG_DrawFrames)
|
||||
{
|
||||
getDebugDrawer()->drawTransform(worldTransform,1);
|
||||
}
|
||||
|
||||
if (shape->getShapeType() == COMPOUND_SHAPE_PROXYTYPE)
|
||||
{
|
||||
|
@ -123,7 +123,7 @@ public:
|
||||
|
||||
//backup
|
||||
btTransform orgTrans = m_compoundColObjWrap->getWorldTransform();
|
||||
btTransform orgInterpolationTrans = m_compoundColObjWrap->getWorldTransform();
|
||||
|
||||
const btTransform& childTrans = compoundShape->getChildTransform(index);
|
||||
btTransform newChildWorldTrans = orgTrans*childTrans ;
|
||||
|
||||
@ -294,7 +294,7 @@ void btCompoundCollisionAlgorithm::processCollision (const btCollisionObjectWrap
|
||||
btManifoldArray manifoldArray;
|
||||
const btCollisionShape* childShape = 0;
|
||||
btTransform orgTrans;
|
||||
btTransform orgInterpolationTrans;
|
||||
|
||||
btTransform newChildWorldTrans;
|
||||
btVector3 aabbMin0,aabbMax0,aabbMin1,aabbMax1;
|
||||
|
||||
@ -305,7 +305,7 @@ void btCompoundCollisionAlgorithm::processCollision (const btCollisionObjectWrap
|
||||
childShape = compoundShape->getChildShape(i);
|
||||
//if not longer overlapping, remove the algorithm
|
||||
orgTrans = colObjWrap->getWorldTransform();
|
||||
orgInterpolationTrans = colObjWrap->getWorldTransform();
|
||||
|
||||
const btTransform& childTrans = compoundShape->getChildTransform(i);
|
||||
newChildWorldTrans = orgTrans*childTrans ;
|
||||
|
||||
|
@ -112,10 +112,9 @@ struct btCompoundCompoundLeafCallback : btDbvt::ICollide
|
||||
btManifoldResult* resultOut,
|
||||
btHashedSimplePairCache* childAlgorithmsCache,
|
||||
btPersistentManifold* sharedManifold)
|
||||
:m_compound0ColObjWrap(compound1ObjWrap),m_compound1ColObjWrap(compound0ObjWrap),m_dispatcher(dispatcher),m_dispatchInfo(dispatchInfo),m_resultOut(resultOut),
|
||||
:m_numOverlapPairs(0),m_compound0ColObjWrap(compound1ObjWrap),m_compound1ColObjWrap(compound0ObjWrap),m_dispatcher(dispatcher),m_dispatchInfo(dispatchInfo),m_resultOut(resultOut),
|
||||
m_childCollisionAlgorithmCache(childAlgorithmsCache),
|
||||
m_sharedManifold(sharedManifold),
|
||||
m_numOverlapPairs(0)
|
||||
m_sharedManifold(sharedManifold)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -88,20 +88,19 @@ partId, int triangleIndex)
|
||||
//just for debugging purposes
|
||||
//printf("triangle %d",m_triangleCount++);
|
||||
|
||||
const btCollisionObject* ob = const_cast<btCollisionObject*>(m_triBodyWrap->getCollisionObject());
|
||||
|
||||
|
||||
btCollisionAlgorithmConstructionInfo ci;
|
||||
ci.m_dispatcher1 = m_dispatcher;
|
||||
|
||||
//const btCollisionObject* ob = static_cast<btCollisionObject*>(m_triBodyWrap->getCollisionObject());
|
||||
|
||||
|
||||
|
||||
|
||||
#if 0
|
||||
|
||||
///debug drawing of the overlapping triangles
|
||||
if (m_dispatchInfoPtr && m_dispatchInfoPtr->m_debugDraw && (m_dispatchInfoPtr->m_debugDraw->getDebugMode() &btIDebugDraw::DBG_DrawWireframe ))
|
||||
{
|
||||
const btCollisionObject* ob = const_cast<btCollisionObject*>(m_triBodyWrap->getCollisionObject());
|
||||
btVector3 color(1,1,0);
|
||||
btTransform& tr = ob->getWorldTransform();
|
||||
m_dispatchInfoPtr->m_debugDraw->drawLine(tr(triangle[0]),tr(triangle[1]),color);
|
||||
|
@ -105,8 +105,7 @@ btDefaultCollisionConfiguration::btDefaultCollisionConfiguration(const btDefault
|
||||
int maxSize = sizeof(btConvexConvexAlgorithm);
|
||||
int maxSize2 = sizeof(btConvexConcaveCollisionAlgorithm);
|
||||
int maxSize3 = sizeof(btCompoundCollisionAlgorithm);
|
||||
int sl = sizeof(btConvexSeparatingDistanceUtil);
|
||||
sl = sizeof(btGjkPairDetector);
|
||||
|
||||
int collisionAlgorithmMaxElementSize = btMax(maxSize,constructionInfo.m_customCollisionAlgorithmMaxElementSize);
|
||||
collisionAlgorithmMaxElementSize = btMax(collisionAlgorithmMaxElementSize,maxSize2);
|
||||
collisionAlgorithmMaxElementSize = btMax(collisionAlgorithmMaxElementSize,maxSize3);
|
||||
|
@ -114,7 +114,6 @@ struct btConnectivityProcessor : public btTriangleCallback
|
||||
if(numshared >= 3)
|
||||
return;
|
||||
}
|
||||
|
||||
switch (numshared)
|
||||
{
|
||||
case 0:
|
||||
@ -203,6 +202,7 @@ struct btConnectivityProcessor : public btTriangleCallback
|
||||
ang4 = 0.f;
|
||||
} else
|
||||
{
|
||||
|
||||
calculatedEdge.normalize();
|
||||
btVector3 calculatedNormalA = calculatedEdge.cross(edgeCrossA);
|
||||
calculatedNormalA.normalize();
|
||||
@ -213,7 +213,7 @@ struct btConnectivityProcessor : public btTriangleCallback
|
||||
isConvex = (dotA<0.);
|
||||
|
||||
correctedAngle = isConvex ? ang4 : -ang4;
|
||||
btQuaternion orn2 = btQuaternion(btVector3(calculatedEdge.x(), calculatedEdge.y(), calculatedEdge.z()),-correctedAngle);
|
||||
btQuaternion orn2(calculatedEdge,-correctedAngle);
|
||||
calculatedNormalB = btMatrix3x3(orn2)*normalA;
|
||||
|
||||
|
||||
@ -301,6 +301,11 @@ struct btConnectivityProcessor : public btTriangleCallback
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
// printf("warning: duplicate triangle\n");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -28,18 +28,14 @@ ATTRIBUTE_ALIGNED16(class) btCollisionShape
|
||||
{
|
||||
protected:
|
||||
int m_shapeType;
|
||||
|
||||
union
|
||||
{
|
||||
void* m_userPointer;
|
||||
int m_userIndex;
|
||||
};
|
||||
|
||||
public:
|
||||
|
||||
BT_DECLARE_ALIGNED_ALLOCATOR();
|
||||
|
||||
btCollisionShape() : m_shapeType (INVALID_SHAPE_PROXYTYPE), m_userPointer(0)
|
||||
btCollisionShape() : m_shapeType (INVALID_SHAPE_PROXYTYPE), m_userPointer(0), m_userIndex(-1)
|
||||
{
|
||||
}
|
||||
|
||||
@ -135,7 +131,6 @@ public:
|
||||
{
|
||||
return m_userPointer;
|
||||
}
|
||||
|
||||
void setUserIndex(int index)
|
||||
{
|
||||
m_userIndex = index;
|
||||
@ -146,6 +141,7 @@ public:
|
||||
return m_userIndex;
|
||||
}
|
||||
|
||||
|
||||
virtual int calculateSerializeBufferSize() const;
|
||||
|
||||
///fills the dataBuffer and returns the struct name (and 0 on failure)
|
||||
|
@ -303,7 +303,7 @@ void btCompoundShape::createAabbTreeFromChildren()
|
||||
m_dynamicAabbTree = new(mem) btDbvt();
|
||||
btAssert(mem==m_dynamicAabbTree);
|
||||
|
||||
for ( size_t index = 0; index < m_children.size(); index++ )
|
||||
for ( int index = 0; index < m_children.size(); index++ )
|
||||
{
|
||||
btCompoundShapeChild &child = m_children[index];
|
||||
|
||||
@ -312,7 +312,8 @@ void btCompoundShape::createAabbTreeFromChildren()
|
||||
child.m_childShape->getAabb(child.m_transform,localAabbMin,localAabbMax);
|
||||
|
||||
const btDbvtVolume bounds=btDbvtVolume::FromMM(localAabbMin,localAabbMax);
|
||||
child.m_node = m_dynamicAabbTree->insert(bounds, reinterpret_cast<void*>(index) );
|
||||
size_t index2 = index;
|
||||
child.m_node = m_dynamicAabbTree->insert(bounds, reinterpret_cast<void*>(index2) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -313,7 +313,7 @@ bool btPolyhedralContactClipping::findSeparatingAxis( const btConvexPolyhedron&
|
||||
int edgeB=-1;
|
||||
btVector3 worldEdgeA;
|
||||
btVector3 worldEdgeB;
|
||||
btVector3 witnessPointA,witnessPointB;
|
||||
btVector3 witnessPointA(0,0,0),witnessPointB(0,0,0);
|
||||
|
||||
|
||||
int curEdgeEdge = 0;
|
||||
|
@ -21,7 +21,6 @@ subject to the following restrictions:
|
||||
struct btBroadphaseProxy;
|
||||
class btConvexShape;
|
||||
|
||||
|
||||
class btTriangleRaycastCallback: public btTriangleCallback
|
||||
{
|
||||
public:
|
||||
|
@ -65,10 +65,10 @@ bool btSubsimplexConvexCast::calcTimeOfImpact(
|
||||
|
||||
btVector3 n;
|
||||
n.setValue(btScalar(0.),btScalar(0.),btScalar(0.));
|
||||
bool hasResult = false;
|
||||
|
||||
btVector3 c;
|
||||
|
||||
btScalar lastLambda = lambda;
|
||||
|
||||
|
||||
|
||||
btScalar dist2 = v.length2();
|
||||
@ -109,9 +109,9 @@ bool btSubsimplexConvexCast::calcTimeOfImpact(
|
||||
//m_simplexSolver->reset();
|
||||
//check next line
|
||||
w = supVertexA-supVertexB;
|
||||
lastLambda = lambda;
|
||||
|
||||
n = v;
|
||||
hasResult = true;
|
||||
|
||||
}
|
||||
}
|
||||
///Just like regular GJK only add the vertex if it isn't already (close) to current vertex, it would lead to divisions by zero and NaN etc.
|
||||
@ -121,7 +121,7 @@ bool btSubsimplexConvexCast::calcTimeOfImpact(
|
||||
if (m_simplexSolver->closest(v))
|
||||
{
|
||||
dist2 = v.length2();
|
||||
hasResult = true;
|
||||
|
||||
//todo: check this normal for validity
|
||||
//n=v;
|
||||
//printf("V=%f , %f, %f\n",v[0],v[1],v[2]);
|
||||
|
Loading…
Reference in New Issue
Block a user