DbvtBroadphase, fixed slow initialization issue.

This commit is contained in:
id0x1234
2008-09-11 11:41:10 +00:00
parent 147b6c8975
commit afcfcb0a5d
2 changed files with 9 additions and 2 deletions

View File

@@ -114,7 +114,8 @@ void Process(const btDbvtNode* na,const btDbvtNode* nb)
// //
btDbvtBroadphase::btDbvtBroadphase(btOverlappingPairCache* paircache) btDbvtBroadphase::btDbvtBroadphase(btOverlappingPairCache* paircache)
{ {
m_deferedcollide = false; m_initialize = true;
m_deferedcollide = true;
m_releasepaircache = (paircache!=0)?false:true; m_releasepaircache = (paircache!=0)?false:true;
m_predictedframes = 15; m_predictedframes = 15;
m_stageCurrent = 0; m_stageCurrent = 0;
@@ -317,7 +318,7 @@ if(current)
btBroadphasePair& p=pairs[(m_cid+i)%ci]; btBroadphasePair& p=pairs[(m_cid+i)%ci];
btDbvtProxy* pa=(btDbvtProxy*)p.m_pProxy0; btDbvtProxy* pa=(btDbvtProxy*)p.m_pProxy0;
btDbvtProxy* pb=(btDbvtProxy*)p.m_pProxy1; btDbvtProxy* pb=(btDbvtProxy*)p.m_pProxy1;
if((pa->stage==0)||(pb->stage==0)) //if((pa->stage==0)||(pb->stage==0))
{ {
if(!Intersect(pa->leaf->volume,pb->leaf->volume)) if(!Intersect(pa->leaf->volume,pb->leaf->volume))
{ {
@@ -340,6 +341,11 @@ if(m_updates_call>0)
{ m_updates_ratio=0; } { m_updates_ratio=0; }
m_updates_done/=2; m_updates_done/=2;
m_updates_call/=2; m_updates_call/=2;
if(m_initialize)
{
m_initialize=false;
m_deferedcollide=false;
}
} }
// //

View File

@@ -82,6 +82,7 @@ int m_cid; // Cleanup index
int m_gid; // Gen id int m_gid; // Gen id
bool m_releasepaircache; // Release pair cache on delete bool m_releasepaircache; // Release pair cache on delete
bool m_deferedcollide; // Defere dynamic/static collision to collide call bool m_deferedcollide; // Defere dynamic/static collision to collide call
bool m_initialize; // Initialization
#if DBVT_BP_PROFILE #if DBVT_BP_PROFILE
btClock m_clock; btClock m_clock;
struct { struct {