mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-27 23:35:45 +00:00
Bullet 2.82 update
This commit is contained in:
parent
d0a64026b0
commit
416c50690e
146 changed files with 12202 additions and 1422 deletions
|
|
@ -50,7 +50,9 @@ IF (INSTALL_LIBS)
|
|||
IF (APPLE AND BUILD_SHARED_LIBS AND FRAMEWORK)
|
||||
INSTALL(TARGETS BulletSoftBody DESTINATION .)
|
||||
ELSE (APPLE AND BUILD_SHARED_LIBS AND FRAMEWORK)
|
||||
INSTALL(TARGETS BulletSoftBody DESTINATION lib${LIB_SUFFIX})
|
||||
INSTALL(TARGETS BulletSoftBody RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION lib${LIB_SUFFIX}
|
||||
ARCHIVE DESTINATION lib${LIB_SUFFIX})
|
||||
INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
DESTINATION ${INCLUDE_INSTALL_DIR} FILES_MATCHING PATTERN "*.h" PATTERN
|
||||
".svn" EXCLUDE PATTERN "CMakeFiles" EXCLUDE)
|
||||
|
|
|
|||
|
|
@ -1767,7 +1767,23 @@ void btSoftBody::predictMotion(btScalar dt)
|
|||
{
|
||||
Node& n=m_nodes[i];
|
||||
n.m_q = n.m_x;
|
||||
n.m_v += n.m_f*n.m_im*m_sst.sdt;
|
||||
btVector3 deltaV = n.m_f*n.m_im*m_sst.sdt;
|
||||
{
|
||||
btScalar maxDisplacement = m_worldInfo->m_maxDisplacement;
|
||||
btScalar clampDeltaV = maxDisplacement/m_sst.sdt;
|
||||
for (int c=0;c<3;c++)
|
||||
{
|
||||
if (deltaV[c]>clampDeltaV)
|
||||
{
|
||||
deltaV[c] = clampDeltaV;
|
||||
}
|
||||
if (deltaV[c]<-clampDeltaV)
|
||||
{
|
||||
deltaV[c]=-clampDeltaV;
|
||||
}
|
||||
}
|
||||
}
|
||||
n.m_v += deltaV;
|
||||
n.m_x += n.m_v*m_sst.sdt;
|
||||
n.m_f = btVector3(0,0,0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ struct btSoftBodyWorldInfo
|
|||
btScalar air_density;
|
||||
btScalar water_density;
|
||||
btScalar water_offset;
|
||||
btScalar m_maxDisplacement;
|
||||
btVector3 water_normal;
|
||||
btBroadphaseInterface* m_broadphase;
|
||||
btDispatcher* m_dispatcher;
|
||||
|
|
@ -55,6 +56,7 @@ struct btSoftBodyWorldInfo
|
|||
:air_density((btScalar)1.2),
|
||||
water_density(0),
|
||||
water_offset(0),
|
||||
m_maxDisplacement(1000.f),//avoid soft body from 'exploding' so use some upper threshold of maximum motion that a node can travel per frame
|
||||
water_normal(0,0,0),
|
||||
m_broadphase(0),
|
||||
m_dispatcher(0),
|
||||
|
|
|
|||
|
|
@ -117,9 +117,9 @@ void btSoftBodyTriangleCallback::processTriangle(btVector3* triangle,int partId,
|
|||
//copy over user pointers to temporary shape
|
||||
tm->setUserPointer(m_triBody->getCollisionShape()->getUserPointer());
|
||||
|
||||
btCollisionObjectWrapper softBody(0,m_softBody->getCollisionShape(),m_softBody,m_softBody->getWorldTransform());
|
||||
btCollisionObjectWrapper softBody(0,m_softBody->getCollisionShape(),m_softBody,m_softBody->getWorldTransform(),-1,-1);
|
||||
//btCollisionObjectWrapper triBody(0,tm, ob, btTransform::getIdentity());//ob->getWorldTransform());//??
|
||||
btCollisionObjectWrapper triBody(0,tm, m_triBody, m_triBody->getWorldTransform());
|
||||
btCollisionObjectWrapper triBody(0,tm, m_triBody, m_triBody->getWorldTransform(),partId, triangleIndex);
|
||||
|
||||
btCollisionAlgorithm* colAlgo = ci.m_dispatcher1->findAlgorithm(&softBody,&triBody,0);//m_manifoldPtr);
|
||||
|
||||
|
|
@ -161,8 +161,8 @@ void btSoftBodyTriangleCallback::processTriangle(btVector3* triangle,int partId,
|
|||
tm->setUserPointer(m_triBody->getCollisionShape()->getUserPointer());
|
||||
|
||||
|
||||
btCollisionObjectWrapper softBody(0,m_softBody->getCollisionShape(),m_softBody,m_softBody->getWorldTransform());
|
||||
btCollisionObjectWrapper triBody(0,tm, m_triBody, m_triBody->getWorldTransform());//btTransform::getIdentity());//??
|
||||
btCollisionObjectWrapper softBody(0,m_softBody->getCollisionShape(),m_softBody,m_softBody->getWorldTransform(),-1,-1);
|
||||
btCollisionObjectWrapper triBody(0,tm, m_triBody, m_triBody->getWorldTransform(),partId, triangleIndex);//btTransform::getIdentity());//??
|
||||
|
||||
btCollisionAlgorithm* colAlgo = ci.m_dispatcher1->findAlgorithm(&softBody,&triBody,0);//m_manifoldPtr);
|
||||
|
||||
|
|
|
|||
|
|
@ -911,9 +911,9 @@ btSoftBody* btSoftBodyHelpers::CreateFromConvexHull(btSoftBodyWorldInfo& worldI
|
|||
&hres.m_OutputVertices[0],0);
|
||||
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]};
|
||||
const int idx[]={ static_cast<int>(hres.m_Indices[i*3+0]),
|
||||
static_cast<int>(hres.m_Indices[i*3+1]),
|
||||
static_cast<int>(hres.m_Indices[i*3+2])};
|
||||
if(idx[0]<idx[1]) psb->appendLink( idx[0],idx[1]);
|
||||
if(idx[1]<idx[2]) psb->appendLink( idx[1],idx[2]);
|
||||
if(idx[2]<idx[0]) psb->appendLink( idx[2],idx[0]);
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@ struct btSparseSdf
|
|||
btScalar voxelsz;
|
||||
int puid;
|
||||
int ncells;
|
||||
int m_clampCells;
|
||||
int nprobes;
|
||||
int nqueries;
|
||||
|
||||
|
|
@ -77,10 +78,13 @@ struct btSparseSdf
|
|||
//
|
||||
|
||||
//
|
||||
void Initialize(int hashsize=2383)
|
||||
void Initialize(int hashsize=2383, int clampCells = 256*1024)
|
||||
{
|
||||
//avoid a crash due to running out of memory, so clamp the maximum number of cells allocated
|
||||
//if this limit is reached, the SDF is reset (at the cost of some performance during the reset)
|
||||
m_clampCells = clampCells;
|
||||
cells.resize(hashsize,0);
|
||||
Reset();
|
||||
Reset();
|
||||
}
|
||||
//
|
||||
void Reset()
|
||||
|
|
@ -181,6 +185,15 @@ struct btSparseSdf
|
|||
{
|
||||
++nprobes;
|
||||
++ncells;
|
||||
int sz = sizeof(Cell);
|
||||
if (ncells>m_clampCells)
|
||||
{
|
||||
static int numResets=0;
|
||||
numResets++;
|
||||
// printf("numResets=%d\n",numResets);
|
||||
Reset();
|
||||
}
|
||||
|
||||
c=new Cell();
|
||||
c->next=root;root=c;
|
||||
c->pclient=shape;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue