Bullet Collision Detection & Physics Library
btCollisionWorldImporter.cpp
Go to the documentation of this file.
1 /*
2 Bullet Continuous Collision Detection and Physics Library
3 Copyright (c) 2003-2014 Erwin Coumans http://bulletphysics.org
4 
5 This software is provided 'as-is', without any express or implied warranty.
6 In no event will the authors be held liable for any damages arising from the use of this software.
7 Permission is granted to anyone to use this software for any purpose,
8 including commercial applications, and to alter it and redistribute it freely,
9 subject to the following restrictions:
10 
11 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
12 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
13 3. This notice may not be removed or altered from any source distribution.
14 */
15 
18 #include "LinearMath/btSerializer.h" //for btBulletSerializedArrays definition
19 
20 #ifdef SUPPORT_GIMPACT_SHAPE_IMPORT
22 #endif //SUPPORT_GIMPACT_SHAPE_IMPORT
23 
25  : m_collisionWorld(world),
26  m_verboseMode(0)
27 {
28 }
29 
31 {
32 }
33 
35 {
36  m_shapeMap.clear();
37  m_bodyMap.clear();
38 
39  int i;
40 
41  for (i = 0; i < arrays->m_bvhsDouble.size(); i++)
42  {
44  btQuantizedBvhDoubleData* bvhData = arrays->m_bvhsDouble[i];
45  bvh->deSerializeDouble(*bvhData);
46  m_bvhMap.insert(arrays->m_bvhsDouble[i], bvh);
47  }
48  for (i = 0; i < arrays->m_bvhsFloat.size(); i++)
49  {
51  btQuantizedBvhFloatData* bvhData = arrays->m_bvhsFloat[i];
52  bvh->deSerializeFloat(*bvhData);
53  m_bvhMap.insert(arrays->m_bvhsFloat[i], bvh);
54  }
55 
56  for (i = 0; i < arrays->m_colShapeData.size(); i++)
57  {
58  btCollisionShapeData* shapeData = arrays->m_colShapeData[i];
59  btCollisionShape* shape = convertCollisionShape(shapeData);
60  if (shape)
61  {
62  // printf("shapeMap.insert(%x,%x)\n",shapeData,shape);
63  m_shapeMap.insert(shapeData, shape);
64  }
65 
66  if (shape && shapeData->m_name)
67  {
68  char* newname = duplicateName(shapeData->m_name);
69  m_objectNameMap.insert(shape, newname);
70  m_nameShapeMap.insert(newname, shape);
71  }
72  }
73 
74  for (i = 0; i < arrays->m_collisionObjectDataDouble.size(); i++)
75  {
77  btCollisionShape** shapePtr = m_shapeMap.find(colObjData->m_collisionShape);
78  if (shapePtr && *shapePtr)
79  {
80  btTransform startTransform;
81  colObjData->m_worldTransform.m_origin.m_floats[3] = 0.f;
82  startTransform.deSerializeDouble(colObjData->m_worldTransform);
83 
84  btCollisionShape* shape = (btCollisionShape*)*shapePtr;
85  btCollisionObject* body = createCollisionObject(startTransform, shape, colObjData->m_name);
86  body->setFriction(btScalar(colObjData->m_friction));
87  body->setRestitution(btScalar(colObjData->m_restitution));
88 
89 #ifdef USE_INTERNAL_EDGE_UTILITY
91  {
93  if (trimesh->getTriangleInfoMap())
94  {
96  }
97  }
98 #endif //USE_INTERNAL_EDGE_UTILITY
99  m_bodyMap.insert(colObjData, body);
100  }
101  else
102  {
103  printf("error: no shape found\n");
104  }
105  }
106  for (i = 0; i < arrays->m_collisionObjectDataFloat.size(); i++)
107  {
109  btCollisionShape** shapePtr = m_shapeMap.find(colObjData->m_collisionShape);
110  if (shapePtr && *shapePtr)
111  {
112  btTransform startTransform;
113  colObjData->m_worldTransform.m_origin.m_floats[3] = 0.f;
114  startTransform.deSerializeFloat(colObjData->m_worldTransform);
115 
116  btCollisionShape* shape = (btCollisionShape*)*shapePtr;
117  btCollisionObject* body = createCollisionObject(startTransform, shape, colObjData->m_name);
118 
119 #ifdef USE_INTERNAL_EDGE_UTILITY
121  {
123  if (trimesh->getTriangleInfoMap())
124  {
126  }
127  }
128 #endif //USE_INTERNAL_EDGE_UTILITY
129  m_bodyMap.insert(colObjData, body);
130  }
131  else
132  {
133  printf("error: no shape found\n");
134  }
135  }
136 
137  return true;
138 }
139 
141 {
142  int i;
143 
144  for (i = 0; i < m_allocatedCollisionObjects.size(); i++)
145  {
146  if (m_collisionWorld)
148  delete m_allocatedCollisionObjects[i];
149  }
150 
152 
153  for (i = 0; i < m_allocatedCollisionShapes.size(); i++)
154  {
155  delete m_allocatedCollisionShapes[i];
156  }
158 
159  for (i = 0; i < m_allocatedBvhs.size(); i++)
160  {
161  delete m_allocatedBvhs[i];
162  }
164 
165  for (i = 0; i < m_allocatedTriangleInfoMaps.size(); i++)
166  {
167  delete m_allocatedTriangleInfoMaps[i];
168  }
170  for (i = 0; i < m_allocatedTriangleIndexArrays.size(); i++)
171  {
173  }
175  for (i = 0; i < m_allocatedNames.size(); i++)
176  {
177  delete[] m_allocatedNames[i];
178  }
180 
181  for (i = 0; i < m_allocatedbtStridingMeshInterfaceDatas.size(); i++)
182  {
184 
185  for (int a = 0; a < curData->m_numMeshParts; a++)
186  {
187  btMeshPartData* curPart = &curData->m_meshPartsPtr[a];
188  if (curPart->m_vertices3f)
189  delete[] curPart->m_vertices3f;
190 
191  if (curPart->m_vertices3d)
192  delete[] curPart->m_vertices3d;
193 
194  if (curPart->m_indices32)
195  delete[] curPart->m_indices32;
196 
197  if (curPart->m_3indices16)
198  delete[] curPart->m_3indices16;
199 
200  if (curPart->m_indices16)
201  delete[] curPart->m_indices16;
202 
203  if (curPart->m_3indices8)
204  delete[] curPart->m_3indices8;
205  }
206  delete[] curData->m_meshPartsPtr;
207  delete curData;
208  }
210 
211  for (i = 0; i < m_indexArrays.size(); i++)
212  {
214  }
216 
217  for (i = 0; i < m_shortIndexArrays.size(); i++)
218  {
220  }
222 
223  for (i = 0; i < m_charIndexArrays.size(); i++)
224  {
226  }
228 
229  for (i = 0; i < m_floatVertexArrays.size(); i++)
230  {
232  }
234 
235  for (i = 0; i < m_doubleVertexArrays.size(); i++)
236  {
238  }
240 }
241 
243 {
244  btCollisionShape* shape = 0;
245 
246  switch (shapeData->m_shapeType)
247  {
249  {
250  btStaticPlaneShapeData* planeData = (btStaticPlaneShapeData*)shapeData;
251  btVector3 planeNormal, localScaling;
252  planeNormal.deSerializeFloat(planeData->m_planeNormal);
253  localScaling.deSerializeFloat(planeData->m_localScaling);
254  shape = createPlaneShape(planeNormal, planeData->m_planeConstant);
255  shape->setLocalScaling(localScaling);
256 
257  break;
258  }
260  {
262  btCollisionShapeData* colShapeData = (btCollisionShapeData*)&scaledMesh->m_trimeshShapeData;
264  btCollisionShape* childShape = convertCollisionShape(colShapeData);
265  btBvhTriangleMeshShape* meshShape = (btBvhTriangleMeshShape*)childShape;
266  btVector3 localScaling;
267  localScaling.deSerializeFloat(scaledMesh->m_localScaling);
268 
269  shape = createScaledTrangleMeshShape(meshShape, localScaling);
270  break;
271  }
272 #ifdef SUPPORT_GIMPACT_SHAPE_IMPORT
274  {
275  btGImpactMeshShapeData* gimpactData = (btGImpactMeshShapeData*)shapeData;
276  if (gimpactData->m_gimpactSubType == CONST_GIMPACT_TRIMESH_SHAPE)
277  {
279  btTriangleIndexVertexArray* meshInterface = createMeshInterface(*interfaceData);
280 
281  btGImpactMeshShape* gimpactShape = createGimpactShape(meshInterface);
282  btVector3 localScaling;
283  localScaling.deSerializeFloat(gimpactData->m_localScaling);
284  gimpactShape->setLocalScaling(localScaling);
285  gimpactShape->setMargin(btScalar(gimpactData->m_collisionMargin));
286  gimpactShape->updateBound();
287  shape = gimpactShape;
288  }
289  else
290  {
291  printf("unsupported gimpact sub type\n");
292  }
293  break;
294  }
295 #endif //SUPPORT_GIMPACT_SHAPE_IMPORT \
296  //The btCapsuleShape* API has issue passing the margin/scaling/halfextents unmodified through the API \
297  //so deal with this
299  {
300  btCapsuleShapeData* capData = (btCapsuleShapeData*)shapeData;
301 
302  switch (capData->m_upAxis)
303  {
304  case 0:
305  {
306  shape = createCapsuleShapeX(1, 1);
307  break;
308  }
309  case 1:
310  {
311  shape = createCapsuleShapeY(1, 1);
312  break;
313  }
314  case 2:
315  {
316  shape = createCapsuleShapeZ(1, 1);
317  break;
318  }
319  default:
320  {
321  printf("error: wrong up axis for btCapsuleShape\n");
322  }
323  };
324  if (shape)
325  {
326  btCapsuleShape* cap = (btCapsuleShape*)shape;
327  cap->deSerializeFloat(capData);
328  }
329  break;
330  }
333  case BOX_SHAPE_PROXYTYPE:
337  {
339  btVector3 implicitShapeDimensions;
340  implicitShapeDimensions.deSerializeFloat(bsd->m_implicitShapeDimensions);
341  btVector3 localScaling;
342  localScaling.deSerializeFloat(bsd->m_localScaling);
344  switch (shapeData->m_shapeType)
345  {
346  case BOX_SHAPE_PROXYTYPE:
347  {
348  btBoxShape* box = (btBoxShape*)createBoxShape(implicitShapeDimensions / localScaling + margin);
349  //box->initializePolyhedralFeatures();
350  shape = box;
351 
352  break;
353  }
355  {
356  shape = createSphereShape(implicitShapeDimensions.getX());
357  break;
358  }
359 
361  {
362  btCylinderShapeData* cylData = (btCylinderShapeData*)shapeData;
363  btVector3 halfExtents = implicitShapeDimensions + margin;
364  switch (cylData->m_upAxis)
365  {
366  case 0:
367  {
368  shape = createCylinderShapeX(halfExtents.getY(), halfExtents.getX());
369  break;
370  }
371  case 1:
372  {
373  shape = createCylinderShapeY(halfExtents.getX(), halfExtents.getY());
374  break;
375  }
376  case 2:
377  {
378  shape = createCylinderShapeZ(halfExtents.getX(), halfExtents.getZ());
379  break;
380  }
381  default:
382  {
383  printf("unknown Cylinder up axis\n");
384  }
385  };
386 
387  break;
388  }
390  {
391  btConeShapeData* conData = (btConeShapeData*)shapeData;
392  btVector3 halfExtents = implicitShapeDimensions; //+margin;
393  switch (conData->m_upIndex)
394  {
395  case 0:
396  {
397  shape = createConeShapeX(halfExtents.getY(), halfExtents.getX());
398  break;
399  }
400  case 1:
401  {
402  shape = createConeShapeY(halfExtents.getX(), halfExtents.getY());
403  break;
404  }
405  case 2:
406  {
407  shape = createConeShapeZ(halfExtents.getX(), halfExtents.getZ());
408  break;
409  }
410  default:
411  {
412  printf("unknown Cone up axis\n");
413  }
414  };
415 
416  break;
417  }
419  {
421  int numSpheres = mss->m_localPositionArraySize;
422 
425  radii.resize(numSpheres);
426  tmpPos.resize(numSpheres);
427  int i;
428  for (i = 0; i < numSpheres; i++)
429  {
430  tmpPos[i].deSerializeFloat(mss->m_localPositionArrayPtr[i].m_pos);
431  radii[i] = mss->m_localPositionArrayPtr[i].m_radius;
432  }
433  shape = createMultiSphereShape(&tmpPos[0], &radii[0], numSpheres);
434  break;
435  }
437  {
438  // int sz = sizeof(btConvexHullShapeData);
439  // int sz2 = sizeof(btConvexInternalShapeData);
440  // int sz3 = sizeof(btCollisionShapeData);
441  btConvexHullShapeData* convexData = (btConvexHullShapeData*)bsd;
442  int numPoints = convexData->m_numUnscaledPoints;
443 
445  tmpPoints.resize(numPoints);
446  int i;
447  for (i = 0; i < numPoints; i++)
448  {
449 #ifdef BT_USE_DOUBLE_PRECISION
450  if (convexData->m_unscaledPointsDoublePtr)
451  tmpPoints[i].deSerialize(convexData->m_unscaledPointsDoublePtr[i]);
452  if (convexData->m_unscaledPointsFloatPtr)
453  tmpPoints[i].deSerializeFloat(convexData->m_unscaledPointsFloatPtr[i]);
454 #else
455  if (convexData->m_unscaledPointsFloatPtr)
456  tmpPoints[i].deSerialize(convexData->m_unscaledPointsFloatPtr[i]);
457  if (convexData->m_unscaledPointsDoublePtr)
458  tmpPoints[i].deSerializeDouble(convexData->m_unscaledPointsDoublePtr[i]);
459 #endif //BT_USE_DOUBLE_PRECISION
460  }
462  for (i = 0; i < numPoints; i++)
463  {
464  hullShape->addPoint(tmpPoints[i]);
465  }
466  hullShape->setMargin(bsd->m_collisionMargin);
467  //hullShape->initializePolyhedralFeatures();
468  shape = hullShape;
469  break;
470  }
471  default:
472  {
473  printf("error: cannot create shape type (%d)\n", shapeData->m_shapeType);
474  }
475  }
476 
477  if (shape)
478  {
479  shape->setMargin(bsd->m_collisionMargin);
480 
481  btVector3 localScaling;
482  localScaling.deSerializeFloat(bsd->m_localScaling);
483  shape->setLocalScaling(localScaling);
484  }
485  break;
486  }
488  {
489  btTriangleMeshShapeData* trimesh = (btTriangleMeshShapeData*)shapeData;
491  btTriangleIndexVertexArray* meshInterface = createMeshInterface(*interfaceData);
492  if (!meshInterface->getNumSubParts())
493  {
494  return 0;
495  }
496 
497  btVector3 scaling;
498  scaling.deSerializeFloat(trimesh->m_meshInterface.m_scaling);
499  meshInterface->setScaling(scaling);
500 
501  btOptimizedBvh* bvh = 0;
502 #if 1
503  if (trimesh->m_quantizedFloatBvh)
504  {
505  btOptimizedBvh** bvhPtr = m_bvhMap.find(trimesh->m_quantizedFloatBvh);
506  if (bvhPtr && *bvhPtr)
507  {
508  bvh = *bvhPtr;
509  }
510  else
511  {
512  bvh = createOptimizedBvh();
513  bvh->deSerializeFloat(*trimesh->m_quantizedFloatBvh);
514  }
515  }
516  if (trimesh->m_quantizedDoubleBvh)
517  {
518  btOptimizedBvh** bvhPtr = m_bvhMap.find(trimesh->m_quantizedDoubleBvh);
519  if (bvhPtr && *bvhPtr)
520  {
521  bvh = *bvhPtr;
522  }
523  else
524  {
525  bvh = createOptimizedBvh();
526  bvh->deSerializeDouble(*trimesh->m_quantizedDoubleBvh);
527  }
528  }
529 #endif
530 
531  btBvhTriangleMeshShape* trimeshShape = createBvhTriangleMeshShape(meshInterface, bvh);
532  trimeshShape->setMargin(trimesh->m_collisionMargin);
533  shape = trimeshShape;
534 
535  if (trimesh->m_triangleInfoMap)
536  {
538  map->deSerialize(*trimesh->m_triangleInfoMap);
539  trimeshShape->setTriangleInfoMap(map);
540 
541 #ifdef USE_INTERNAL_EDGE_UTILITY
542  gContactAddedCallback = btAdjustInternalEdgeContactsCallback;
543 #endif //USE_INTERNAL_EDGE_UTILITY
544  }
545 
546  //printf("trimesh->m_collisionMargin=%f\n",trimesh->m_collisionMargin);
547  break;
548  }
550  {
551  btCompoundShapeData* compoundData = (btCompoundShapeData*)shapeData;
552  btCompoundShape* compoundShape = createCompoundShape();
553 
554  //btCompoundShapeChildData* childShapeDataArray = &compoundData->m_childShapePtr[0];
555 
557  for (int i = 0; i < compoundData->m_numChildShapes; i++)
558  {
559  //btCompoundShapeChildData* ptr = &compoundData->m_childShapePtr[i];
560 
561  btCollisionShapeData* cd = compoundData->m_childShapePtr[i].m_childShape;
562 
563  btCollisionShape* childShape = convertCollisionShape(cd);
564  if (childShape)
565  {
566  btTransform localTransform;
567  localTransform.deSerializeFloat(compoundData->m_childShapePtr[i].m_transform);
568  compoundShape->addChildShape(localTransform, childShape);
569  }
570  else
571  {
572 #ifdef _DEBUG
573  printf("error: couldn't create childShape for compoundShape\n");
574 #endif
575  }
576  }
577  shape = compoundShape;
578 
579  break;
580  }
582  {
583  return 0;
584  }
585  default:
586  {
587 #ifdef _DEBUG
588  printf("unsupported shape type (%d)\n", shapeData->m_shapeType);
589 #endif
590  }
591  }
592 
593  return shape;
594 }
595 
597 {
598  if (name)
599  {
600  int l = (int)strlen(name);
601  char* newName = new char[l + 1];
602  memcpy(newName, name, l);
603  newName[l] = 0;
604  m_allocatedNames.push_back(newName);
605  return newName;
606  }
607  return 0;
608 }
609 
611 {
613 
614  for (int i = 0; i < meshData.m_numMeshParts; i++)
615  {
616  btIndexedMesh meshPart;
617  meshPart.m_numTriangles = meshData.m_meshPartsPtr[i].m_numTriangles;
618  meshPart.m_numVertices = meshData.m_meshPartsPtr[i].m_numVertices;
619 
620  if (meshData.m_meshPartsPtr[i].m_indices32)
621  {
622  meshPart.m_indexType = PHY_INTEGER;
623  meshPart.m_triangleIndexStride = 3 * sizeof(int);
624  int* indexArray = (int*)btAlignedAlloc(sizeof(int) * 3 * meshPart.m_numTriangles, 16);
625  m_indexArrays.push_back(indexArray);
626  for (int j = 0; j < 3 * meshPart.m_numTriangles; j++)
627  {
628  indexArray[j] = meshData.m_meshPartsPtr[i].m_indices32[j].m_value;
629  }
630  meshPart.m_triangleIndexBase = (const unsigned char*)indexArray;
631  }
632  else
633  {
634  if (meshData.m_meshPartsPtr[i].m_3indices16)
635  {
636  meshPart.m_indexType = PHY_SHORT;
637  meshPart.m_triangleIndexStride = sizeof(short int) * 3; //sizeof(btShortIntIndexTripletData);
638 
639  short int* indexArray = (short int*)btAlignedAlloc(sizeof(short int) * 3 * meshPart.m_numTriangles, 16);
640  m_shortIndexArrays.push_back(indexArray);
641 
642  for (int j = 0; j < meshPart.m_numTriangles; j++)
643  {
644  indexArray[3 * j] = meshData.m_meshPartsPtr[i].m_3indices16[j].m_values[0];
645  indexArray[3 * j + 1] = meshData.m_meshPartsPtr[i].m_3indices16[j].m_values[1];
646  indexArray[3 * j + 2] = meshData.m_meshPartsPtr[i].m_3indices16[j].m_values[2];
647  }
648 
649  meshPart.m_triangleIndexBase = (const unsigned char*)indexArray;
650  }
651  if (meshData.m_meshPartsPtr[i].m_indices16)
652  {
653  meshPart.m_indexType = PHY_SHORT;
654  meshPart.m_triangleIndexStride = 3 * sizeof(short int);
655  short int* indexArray = (short int*)btAlignedAlloc(sizeof(short int) * 3 * meshPart.m_numTriangles, 16);
656  m_shortIndexArrays.push_back(indexArray);
657  for (int j = 0; j < 3 * meshPart.m_numTriangles; j++)
658  {
659  indexArray[j] = meshData.m_meshPartsPtr[i].m_indices16[j].m_value;
660  }
661 
662  meshPart.m_triangleIndexBase = (const unsigned char*)indexArray;
663  }
664 
665  if (meshData.m_meshPartsPtr[i].m_3indices8)
666  {
667  meshPart.m_indexType = PHY_UCHAR;
668  meshPart.m_triangleIndexStride = sizeof(unsigned char) * 3;
669 
670  unsigned char* indexArray = (unsigned char*)btAlignedAlloc(sizeof(unsigned char) * 3 * meshPart.m_numTriangles, 16);
671  m_charIndexArrays.push_back(indexArray);
672 
673  for (int j = 0; j < meshPart.m_numTriangles; j++)
674  {
675  indexArray[3 * j] = meshData.m_meshPartsPtr[i].m_3indices8[j].m_values[0];
676  indexArray[3 * j + 1] = meshData.m_meshPartsPtr[i].m_3indices8[j].m_values[1];
677  indexArray[3 * j + 2] = meshData.m_meshPartsPtr[i].m_3indices8[j].m_values[2];
678  }
679 
680  meshPart.m_triangleIndexBase = (const unsigned char*)indexArray;
681  }
682  }
683 
684  if (meshData.m_meshPartsPtr[i].m_vertices3f)
685  {
686  meshPart.m_vertexType = PHY_FLOAT;
687  meshPart.m_vertexStride = sizeof(btVector3FloatData);
689  m_floatVertexArrays.push_back(vertices);
690 
691  for (int j = 0; j < meshPart.m_numVertices; j++)
692  {
693  vertices[j].m_floats[0] = meshData.m_meshPartsPtr[i].m_vertices3f[j].m_floats[0];
694  vertices[j].m_floats[1] = meshData.m_meshPartsPtr[i].m_vertices3f[j].m_floats[1];
695  vertices[j].m_floats[2] = meshData.m_meshPartsPtr[i].m_vertices3f[j].m_floats[2];
696  vertices[j].m_floats[3] = meshData.m_meshPartsPtr[i].m_vertices3f[j].m_floats[3];
697  }
698  meshPart.m_vertexBase = (const unsigned char*)vertices;
699  }
700  else
701  {
702  meshPart.m_vertexType = PHY_DOUBLE;
703  meshPart.m_vertexStride = sizeof(btVector3DoubleData);
704 
707 
708  for (int j = 0; j < meshPart.m_numVertices; j++)
709  {
710  vertices[j].m_floats[0] = meshData.m_meshPartsPtr[i].m_vertices3d[j].m_floats[0];
711  vertices[j].m_floats[1] = meshData.m_meshPartsPtr[i].m_vertices3d[j].m_floats[1];
712  vertices[j].m_floats[2] = meshData.m_meshPartsPtr[i].m_vertices3d[j].m_floats[2];
713  vertices[j].m_floats[3] = meshData.m_meshPartsPtr[i].m_vertices3d[j].m_floats[3];
714  }
715  meshPart.m_vertexBase = (const unsigned char*)vertices;
716  }
717 
718  if (meshPart.m_triangleIndexBase && meshPart.m_vertexBase)
719  {
720  meshInterface->addIndexedMesh(meshPart, meshPart.m_indexType);
721  }
722  }
723 
724  return meshInterface;
725 }
726 
728 {
729  //create a new btStridingMeshInterfaceData that is an exact copy of shapedata and store it in the WorldImporter
731 
732  newData->m_scaling = interfaceData->m_scaling;
733  newData->m_numMeshParts = interfaceData->m_numMeshParts;
734  newData->m_meshPartsPtr = new btMeshPartData[newData->m_numMeshParts];
735 
736  for (int i = 0; i < newData->m_numMeshParts; i++)
737  {
738  btMeshPartData* curPart = &interfaceData->m_meshPartsPtr[i];
739  btMeshPartData* curNewPart = &newData->m_meshPartsPtr[i];
740 
741  curNewPart->m_numTriangles = curPart->m_numTriangles;
742  curNewPart->m_numVertices = curPart->m_numVertices;
743 
744  if (curPart->m_vertices3f)
745  {
746  curNewPart->m_vertices3f = new btVector3FloatData[curNewPart->m_numVertices];
747  memcpy(curNewPart->m_vertices3f, curPart->m_vertices3f, sizeof(btVector3FloatData) * curNewPart->m_numVertices);
748  }
749  else
750  curNewPart->m_vertices3f = NULL;
751 
752  if (curPart->m_vertices3d)
753  {
754  curNewPart->m_vertices3d = new btVector3DoubleData[curNewPart->m_numVertices];
755  memcpy(curNewPart->m_vertices3d, curPart->m_vertices3d, sizeof(btVector3DoubleData) * curNewPart->m_numVertices);
756  }
757  else
758  curNewPart->m_vertices3d = NULL;
759 
760  int numIndices = curNewPart->m_numTriangles * 3;
763  bool uninitialized3indices8Workaround = false;
764 
765  if (curPart->m_indices32)
766  {
767  uninitialized3indices8Workaround = true;
768  curNewPart->m_indices32 = new btIntIndexData[numIndices];
769  memcpy(curNewPart->m_indices32, curPart->m_indices32, sizeof(btIntIndexData) * numIndices);
770  }
771  else
772  curNewPart->m_indices32 = NULL;
773 
774  if (curPart->m_3indices16)
775  {
776  uninitialized3indices8Workaround = true;
777  curNewPart->m_3indices16 = new btShortIntIndexTripletData[curNewPart->m_numTriangles];
778  memcpy(curNewPart->m_3indices16, curPart->m_3indices16, sizeof(btShortIntIndexTripletData) * curNewPart->m_numTriangles);
779  }
780  else
781  curNewPart->m_3indices16 = NULL;
782 
783  if (curPart->m_indices16)
784  {
785  uninitialized3indices8Workaround = true;
786  curNewPart->m_indices16 = new btShortIntIndexData[numIndices];
787  memcpy(curNewPart->m_indices16, curPart->m_indices16, sizeof(btShortIntIndexData) * numIndices);
788  }
789  else
790  curNewPart->m_indices16 = NULL;
791 
792  if (!uninitialized3indices8Workaround && curPart->m_3indices8)
793  {
794  curNewPart->m_3indices8 = new btCharIndexTripletData[curNewPart->m_numTriangles];
795  memcpy(curNewPart->m_3indices8, curPart->m_3indices8, sizeof(btCharIndexTripletData) * curNewPart->m_numTriangles);
796  }
797  else
798  curNewPart->m_3indices8 = NULL;
799  }
800 
802 
803  return (newData);
804 }
805 
806 #ifdef USE_INTERNAL_EDGE_UTILITY
808 
809 static bool btAdjustInternalEdgeContactsCallback(btManifoldPoint& cp, const btCollisionObject* colObj0, int partId0, int index0, const btCollisionObject* colObj1, int partId1, int index1)
810 {
811  btAdjustInternalEdgeContacts(cp, colObj1, colObj0, partId1, index1);
812  //btAdjustInternalEdgeContacts(cp,colObj1,colObj0, partId1,index1, BT_TRIANGLE_CONVEX_BACKFACE_MODE);
813  //btAdjustInternalEdgeContacts(cp,colObj1,colObj0, partId1,index1, BT_TRIANGLE_CONVEX_DOUBLE_SIDED+BT_TRIANGLE_CONCAVE_DOUBLE_SIDED);
814  return true;
815 }
816 #endif //USE_INTERNAL_EDGE_UTILITY
817 
818 /*
819 btRigidBody* btWorldImporter::createRigidBody(bool isDynamic, btScalar mass, const btTransform& startTransform,btCollisionShape* shape,const char* bodyName)
820 {
821  btVector3 localInertia;
822  localInertia.setZero();
823 
824  if (mass)
825  shape->calculateLocalInertia(mass,localInertia);
826 
827  btRigidBody* body = new btRigidBody(mass,0,shape,localInertia);
828  body->setWorldTransform(startTransform);
829 
830  if (m_dynamicsWorld)
831  m_dynamicsWorld->addRigidBody(body);
832 
833  if (bodyName)
834  {
835  char* newname = duplicateName(bodyName);
836  m_objectNameMap.insert(body,newname);
837  m_nameBodyMap.insert(newname,body);
838  }
839  m_allocatedRigidBodies.push_back(body);
840  return body;
841 
842 }
843 */
844 
846 {
847  btCollisionObject** bodyPtr = m_nameColObjMap.find(name);
848  if (bodyPtr && *bodyPtr)
849  {
850  return *bodyPtr;
851  }
852  return 0;
853 }
854 
856 {
857  btCollisionObject* colObj = new btCollisionObject();
858  colObj->setWorldTransform(startTransform);
859  colObj->setCollisionShape(shape);
860  m_collisionWorld->addCollisionObject(colObj); //todo: flags etc
861 
862  if (bodyName)
863  {
864  char* newname = duplicateName(bodyName);
865  m_objectNameMap.insert(colObj, newname);
866  m_nameColObjMap.insert(newname, colObj);
867  }
869 
870  return colObj;
871 }
872 
874 {
875  btStaticPlaneShape* shape = new btStaticPlaneShape(planeNormal, planeConstant);
877  return shape;
878 }
880 {
881  btBoxShape* shape = new btBoxShape(halfExtents);
883  return shape;
884 }
886 {
887  btSphereShape* shape = new btSphereShape(radius);
889  return shape;
890 }
891 
893 {
894  btCapsuleShapeX* shape = new btCapsuleShapeX(radius, height);
896  return shape;
897 }
898 
900 {
901  btCapsuleShape* shape = new btCapsuleShape(radius, height);
903  return shape;
904 }
905 
907 {
908  btCapsuleShapeZ* shape = new btCapsuleShapeZ(radius, height);
910  return shape;
911 }
912 
914 {
915  btCylinderShapeX* shape = new btCylinderShapeX(btVector3(height, radius, radius));
917  return shape;
918 }
919 
921 {
922  btCylinderShape* shape = new btCylinderShape(btVector3(radius, height, radius));
924  return shape;
925 }
926 
928 {
929  btCylinderShapeZ* shape = new btCylinderShapeZ(btVector3(radius, radius, height));
931  return shape;
932 }
933 
935 {
936  btConeShapeX* shape = new btConeShapeX(radius, height);
938  return shape;
939 }
940 
942 {
943  btConeShape* shape = new btConeShape(radius, height);
945  return shape;
946 }
947 
949 {
950  btConeShapeZ* shape = new btConeShapeZ(radius, height);
952  return shape;
953 }
954 
956 {
959  return in;
960 }
961 
963 {
964  btOptimizedBvh* bvh = new btOptimizedBvh();
966  return bvh;
967 }
968 
970 {
973  return tim;
974 }
975 
977 {
978  if (bvh)
979  {
980  btBvhTriangleMeshShape* bvhTriMesh = new btBvhTriangleMeshShape(trimesh, bvh->isQuantized(), false);
981  bvhTriMesh->setOptimizedBvh(bvh);
983  return bvhTriMesh;
984  }
985 
986  btBvhTriangleMeshShape* ts = new btBvhTriangleMeshShape(trimesh, true);
988  return ts;
989 }
991 {
992  return 0;
993 }
994 #ifdef SUPPORT_GIMPACT_SHAPE_IMPORT
995 btGImpactMeshShape* btCollisionWorldImporter::createGimpactShape(btStridingMeshInterface* trimesh)
996 {
997  btGImpactMeshShape* shape = new btGImpactMeshShape(trimesh);
999  return shape;
1000 }
1001 #endif //SUPPORT_GIMPACT_SHAPE_IMPORT
1002 
1004 {
1005  btConvexHullShape* shape = new btConvexHullShape();
1007  return shape;
1008 }
1009 
1011 {
1012  btCompoundShape* shape = new btCompoundShape();
1014  return shape;
1015 }
1016 
1018 {
1019  btScaledBvhTriangleMeshShape* shape = new btScaledBvhTriangleMeshShape(meshShape, localScaling);
1021  return shape;
1022 }
1023 
1025 {
1026  btMultiSphereShape* shape = new btMultiSphereShape(positions, radi, numSpheres);
1028  return shape;
1029 }
1030 
1031 // query for data
1033 {
1035 }
1036 
1038 {
1039  return m_allocatedCollisionShapes[index];
1040 }
1041 
1043 {
1044  btCollisionShape** shapePtr = m_nameShapeMap.find(name);
1045  if (shapePtr && *shapePtr)
1046  {
1047  return *shapePtr;
1048  }
1049  return 0;
1050 }
1051 
1052 const char* btCollisionWorldImporter::getNameForPointer(const void* ptr) const
1053 {
1054  const char* const* namePtr = m_objectNameMap.find(ptr);
1055  if (namePtr && *namePtr)
1056  return *namePtr;
1057  return 0;
1058 }
1059 
1061 {
1062  return m_allocatedRigidBodies.size();
1063 }
1064 
1066 {
1067  return m_allocatedRigidBodies[index];
1068 }
1069 
1071 {
1072  return m_allocatedBvhs.size();
1073 }
1075 {
1076  return m_allocatedBvhs[index];
1077 }
1078 
1080 {
1082 }
1083 
1085 {
1086  return m_allocatedTriangleInfoMaps[index];
1087 }
btCollisionWorldImporter::duplicateName
char * duplicateName(const char *name)
Definition: btCollisionWorldImporter.cpp:596
btCollisionShapeData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
Definition: btCollisionShape.h:151
btBulletSerializedArrays::m_bvhsDouble
btAlignedObjectArray< struct btQuantizedBvhDoubleData * > m_bvhsDouble
Definition: btSerializer.h:138
btMeshPartData::m_3indices16
btShortIntIndexTripletData * m_3indices16
Definition: btStridingMeshInterface.h:127
btCollisionObject
btCollisionObject can be used to manage collision detection objects.
Definition: btCollisionObject.h:48
btCollisionWorldImporter::m_nameColObjMap
btHashMap< btHashString, btCollisionObject * > m_nameColObjMap
Definition: btCollisionWorldImporter.h:76
btCollisionShapeData::m_shapeType
int m_shapeType
Definition: btCollisionShape.h:154
btCollisionWorldImporter::getBvhByIndex
btOptimizedBvh * getBvhByIndex(int index) const
Definition: btCollisionWorldImporter.cpp:1074
SOFTBODY_SHAPE_PROXYTYPE
Definition: btBroadphaseProxy.h:73
btCollisionWorldImporter::deleteAllData
virtual void deleteAllData()
delete all memory collision shapes, rigid bodies, constraints etc.
Definition: btCollisionWorldImporter.cpp:140
btCompoundShapeChildData::m_childShape
btCollisionShapeData * m_childShape
Definition: btCompoundShape.h:182
btCollisionWorldImporter::getCollisionShapeByIndex
btCollisionShape * getCollisionShapeByIndex(int index)
Definition: btCollisionWorldImporter.cpp:1037
btAlignedFree
#define btAlignedFree(ptr)
Definition: btAlignedAllocator.h:47
btCollisionShape::getShapeType
int getShapeType() const
Definition: btCollisionShape.h:106
btCollisionWorldImporter::createBvhTriangleMeshShape
virtual btBvhTriangleMeshShape * createBvhTriangleMeshShape(btStridingMeshInterface *trimesh, btOptimizedBvh *bvh)
Definition: btCollisionWorldImporter.cpp:976
CYLINDER_SHAPE_PROXYTYPE
Definition: btBroadphaseProxy.h:44
btCollisionWorldImporter::createMultiSphereShape
virtual class btMultiSphereShape * createMultiSphereShape(const btVector3 *positions, const btScalar *radi, int numSpheres)
Definition: btCollisionWorldImporter.cpp:1024
btOptimizedBvh
The btOptimizedBvh extends the btQuantizedBvh to create AABB tree for triangle meshes,...
Definition: btOptimizedBvh.h:26
btTransformDoubleData::m_origin
btVector3DoubleData m_origin
Definition: btTransform.h:253
btCollisionWorldImporter.h
btCollisionShapeData::m_name
char * m_name
Definition: btCollisionShape.h:153
btCollisionObjectFloatData::m_name
char * m_name
Definition: btCollisionObject.h:631
btCollisionWorldImporter::createCylinderShapeZ
virtual btCollisionShape * createCylinderShapeZ(btScalar radius, btScalar height)
Definition: btCollisionWorldImporter.cpp:927
btShortIntIndexTripletData::m_values
short m_values[3]
Definition: btStridingMeshInterface.h:108
btStaticPlaneShapeData::m_planeConstant
float m_planeConstant
Definition: btStaticPlaneShape.h:75
btScalar
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
Definition: btScalar.h:294
btBoxShape
The btBoxShape is a box primitive around the origin, its sides axis aligned with length specified by ...
Definition: btBoxShape.h:26
btConvexHullShapeData::m_unscaledPointsFloatPtr
btVector3FloatData * m_unscaledPointsFloatPtr
Definition: btConvexHullShape.h:101
btMeshPartData::m_vertices3f
btVector3FloatData * m_vertices3f
Definition: btStridingMeshInterface.h:123
btConeShapeData::m_upIndex
int m_upIndex
Definition: btConeShape.h:147
btScaledTriangleMeshShapeData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
Definition: btScaledBvhTriangleMeshShape.h:64
btCylinderShapeData::m_upAxis
int m_upAxis
Definition: btCylinderShape.h:178
btCollisionWorldImporter::getCollisionShapeByName
btCollisionShape * getCollisionShapeByName(const char *name)
Definition: btCollisionWorldImporter.cpp:1042
btCollisionWorldImporter::m_bvhMap
btHashMap< btHashPtr, btOptimizedBvh * > m_bvhMap
Definition: btCollisionWorldImporter.h:72
btCollisionObjectDoubleData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
Definition: btCollisionObject.h:591
btAdjustInternalEdgeContacts
void btAdjustInternalEdgeContacts(btManifoldPoint &cp, const btCollisionObjectWrapper *colObj0Wrap, const btCollisionObjectWrapper *colObj1Wrap, int partId0, int index0, int normalAdjustFlags)
Changes a btManifoldPoint collision normal to the normal from the mesh.
Definition: btInternalEdgeUtility.cpp:423
btTriangleMeshShapeData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
Definition: btBvhTriangleMeshShape.h:120
btCollisionObjectFloatData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
Definition: btCollisionObject.h:626
btBvhTriangleMeshShape
The btBvhTriangleMeshShape is a static-triangle mesh shape, it can only be used for fixed/non-moving ...
Definition: btBvhTriangleMeshShape.h:34
btCompoundShapeChildData::m_transform
btTransformFloatData m_transform
Definition: btCompoundShape.h:181
btCollisionWorldImporter::getTriangleInfoMapByIndex
btTriangleInfoMap * getTriangleInfoMapByIndex(int index) const
Definition: btCollisionWorldImporter.cpp:1084
btCollisionWorldImporter::createCylinderShapeX
virtual btCollisionShape * createCylinderShapeX(btScalar radius, btScalar height)
Definition: btCollisionWorldImporter.cpp:913
btIndexedMesh::m_vertexType
PHY_ScalarType m_vertexType
Definition: btTriangleIndexVertexArray.h:46
btBulletSerializedArrays::m_bvhsFloat
btAlignedObjectArray< struct btQuantizedBvhFloatData * > m_bvhsFloat
Definition: btSerializer.h:139
btStridingMeshInterface::setScaling
void setScaling(const btVector3 &scaling)
Definition: btStridingMeshInterface.h:84
btStaticPlaneShapeData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
Definition: btStaticPlaneShape.h:69
btAlignedObjectArray::clear
void clear()
clear the array, deallocated memory. Generally it is better to use array.resize(0),...
Definition: btAlignedObjectArray.h:183
btMeshPartData::m_indices16
btShortIntIndexData * m_indices16
Definition: btStridingMeshInterface.h:130
gContactAddedCallback
ContactAddedCallback gContactAddedCallback
This is to allow MaterialCombiner/Custom Friction/Restitution values.
Definition: btManifoldResult.cpp:22
btCollisionWorldImporter::createTriangleMeshContainer
virtual class btTriangleIndexVertexArray * createTriangleMeshContainer()
Definition: btCollisionWorldImporter.cpp:955
btCollisionWorldImporter::m_shapeMap
btHashMap< btHashPtr, btCollisionShape * > m_shapeMap
Definition: btCollisionWorldImporter.h:80
btMeshPartData::m_numVertices
int m_numVertices
Definition: btStridingMeshInterface.h:133
btCollisionWorldImporter::convertAllObjects
bool convertAllObjects(btBulletSerializedArrays *arrays)
Definition: btCollisionWorldImporter.cpp:34
btCollisionWorldImporter::createTriangleInfoMap
virtual btTriangleInfoMap * createTriangleInfoMap()
Definition: btCollisionWorldImporter.cpp:969
btVector3DoubleData::m_floats
double m_floats[4]
Definition: btVector3.h:1288
btAlignedAlloc
#define btAlignedAlloc(size, alignment)
Definition: btAlignedAllocator.h:46
btStridingMeshInterfaceData::m_numMeshParts
int m_numMeshParts
Definition: btStridingMeshInterface.h:142
btCollisionWorldImporter::m_allocatedRigidBodies
btAlignedObjectArray< btCollisionObject * > m_allocatedRigidBodies
Definition: btCollisionWorldImporter.h:55
btCollisionObjectDoubleData::m_worldTransform
btTransformDoubleData m_worldTransform
Definition: btCollisionObject.h:598
btCollisionWorldImporter::m_indexArrays
btAlignedObjectArray< int * > m_indexArrays
Definition: btCollisionWorldImporter.h:65
btCollisionObjectDoubleData::m_collisionShape
void * m_collisionShape
Definition: btCollisionObject.h:594
btCollisionWorldImporter::createOptimizedBvh
virtual btOptimizedBvh * createOptimizedBvh()
acceleration and connectivity structures
Definition: btCollisionWorldImporter.cpp:962
btCollisionWorldImporter::m_nameShapeMap
btHashMap< btHashString, btCollisionShape * > m_nameShapeMap
Definition: btCollisionWorldImporter.h:75
btGImpactMeshShape::setLocalScaling
virtual void setLocalScaling(const btVector3 &scaling)
Definition: btGImpactShape.h:912
btCollisionWorldImporter::createSphereShape
virtual btCollisionShape * createSphereShape(btScalar radius)
Definition: btCollisionWorldImporter.cpp:885
btGImpactMeshShape
This class manages a mesh supplied by the btStridingMeshInterface interface.
Definition: btGImpactShape.h:842
btPositionAndRadius::m_pos
btVector3FloatData m_pos
Definition: btMultiSphereShape.h:73
PHY_FLOAT
Definition: btConcaveShape.h:27
btTriangleInfoMap::deSerialize
void deSerialize(struct btTriangleInfoMapData &data)
fills the dataBuffer and returns the struct name (and 0 on failure)
Definition: btTriangleInfoMap.h:204
btCharIndexTripletData
Definition: btStridingMeshInterface.h:112
btIndexedMesh::m_triangleIndexBase
const unsigned char * m_triangleIndexBase
Definition: btTriangleIndexVertexArray.h:31
btMeshPartData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
Definition: btStridingMeshInterface.h:121
btCollisionWorldImporter::createConvexHullShape
virtual class btConvexHullShape * createConvexHullShape()
Definition: btCollisionWorldImporter.cpp:1003
btCollisionWorldImporter::m_bodyMap
btHashMap< btHashPtr, btCollisionObject * > m_bodyMap
Definition: btCollisionWorldImporter.h:81
btHashMap::clear
void clear()
Definition: btHashMap.h:461
btMultiSphereShapeData::m_localPositionArraySize
int m_localPositionArraySize
Definition: btMultiSphereShape.h:84
btCollisionWorldImporter::m_allocatedbtStridingMeshInterfaceDatas
btAlignedObjectArray< btStridingMeshInterfaceData * > m_allocatedbtStridingMeshInterfaceDatas
Definition: btCollisionWorldImporter.h:60
btTriangleMeshShapeData::m_meshInterface
btStridingMeshInterfaceData m_meshInterface
Definition: btBvhTriangleMeshShape.h:124
btVector3FloatData
Definition: btVector3.h:1281
btCollisionWorldImporter::createConeShapeZ
virtual btCollisionShape * createConeShapeZ(btScalar radius, btScalar height)
Definition: btCollisionWorldImporter.cpp:948
btBulletSerializedArrays::m_colShapeData
btAlignedObjectArray< struct btCollisionShapeData * > m_colShapeData
Definition: btSerializer.h:140
btCollisionObjectDoubleData::m_restitution
double m_restitution
Definition: btCollisionObject.h:609
btCollisionWorldImporter::createMeshInterface
virtual btTriangleIndexVertexArray * createMeshInterface(btStridingMeshInterfaceData &meshData)
Definition: btCollisionWorldImporter.cpp:610
GIMPACT_SHAPE_PROXYTYPE
Used for GIMPACT Trimesh integration.
Definition: btBroadphaseProxy.h:61
btShortIntIndexData::m_value
short m_value
Definition: btStridingMeshInterface.h:102
btCapsuleShapeData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
Definition: btCapsuleShape.h:141
btStridingMeshInterface
The btStridingMeshInterface is the interface class for high performance generic access to triangle me...
Definition: btStridingMeshInterface.h:26
btVector3::getX
const btScalar & getX() const
Return the x value.
Definition: btVector3.h:561
btBvhTriangleMeshShape::setOptimizedBvh
void setOptimizedBvh(btOptimizedBvh *bvh, const btVector3 &localScaling=btVector3(1, 1, 1))
Definition: btBvhTriangleMeshShape.cpp:345
btTriangleMeshShapeData::m_collisionMargin
float m_collisionMargin
Definition: btBvhTriangleMeshShape.h:131
btTriangleMeshShapeData::m_triangleInfoMap
btTriangleInfoMapData * m_triangleInfoMap
Definition: btBvhTriangleMeshShape.h:129
btCollisionObjectFloatData::m_collisionShape
void * m_collisionShape
Definition: btCollisionObject.h:629
btShortIntIndexTripletData
Definition: btStridingMeshInterface.h:106
btCollisionShape
The btCollisionShape class provides an interface for collision shapes that can be shared among btColl...
Definition: btCollisionShape.h:26
MULTI_SPHERE_SHAPE_PROXYTYPE
Definition: btBroadphaseProxy.h:40
btCollisionWorldImporter::m_allocatedBvhs
btAlignedObjectArray< btOptimizedBvh * > m_allocatedBvhs
Definition: btCollisionWorldImporter.h:57
btConvexInternalShapeData::m_localScaling
btVector3FloatData m_localScaling
Definition: btConvexInternalShape.h:139
btCapsuleShapeX
btCapsuleShapeX represents a capsule around the Z axis the total height is height+2*radius,...
Definition: btCapsuleShape.h:114
btCollisionObject::setRestitution
void setRestitution(btScalar rest)
Definition: btCollisionObject.h:297
btConcaveShape::setMargin
virtual void setMargin(btScalar collisionMargin)
Definition: btConcaveShape.h:56
btGImpactMeshShapeData::m_gimpactSubType
int m_gimpactSubType
Definition: btGImpactShape.h:1099
PHY_DOUBLE
Definition: btConcaveShape.h:28
btVector3DoubleData
Definition: btVector3.h:1286
CAPSULE_SHAPE_PROXYTYPE
Definition: btBroadphaseProxy.h:41
btCollisionObject::setCollisionShape
virtual void setCollisionShape(btCollisionShape *collisionShape)
Definition: btCollisionObject.h:217
btManifoldPoint
ManifoldContactPoint collects and maintains persistent contactpoints.
Definition: btManifoldPoint.h:51
btMultiSphereShapeData::m_localPositionArrayPtr
btPositionAndRadius * m_localPositionArrayPtr
Definition: btMultiSphereShape.h:83
btMultiSphereShape
The btMultiSphereShape represents the convex hull of a collection of spheres.
Definition: btMultiSphereShape.h:26
btGImpactMeshShapeData::m_collisionMargin
float m_collisionMargin
Definition: btGImpactShape.h:1097
btCollisionWorldImporter::m_collisionWorld
btCollisionWorld * m_collisionWorld
Definition: btCollisionWorldImporter.h:50
btCollisionWorldImporter::~btCollisionWorldImporter
virtual ~btCollisionWorldImporter()
Definition: btCollisionWorldImporter.cpp:30
btGImpactMeshShapeData::m_meshInterface
btStridingMeshInterfaceData m_meshInterface
Definition: btGImpactShape.h:1093
btCollisionWorldImporter::getCollisionObjectByName
btCollisionObject * getCollisionObjectByName(const char *name)
Definition: btCollisionWorldImporter.cpp:845
btAlignedObjectArray::resize
void resize(int newsize, const T &fillData=T())
Definition: btAlignedObjectArray.h:210
btIndexedMesh::m_numTriangles
int m_numTriangles
Definition: btTriangleIndexVertexArray.h:30
btMultiSphereShapeData
Definition: btMultiSphereShape.h:79
btCollisionWorldImporter::m_doubleVertexArrays
btAlignedObjectArray< btVector3DoubleData * > m_doubleVertexArrays
Definition: btCollisionWorldImporter.h:70
btCylinderShapeX
Definition: btCylinderShape.h:129
btTriangleInfoMap
The btTriangleInfoMap stores edge angle information for some triangles. You can compute this informat...
Definition: btTriangleInfoMap.h:53
btCollisionWorldImporter::createConvexTriangleMeshShape
virtual btCollisionShape * createConvexTriangleMeshShape(btStridingMeshInterface *trimesh)
Definition: btCollisionWorldImporter.cpp:990
btGImpactMeshShape::setMargin
virtual void setMargin(btScalar margin)
Definition: btGImpactShape.h:926
btCollisionObject::CF_CUSTOM_MATERIAL_CALLBACK
Definition: btCollisionObject.h:131
btCollisionWorldImporter::createCylinderShapeY
virtual btCollisionShape * createCylinderShapeY(btScalar radius, btScalar height)
Definition: btCollisionWorldImporter.cpp:920
btCollisionObjectFloatData::m_worldTransform
btTransformFloatData m_worldTransform
Definition: btCollisionObject.h:633
SCALED_TRIANGLE_MESH_SHAPE_PROXYTYPE
Definition: btBroadphaseProxy.h:55
btBulletSerializedArrays::m_collisionObjectDataFloat
btAlignedObjectArray< struct btCollisionObjectFloatData * > m_collisionObjectDataFloat
Definition: btSerializer.h:146
btCompoundShapeData::m_childShapePtr
btCompoundShapeChildData * m_childShapePtr
Definition: btCompoundShape.h:192
btCollisionObject::setFriction
void setFriction(btScalar frict)
Definition: btCollisionObject.h:306
btQuantizedBvh::deSerializeDouble
virtual void deSerializeDouble(struct btQuantizedBvhDoubleData &quantizedBvhDoubleData)
Definition: btQuantizedBvh.cpp:1200
btBulletSerializedArrays::m_collisionObjectDataDouble
btAlignedObjectArray< struct btCollisionObjectDoubleData * > m_collisionObjectDataDouble
Definition: btSerializer.h:145
btCollisionObject::setWorldTransform
void setWorldTransform(const btTransform &worldTrans)
Definition: btCollisionObject.h:375
btSerializer.h
btTransform
The btTransform class supports rigid transforms with only translation and rotation and no scaling/she...
Definition: btTransform.h:28
BOX_SHAPE_PROXYTYPE
Definition: btBroadphaseProxy.h:30
btTriangleMeshShapeData::m_quantizedDoubleBvh
btQuantizedBvhDoubleData * m_quantizedDoubleBvh
Definition: btBvhTriangleMeshShape.h:127
btCollisionObject::getCollisionFlags
int getCollisionFlags() const
Definition: btCollisionObject.h:475
btCollisionWorldImporter::createConeShapeY
virtual btCollisionShape * createConeShapeY(btScalar radius, btScalar height)
Definition: btCollisionWorldImporter.cpp:941
ContactAddedCallback
bool(* ContactAddedCallback)(btManifoldPoint &cp, const btCollisionObjectWrapper *colObj0Wrap, int partId0, int index0, const btCollisionObjectWrapper *colObj1Wrap, int partId1, int index1)
Definition: btManifoldResult.h:31
btConvexHullShapeData::m_numUnscaledPoints
int m_numUnscaledPoints
Definition: btConvexHullShape.h:104
btIndexedMesh
The btIndexedMesh indexes a single vertex and index array.
Definition: btTriangleIndexVertexArray.h:25
btConeShapeZ
btConeShapeZ implements a Cone shape, around the Z axis
Definition: btConeShape.h:125
btCompoundShapeData::m_numChildShapes
int m_numChildShapes
Definition: btCompoundShape.h:194
btCapsuleShape
The btCapsuleShape represents a capsule around the Y axis, there is also the btCapsuleShapeX aligned ...
Definition: btCapsuleShape.h:25
btCollisionWorldImporter::createCapsuleShapeZ
virtual btCollisionShape * createCapsuleShapeZ(btScalar radius, btScalar height)
Definition: btCollisionWorldImporter.cpp:906
btSphereShape
The btSphereShape implements an implicit sphere, centered around a local origin with radius.
Definition: btSphereShape.h:22
btVector3
btVector3 can be used to represent 3D points and vectors.
Definition: btVector3.h:80
btCollisionWorldImporter::createPlaneShape
virtual btCollisionShape * createPlaneShape(const btVector3 &planeNormal, btScalar planeConstant)
shapes
Definition: btCollisionWorldImporter.cpp:873
CONVEX_HULL_SHAPE_PROXYTYPE
Definition: btBroadphaseProxy.h:34
btCylinderShapeData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
Definition: btCylinderShape.h:174
btIndexedMesh::m_triangleIndexStride
int m_triangleIndexStride
Definition: btTriangleIndexVertexArray.h:33
btMeshPartData::m_vertices3d
btVector3DoubleData * m_vertices3d
Definition: btStridingMeshInterface.h:124
btCollisionWorldImporter::m_charIndexArrays
btAlignedObjectArray< unsigned char * > m_charIndexArrays
Definition: btCollisionWorldImporter.h:67
btCollisionWorldImporter::getNameForPointer
const char * getNameForPointer(const void *ptr) const
Definition: btCollisionWorldImporter.cpp:1052
btConvexInternalShapeData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
Definition: btConvexInternalShape.h:135
btIndexedMesh::m_vertexStride
int m_vertexStride
Definition: btTriangleIndexVertexArray.h:37
btQuantizedBvh::deSerializeFloat
virtual void deSerializeFloat(struct btQuantizedBvhFloatData &quantizedBvhFloatData)
Definition: btQuantizedBvh.cpp:1129
btCharIndexTripletData::m_values
unsigned char m_values[3]
Definition: btStridingMeshInterface.h:114
btCollisionWorldImporter::createConeShapeX
virtual btCollisionShape * createConeShapeX(btScalar radius, btScalar height)
Definition: btCollisionWorldImporter.cpp:934
btConvexHullShapeData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
Definition: btConvexHullShape.h:97
SPHERE_SHAPE_PROXYTYPE
Definition: btBroadphaseProxy.h:39
btBvhTriangleMeshShape::setTriangleInfoMap
void setTriangleInfoMap(btTriangleInfoMap *triangleInfoMap)
Definition: btBvhTriangleMeshShape.h:92
btVector3::getZ
const btScalar & getZ() const
Return the z value.
Definition: btVector3.h:565
btMeshPartData::m_indices32
btIntIndexData * m_indices32
Definition: btStridingMeshInterface.h:126
btConvexInternalShapeData::m_collisionMargin
float m_collisionMargin
Definition: btConvexInternalShape.h:143
btCollisionWorldImporter::m_allocatedTriangleIndexArrays
btAlignedObjectArray< btTriangleIndexVertexArray * > m_allocatedTriangleIndexArrays
Definition: btCollisionWorldImporter.h:59
btCollisionWorldImporter::createCapsuleShapeY
virtual btCollisionShape * createCapsuleShapeY(btScalar radius, btScalar height)
Definition: btCollisionWorldImporter.cpp:899
btAlignedObjectArray< btVector3 >
btVector3::getY
const btScalar & getY() const
Return the y value.
Definition: btVector3.h:563
btCollisionWorldImporter::getNumCollisionShapes
int getNumCollisionShapes() const
Definition: btCollisionWorldImporter.cpp:1032
btHashMap::find
const Value * find(const Key &key) const
Definition: btHashMap.h:424
btCollisionWorldImporter::m_allocatedNames
btAlignedObjectArray< char * > m_allocatedNames
Definition: btCollisionWorldImporter.h:63
btTriangleMeshShapeData::m_quantizedFloatBvh
btQuantizedBvhFloatData * m_quantizedFloatBvh
Definition: btBvhTriangleMeshShape.h:126
btCompoundShape
The btCompoundShape allows to store multiple other btCollisionShapes This allows for moving concave c...
Definition: btCompoundShape.h:55
btConvexHullShape
The btConvexHullShape implements an implicit convex hull of an array of vertices.
Definition: btConvexHullShape.h:25
btBulletSerializedArrays
Definition: btSerializer.h:133
CONST_GIMPACT_TRIMESH_SHAPE
Definition: btGImpactShape.h:48
btCollisionWorld::removeCollisionObject
virtual void removeCollisionObject(btCollisionObject *collisionObject)
Definition: btCollisionWorld.cpp:238
btCollisionShape::setMargin
virtual void setMargin(btScalar margin)=0
btShortIntIndexData
Definition: btStridingMeshInterface.h:100
TRIANGLE_MESH_SHAPE_PROXYTYPE
Definition: btBroadphaseProxy.h:54
btMeshPartData::m_numTriangles
int m_numTriangles
Definition: btStridingMeshInterface.h:132
btIntIndexData::m_value
int m_value
Definition: btStridingMeshInterface.h:97
btCollisionWorldImporter::getNumTriangleInfoMaps
int getNumTriangleInfoMaps() const
Definition: btCollisionWorldImporter.cpp:1079
btCollisionObject::setCollisionFlags
void setCollisionFlags(int flags)
Definition: btCollisionObject.h:480
btScaledTriangleMeshShapeData::m_localScaling
btVector3FloatData m_localScaling
Definition: btScaledBvhTriangleMeshShape.h:68
btCompoundShape::addChildShape
void addChildShape(const btTransform &localTransform, btCollisionShape *shape)
Definition: btCompoundShape.cpp:50
btStaticPlaneShapeData::m_planeNormal
btVector3FloatData m_planeNormal
Definition: btStaticPlaneShape.h:74
btConvexHullShapeData::m_unscaledPointsDoublePtr
btVector3DoubleData * m_unscaledPointsDoublePtr
Definition: btConvexHullShape.h:102
btHashMap::insert
void insert(const Key &key, const Value &value)
Definition: btHashMap.h:264
btGImpactMeshShapeData::m_localScaling
btVector3FloatData m_localScaling
Definition: btGImpactShape.h:1095
btStaticPlaneShape
The btStaticPlaneShape simulates an infinite non-moving (static) collision plane.
Definition: btStaticPlaneShape.h:22
btQuantizedBvhFloatData
Definition: btQuantizedBvh.h:503
btBulletCollisionCommon.h
btTriangleIndexVertexArray::getNumSubParts
virtual int getNumSubParts() const
getNumSubParts returns the number of seperate subparts each subpart has a continuous array of vertice...
Definition: btTriangleIndexVertexArray.h:105
btStridingMeshInterfaceData::m_meshPartsPtr
btMeshPartData * m_meshPartsPtr
Definition: btStridingMeshInterface.h:140
btTriangleIndexVertexArray::addIndexedMesh
void addIndexedMesh(const btIndexedMesh &mesh, PHY_ScalarType indexType=PHY_INTEGER)
Definition: btTriangleIndexVertexArray.h:87
btConeShape
The btConeShape implements a cone shape primitive, centered around the origin and aligned with the Y ...
Definition: btConeShape.h:23
btCollisionWorldImporter::m_allocatedTriangleInfoMaps
btAlignedObjectArray< btTriangleInfoMap * > m_allocatedTriangleInfoMaps
Definition: btCollisionWorldImporter.h:58
PHY_INTEGER
Definition: btConcaveShape.h:29
btCollisionWorldImporter::getRigidBodyByIndex
btCollisionObject * getRigidBodyByIndex(int index) const
Definition: btCollisionWorldImporter.cpp:1065
btQuantizedBvh::isQuantized
bool isQuantized()
Definition: btQuantizedBvh.h:453
btCapsuleShape::deSerializeFloat
void deSerializeFloat(struct btCapsuleShapeData *dataBuffer)
Definition: btCapsuleShape.h:173
btCollisionWorldImporter::createCapsuleShapeX
virtual btCollisionShape * createCapsuleShapeX(btScalar radius, btScalar height)
Definition: btCollisionWorldImporter.cpp:892
btCollisionWorldImporter::createStridingMeshInterfaceData
virtual btStridingMeshInterfaceData * createStridingMeshInterfaceData(btStridingMeshInterfaceData *interfaceData)
Definition: btCollisionWorldImporter.cpp:727
btCollisionObjectDoubleData::m_name
char * m_name
Definition: btCollisionObject.h:596
btCollisionWorldImporter::m_objectNameMap
btHashMap< btHashPtr, const char * > m_objectNameMap
Definition: btCollisionWorldImporter.h:78
btConvexInternalShape::setMargin
virtual void setMargin(btScalar margin)
Definition: btConvexInternalShape.h:102
btStridingMeshInterfaceData::m_scaling
btVector3FloatData m_scaling
Definition: btStridingMeshInterface.h:141
btCylinderShape
The btCylinderShape class implements a cylinder shape primitive, centered around the origin....
Definition: btCylinderShape.h:24
btCollisionWorldImporter::createBoxShape
virtual btCollisionShape * createBoxShape(const btVector3 &halfExtents)
Definition: btCollisionWorldImporter.cpp:879
btTransformFloatData::m_origin
btVector3FloatData m_origin
Definition: btTransform.h:247
btIntIndexData
Definition: btStridingMeshInterface.h:95
btCollisionWorld
CollisionWorld is interface and container for the collision detection.
Definition: btCollisionWorld.h:85
btCollisionWorldImporter::createCompoundShape
virtual class btCompoundShape * createCompoundShape()
Definition: btCollisionWorldImporter.cpp:1010
btStaticPlaneShapeData::m_localScaling
btVector3FloatData m_localScaling
Definition: btStaticPlaneShape.h:73
PHY_UCHAR
Definition: btConcaveShape.h:32
btCollisionWorldImporter::getNumBvhs
int getNumBvhs() const
Definition: btCollisionWorldImporter.cpp:1070
btCollisionShape::setLocalScaling
virtual void setLocalScaling(const btVector3 &scaling)=0
btVector3::deSerializeFloat
void deSerializeFloat(const struct btVector3FloatData &dataIn)
Definition: btVector3.h:1298
btCollisionWorldImporter::m_shortIndexArrays
btAlignedObjectArray< short int * > m_shortIndexArrays
Definition: btCollisionWorldImporter.h:66
btCollisionWorldImporter::getNumRigidBodies
int getNumRigidBodies() const
Definition: btCollisionWorldImporter.cpp:1060
btConvexHullShape::addPoint
void addPoint(const btVector3 &point, bool recalculateLocalAabb=true)
Definition: btConvexHullShape.cpp:51
btBvhTriangleMeshShape::getTriangleInfoMap
const btTriangleInfoMap * getTriangleInfoMap() const
Definition: btBvhTriangleMeshShape.h:97
btStridingMeshInterfaceData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
Definition: btStridingMeshInterface.h:138
CONE_SHAPE_PROXYTYPE
Definition: btBroadphaseProxy.h:42
btTriangleIndexVertexArray
The btTriangleIndexVertexArray allows to access multiple triangle meshes, by indexing into existing t...
Definition: btTriangleIndexVertexArray.h:65
btCompoundShapeData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
Definition: btCompoundShape.h:188
btCollisionWorld::addCollisionObject
virtual void addCollisionObject(btCollisionObject *collisionObject, int collisionFilterGroup=btBroadphaseProxy::DefaultFilter, int collisionFilterMask=btBroadphaseProxy::AllFilter)
Definition: btCollisionWorld.cpp:123
btCollisionWorldImporter::m_allocatedCollisionObjects
btAlignedObjectArray< btCollisionObject * > m_allocatedCollisionObjects
Definition: btCollisionWorldImporter.h:61
btPositionAndRadius::m_radius
float m_radius
Definition: btMultiSphereShape.h:74
btQuantizedBvhDoubleData
Definition: btQuantizedBvh.h:520
btAlignedObjectArray::push_back
void push_back(const T &_Val)
Definition: btAlignedObjectArray.h:264
btGImpactMeshShapeData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
Definition: btGImpactShape.h:1089
btGImpactShapeInterface::updateBound
void updateBound()
performs refit operation
Definition: btGImpactShape.h:115
btIndexedMesh::m_vertexBase
const unsigned char * m_vertexBase
Definition: btTriangleIndexVertexArray.h:35
btCylinderShapeZ
Definition: btCylinderShape.h:151
btCapsuleShapeData::m_upAxis
int m_upAxis
Definition: btCapsuleShape.h:145
STATIC_PLANE_PROXYTYPE
Definition: btBroadphaseProxy.h:66
btTransform::deSerializeFloat
void deSerializeFloat(const struct btTransformFloatData &dataIn)
Definition: btTransform.h:274
btTransform::deSerializeDouble
void deSerializeDouble(const struct btTransformDoubleData &dataIn)
Definition: btTransform.h:280
btCollisionWorldImporter::convertCollisionShape
btCollisionShape * convertCollisionShape(btCollisionShapeData *shapeData)
Definition: btCollisionWorldImporter.cpp:242
btCollisionWorldImporter::btCollisionWorldImporter
btCollisionWorldImporter(btCollisionWorld *world)
Definition: btCollisionWorldImporter.cpp:24
btCollisionWorldImporter::m_floatVertexArrays
btAlignedObjectArray< btVector3FloatData * > m_floatVertexArrays
Definition: btCollisionWorldImporter.h:69
btIndexedMesh::m_numVertices
int m_numVertices
Definition: btTriangleIndexVertexArray.h:34
btConeShapeData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
Definition: btConeShape.h:143
btScaledBvhTriangleMeshShape
The btScaledBvhTriangleMeshShape allows to instance a scaled version of an existing btBvhTriangleMesh...
Definition: btScaledBvhTriangleMeshShape.h:23
btVector3FloatData::m_floats
float m_floats[4]
Definition: btVector3.h:1283
btCollisionWorldImporter::createCollisionObject
virtual btCollisionObject * createCollisionObject(const btTransform &startTransform, btCollisionShape *shape, const char *bodyName)
those virtuals are called by load and can be overridden by the user
Definition: btCollisionWorldImporter.cpp:855
btCapsuleShapeZ
btCapsuleShapeZ represents a capsule around the Z axis the total height is height+2*radius,...
Definition: btCapsuleShape.h:128
btCollisionObjectDoubleData::m_friction
double m_friction
Definition: btCollisionObject.h:605
btIndexedMesh::m_indexType
PHY_ScalarType m_indexType
Definition: btTriangleIndexVertexArray.h:41
btScaledTriangleMeshShapeData::m_trimeshShapeData
btTriangleMeshShapeData m_trimeshShapeData
Definition: btScaledBvhTriangleMeshShape.h:66
btConvexInternalShapeData::m_implicitShapeDimensions
btVector3FloatData m_implicitShapeDimensions
Definition: btConvexInternalShape.h:141
btGImpactShape.h
btConeShapeX
btConeShape implements a Cone shape, around the X axis
Definition: btConeShape.h:107
btAlignedObjectArray::size
int size() const
return the number of elements in the array
Definition: btAlignedObjectArray.h:149
btMeshPartData::m_3indices8
btCharIndexTripletData * m_3indices8
Definition: btStridingMeshInterface.h:128
PHY_SHORT
Definition: btConcaveShape.h:30
btCollisionWorldImporter::createScaledTrangleMeshShape
virtual class btScaledBvhTriangleMeshShape * createScaledTrangleMeshShape(btBvhTriangleMeshShape *meshShape, const btVector3 &localScalingbtBvhTriangleMeshShape)
Definition: btCollisionWorldImporter.cpp:1017
COMPOUND_SHAPE_PROXYTYPE
Definition: btBroadphaseProxy.h:71
btCollisionWorldImporter::m_allocatedCollisionShapes
btAlignedObjectArray< btCollisionShape * > m_allocatedCollisionShapes
Definition: btCollisionWorldImporter.h:54