40 #if (DBVT_MERGE_IMPL==DBVT_IMPL_SSE) 55 return( edges.
x()*edges.
y()*edges.
z()+
56 edges.
x()+edges.
y()+edges.
z());
66 }
else maxdepth=
btMax(maxdepth,depth);
162 }
while(0!=(prev=node->
parent));
201 return(prev?prev:pdbvt->
m_root);
252 while(begin!=end &&
leftOfAxis(leaves[begin],org,axis))
262 while(begin!=end && !
leftOfAxis(leaves[end-1],org,axis))
275 leaves[begin]=leaves[end];
287 #if DBVT_MERGE_IMPL==DBVT_IMPL_SSE 295 for(
int i=1,ni=count;i<ni;++i)
297 Merge(volume,leaves[i]->volume,volume);
310 int minidx[2]={-1,-1};
311 for(
int i=0;i<count;++i)
313 for(
int j=i+1;j<count;++j)
324 btDbvtNode* n[] = {leaves[minidx[0]],leaves[minidx[1]]};
330 leaves[minidx[0]] = p;
331 leaves[minidx[1]] = leaves[count-1];
348 if(count>bu_treshold)
355 int splitcount[3][2]={{0,0},{0,0},{0,0}};
357 for( i=0;i<count;++i)
362 ++splitcount[j][
btDot(x,axis[j])>0?1:0];
367 if((splitcount[i][0]>0)&&(splitcount[i][1]>0))
369 const int midp=(int)
btFabs(
btScalar(splitcount[i][0]-splitcount[i][1]));
379 partition=
split(leaves,count,org,axis[bestaxis]);
380 btAssert(partition!=0 && partition!=count);
387 node->
childs[0]=
topdown(pdbvt,&leaves[0],partition,bu_treshold);
388 node->
childs[1]=
topdown(pdbvt,&leaves[partition],count-partition,bu_treshold);
433 while(n&&(count--)) n=n->
parent;
492 m_root=
topdown(
this,&leaves[0],leaves.
size(),bu_treshold);
499 if(passes<0) passes=m_leaves;
500 if(m_root&&(passes>0))
507 node=
sort(node,m_root)->
childs[(m_opath>>bit)&1];
508 bit=(bit+1)&(
sizeof(
unsigned)*8-1);
533 for(
int i=0;(i<lookahead)&&root->
parent;++i)
550 for(
int i=0;(i<m_lkhd)&&root->
parent;++i)
601 enumNodes(m_root,nodes);
631 const int i=stack.
size()-1;
648 }
while(stack.
size()>0);
664 return(countLeaves(node->
childs[0])+countLeaves(node->
childs[1]));
674 extractLeaves(node->
childs[0],leaves);
675 extractLeaves(node->
childs[1],leaves);
684 #if DBVT_ENABLE_BENCHMARK 688 #include "LinearMath/btQuickProf.h" 725 struct btDbvtBenchmark
729 NilPolicy() : m_pcount(0),m_depth(-
SIMD_INFINITY),m_checksort(
true) {}
736 {
if(depth>=m_depth) m_depth=depth;
else printf(
"wrong depth: %f (should be >= %f)\r\n",depth,m_depth); }
755 static int sortfnc(
const Node& a,
const Node& b)
757 if(a.depth<b.depth)
return(+1);
758 if(a.depth>b.depth)
return(-1);
776 static int sortfnc(
const Node& a,
const Node& b)
778 if(a.depth<b.depth)
return(+1);
779 if(a.depth>b.depth)
return(-1);
791 return(
btVector3(RandUnit(),RandUnit(),RandUnit()));
795 return(RandVector3()*cs-
btVector3(cs,cs,cs)/2);
811 for(
int i=0;i<leaves;++i)
813 dbvt.
insert(RandVolume(cs,eb,es),0);
820 static const btScalar cfgVolumeCenterScale = 100;
821 static const btScalar cfgVolumeExentsBase = 1;
822 static const btScalar cfgVolumeExentsScale = 4;
823 static const int cfgLeaves = 8192;
824 static const bool cfgEnable =
true;
827 bool cfgBenchmark1_Enable = cfgEnable;
828 static const int cfgBenchmark1_Iterations = 8;
829 static const int cfgBenchmark1_Reference = 3499;
831 bool cfgBenchmark2_Enable = cfgEnable;
832 static const int cfgBenchmark2_Iterations = 4;
833 static const int cfgBenchmark2_Reference = 1945;
835 bool cfgBenchmark3_Enable = cfgEnable;
836 static const int cfgBenchmark3_Iterations = 512;
837 static const int cfgBenchmark3_Reference = 5485;
839 bool cfgBenchmark4_Enable = cfgEnable;
840 static const int cfgBenchmark4_Iterations = 512;
841 static const int cfgBenchmark4_Reference = 2814;
843 bool cfgBenchmark5_Enable = cfgEnable;
844 static const int cfgBenchmark5_Iterations = 512;
845 static const btScalar cfgBenchmark5_OffsetScale = 2;
846 static const int cfgBenchmark5_Reference = 7379;
848 bool cfgBenchmark6_Enable = cfgEnable;
849 static const int cfgBenchmark6_Iterations = 512;
850 static const btScalar cfgBenchmark6_OffsetScale = 2;
851 static const int cfgBenchmark6_Reference = 7270;
853 bool cfgBenchmark7_Enable = cfgEnable;
854 static const int cfgBenchmark7_Passes = 32;
855 static const int cfgBenchmark7_Iterations = 65536;
856 static const int cfgBenchmark7_Reference = 6307;
858 bool cfgBenchmark8_Enable = cfgEnable;
859 static const int cfgBenchmark8_Passes = 32;
860 static const int cfgBenchmark8_Iterations = 65536;
861 static const int cfgBenchmark8_Reference = 2105;
863 bool cfgBenchmark9_Enable = cfgEnable;
864 static const int cfgBenchmark9_Passes = 32;
865 static const int cfgBenchmark9_Iterations = 65536;
866 static const int cfgBenchmark9_Reference = 1879;
868 bool cfgBenchmark10_Enable = cfgEnable;
869 static const btScalar cfgBenchmark10_Scale = cfgVolumeCenterScale/10000;
870 static const int cfgBenchmark10_Passes = 32;
871 static const int cfgBenchmark10_Iterations = 65536;
872 static const int cfgBenchmark10_Reference = 1244;
874 bool cfgBenchmark11_Enable = cfgEnable;
875 static const int cfgBenchmark11_Passes = 64;
876 static const int cfgBenchmark11_Iterations = 65536;
877 static const int cfgBenchmark11_Reference = 2510;
879 bool cfgBenchmark12_Enable = cfgEnable;
880 static const int cfgBenchmark12_Iterations = 32;
881 static const int cfgBenchmark12_Reference = 3677;
883 bool cfgBenchmark13_Enable = cfgEnable;
884 static const int cfgBenchmark13_Iterations = 1024;
885 static const int cfgBenchmark13_Reference = 2231;
887 bool cfgBenchmark14_Enable = cfgEnable;
888 static const int cfgBenchmark14_Iterations = 8192;
889 static const int cfgBenchmark14_Reference = 3500;
891 bool cfgBenchmark15_Enable = cfgEnable;
892 static const int cfgBenchmark15_Iterations = 8192;
893 static const int cfgBenchmark15_Reference = 1151;
895 bool cfgBenchmark16_Enable = cfgEnable;
896 static const int cfgBenchmark16_BatchCount = 256;
897 static const int cfgBenchmark16_Passes = 16384;
898 static const int cfgBenchmark16_Reference = 5138;
900 bool cfgBenchmark17_Enable = cfgEnable;
901 static const int cfgBenchmark17_Iterations = 4;
902 static const int cfgBenchmark17_Reference = 3390;
905 printf(
"Benchmarking dbvt...\r\n");
906 printf(
"\tWorld scale: %f\r\n",cfgVolumeCenterScale);
907 printf(
"\tExtents base: %f\r\n",cfgVolumeExentsBase);
908 printf(
"\tExtents range: %f\r\n",cfgVolumeExentsScale);
909 printf(
"\tLeaves: %u\r\n",cfgLeaves);
910 printf(
"\tsizeof(btDbvtVolume): %u bytes\r\n",
sizeof(
btDbvtVolume));
911 printf(
"\tsizeof(btDbvtNode): %u bytes\r\n",
sizeof(
btDbvtNode));
912 if(cfgBenchmark1_Enable)
917 volumes.
resize(cfgLeaves);
918 results.
resize(cfgLeaves);
919 for(
int i=0;i<cfgLeaves;++i)
921 volumes[i]=btDbvtBenchmark::RandVolume(cfgVolumeCenterScale,cfgVolumeExentsBase,cfgVolumeExentsScale);
923 printf(
"[1] btDbvtVolume intersections: ");
925 for(
int i=0;i<cfgBenchmark1_Iterations;++i)
927 for(
int j=0;j<cfgLeaves;++j)
929 for(
int k=0;k<cfgLeaves;++k)
931 results[k]=
Intersect(volumes[j],volumes[k]);
936 printf(
"%u ms (%i%%)\r\n",time,(time-cfgBenchmark1_Reference)*100/time);
938 if(cfgBenchmark2_Enable)
943 volumes.
resize(cfgLeaves);
944 results.
resize(cfgLeaves);
945 for(
int i=0;i<cfgLeaves;++i)
947 volumes[i]=btDbvtBenchmark::RandVolume(cfgVolumeCenterScale,cfgVolumeExentsBase,cfgVolumeExentsScale);
949 printf(
"[2] btDbvtVolume merges: ");
951 for(
int i=0;i<cfgBenchmark2_Iterations;++i)
953 for(
int j=0;j<cfgLeaves;++j)
955 for(
int k=0;k<cfgLeaves;++k)
957 Merge(volumes[j],volumes[k],results[k]);
962 printf(
"%u ms (%i%%)\r\n",time,(time-cfgBenchmark2_Reference)*100/time);
964 if(cfgBenchmark3_Enable)
968 btDbvtBenchmark::NilPolicy policy;
969 btDbvtBenchmark::RandTree(cfgVolumeCenterScale,cfgVolumeExentsBase,cfgVolumeExentsScale,cfgLeaves,dbvt[0]);
970 btDbvtBenchmark::RandTree(cfgVolumeCenterScale,cfgVolumeExentsBase,cfgVolumeExentsScale,cfgLeaves,dbvt[1]);
973 printf(
"[3] btDbvt::collideTT: ");
975 for(
int i=0;i<cfgBenchmark3_Iterations;++i)
980 printf(
"%u ms (%i%%)\r\n",time,(time-cfgBenchmark3_Reference)*100/time);
982 if(cfgBenchmark4_Enable)
986 btDbvtBenchmark::NilPolicy policy;
987 btDbvtBenchmark::RandTree(cfgVolumeCenterScale,cfgVolumeExentsBase,cfgVolumeExentsScale,cfgLeaves,dbvt);
989 printf(
"[4] btDbvt::collideTT self: ");
991 for(
int i=0;i<cfgBenchmark4_Iterations;++i)
996 printf(
"%u ms (%i%%)\r\n",time,(time-cfgBenchmark4_Reference)*100/time);
998 if(cfgBenchmark5_Enable)
1003 btDbvtBenchmark::NilPolicy policy;
1004 transforms.
resize(cfgBenchmark5_Iterations);
1005 for(
int i=0;i<transforms.
size();++i)
1007 transforms[i]=btDbvtBenchmark::RandTransform(cfgVolumeCenterScale*cfgBenchmark5_OffsetScale);
1009 btDbvtBenchmark::RandTree(cfgVolumeCenterScale,cfgVolumeExentsBase,cfgVolumeExentsScale,cfgLeaves,dbvt[0]);
1010 btDbvtBenchmark::RandTree(cfgVolumeCenterScale,cfgVolumeExentsBase,cfgVolumeExentsScale,cfgLeaves,dbvt[1]);
1013 printf(
"[5] btDbvt::collideTT xform: ");
1015 for(
int i=0;i<cfgBenchmark5_Iterations;++i)
1020 printf(
"%u ms (%i%%)\r\n",time,(time-cfgBenchmark5_Reference)*100/time);
1022 if(cfgBenchmark6_Enable)
1027 btDbvtBenchmark::NilPolicy policy;
1028 transforms.
resize(cfgBenchmark6_Iterations);
1029 for(
int i=0;i<transforms.
size();++i)
1031 transforms[i]=btDbvtBenchmark::RandTransform(cfgVolumeCenterScale*cfgBenchmark6_OffsetScale);
1033 btDbvtBenchmark::RandTree(cfgVolumeCenterScale,cfgVolumeExentsBase,cfgVolumeExentsScale,cfgLeaves,dbvt);
1035 printf(
"[6] btDbvt::collideTT xform,self: ");
1037 for(
int i=0;i<cfgBenchmark6_Iterations;++i)
1042 printf(
"%u ms (%i%%)\r\n",time,(time-cfgBenchmark6_Reference)*100/time);
1044 if(cfgBenchmark7_Enable)
1050 btDbvtBenchmark::NilPolicy policy;
1051 rayorg.
resize(cfgBenchmark7_Iterations);
1052 raydir.
resize(cfgBenchmark7_Iterations);
1053 for(
int i=0;i<rayorg.
size();++i)
1055 rayorg[i]=btDbvtBenchmark::RandVector3(cfgVolumeCenterScale*2);
1056 raydir[i]=btDbvtBenchmark::RandVector3(cfgVolumeCenterScale*2);
1058 btDbvtBenchmark::RandTree(cfgVolumeCenterScale,cfgVolumeExentsBase,cfgVolumeExentsScale,cfgLeaves,dbvt);
1060 printf(
"[7] btDbvt::rayTest: ");
1062 for(
int i=0;i<cfgBenchmark7_Passes;++i)
1064 for(
int j=0;j<cfgBenchmark7_Iterations;++j)
1070 unsigned rays=cfgBenchmark7_Passes*cfgBenchmark7_Iterations;
1071 printf(
"%u ms (%i%%),(%u r/s)\r\n",time,(time-cfgBenchmark7_Reference)*100/time,(rays*1000)/time);
1073 if(cfgBenchmark8_Enable)
1077 btDbvtBenchmark::RandTree(cfgVolumeCenterScale,cfgVolumeExentsBase,cfgVolumeExentsScale,cfgLeaves,dbvt);
1079 printf(
"[8] insert/remove: ");
1081 for(
int i=0;i<cfgBenchmark8_Passes;++i)
1083 for(
int j=0;j<cfgBenchmark8_Iterations;++j)
1085 dbvt.
remove(dbvt.
insert(btDbvtBenchmark::RandVolume(cfgVolumeCenterScale,cfgVolumeExentsBase,cfgVolumeExentsScale),0));
1089 const int ir=cfgBenchmark8_Passes*cfgBenchmark8_Iterations;
1090 printf(
"%u ms (%i%%),(%u ir/s)\r\n",time,(time-cfgBenchmark8_Reference)*100/time,ir*1000/time);
1092 if(cfgBenchmark9_Enable)
1097 btDbvtBenchmark::RandTree(cfgVolumeCenterScale,cfgVolumeExentsBase,cfgVolumeExentsScale,cfgLeaves,dbvt);
1100 printf(
"[9] updates (teleport): ");
1102 for(
int i=0;i<cfgBenchmark9_Passes;++i)
1104 for(
int j=0;j<cfgBenchmark9_Iterations;++j)
1106 dbvt.
update(const_cast<btDbvtNode*>(leaves[rand()%cfgLeaves]),
1107 btDbvtBenchmark::RandVolume(cfgVolumeCenterScale,cfgVolumeExentsBase,cfgVolumeExentsScale));
1111 const int up=cfgBenchmark9_Passes*cfgBenchmark9_Iterations;
1112 printf(
"%u ms (%i%%),(%u u/s)\r\n",time,(time-cfgBenchmark9_Reference)*100/time,up*1000/time);
1114 if(cfgBenchmark10_Enable)
1120 vectors.
resize(cfgBenchmark10_Iterations);
1121 for(
int i=0;i<vectors.
size();++i)
1123 vectors[i]=(btDbvtBenchmark::RandVector3()*2-
btVector3(1,1,1))*cfgBenchmark10_Scale;
1125 btDbvtBenchmark::RandTree(cfgVolumeCenterScale,cfgVolumeExentsBase,cfgVolumeExentsScale,cfgLeaves,dbvt);
1128 printf(
"[10] updates (jitter): ");
1131 for(
int i=0;i<cfgBenchmark10_Passes;++i)
1133 for(
int j=0;j<cfgBenchmark10_Iterations;++j)
1142 const int up=cfgBenchmark10_Passes*cfgBenchmark10_Iterations;
1143 printf(
"%u ms (%i%%),(%u u/s)\r\n",time,(time-cfgBenchmark10_Reference)*100/time,up*1000/time);
1145 if(cfgBenchmark11_Enable)
1149 btDbvtBenchmark::RandTree(cfgVolumeCenterScale,cfgVolumeExentsBase,cfgVolumeExentsScale,cfgLeaves,dbvt);
1151 printf(
"[11] optimize (incremental): ");
1153 for(
int i=0;i<cfgBenchmark11_Passes;++i)
1158 const int op=cfgBenchmark11_Passes*cfgBenchmark11_Iterations;
1159 printf(
"%u ms (%i%%),(%u o/s)\r\n",time,(time-cfgBenchmark11_Reference)*100/time,op/time*1000);
1161 if(cfgBenchmark12_Enable)
1166 volumes.
resize(cfgLeaves);
1167 results.
resize(cfgLeaves);
1168 for(
int i=0;i<cfgLeaves;++i)
1170 volumes[i]=btDbvtBenchmark::RandVolume(cfgVolumeCenterScale,cfgVolumeExentsBase,cfgVolumeExentsScale);
1172 printf(
"[12] btDbvtVolume notequal: ");
1174 for(
int i=0;i<cfgBenchmark12_Iterations;++i)
1176 for(
int j=0;j<cfgLeaves;++j)
1178 for(
int k=0;k<cfgLeaves;++k)
1180 results[k]=
NotEqual(volumes[j],volumes[k]);
1185 printf(
"%u ms (%i%%)\r\n",time,(time-cfgBenchmark12_Reference)*100/time);
1187 if(cfgBenchmark13_Enable)
1192 btDbvtBenchmark::NilPolicy policy;
1193 vectors.
resize(cfgBenchmark13_Iterations);
1194 for(
int i=0;i<vectors.
size();++i)
1196 vectors[i]=(btDbvtBenchmark::RandVector3()*2-
btVector3(1,1,1)).normalized();
1198 btDbvtBenchmark::RandTree(cfgVolumeCenterScale,cfgVolumeExentsBase,cfgVolumeExentsScale,cfgLeaves,dbvt);
1200 printf(
"[13] culling(OCL+fullsort): ");
1202 for(
int i=0;i<cfgBenchmark13_Iterations;++i)
1209 const int t=cfgBenchmark13_Iterations;
1210 printf(
"%u ms (%i%%),(%u t/s)\r\n",time,(time-cfgBenchmark13_Reference)*100/time,(t*1000)/time);
1212 if(cfgBenchmark14_Enable)
1217 btDbvtBenchmark::P14 policy;
1218 vectors.
resize(cfgBenchmark14_Iterations);
1219 for(
int i=0;i<vectors.
size();++i)
1221 vectors[i]=(btDbvtBenchmark::RandVector3()*2-
btVector3(1,1,1)).normalized();
1223 btDbvtBenchmark::RandTree(cfgVolumeCenterScale,cfgVolumeExentsBase,cfgVolumeExentsScale,cfgLeaves,dbvt);
1225 policy.m_nodes.reserve(cfgLeaves);
1226 printf(
"[14] culling(OCL+qsort): ");
1228 for(
int i=0;i<cfgBenchmark14_Iterations;++i)
1231 policy.m_nodes.resize(0);
1232 dbvt.
collideOCL(dbvt.
m_root,&vectors[i],&offset,vectors[i],1,policy,
false);
1233 policy.m_nodes.quickSort(btDbvtBenchmark::P14::sortfnc);
1236 const int t=cfgBenchmark14_Iterations;
1237 printf(
"%u ms (%i%%),(%u t/s)\r\n",time,(time-cfgBenchmark14_Reference)*100/time,(t*1000)/time);
1239 if(cfgBenchmark15_Enable)
1244 btDbvtBenchmark::P15 policy;
1245 vectors.
resize(cfgBenchmark15_Iterations);
1246 for(
int i=0;i<vectors.
size();++i)
1248 vectors[i]=(btDbvtBenchmark::RandVector3()*2-
btVector3(1,1,1)).normalized();
1250 btDbvtBenchmark::RandTree(cfgVolumeCenterScale,cfgVolumeExentsBase,cfgVolumeExentsScale,cfgLeaves,dbvt);
1252 policy.m_nodes.reserve(cfgLeaves);
1253 printf(
"[15] culling(KDOP+qsort): ");
1255 for(
int i=0;i<cfgBenchmark15_Iterations;++i)
1258 policy.m_nodes.resize(0);
1259 policy.m_axis=vectors[i];
1261 policy.m_nodes.quickSort(btDbvtBenchmark::P15::sortfnc);
1264 const int t=cfgBenchmark15_Iterations;
1265 printf(
"%u ms (%i%%),(%u t/s)\r\n",time,(time-cfgBenchmark15_Reference)*100/time,(t*1000)/time);
1267 if(cfgBenchmark16_Enable)
1272 btDbvtBenchmark::RandTree(cfgVolumeCenterScale,cfgVolumeExentsBase,cfgVolumeExentsScale,cfgLeaves,dbvt);
1274 batch.
reserve(cfgBenchmark16_BatchCount);
1275 printf(
"[16] insert/remove batch(%u): ",cfgBenchmark16_BatchCount);
1277 for(
int i=0;i<cfgBenchmark16_Passes;++i)
1279 for(
int j=0;j<cfgBenchmark16_BatchCount;++j)
1281 batch.
push_back(dbvt.
insert(btDbvtBenchmark::RandVolume(cfgVolumeCenterScale,cfgVolumeExentsBase,cfgVolumeExentsScale),0));
1283 for(
int j=0;j<cfgBenchmark16_BatchCount;++j)
1290 const int ir=cfgBenchmark16_Passes*cfgBenchmark16_BatchCount;
1291 printf(
"%u ms (%i%%),(%u bir/s)\r\n",time,(time-cfgBenchmark16_Reference)*100/time,
int(ir*1000.0/time));
1293 if(cfgBenchmark17_Enable)
1299 volumes.
resize(cfgLeaves);
1300 results.
resize(cfgLeaves);
1301 indices.
resize(cfgLeaves);
1302 for(
int i=0;i<cfgLeaves;++i)
1305 volumes[i]=btDbvtBenchmark::RandVolume(cfgVolumeCenterScale,cfgVolumeExentsBase,cfgVolumeExentsScale);
1307 for(
int i=0;i<cfgLeaves;++i)
1309 btSwap(indices[i],indices[rand()%cfgLeaves]);
1311 printf(
"[17] btDbvtVolume select: ");
1313 for(
int i=0;i<cfgBenchmark17_Iterations;++i)
1315 for(
int j=0;j<cfgLeaves;++j)
1317 for(
int k=0;k<cfgLeaves;++k)
1319 const int idx=indices[k];
1320 results[idx]=
Select(volumes[idx],volumes[j],volumes[k]);
1325 printf(
"%u ms (%i%%)\r\n",time,(time-cfgBenchmark17_Reference)*100/time);
static DBVT_PREFIX void collideKDOP(const btDbvtNode *root, const btVector3 *normals, const btScalar *offsets, int count, DBVT_IPOLICY)
DBVT_INLINE void Merge(const btDbvtAabbMm &a, const btDbvtAabbMm &b, btDbvtAabbMm &r)
void push_back(const T &_Val)
DBVT_INLINE bool isleaf() const
static DBVT_PREFIX void collideOCL(const btDbvtNode *root, const btVector3 *normals, const btScalar *offsets, const btVector3 &sortaxis, int count, DBVT_IPOLICY, bool fullsort=true)
The btAlignedObjectArray template class uses a subset of the stl::vector interface for its methods It...
static void fetchleaves(btDbvt *pdbvt, btDbvtNode *root, tNodeArray &leaves, int depth=-1)
static bool leftOfAxis(const btDbvtNode *node, const btVector3 &org, const btVector3 &axis)
static void getmaxdepth(const btDbvtNode *node, int depth, int &maxdepth)
static void recursedeletenode(btDbvt *pdbvt, btDbvtNode *node)
static int split(btDbvtNode **leaves, int count, const btVector3 &org, const btVector3 &axis)
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
The btDbvt class implements a fast dynamic bounding volume tree based on axis aligned bounding boxes ...
btDbvtNode * insert(const btDbvtVolume &box, void *data)
The btClock is a portable basic clock that measures accurate time in seconds, use for profiling...
virtual void WriteNode(const btDbvtNode *, int index, int parent, int child0, int child1)=0
void reset()
Resets the initial reference time.
static DBVT_PREFIX void rayTest(const btDbvtNode *root, const btVector3 &rayFrom, const btVector3 &rayTo, DBVT_IPOLICY)
rayTest is a re-entrant ray test, and can be called in parallel as long as the btAlignedAlloc is thre...
static btDbvtNode * topdown(btDbvt *pdbvt, btDbvtNode **leaves, int count, int bu_treshold)
DBVT_INLINE int Select(const btDbvtAabbMm &o, const btDbvtAabbMm &a, const btDbvtAabbMm &b)
DBVT_INLINE bool isinternal() const
void Process(const btDbvtNode *n)
const btScalar & x() const
Return the x value.
void update(btDbvtNode *leaf, int lookahead=-1)
btAlignedObjectArray< const btDbvtNode * > tConstNodeArray
static int countLeaves(const btDbvtNode *node)
int size() const
return the number of elements in the array
void optimizeIncremental(int passes)
static DBVT_INLINE btDbvtNode * createnode(btDbvt *pdbvt, btDbvtNode *parent, void *data)
static btDbvtAabbMm FromCE(const btVector3 &c, const btVector3 &e)
static DBVT_INLINE btDbvtVolume merge(const btDbvtVolume &a, const btDbvtVolume &b)
static int maxdepth(const btDbvtNode *node)
static btDbvtAabbMm FromMM(const btVector3 &mi, const btVector3 &mx)
DBVT_INLINE btVector3 Lengths() const
static void insertleaf(btDbvt *pdbvt, btDbvtNode *root, btDbvtNode *leaf)
#define btAlignedFree(ptr)
DBVT_INLINE btVector3 Center() const
DBVT_INLINE void Expand(const btVector3 &e)
void optimizeTopDown(int bu_treshold=128)
const btScalar & y() const
Return the y value.
btVector3 can be used to represent 3D points and vectors.
#define ATTRIBUTE_ALIGNED16(a)
DBVT_INLINE const btVector3 & Maxs() const
unsigned long long int getTimeMilliseconds()
Returns the time in ms since the last call to reset or since the btClock was created.
void write(IWriter *iwriter) const
virtual void Prepare(const btDbvtNode *root, int numnodes)=0
static void clear(T &value)
void resize(int newsize, const T &fillData=T())
int findLinearSearch(const T &key) const
virtual void WriteLeaf(const btDbvtNode *, int index, int parent)=0
static btDbvtNode * removeleaf(btDbvt *pdbvt, btDbvtNode *leaf)
const T & btMax(const T &a, const T &b)
static void extractLeaves(const btDbvtNode *node, btAlignedObjectArray< const btDbvtNode * > &leaves)
DBVT_INLINE bool Intersect(const btDbvtAabbMm &a, const btDbvtAabbMm &b)
#define btAlignedAlloc(size, alignment)
static btDbvtVolume bounds(btDbvtNode **leaves, int count)
static DBVT_INLINE int indexof(const btDbvtNode *node)
btScalar dot(const btQuaternion &q1, const btQuaternion &q2)
Calculate the dot product between two quaternions.
btAlignedObjectArray< btDbvtNode * > tNodeArray
btDbvt implementation by Nathanael Presson
DBVT_PREFIX void collideTT(const btDbvtNode *root0, const btDbvtNode *root1, DBVT_IPOLICY)
The btQuaternion implements quaternion to perform linear algebra rotations in combination with btMatr...
btScalar btDot(const btVector3 &v1, const btVector3 &v2)
Return the dot product between two vectors.
static DBVT_INLINE void deletenode(btDbvt *pdbvt, btDbvtNode *node)
DBVT_INLINE bool Contain(const btDbvtAabbMm &a) const
DBVT_INLINE const btVector3 & Mins() const
DBVT_INLINE void SignedExpand(const btVector3 &e)
static DBVT_INLINE btDbvtNode * sort(btDbvtNode *n, btDbvtNode *&r)
void clone(btDbvt &dest, IClone *iclone=0) const
void remove(btDbvtNode *leaf)
static void bottomup(btDbvt *pdbvt, btDbvtNode **leaves, int count)
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
virtual void CloneLeaf(btDbvtNode *)
DBVT_INLINE bool NotEqual(const btDbvtAabbMm &a, const btDbvtAabbMm &b)
btScalar btFabs(btScalar x)
const btScalar & z() const
Return the z value.