Bullet Collision Detection & Physics Library: btWorldImporter.cpp Source File

Bullet Collision Detection & Physics Library

btWorldImporter.cpp
Go to the documentation of this file.
1 /*
2 Bullet Continuous Collision Detection and Physics Library
3 Copyright (c) 2003-2012 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
16 #include "btWorldImporter.h"
17 #include "btBulletDynamicsCommon.h"
18 #ifdef USE_GIMPACT
19 #include "BulletCollision/Gimpact/btGImpactShape.h"
20 #endif
21 btWorldImporter::btWorldImporter(btDynamicsWorld* world)
22 : m_dynamicsWorld(world),
23 m_verboseMode(0),
24 m_importerFlags(0)
25 {
26 }
27
28 btWorldImporter::~btWorldImporter()
29 {
30 }
31
32 void btWorldImporter::deleteAllData()
33 {
34 int i;
35 for (i = 0; i < m_allocatedConstraints.size(); i++)
36 {
37 if (m_dynamicsWorld)
38 m_dynamicsWorld->removeConstraint(m_allocatedConstraints[i]);
39 delete m_allocatedConstraints[i];
40 }
41 m_allocatedConstraints.clear();
42
43 for (i = 0; i < m_allocatedRigidBodies.size(); i++)
44 {
45 if (m_dynamicsWorld)
46 m_dynamicsWorld->removeRigidBody(btRigidBody::upcast(m_allocatedRigidBodies[i]));
47 delete m_allocatedRigidBodies[i];
48 }
49
50 m_allocatedRigidBodies.clear();
51
52 for (i = 0; i < m_allocatedCollisionShapes.size(); i++)
53 {
54 delete m_allocatedCollisionShapes[i];
55 }
56 m_allocatedCollisionShapes.clear();
57
58 for (i = 0; i < m_allocatedBvhs.size(); i++)
59 {
60 delete m_allocatedBvhs[i];
61 }
62 m_allocatedBvhs.clear();
63
64 for (i = 0; i < m_allocatedTriangleInfoMaps.size(); i++)
65 {
66 delete m_allocatedTriangleInfoMaps[i];
67 }
68 m_allocatedTriangleInfoMaps.clear();
69 for (i = 0; i < m_allocatedTriangleIndexArrays.size(); i++)
70 {
71 delete m_allocatedTriangleIndexArrays[i];
72 }
73 m_allocatedTriangleIndexArrays.clear();
74 for (i = 0; i < m_allocatedNames.size(); i++)
75 {
76 delete[] m_allocatedNames[i];
77 }
78 m_allocatedNames.clear();
79
80 for (i = 0; i < m_allocatedbtStridingMeshInterfaceDatas.size(); i++)
81 {
82 btStridingMeshInterfaceData* curData = m_allocatedbtStridingMeshInterfaceDatas[i];
83
84 for (int a = 0; a < curData->m_numMeshParts; a++)
85 {
86 btMeshPartData* curPart = &curData->m_meshPartsPtr[a];
87 if (curPart->m_vertices3f)
88 delete[] curPart->m_vertices3f;
89
90 if (curPart->m_vertices3d)
91 delete[] curPart->m_vertices3d;
92
93 if (curPart->m_indices32)
94 delete[] curPart->m_indices32;
95
96 if (curPart->m_3indices16)
97 delete[] curPart->m_3indices16;
98
99 if (curPart->m_indices16)
100 delete[] curPart->m_indices16;
101
102 if (curPart->m_3indices8)
103 delete[] curPart->m_3indices8;
104 }
105 delete[] curData->m_meshPartsPtr;
106 delete curData;
107 }
108 m_allocatedbtStridingMeshInterfaceDatas.clear();
109
110 for (i = 0; i < m_indexArrays.size(); i++)
111 {
112 btAlignedFree(m_indexArrays[i]);
113 }
114 m_indexArrays.clear();
115
116 for (i = 0; i < m_shortIndexArrays.size(); i++)
117 {
118 btAlignedFree(m_shortIndexArrays[i]);
119 }
120 m_shortIndexArrays.clear();
121
122 for (i = 0; i < m_charIndexArrays.size(); i++)
123 {
124 btAlignedFree(m_charIndexArrays[i]);
125 }
126 m_charIndexArrays.clear();
127
128 for (i = 0; i < m_floatVertexArrays.size(); i++)
129 {
130 btAlignedFree(m_floatVertexArrays[i]);
131 }
132 m_floatVertexArrays.clear();
133
134 for (i = 0; i < m_doubleVertexArrays.size(); i++)
135 {
136 btAlignedFree(m_doubleVertexArrays[i]);
137 }
138 m_doubleVertexArrays.clear();
139 }
140
141 btCollisionShape* btWorldImporter::convertCollisionShape(btCollisionShapeData* shapeData)
142 {
143 btCollisionShape* shape = 0;
144
145 switch (shapeData->m_shapeType)
146 {
147 case STATIC_PLANE_PROXYTYPE:
148 {
149 btStaticPlaneShapeData* planeData = (btStaticPlaneShapeData*)shapeData;
150 btVector3 planeNormal, localScaling;
151 planeNormal.deSerializeFloat(planeData->m_planeNormal);
152 localScaling.deSerializeFloat(planeData->m_localScaling);
153 shape = createPlaneShape(planeNormal, planeData->m_planeConstant);
154 shape->setLocalScaling(localScaling);
155
156 break;
157 }
158 case SCALED_TRIANGLE_MESH_SHAPE_PROXYTYPE:
159 {
160 btScaledTriangleMeshShapeData* scaledMesh = (btScaledTriangleMeshShapeData*)shapeData;
161 btCollisionShapeData* colShapeData = (btCollisionShapeData*)&scaledMesh->m_trimeshShapeData;
162 colShapeData->m_shapeType = TRIANGLE_MESH_SHAPE_PROXYTYPE;
163 btCollisionShape* childShape = convertCollisionShape(colShapeData);
164 btBvhTriangleMeshShape* meshShape = (btBvhTriangleMeshShape*)childShape;
165 btVector3 localScaling;
166 localScaling.deSerializeFloat(scaledMesh->m_localScaling);
167
168 shape = createScaledTrangleMeshShape(meshShape, localScaling);
169 break;
170 }
171 case GIMPACT_SHAPE_PROXYTYPE:
172 {
173 #ifdef USE_GIMPACT
174 btGImpactMeshShapeData* gimpactData = (btGImpactMeshShapeData*)shapeData;
175 if (gimpactData->m_gimpactSubType == CONST_GIMPACT_TRIMESH_SHAPE)
176 {
177 btStridingMeshInterfaceData* interfaceData = createStridingMeshInterfaceData(&gimpactData->m_meshInterface);
178 btTriangleIndexVertexArray* meshInterface = createMeshInterface(*interfaceData);
179
180 btGImpactMeshShape* gimpactShape = createGimpactShape(meshInterface);
181 btVector3 localScaling;
182 localScaling.deSerializeFloat(gimpactData->m_localScaling);
183 gimpactShape->setLocalScaling(localScaling);
184 gimpactShape->setMargin(btScalar(gimpactData->m_collisionMargin));
185 gimpactShape->updateBound();
186 shape = gimpactShape;
187 }
188 else
189 {
190 printf("unsupported gimpact sub type\n");
191 }
192 #endif //USE_GIMPACT
193 break;
194 }
195 //The btCapsuleShape* API has issue passing the margin/scaling/halfextents unmodified through the API
196 //so deal with this
197 case CAPSULE_SHAPE_PROXYTYPE:
198 {
199 btCapsuleShapeData* capData = (btCapsuleShapeData*)shapeData;
200
201 switch (capData->m_upAxis)
202 {
203 case 0:
204 {
205 shape = createCapsuleShapeX(1, 1);
206 break;
207 }
208 case 1:
209 {
210 shape = createCapsuleShapeY(1, 1);
211 break;
212 }
213 case 2:
214 {
215 shape = createCapsuleShapeZ(1, 1);
216 break;
217 }
218 default:
219 {
220 printf("error: wrong up axis for btCapsuleShape\n");
221 }
222 };
223 if (shape)
224 {
225 btCapsuleShape* cap = (btCapsuleShape*)shape;
226 cap->deSerializeFloat(capData);
227 }
228 break;
229 }
230 case CYLINDER_SHAPE_PROXYTYPE:
231 case CONE_SHAPE_PROXYTYPE:
232 case BOX_SHAPE_PROXYTYPE:
233 case SPHERE_SHAPE_PROXYTYPE:
234 case MULTI_SPHERE_SHAPE_PROXYTYPE:
235 case CONVEX_HULL_SHAPE_PROXYTYPE:
236 {
237 btConvexInternalShapeData* bsd = (btConvexInternalShapeData*)shapeData;
238 btVector3 implicitShapeDimensions;
239 implicitShapeDimensions.deSerializeFloat(bsd->m_implicitShapeDimensions);
240 btVector3 localScaling;
241 localScaling.deSerializeFloat(bsd->m_localScaling);
242 btVector3 margin(bsd->m_collisionMargin, bsd->m_collisionMargin, bsd->m_collisionMargin);
243 switch (shapeData->m_shapeType)
244 {
245 case BOX_SHAPE_PROXYTYPE:
246 {
247 btBoxShape* box = (btBoxShape*)createBoxShape(implicitShapeDimensions / localScaling + margin);
248 //box->initializePolyhedralFeatures();
249 shape = box;
250
251 break;
252 }
253 case SPHERE_SHAPE_PROXYTYPE:
254 {
255 shape = createSphereShape(implicitShapeDimensions.getX());
256 break;
257 }
258
259 case CYLINDER_SHAPE_PROXYTYPE:
260 {
261 btCylinderShapeData* cylData = (btCylinderShapeData*)shapeData;
262 btVector3 halfExtents = implicitShapeDimensions + margin;
263 switch (cylData->m_upAxis)
264 {
265 case 0:
266 {
267 shape = createCylinderShapeX(halfExtents.getY(), halfExtents.getX());
268 break;
269 }
270 case 1:
271 {
272 shape = createCylinderShapeY(halfExtents.getX(), halfExtents.getY());
273 break;
274 }
275 case 2:
276 {
277 shape = createCylinderShapeZ(halfExtents.getX(), halfExtents.getZ());
278 break;
279 }
280 default:
281 {
282 printf("unknown Cylinder up axis\n");
283 }
284 };
285
286 break;
287 }
288 case CONE_SHAPE_PROXYTYPE:
289 {
290 btConeShapeData* conData = (btConeShapeData*)shapeData;
291 btVector3 halfExtents = implicitShapeDimensions; //+margin;
292 switch (conData->m_upIndex)
293 {
294 case 0:
295 {
296 shape = createConeShapeX(halfExtents.getY(), halfExtents.getX());
297 break;
298 }
299 case 1:
300 {
301 shape = createConeShapeY(halfExtents.getX(), halfExtents.getY());
302 break;
303 }
304 case 2:
305 {
306 shape = createConeShapeZ(halfExtents.getX(), halfExtents.getZ());
307 break;
308 }
309 default:
310 {
311 printf("unknown Cone up axis\n");
312 }
313 };
314
315 break;
316 }
317 case MULTI_SPHERE_SHAPE_PROXYTYPE:
318 {
319 btMultiSphereShapeData* mss = (btMultiSphereShapeData*)bsd;
320 int numSpheres = mss->m_localPositionArraySize;
321
322 btAlignedObjectArray<btVector3> tmpPos;
323 btAlignedObjectArray<btScalar> radii;
324 radii.resize(numSpheres);
325 tmpPos.resize(numSpheres);
326 int i;
327 for (i = 0; i < numSpheres; i++)
328 {
329 tmpPos[i].deSerializeFloat(mss->m_localPositionArrayPtr[i].m_pos);
330 radii[i] = mss->m_localPositionArrayPtr[i].m_radius;
331 }
332 shape = createMultiSphereShape(&tmpPos[0], &radii[0], numSpheres);
333 break;
334 }
335 case CONVEX_HULL_SHAPE_PROXYTYPE:
336 {
337 // int sz = sizeof(btConvexHullShapeData);
338 // int sz2 = sizeof(btConvexInternalShapeData);
339 // int sz3 = sizeof(btCollisionShapeData);
340 btConvexHullShapeData* convexData = (btConvexHullShapeData*)bsd;
341 int numPoints = convexData->m_numUnscaledPoints;
342
343 btAlignedObjectArray<btVector3> tmpPoints;
344 tmpPoints.resize(numPoints);
345 int i;
346 for (i = 0; i < numPoints; i++)
347 {
348 #ifdef BT_USE_DOUBLE_PRECISION
349 if (convexData->m_unscaledPointsDoublePtr)
350 tmpPoints[i].deSerialize(convexData->m_unscaledPointsDoublePtr[i]);
351 if (convexData->m_unscaledPointsFloatPtr)
352 tmpPoints[i].deSerializeFloat(convexData->m_unscaledPointsFloatPtr[i]);
353 #else
354 if (convexData->m_unscaledPointsFloatPtr)
355 tmpPoints[i].deSerialize(convexData->m_unscaledPointsFloatPtr[i]);
356 if (convexData->m_unscaledPointsDoublePtr)
357 tmpPoints[i].deSerializeDouble(convexData->m_unscaledPointsDoublePtr[i]);
358 #endif //BT_USE_DOUBLE_PRECISION
359 }
360 btConvexHullShape* hullShape = createConvexHullShape();
361 for (i = 0; i < numPoints; i++)
362 {
363 hullShape->addPoint(tmpPoints[i]);
364 }
365 hullShape->setMargin(bsd->m_collisionMargin);
366 //hullShape->initializePolyhedralFeatures();
367 shape = hullShape;
368 break;
369 }
370 default:
371 {
372 printf("error: cannot create shape type (%d)\n", shapeData->m_shapeType);
373 }
374 }
375
376 if (shape)
377 {
378 shape->setMargin(bsd->m_collisionMargin);
379
380 btVector3 localScaling;
381 localScaling.deSerializeFloat(bsd->m_localScaling);
382 shape->setLocalScaling(localScaling);
383 }
384 break;
385 }
386 case TRIANGLE_MESH_SHAPE_PROXYTYPE:
387 {
388 btTriangleMeshShapeData* trimesh = (btTriangleMeshShapeData*)shapeData;
389 btStridingMeshInterfaceData* interfaceData = createStridingMeshInterfaceData(&trimesh->m_meshInterface);
390 btTriangleIndexVertexArray* meshInterface = createMeshInterface(*interfaceData);
391 if (!meshInterface->getNumSubParts())
392 {
393 return 0;
394 }
395
396 btVector3 scaling;
397 scaling.deSerializeFloat(trimesh->m_meshInterface.m_scaling);
398 meshInterface->setScaling(scaling);
399
400 btOptimizedBvh* bvh = 0;
401 #if 1
402 if (trimesh->m_quantizedFloatBvh)
403 {
404 btOptimizedBvh** bvhPtr = m_bvhMap.find(trimesh->m_quantizedFloatBvh);
405 if (bvhPtr && *bvhPtr)
406 {
407 bvh = *bvhPtr;
408 }
409 else
410 {
411 bvh = createOptimizedBvh();
412 bvh->deSerializeFloat(*trimesh->m_quantizedFloatBvh);
413 }
414 }
415 if (trimesh->m_quantizedDoubleBvh)
416 {
417 btOptimizedBvh** bvhPtr = m_bvhMap.find(trimesh->m_quantizedDoubleBvh);
418 if (bvhPtr && *bvhPtr)
419 {
420 bvh = *bvhPtr;
421 }
422 else
423 {
424 bvh = createOptimizedBvh();
425 bvh->deSerializeDouble(*trimesh->m_quantizedDoubleBvh);
426 }
427 }
428 #endif
429
430 btBvhTriangleMeshShape* trimeshShape = createBvhTriangleMeshShape(meshInterface, bvh);
431 trimeshShape->setMargin(trimesh->m_collisionMargin);
432 shape = trimeshShape;
433
434 if (trimesh->m_triangleInfoMap)
435 {
436 btTriangleInfoMap* map = createTriangleInfoMap();
437 map->deSerialize(*trimesh->m_triangleInfoMap);
438 trimeshShape->setTriangleInfoMap(map);
439
440 #ifdef USE_INTERNAL_EDGE_UTILITY
441 gContactAddedCallback = btAdjustInternalEdgeContactsCallback;
442 #endif //USE_INTERNAL_EDGE_UTILITY
443 }
444
445 //printf("trimesh->m_collisionMargin=%f\n",trimesh->m_collisionMargin);
446 break;
447 }
448 case COMPOUND_SHAPE_PROXYTYPE:
449 {
450 btCompoundShapeData* compoundData = (btCompoundShapeData*)shapeData;
451 btCompoundShape* compoundShape = createCompoundShape();
452
453 btAlignedObjectArray<btCollisionShape*> childShapes;
454 for (int i = 0; i < compoundData->m_numChildShapes; i++)
455 {
456 btCollisionShapeData* cd = compoundData->m_childShapePtr[i].m_childShape;
457
458 btCollisionShape* childShape = convertCollisionShape(cd);
459 if (childShape)
460 {
461 btTransform localTransform;
462 localTransform.deSerializeFloat(compoundData->m_childShapePtr[i].m_transform);
463 compoundShape->addChildShape(localTransform, childShape);
464 }
465 else
466 {
467 #ifdef _DEBUG
468 printf("error: couldn't create childShape for compoundShape\n");
469 #endif
470 }
471 }
472 shape = compoundShape;
473
474 break;
475 }
476 case SOFTBODY_SHAPE_PROXYTYPE:
477 {
478 return 0;
479 }
480 default:
481 {
482 #ifdef _DEBUG
483 printf("unsupported shape type (%d)\n", shapeData->m_shapeType);
484 #endif
485 }
486 }
487
488 return shape;
489 }
490
491 char* btWorldImporter::duplicateName(const char* name)
492 {
493 if (name)
494 {
495 int l = (int)strlen(name);
496 char* newName = new char[l + 1];
497 memcpy(newName, name, l);
498 newName[l] = 0;
499 m_allocatedNames.push_back(newName);
500 return newName;
501 }
502 return 0;
503 }
504
505 void btWorldImporter::convertConstraintBackwardsCompatible281(btTypedConstraintData* constraintData, btRigidBody* rbA, btRigidBody* rbB, int fileVersion)
506 {
507 btTypedConstraint* constraint = 0;
508
509 switch (constraintData->m_objectType)
510 {
511 case POINT2POINT_CONSTRAINT_TYPE:
512 {
513 btPoint2PointConstraintDoubleData* p2pData = (btPoint2PointConstraintDoubleData*)constraintData;
514 if (rbA && rbB)
515 {
516 btVector3 pivotInA, pivotInB;
517 pivotInA.deSerializeDouble(p2pData->m_pivotInA);
518 pivotInB.deSerializeDouble(p2pData->m_pivotInB);
519 constraint = createPoint2PointConstraint(*rbA, *rbB, pivotInA, pivotInB);
520 }
521 else
522 {
523 btVector3 pivotInA;
524 pivotInA.deSerializeDouble(p2pData->m_pivotInA);
525 constraint = createPoint2PointConstraint(*rbA, pivotInA);
526 }
527 break;
528 }
529 case HINGE_CONSTRAINT_TYPE:
530 {
531 btHingeConstraint* hinge = 0;
532
533 btHingeConstraintDoubleData* hingeData = (btHingeConstraintDoubleData*)constraintData;
534 if (rbA && rbB)
535 {
536 btTransform rbAFrame, rbBFrame;
537 rbAFrame.deSerializeDouble(hingeData->m_rbAFrame);
538 rbBFrame.deSerializeDouble(hingeData->m_rbBFrame);
539 hinge = createHingeConstraint(*rbA, *rbB, rbAFrame, rbBFrame, hingeData->m_useReferenceFrameA != 0);
540 }
541 else
542 {
543 btTransform rbAFrame;
544 rbAFrame.deSerializeDouble(hingeData->m_rbAFrame);
545 hinge = createHingeConstraint(*rbA, rbAFrame, hingeData->m_useReferenceFrameA != 0);
546 }
547 if (hingeData->m_enableAngularMotor)
548 {
549 hinge->enableAngularMotor(true, (btScalar)hingeData->m_motorTargetVelocity, (btScalar)hingeData->m_maxMotorImpulse);
550 }
551 hinge->setAngularOnly(hingeData->m_angularOnly != 0);
552 hinge->setLimit(btScalar(hingeData->m_lowerLimit), btScalar(hingeData->m_upperLimit), btScalar(hingeData->m_limitSoftness), btScalar(hingeData->m_biasFactor), btScalar(hingeData->m_relaxationFactor));
553
554 constraint = hinge;
555 break;
556 }
557 case CONETWIST_CONSTRAINT_TYPE:
558 {
559 btConeTwistConstraintData* coneData = (btConeTwistConstraintData*)constraintData;
560 btConeTwistConstraint* coneTwist = 0;
561
562 if (rbA && rbB)
563 {
564 btTransform rbAFrame, rbBFrame;
565 rbAFrame.deSerializeFloat(coneData->m_rbAFrame);
566 rbBFrame.deSerializeFloat(coneData->m_rbBFrame);
567 coneTwist = createConeTwistConstraint(*rbA, *rbB, rbAFrame, rbBFrame);
568 }
569 else
570 {
571 btTransform rbAFrame;
572 rbAFrame.deSerializeFloat(coneData->m_rbAFrame);
573 coneTwist = createConeTwistConstraint(*rbA, rbAFrame);
574 }
575 coneTwist->setLimit((btScalar)coneData->m_swingSpan1, (btScalar)coneData->m_swingSpan2, (btScalar)coneData->m_twistSpan, (btScalar)coneData->m_limitSoftness,
576 (btScalar)coneData->m_biasFactor, (btScalar)coneData->m_relaxationFactor);
577 coneTwist->setDamping((btScalar)coneData->m_damping);
578
579 constraint = coneTwist;
580 break;
581 }
582
583 case D6_SPRING_CONSTRAINT_TYPE:
584 {
585 btGeneric6DofSpringConstraintData* dofData = (btGeneric6DofSpringConstraintData*)constraintData;
586 // int sz = sizeof(btGeneric6DofSpringConstraintData);
587 btGeneric6DofSpringConstraint* dof = 0;
588
589 if (rbA && rbB)
590 {
591 btTransform rbAFrame, rbBFrame;
592 rbAFrame.deSerializeFloat(dofData->m_6dofData.m_rbAFrame);
593 rbBFrame.deSerializeFloat(dofData->m_6dofData.m_rbBFrame);
594 dof = createGeneric6DofSpringConstraint(*rbA, *rbB, rbAFrame, rbBFrame, dofData->m_6dofData.m_useLinearReferenceFrameA != 0);
595 }
596 else
597 {
598 printf("Error in btWorldImporter::createGeneric6DofSpringConstraint: requires rbA && rbB\n");
599 }
600
601 if (dof)
602 {
603 btVector3 angLowerLimit, angUpperLimit, linLowerLimit, linUpperlimit;
604 angLowerLimit.deSerializeFloat(dofData->m_6dofData.m_angularLowerLimit);
605 angUpperLimit.deSerializeFloat(dofData->m_6dofData.m_angularUpperLimit);
606 linLowerLimit.deSerializeFloat(dofData->m_6dofData.m_linearLowerLimit);
607 linUpperlimit.deSerializeFloat(dofData->m_6dofData.m_linearUpperLimit);
608
609 angLowerLimit.setW(0.f);
610 dof->setAngularLowerLimit(angLowerLimit);
611 dof->setAngularUpperLimit(angUpperLimit);
612 dof->setLinearLowerLimit(linLowerLimit);
613 dof->setLinearUpperLimit(linUpperlimit);
614
615 int i;
616 if (fileVersion > 280)
617 {
618 for (i = 0; i < 6; i++)
619 {
620 dof->setStiffness(i, (btScalar)dofData->m_springStiffness[i]);
621 dof->setEquilibriumPoint(i, (btScalar)dofData->m_equilibriumPoint[i]);
622 dof->enableSpring(i, dofData->m_springEnabled[i] != 0);
623 dof->setDamping(i, (btScalar)dofData->m_springDamping[i]);
624 }
625 }
626 }
627
628 constraint = dof;
629 break;
630 }
631 case D6_CONSTRAINT_TYPE:
632 {
633 btGeneric6DofConstraintData* dofData = (btGeneric6DofConstraintData*)constraintData;
634 btGeneric6DofConstraint* dof = 0;
635
636 if (rbA && rbB)
637 {
638 btTransform rbAFrame, rbBFrame;
639 rbAFrame.deSerializeFloat(dofData->m_rbAFrame);
640 rbBFrame.deSerializeFloat(dofData->m_rbBFrame);
641 dof = createGeneric6DofConstraint(*rbA, *rbB, rbAFrame, rbBFrame, dofData->m_useLinearReferenceFrameA != 0);
642 }
643 else
644 {
645 if (rbB)
646 {
647 btTransform rbBFrame;
648 rbBFrame.deSerializeFloat(dofData->m_rbBFrame);
649 dof = createGeneric6DofConstraint(*rbB, rbBFrame, dofData->m_useLinearReferenceFrameA != 0);
650 }
651 else
652 {
653 printf("Error in btWorldImporter::createGeneric6DofConstraint: missing rbB\n");
654 }
655 }
656
657 if (dof)
658 {
659 btVector3 angLowerLimit, angUpperLimit, linLowerLimit, linUpperlimit;
660 angLowerLimit.deSerializeFloat(dofData->m_angularLowerLimit);
661 angUpperLimit.deSerializeFloat(dofData->m_angularUpperLimit);
662 linLowerLimit.deSerializeFloat(dofData->m_linearLowerLimit);
663 linUpperlimit.deSerializeFloat(dofData->m_linearUpperLimit);
664
665 dof->setAngularLowerLimit(angLowerLimit);
666 dof->setAngularUpperLimit(angUpperLimit);
667 dof->setLinearLowerLimit(linLowerLimit);
668 dof->setLinearUpperLimit(linUpperlimit);
669 }
670
671 constraint = dof;
672 break;
673 }
674 case SLIDER_CONSTRAINT_TYPE:
675 {
676 btSliderConstraintData* sliderData = (btSliderConstraintData*)constraintData;
677 btSliderConstraint* slider = 0;
678 if (rbA && rbB)
679 {
680 btTransform rbAFrame, rbBFrame;
681 rbAFrame.deSerializeFloat(sliderData->m_rbAFrame);
682 rbBFrame.deSerializeFloat(sliderData->m_rbBFrame);
683 slider = createSliderConstraint(*rbA, *rbB, rbAFrame, rbBFrame, sliderData->m_useLinearReferenceFrameA != 0);
684 }
685 else
686 {
687 btTransform rbBFrame;
688 rbBFrame.deSerializeFloat(sliderData->m_rbBFrame);
689 slider = createSliderConstraint(*rbB, rbBFrame, sliderData->m_useLinearReferenceFrameA != 0);
690 }
691 slider->setLowerLinLimit((btScalar)sliderData->m_linearLowerLimit);
692 slider->setUpperLinLimit((btScalar)sliderData->m_linearUpperLimit);
693 slider->setLowerAngLimit((btScalar)sliderData->m_angularLowerLimit);
694 slider->setUpperAngLimit((btScalar)sliderData->m_angularUpperLimit);
695 slider->setUseFrameOffset(sliderData->m_useOffsetForConstraintFrame != 0);
696 constraint = slider;
697 break;
698 }
699
700 default:
701 {
702 printf("unknown constraint type\n");
703 }
704 };
705
706 if (constraint)
707 {
708 constraint->setDbgDrawSize((btScalar)constraintData->m_dbgDrawSize);
710 if (fileVersion >= 280)
711 {
712 constraint->setBreakingImpulseThreshold((btScalar)constraintData->m_breakingImpulseThreshold);
713 constraint->setEnabled(constraintData->m_isEnabled != 0);
714 constraint->setOverrideNumSolverIterations(constraintData->m_overrideNumSolverIterations);
715 }
716
717 if (constraintData->m_name)
718 {
719 char* newname = duplicateName(constraintData->m_name);
720 m_nameConstraintMap.insert(newname, constraint);
721 m_objectNameMap.insert(constraint, newname);
722 }
723 if (m_dynamicsWorld)
724 m_dynamicsWorld->addConstraint(constraint, constraintData->m_disableCollisionsBetweenLinkedBodies != 0);
725 }
726 }
727
728 void btWorldImporter::convertConstraintFloat(btTypedConstraintFloatData* constraintData, btRigidBody* rbA, btRigidBody* rbB, int fileVersion)
729 {
730 btTypedConstraint* constraint = 0;
731
732 switch (constraintData->m_objectType)
733 {
734 case POINT2POINT_CONSTRAINT_TYPE:
735 {
736 btPoint2PointConstraintFloatData* p2pData = (btPoint2PointConstraintFloatData*)constraintData;
737 if (rbA && rbB)
738 {
739 btVector3 pivotInA, pivotInB;
740 pivotInA.deSerializeFloat(p2pData->m_pivotInA);
741 pivotInB.deSerializeFloat(p2pData->m_pivotInB);
742 constraint = createPoint2PointConstraint(*rbA, *rbB, pivotInA, pivotInB);
743 }
744 else
745 {
746 btVector3 pivotInA;
747 pivotInA.deSerializeFloat(p2pData->m_pivotInA);
748 constraint = createPoint2PointConstraint(*rbA, pivotInA);
749 }
750 break;
751 }
752 case HINGE_CONSTRAINT_TYPE:
753 {
754 btHingeConstraint* hinge = 0;
755 btHingeConstraintFloatData* hingeData = (btHingeConstraintFloatData*)constraintData;
756 if (rbA && rbB)
757 {
758 btTransform rbAFrame, rbBFrame;
759 rbAFrame.deSerializeFloat(hingeData->m_rbAFrame);
760 rbBFrame.deSerializeFloat(hingeData->m_rbBFrame);
761 hinge = createHingeConstraint(*rbA, *rbB, rbAFrame, rbBFrame, hingeData->m_useReferenceFrameA != 0);
762 }
763 else
764 {
765 btTransform rbAFrame;
766 rbAFrame.deSerializeFloat(hingeData->m_rbAFrame);
767 hinge = createHingeConstraint(*rbA, rbAFrame, hingeData->m_useReferenceFrameA != 0);
768 }
769 if (hingeData->m_enableAngularMotor)
770 {
771 hinge->enableAngularMotor(true, hingeData->m_motorTargetVelocity, hingeData->m_maxMotorImpulse);
772 }
773 hinge->setAngularOnly(hingeData->m_angularOnly != 0);
774 hinge->setLimit(btScalar(hingeData->m_lowerLimit), btScalar(hingeData->m_upperLimit), btScalar(hingeData->m_limitSoftness), btScalar(hingeData->m_biasFactor), btScalar(hingeData->m_relaxationFactor));
775
776 constraint = hinge;
777 break;
778 }
779 case CONETWIST_CONSTRAINT_TYPE:
780 {
781 btConeTwistConstraintData* coneData = (btConeTwistConstraintData*)constraintData;
782 btConeTwistConstraint* coneTwist = 0;
783
784 if (rbA && rbB)
785 {
786 btTransform rbAFrame, rbBFrame;
787 rbAFrame.deSerializeFloat(coneData->m_rbAFrame);
788 rbBFrame.deSerializeFloat(coneData->m_rbBFrame);
789 coneTwist = createConeTwistConstraint(*rbA, *rbB, rbAFrame, rbBFrame);
790 }
791 else
792 {
793 btTransform rbAFrame;
794 rbAFrame.deSerializeFloat(coneData->m_rbAFrame);
795 coneTwist = createConeTwistConstraint(*rbA, rbAFrame);
796 }
797 coneTwist->setLimit(coneData->m_swingSpan1, coneData->m_swingSpan2, coneData->m_twistSpan, coneData->m_limitSoftness, coneData->m_biasFactor, coneData->m_relaxationFactor);
798 coneTwist->setDamping(coneData->m_damping);
799
800 constraint = coneTwist;
801 break;
802 }
803
804 case D6_SPRING_CONSTRAINT_TYPE:
805 {
806 btGeneric6DofSpringConstraintData* dofData = (btGeneric6DofSpringConstraintData*)constraintData;
807 // int sz = sizeof(btGeneric6DofSpringConstraintData);
808 btGeneric6DofSpringConstraint* dof = 0;
809
810 if (rbA && rbB)
811 {
812 btTransform rbAFrame, rbBFrame;
813 rbAFrame.deSerializeFloat(dofData->m_6dofData.m_rbAFrame);
814 rbBFrame.deSerializeFloat(dofData->m_6dofData.m_rbBFrame);
815 dof = createGeneric6DofSpringConstraint(*rbA, *rbB, rbAFrame, rbBFrame, dofData->m_6dofData.m_useLinearReferenceFrameA != 0);
816 }
817 else
818 {
819 printf("Error in btWorldImporter::createGeneric6DofSpringConstraint: requires rbA && rbB\n");
820 }
821
822 if (dof)
823 {
824 btVector3 angLowerLimit, angUpperLimit, linLowerLimit, linUpperlimit;
825 angLowerLimit.deSerializeFloat(dofData->m_6dofData.m_angularLowerLimit);
826 angUpperLimit.deSerializeFloat(dofData->m_6dofData.m_angularUpperLimit);
827 linLowerLimit.deSerializeFloat(dofData->m_6dofData.m_linearLowerLimit);
828 linUpperlimit.deSerializeFloat(dofData->m_6dofData.m_linearUpperLimit);
829
830 angLowerLimit.setW(0.f);
831 dof->setAngularLowerLimit(angLowerLimit);
832 dof->setAngularUpperLimit(angUpperLimit);
833 dof->setLinearLowerLimit(linLowerLimit);
834 dof->setLinearUpperLimit(linUpperlimit);
835
836 int i;
837 if (fileVersion > 280)
838 {
839 for (i = 0; i < 6; i++)
840 {
841 dof->setStiffness(i, dofData->m_springStiffness[i]);
842 dof->setEquilibriumPoint(i, dofData->m_equilibriumPoint[i]);
843 dof->enableSpring(i, dofData->m_springEnabled[i] != 0);
844 dof->setDamping(i, dofData->m_springDamping[i]);
845 }
846 }
847 }
848
849 constraint = dof;
850 break;
851 }
852 case D6_CONSTRAINT_TYPE:
853 {
854 btGeneric6DofConstraintData* dofData = (btGeneric6DofConstraintData*)constraintData;
855 btGeneric6DofConstraint* dof = 0;
856
857 if (rbA && rbB)
858 {
859 btTransform rbAFrame, rbBFrame;
860 rbAFrame.deSerializeFloat(dofData->m_rbAFrame);
861 rbBFrame.deSerializeFloat(dofData->m_rbBFrame);
862 dof = createGeneric6DofConstraint(*rbA, *rbB, rbAFrame, rbBFrame, dofData->m_useLinearReferenceFrameA != 0);
863 }
864 else
865 {
866 if (rbB)
867 {
868 btTransform rbBFrame;
869 rbBFrame.deSerializeFloat(dofData->m_rbBFrame);
870 dof = createGeneric6DofConstraint(*rbB, rbBFrame, dofData->m_useLinearReferenceFrameA != 0);
871 }
872 else
873 {
874 printf("Error in btWorldImporter::createGeneric6DofConstraint: missing rbB\n");
875 }
876 }
877
878 if (dof)
879 {
880 btVector3 angLowerLimit, angUpperLimit, linLowerLimit, linUpperlimit;
881 angLowerLimit.deSerializeFloat(dofData->m_angularLowerLimit);
882 angUpperLimit.deSerializeFloat(dofData->m_angularUpperLimit);
883 linLowerLimit.deSerializeFloat(dofData->m_linearLowerLimit);
884 linUpperlimit.deSerializeFloat(dofData->m_linearUpperLimit);
885
886 dof->setAngularLowerLimit(angLowerLimit);
887 dof->setAngularUpperLimit(angUpperLimit);
888 dof->setLinearLowerLimit(linLowerLimit);
889 dof->setLinearUpperLimit(linUpperlimit);
890 }
891
892 constraint = dof;
893 break;
894 }
895 case SLIDER_CONSTRAINT_TYPE:
896 {
897 btSliderConstraintData* sliderData = (btSliderConstraintData*)constraintData;
898 btSliderConstraint* slider = 0;
899 if (rbA && rbB)
900 {
901 btTransform rbAFrame, rbBFrame;
902 rbAFrame.deSerializeFloat(sliderData->m_rbAFrame);
903 rbBFrame.deSerializeFloat(sliderData->m_rbBFrame);
904 slider = createSliderConstraint(*rbA, *rbB, rbAFrame, rbBFrame, sliderData->m_useLinearReferenceFrameA != 0);
905 }
906 else
907 {
908 btTransform rbBFrame;
909 rbBFrame.deSerializeFloat(sliderData->m_rbBFrame);
910 slider = createSliderConstraint(*rbB, rbBFrame, sliderData->m_useLinearReferenceFrameA != 0);
911 }
912 slider->setLowerLinLimit(sliderData->m_linearLowerLimit);
913 slider->setUpperLinLimit(sliderData->m_linearUpperLimit);
914 slider->setLowerAngLimit(sliderData->m_angularLowerLimit);
915 slider->setUpperAngLimit(sliderData->m_angularUpperLimit);
916 slider->setUseFrameOffset(sliderData->m_useOffsetForConstraintFrame != 0);
917 constraint = slider;
918 break;
919 }
920 case GEAR_CONSTRAINT_TYPE:
921 {
922 btGearConstraintFloatData* gearData = (btGearConstraintFloatData*)constraintData;
923 btGearConstraint* gear = 0;
924 if (rbA && rbB)
925 {
926 btVector3 axisInA, axisInB;
927 axisInA.deSerializeFloat(gearData->m_axisInA);
928 axisInB.deSerializeFloat(gearData->m_axisInB);
929 gear = createGearConstraint(*rbA, *rbB, axisInA, axisInB, gearData->m_ratio);
930 }
931 else
932 {
933 btAssert(0);
934 //perhaps a gear against a 'fixed' body, while the 'fixed' body is not serialized?
935 //btGearConstraint(btRigidBody& rbA, btRigidBody& rbB, const btVector3& axisInA,const btVector3& axisInB, btScalar ratio=1.f);
936 }
937 constraint = gear;
938 break;
939 }
940 case D6_SPRING_2_CONSTRAINT_TYPE:
941 {
942 btGeneric6DofSpring2ConstraintData* dofData = (btGeneric6DofSpring2ConstraintData*)constraintData;
943
944 btGeneric6DofSpring2Constraint* dof = 0;
945
946 if (rbA && rbB)
947 {
948 btTransform rbAFrame, rbBFrame;
949 rbAFrame.deSerializeFloat(dofData->m_rbAFrame);
950 rbBFrame.deSerializeFloat(dofData->m_rbBFrame);
951 dof = createGeneric6DofSpring2Constraint(*rbA, *rbB, rbAFrame, rbBFrame, dofData->m_rotateOrder);
952 }
953 else
954 {
955 printf("Error in btWorldImporter::createGeneric6DofSpring2Constraint: requires rbA && rbB\n");
956 }
957
958 if (dof)
959 {
960 btVector3 angLowerLimit, angUpperLimit, linLowerLimit, linUpperlimit;
961 angLowerLimit.deSerializeFloat(dofData->m_angularLowerLimit);
962 angUpperLimit.deSerializeFloat(dofData->m_angularUpperLimit);
963 linLowerLimit.deSerializeFloat(dofData->m_linearLowerLimit);
964 linUpperlimit.deSerializeFloat(dofData->m_linearUpperLimit);
965
966 angLowerLimit.setW(0.f);
967 dof->setAngularLowerLimit(angLowerLimit);
968 dof->setAngularUpperLimit(angUpperLimit);
969 dof->setLinearLowerLimit(linLowerLimit);
970 dof->setLinearUpperLimit(linUpperlimit);
971
972 int i;
973 if (fileVersion > 280)
974 {
975 //6-dof: 3 linear followed by 3 angular
976 for (i = 0; i < 3; i++)
977 {
978 dof->setStiffness(i, dofData->m_linearSpringStiffness.m_floats[i], dofData->m_linearSpringStiffnessLimited[i] != 0);
979 dof->setEquilibriumPoint(i, dofData->m_linearEquilibriumPoint.m_floats[i]);
980 dof->enableSpring(i, dofData->m_linearEnableSpring[i] != 0);
981 dof->setDamping(i, dofData->m_linearSpringDamping.m_floats[i], (dofData->m_linearSpringDampingLimited[i] != 0));
982 }
983 for (i = 0; i < 3; i++)
984 {
985 dof->setStiffness(i + 3, dofData->m_angularSpringStiffness.m_floats[i], (dofData->m_angularSpringStiffnessLimited[i] != 0));
986 dof->setEquilibriumPoint(i + 3, dofData->m_angularEquilibriumPoint.m_floats[i]);
987 dof->enableSpring(i + 3, dofData->m_angularEnableSpring[i] != 0);
988 dof->setDamping(i + 3, dofData->m_angularSpringDamping.m_floats[i], dofData->m_angularSpringDampingLimited[i]);
989 }
990 }
991 }
992
993 constraint = dof;
994 break;
995 }
996 case FIXED_CONSTRAINT_TYPE:
997 {
998 btGeneric6DofSpring2Constraint* dof = 0;
999 if (rbA && rbB)
1000 {
1001 btTransform rbAFrame, rbBFrame;
1002 //compute a shared world frame, and compute frameInA, frameInB relative to this
1003 btTransform sharedFrame;
1004 sharedFrame.setIdentity();
1005 btVector3 centerPos = btScalar(0.5) * (rbA->getWorldTransform().getOrigin() +
1006 rbB->getWorldTransform().getOrigin());
1007 sharedFrame.setOrigin(centerPos);
1008 rbAFrame = rbA->getWorldTransform().inverse() * sharedFrame;
1009 rbBFrame = rbB->getWorldTransform().inverse() * sharedFrame;
1010
1011 dof = createGeneric6DofSpring2Constraint(*rbA, *rbB, rbAFrame, rbBFrame, RO_XYZ);
1012 dof->setLinearUpperLimit(btVector3(0, 0, 0));
1013 dof->setLinearLowerLimit(btVector3(0, 0, 0));
1014 dof->setAngularUpperLimit(btVector3(0, 0, 0));
1015 dof->setAngularLowerLimit(btVector3(0, 0, 0));
1016 }
1017 else
1018 {
1019 printf("Error in btWorldImporter::createGeneric6DofSpring2Constraint: requires rbA && rbB\n");
1020 }
1021
1022 constraint = dof;
1023 break;
1024 }
1025 default:
1026 {
1027 printf("unknown constraint type\n");
1028 }
1029 };
1030
1031 if (constraint)
1032 {
1033 constraint->setDbgDrawSize(constraintData->m_dbgDrawSize);
1035 if (fileVersion >= 280)
1036 {
1037 constraint->setBreakingImpulseThreshold(constraintData->m_breakingImpulseThreshold);
1038 constraint->setEnabled(constraintData->m_isEnabled != 0);
1039 constraint->setOverrideNumSolverIterations(constraintData->m_overrideNumSolverIterations);
1040 }
1041
1042 if (constraintData->m_name)
1043 {
1044 char* newname = duplicateName(constraintData->m_name);
1045 m_nameConstraintMap.insert(newname, constraint);
1046 m_objectNameMap.insert(constraint, newname);
1047 }
1048 if (m_dynamicsWorld)
1049 m_dynamicsWorld->addConstraint(constraint, constraintData->m_disableCollisionsBetweenLinkedBodies != 0);
1050 }
1051 }
1052
1053 void btWorldImporter::convertConstraintDouble(btTypedConstraintDoubleData* constraintData, btRigidBody* rbA, btRigidBody* rbB, int fileVersion)
1054 {
1055 btTypedConstraint* constraint = 0;
1056
1057 switch (constraintData->m_objectType)
1058 {
1059 case POINT2POINT_CONSTRAINT_TYPE:
1060 {
1061 btPoint2PointConstraintDoubleData2* p2pData = (btPoint2PointConstraintDoubleData2*)constraintData;
1062 if (rbA && rbB)
1063 {
1064 btVector3 pivotInA, pivotInB;
1065 pivotInA.deSerializeDouble(p2pData->m_pivotInA);
1066 pivotInB.deSerializeDouble(p2pData->m_pivotInB);
1067 constraint = createPoint2PointConstraint(*rbA, *rbB, pivotInA, pivotInB);
1068 }
1069 else
1070 {
1071 btVector3 pivotInA;
1072 pivotInA.deSerializeDouble(p2pData->m_pivotInA);
1073 constraint = createPoint2PointConstraint(*rbA, pivotInA);
1074 }
1075 break;
1076 }
1077 case HINGE_CONSTRAINT_TYPE:
1078 {
1079 btHingeConstraint* hinge = 0;
1080
1081 btHingeConstraintDoubleData2* hingeData = (btHingeConstraintDoubleData2*)constraintData;
1082 if (rbA && rbB)
1083 {
1084 btTransform rbAFrame, rbBFrame;
1085 rbAFrame.deSerializeDouble(hingeData->m_rbAFrame);
1086 rbBFrame.deSerializeDouble(hingeData->m_rbBFrame);
1087 hinge = createHingeConstraint(*rbA, *rbB, rbAFrame, rbBFrame, hingeData->m_useReferenceFrameA != 0);
1088 }
1089 else
1090 {
1091 btTransform rbAFrame;
1092 rbAFrame.deSerializeDouble(hingeData->m_rbAFrame);
1093 hinge = createHingeConstraint(*rbA, rbAFrame, hingeData->m_useReferenceFrameA != 0);
1094 }
1095 if (hingeData->m_enableAngularMotor)
1096 {
1097 hinge->enableAngularMotor(true, (btScalar)hingeData->m_motorTargetVelocity, (btScalar)hingeData->m_maxMotorImpulse);
1098 }
1099 hinge->setAngularOnly(hingeData->m_angularOnly != 0);
1100 hinge->setLimit(btScalar(hingeData->m_lowerLimit), btScalar(hingeData->m_upperLimit), btScalar(hingeData->m_limitSoftness), btScalar(hingeData->m_biasFactor), btScalar(hingeData->m_relaxationFactor));
1101
1102 constraint = hinge;
1103 break;
1104 }
1105 case CONETWIST_CONSTRAINT_TYPE:
1106 {
1107 btConeTwistConstraintDoubleData* coneData = (btConeTwistConstraintDoubleData*)constraintData;
1108 btConeTwistConstraint* coneTwist = 0;
1109
1110 if (rbA && rbB)
1111 {
1112 btTransform rbAFrame, rbBFrame;
1113 rbAFrame.deSerializeDouble(coneData->m_rbAFrame);
1114 rbBFrame.deSerializeDouble(coneData->m_rbBFrame);
1115 coneTwist = createConeTwistConstraint(*rbA, *rbB, rbAFrame, rbBFrame);
1116 }
1117 else
1118 {
1119 btTransform rbAFrame;
1120 rbAFrame.deSerializeDouble(coneData->m_rbAFrame);
1121 coneTwist = createConeTwistConstraint(*rbA, rbAFrame);
1122 }
1123 coneTwist->setLimit((btScalar)coneData->m_swingSpan1, (btScalar)coneData->m_swingSpan2, (btScalar)coneData->m_twistSpan, (btScalar)coneData->m_limitSoftness,
1124 (btScalar)coneData->m_biasFactor, (btScalar)coneData->m_relaxationFactor);
1125 coneTwist->setDamping((btScalar)coneData->m_damping);
1126
1127 constraint = coneTwist;
1128 break;
1129 }
1130
1131 case D6_SPRING_CONSTRAINT_TYPE:
1132 {
1133 btGeneric6DofSpringConstraintDoubleData2* dofData = (btGeneric6DofSpringConstraintDoubleData2*)constraintData;
1134 // int sz = sizeof(btGeneric6DofSpringConstraintData);
1135 btGeneric6DofSpringConstraint* dof = 0;
1136
1137 if (rbA && rbB)
1138 {
1139 btTransform rbAFrame, rbBFrame;
1140 rbAFrame.deSerializeDouble(dofData->m_6dofData.m_rbAFrame);
1141 rbBFrame.deSerializeDouble(dofData->m_6dofData.m_rbBFrame);
1142 dof = createGeneric6DofSpringConstraint(*rbA, *rbB, rbAFrame, rbBFrame, dofData->m_6dofData.m_useLinearReferenceFrameA != 0);
1143 }
1144 else
1145 {
1146 printf("Error in btWorldImporter::createGeneric6DofSpringConstraint: requires rbA && rbB\n");
1147 }
1148
1149 if (dof)
1150 {
1151 btVector3 angLowerLimit, angUpperLimit, linLowerLimit, linUpperlimit;
1152 angLowerLimit.deSerializeDouble(dofData->m_6dofData.m_angularLowerLimit);
1153 angUpperLimit.deSerializeDouble(dofData->m_6dofData.m_angularUpperLimit);
1154 linLowerLimit.deSerializeDouble(dofData->m_6dofData.m_linearLowerLimit);
1155 linUpperlimit.deSerializeDouble(dofData->m_6dofData.m_linearUpperLimit);
1156
1157 angLowerLimit.setW(0.f);
1158 dof->setAngularLowerLimit(angLowerLimit);
1159 dof->setAngularUpperLimit(angUpperLimit);
1160 dof->setLinearLowerLimit(linLowerLimit);
1161 dof->setLinearUpperLimit(linUpperlimit);
1162
1163 int i;
1164 if (fileVersion > 280)
1165 {
1166 for (i = 0; i < 6; i++)
1167 {
1168 dof->setStiffness(i, (btScalar)dofData->m_springStiffness[i]);
1169 dof->setEquilibriumPoint(i, (btScalar)dofData->m_equilibriumPoint[i]);
1170 dof->enableSpring(i, dofData->m_springEnabled[i] != 0);
1171 dof->setDamping(i, (btScalar)dofData->m_springDamping[i]);
1172 }
1173 }
1174 }
1175
1176 constraint = dof;
1177 break;
1178 }
1179 case D6_CONSTRAINT_TYPE:
1180 {
1181 btGeneric6DofConstraintDoubleData2* dofData = (btGeneric6DofConstraintDoubleData2*)constraintData;
1182 btGeneric6DofConstraint* dof = 0;
1183
1184 if (rbA && rbB)
1185 {
1186 btTransform rbAFrame, rbBFrame;
1187 rbAFrame.deSerializeDouble(dofData->m_rbAFrame);
1188 rbBFrame.deSerializeDouble(dofData->m_rbBFrame);
1189 dof = createGeneric6DofConstraint(*rbA, *rbB, rbAFrame, rbBFrame, dofData->m_useLinearReferenceFrameA != 0);
1190 }
1191 else
1192 {
1193 if (rbB)
1194 {
1195 btTransform rbBFrame;
1196 rbBFrame.deSerializeDouble(dofData->m_rbBFrame);
1197 dof = createGeneric6DofConstraint(*rbB, rbBFrame, dofData->m_useLinearReferenceFrameA != 0);
1198 }
1199 else
1200 {
1201 printf("Error in btWorldImporter::createGeneric6DofConstraint: missing rbB\n");
1202 }
1203 }
1204
1205 if (dof)
1206 {
1207 btVector3 angLowerLimit, angUpperLimit, linLowerLimit, linUpperlimit;
1208 angLowerLimit.deSerializeDouble(dofData->m_angularLowerLimit);
1209 angUpperLimit.deSerializeDouble(dofData->m_angularUpperLimit);
1210 linLowerLimit.deSerializeDouble(dofData->m_linearLowerLimit);
1211 linUpperlimit.deSerializeDouble(dofData->m_linearUpperLimit);
1212
1213 dof->setAngularLowerLimit(angLowerLimit);
1214 dof->setAngularUpperLimit(angUpperLimit);
1215 dof->setLinearLowerLimit(linLowerLimit);
1216 dof->setLinearUpperLimit(linUpperlimit);
1217 }
1218
1219 constraint = dof;
1220 break;
1221 }
1222 case SLIDER_CONSTRAINT_TYPE:
1223 {
1224 btSliderConstraintDoubleData* sliderData = (btSliderConstraintDoubleData*)constraintData;
1225 btSliderConstraint* slider = 0;
1226 if (rbA && rbB)
1227 {
1228 btTransform rbAFrame, rbBFrame;
1229 rbAFrame.deSerializeDouble(sliderData->m_rbAFrame);
1230 rbBFrame.deSerializeDouble(sliderData->m_rbBFrame);
1231 slider = createSliderConstraint(*rbA, *rbB, rbAFrame, rbBFrame, sliderData->m_useLinearReferenceFrameA != 0);
1232 }
1233 else
1234 {
1235 btTransform rbBFrame;
1236 rbBFrame.deSerializeDouble(sliderData->m_rbBFrame);
1237 slider = createSliderConstraint(*rbB, rbBFrame, sliderData->m_useLinearReferenceFrameA != 0);
1238 }
1239 slider->setLowerLinLimit((btScalar)sliderData->m_linearLowerLimit);
1240 slider->setUpperLinLimit((btScalar)sliderData->m_linearUpperLimit);
1241 slider->setLowerAngLimit((btScalar)sliderData->m_angularLowerLimit);
1242 slider->setUpperAngLimit((btScalar)sliderData->m_angularUpperLimit);
1243 slider->setUseFrameOffset(sliderData->m_useOffsetForConstraintFrame != 0);
1244 constraint = slider;
1245 break;
1246 }
1247 case GEAR_CONSTRAINT_TYPE:
1248 {
1249 btGearConstraintDoubleData* gearData = (btGearConstraintDoubleData*)constraintData;
1250 btGearConstraint* gear = 0;
1251 if (rbA && rbB)
1252 {
1253 btVector3 axisInA, axisInB;
1254 axisInA.deSerializeDouble(gearData->m_axisInA);
1255 axisInB.deSerializeDouble(gearData->m_axisInB);
1256 gear = createGearConstraint(*rbA, *rbB, axisInA, axisInB, gearData->m_ratio);
1257 }
1258 else
1259 {
1260 btAssert(0);
1261 //perhaps a gear against a 'fixed' body, while the 'fixed' body is not serialized?
1262 //btGearConstraint(btRigidBody& rbA, btRigidBody& rbB, const btVector3& axisInA,const btVector3& axisInB, btScalar ratio=1.f);
1263 }
1264 constraint = gear;
1265 break;
1266 }
1267
1268 case D6_SPRING_2_CONSTRAINT_TYPE:
1269 {
1270 btGeneric6DofSpring2ConstraintDoubleData2* dofData = (btGeneric6DofSpring2ConstraintDoubleData2*)constraintData;
1271
1272 btGeneric6DofSpring2Constraint* dof = 0;
1273
1274 if (rbA && rbB)
1275 {
1276 btTransform rbAFrame, rbBFrame;
1277 rbAFrame.deSerializeDouble(dofData->m_rbAFrame);
1278 rbBFrame.deSerializeDouble(dofData->m_rbBFrame);
1279 dof = createGeneric6DofSpring2Constraint(*rbA, *rbB, rbAFrame, rbBFrame, dofData->m_rotateOrder);
1280 }
1281 else
1282 {
1283 printf("Error in btWorldImporter::createGeneric6DofSpring2Constraint: requires rbA && rbB\n");
1284 }
1285
1286 if (dof)
1287 {
1288 btVector3 angLowerLimit, angUpperLimit, linLowerLimit, linUpperlimit;
1289 angLowerLimit.deSerializeDouble(dofData->m_angularLowerLimit);
1290 angUpperLimit.deSerializeDouble(dofData->m_angularUpperLimit);
1291 linLowerLimit.deSerializeDouble(dofData->m_linearLowerLimit);
1292 linUpperlimit.deSerializeDouble(dofData->m_linearUpperLimit);
1293
1294 angLowerLimit.setW(0.f);
1295 dof->setAngularLowerLimit(angLowerLimit);
1296 dof->setAngularUpperLimit(angUpperLimit);
1297 dof->setLinearLowerLimit(linLowerLimit);
1298 dof->setLinearUpperLimit(linUpperlimit);
1299
1300 int i;
1301 if (fileVersion > 280)
1302 {
1303 //6-dof: 3 linear followed by 3 angular
1304 for (i = 0; i < 3; i++)
1305 {
1306 dof->setStiffness(i, dofData->m_linearSpringStiffness.m_floats[i], dofData->m_linearSpringStiffnessLimited[i]);
1307 dof->setEquilibriumPoint(i, dofData->m_linearEquilibriumPoint.m_floats[i]);
1308 dof->enableSpring(i, dofData->m_linearEnableSpring[i] != 0);
1309 dof->setDamping(i, dofData->m_linearSpringDamping.m_floats[i], (dofData->m_linearSpringDampingLimited[i] != 0));
1310 }
1311 for (i = 0; i < 3; i++)
1312 {
1313 dof->setStiffness(i + 3, dofData->m_angularSpringStiffness.m_floats[i], (dofData->m_angularSpringStiffnessLimited[i] != 0));
1314 dof->setEquilibriumPoint(i + 3, dofData->m_angularEquilibriumPoint.m_floats[i]);
1315 dof->enableSpring(i + 3, dofData->m_angularEnableSpring[i] != 0);
1316 dof->setDamping(i + 3, dofData->m_angularSpringDamping.m_floats[i], (dofData->m_angularSpringDampingLimited[i] != 0));
1317 }
1318 }
1319 }
1320
1321 constraint = dof;
1322 break;
1323 }
1324 case FIXED_CONSTRAINT_TYPE:
1325 {
1326 btGeneric6DofSpring2Constraint* dof = 0;
1327 if (rbA && rbB)
1328 {
1329 btTransform rbAFrame, rbBFrame;
1330 //compute a shared world frame, and compute frameInA, frameInB relative to this
1331 btTransform sharedFrame;
1332 sharedFrame.setIdentity();
1333 btVector3 centerPos = btScalar(0.5) * (rbA->getWorldTransform().getOrigin() +
1334 rbB->getWorldTransform().getOrigin());
1335 sharedFrame.setOrigin(centerPos);
1336 rbAFrame = rbA->getWorldTransform().inverse() * sharedFrame;
1337 rbBFrame = rbB->getWorldTransform().inverse() * sharedFrame;
1338
1339 dof = createGeneric6DofSpring2Constraint(*rbA, *rbB, rbAFrame, rbBFrame, RO_XYZ);
1340 dof->setLinearUpperLimit(btVector3(0, 0, 0));
1341 dof->setLinearLowerLimit(btVector3(0, 0, 0));
1342 dof->setAngularUpperLimit(btVector3(0, 0, 0));
1343 dof->setAngularLowerLimit(btVector3(0, 0, 0));
1344 }
1345 else
1346 {
1347 printf("Error in btWorldImporter::createGeneric6DofSpring2Constraint: requires rbA && rbB\n");
1348 }
1349
1350 constraint = dof;
1351 break;
1352 }
1353
1354 default:
1355 {
1356 printf("unknown constraint type\n");
1357 }
1358 };
1359
1360 if (constraint)
1361 {
1362 constraint->setDbgDrawSize((btScalar)constraintData->m_dbgDrawSize);
1364 if (fileVersion >= 280)
1365 {
1366 constraint->setBreakingImpulseThreshold((btScalar)constraintData->m_breakingImpulseThreshold);
1367 constraint->setEnabled(constraintData->m_isEnabled != 0);
1368 constraint->setOverrideNumSolverIterations(constraintData->m_overrideNumSolverIterations);
1369 }
1370
1371 if (constraintData->m_name)
1372 {
1373 char* newname = duplicateName(constraintData->m_name);
1374 m_nameConstraintMap.insert(newname, constraint);
1375 m_objectNameMap.insert(constraint, newname);
1376 }
1377 if (m_dynamicsWorld)
1378 m_dynamicsWorld->addConstraint(constraint, constraintData->m_disableCollisionsBetweenLinkedBodies != 0);
1379 }
1380 }
1381
1382 btTriangleIndexVertexArray* btWorldImporter::createMeshInterface(btStridingMeshInterfaceData& meshData)
1383 {
1384 btTriangleIndexVertexArray* meshInterface = createTriangleMeshContainer();
1385
1386 for (int i = 0; i < meshData.m_numMeshParts; i++)
1387 {
1388 btIndexedMesh meshPart;
1389 meshPart.m_numTriangles = meshData.m_meshPartsPtr[i].m_numTriangles;
1390 meshPart.m_numVertices = meshData.m_meshPartsPtr[i].m_numVertices;
1391
1392 if (meshData.m_meshPartsPtr[i].m_indices32)
1393 {
1394 meshPart.m_indexType = PHY_INTEGER;
1395 meshPart.m_triangleIndexStride = 3 * sizeof(int);
1396 int* indexArray = (int*)btAlignedAlloc(sizeof(int) * 3 * meshPart.m_numTriangles, 16);
1397 m_indexArrays.push_back(indexArray);
1398 for (int j = 0; j < 3 * meshPart.m_numTriangles; j++)
1399 {
1400 indexArray[j] = meshData.m_meshPartsPtr[i].m_indices32[j].m_value;
1401 }
1402 meshPart.m_triangleIndexBase = (const unsigned char*)indexArray;
1403 }
1404 else
1405 {
1406 if (meshData.m_meshPartsPtr[i].m_3indices16)
1407 {
1408 meshPart.m_indexType = PHY_SHORT;
1409 meshPart.m_triangleIndexStride = sizeof(short int) * 3; //sizeof(btShortIntIndexTripletData);
1410
1411 short int* indexArray = (short int*)btAlignedAlloc(sizeof(short int) * 3 * meshPart.m_numTriangles, 16);
1412 m_shortIndexArrays.push_back(indexArray);
1413
1414 for (int j = 0; j < meshPart.m_numTriangles; j++)
1415 {
1416 indexArray[3 * j] = meshData.m_meshPartsPtr[i].m_3indices16[j].m_values[0];
1417 indexArray[3 * j + 1] = meshData.m_meshPartsPtr[i].m_3indices16[j].m_values[1];
1418 indexArray[3 * j + 2] = meshData.m_meshPartsPtr[i].m_3indices16[j].m_values[2];
1419 }
1420
1421 meshPart.m_triangleIndexBase = (const unsigned char*)indexArray;
1422 }
1423 if (meshData.m_meshPartsPtr[i].m_indices16)
1424 {
1425 meshPart.m_indexType = PHY_SHORT;
1426 meshPart.m_triangleIndexStride = 3 * sizeof(short int);
1427 short int* indexArray = (short int*)btAlignedAlloc(sizeof(short int) * 3 * meshPart.m_numTriangles, 16);
1428 m_shortIndexArrays.push_back(indexArray);
1429 for (int j = 0; j < 3 * meshPart.m_numTriangles; j++)
1430 {
1431 indexArray[j] = meshData.m_meshPartsPtr[i].m_indices16[j].m_value;
1432 }
1433
1434 meshPart.m_triangleIndexBase = (const unsigned char*)indexArray;
1435 }
1436
1437 if (meshData.m_meshPartsPtr[i].m_3indices8)
1438 {
1439 meshPart.m_indexType = PHY_UCHAR;
1440 meshPart.m_triangleIndexStride = sizeof(unsigned char) * 3;
1441
1442 unsigned char* indexArray = (unsigned char*)btAlignedAlloc(sizeof(unsigned char) * 3 * meshPart.m_numTriangles, 16);
1443 m_charIndexArrays.push_back(indexArray);
1444
1445 for (int j = 0; j < meshPart.m_numTriangles; j++)
1446 {
1447 indexArray[3 * j] = meshData.m_meshPartsPtr[i].m_3indices8[j].m_values[0];
1448 indexArray[3 * j + 1] = meshData.m_meshPartsPtr[i].m_3indices8[j].m_values[1];
1449 indexArray[3 * j + 2] = meshData.m_meshPartsPtr[i].m_3indices8[j].m_values[2];
1450 }
1451
1452 meshPart.m_triangleIndexBase = (const unsigned char*)indexArray;
1453 }
1454 }
1455
1456 if (meshData.m_meshPartsPtr[i].m_vertices3f)
1457 {
1458 meshPart.m_vertexType = PHY_FLOAT;
1459 meshPart.m_vertexStride = sizeof(btVector3FloatData);
1460 btVector3FloatData* vertices = (btVector3FloatData*)btAlignedAlloc(sizeof(btVector3FloatData) * meshPart.m_numVertices, 16);
1461 m_floatVertexArrays.push_back(vertices);
1462
1463 for (int j = 0; j < meshPart.m_numVertices; j++)
1464 {
1465 vertices[j].m_floats[0] = meshData.m_meshPartsPtr[i].m_vertices3f[j].m_floats[0];
1466 vertices[j].m_floats[1] = meshData.m_meshPartsPtr[i].m_vertices3f[j].m_floats[1];
1467 vertices[j].m_floats[2] = meshData.m_meshPartsPtr[i].m_vertices3f[j].m_floats[2];
1468 vertices[j].m_floats[3] = meshData.m_meshPartsPtr[i].m_vertices3f[j].m_floats[3];
1469 }
1470 meshPart.m_vertexBase = (const unsigned char*)vertices;
1471 }
1472 else
1473 {
1474 meshPart.m_vertexType = PHY_DOUBLE;
1475 meshPart.m_vertexStride = sizeof(btVector3DoubleData);
1476
1477 btVector3DoubleData* vertices = (btVector3DoubleData*)btAlignedAlloc(sizeof(btVector3DoubleData) * meshPart.m_numVertices, 16);
1478 m_doubleVertexArrays.push_back(vertices);
1479
1480 for (int j = 0; j < meshPart.m_numVertices; j++)
1481 {
1482 vertices[j].m_floats[0] = meshData.m_meshPartsPtr[i].m_vertices3d[j].m_floats[0];
1483 vertices[j].m_floats[1] = meshData.m_meshPartsPtr[i].m_vertices3d[j].m_floats[1];
1484 vertices[j].m_floats[2] = meshData.m_meshPartsPtr[i].m_vertices3d[j].m_floats[2];
1485 vertices[j].m_floats[3] = meshData.m_meshPartsPtr[i].m_vertices3d[j].m_floats[3];
1486 }
1487 meshPart.m_vertexBase = (const unsigned char*)vertices;
1488 }
1489
1490 if (meshPart.m_triangleIndexBase && meshPart.m_vertexBase)
1491 {
1492 meshInterface->addIndexedMesh(meshPart, meshPart.m_indexType);
1493 }
1494 }
1495
1496 return meshInterface;
1497 }
1498
1499 btStridingMeshInterfaceData* btWorldImporter::createStridingMeshInterfaceData(btStridingMeshInterfaceData* interfaceData)
1500 {
1501 //create a new btStridingMeshInterfaceData that is an exact copy of shapedata and store it in the WorldImporter
1502 btStridingMeshInterfaceData* newData = new btStridingMeshInterfaceData;
1503
1504 newData->m_scaling = interfaceData->m_scaling;
1505 newData->m_numMeshParts = interfaceData->m_numMeshParts;
1506 newData->m_meshPartsPtr = new btMeshPartData[newData->m_numMeshParts];
1507
1508 for (int i = 0; i < newData->m_numMeshParts; i++)
1509 {
1510 btMeshPartData* curPart = &interfaceData->m_meshPartsPtr[i];
1511 btMeshPartData* curNewPart = &newData->m_meshPartsPtr[i];
1512
1513 curNewPart->m_numTriangles = curPart->m_numTriangles;
1514 curNewPart->m_numVertices = curPart->m_numVertices;
1515
1516 if (curPart->m_vertices3f)
1517 {
1518 curNewPart->m_vertices3f = new btVector3FloatData[curNewPart->m_numVertices];
1519 memcpy(curNewPart->m_vertices3f, curPart->m_vertices3f, sizeof(btVector3FloatData) * curNewPart->m_numVertices);
1520 }
1521 else
1522 curNewPart->m_vertices3f = NULL;
1523
1524 if (curPart->m_vertices3d)
1525 {
1526 curNewPart->m_vertices3d = new btVector3DoubleData[curNewPart->m_numVertices];
1527 memcpy(curNewPart->m_vertices3d, curPart->m_vertices3d, sizeof(btVector3DoubleData) * curNewPart->m_numVertices);
1528 }
1529 else
1530 curNewPart->m_vertices3d = NULL;
1531
1532 int numIndices = curNewPart->m_numTriangles * 3;
1535 bool uninitialized3indices8Workaround = false;
1536
1537 if (curPart->m_indices32)
1538 {
1539 uninitialized3indices8Workaround = true;
1540 curNewPart->m_indices32 = new btIntIndexData[numIndices];
1541 memcpy(curNewPart->m_indices32, curPart->m_indices32, sizeof(btIntIndexData) * numIndices);
1542 }
1543 else
1544 curNewPart->m_indices32 = NULL;
1545
1546 if (curPart->m_3indices16)
1547 {
1548 uninitialized3indices8Workaround = true;
1549 curNewPart->m_3indices16 = new btShortIntIndexTripletData[curNewPart->m_numTriangles];
1550 memcpy(curNewPart->m_3indices16, curPart->m_3indices16, sizeof(btShortIntIndexTripletData) * curNewPart->m_numTriangles);
1551 }
1552 else
1553 curNewPart->m_3indices16 = NULL;
1554
1555 if (curPart->m_indices16)
1556 {
1557 uninitialized3indices8Workaround = true;
1558 curNewPart->m_indices16 = new btShortIntIndexData[numIndices];
1559 memcpy(curNewPart->m_indices16, curPart->m_indices16, sizeof(btShortIntIndexData) * numIndices);
1560 }
1561 else
1562 curNewPart->m_indices16 = NULL;
1563
1564 if (!uninitialized3indices8Workaround && curPart->m_3indices8)
1565 {
1566 curNewPart->m_3indices8 = new btCharIndexTripletData[curNewPart->m_numTriangles];
1567 memcpy(curNewPart->m_3indices8, curPart->m_3indices8, sizeof(btCharIndexTripletData) * curNewPart->m_numTriangles);
1568 }
1569 else
1570 curNewPart->m_3indices8 = NULL;
1571 }
1572
1573 m_allocatedbtStridingMeshInterfaceDatas.push_back(newData);
1574
1575 return (newData);
1576 }
1577
1578 #ifdef USE_INTERNAL_EDGE_UTILITY
1579 extern ContactAddedCallback gContactAddedCallback;
1580
1581 static bool btAdjustInternalEdgeContactsCallback(btManifoldPoint& cp, const btCollisionObject* colObj0, int partId0, int index0, const btCollisionObject* colObj1, int partId1, int index1)
1582 {
1583 btAdjustInternalEdgeContacts(cp, colObj1, colObj0, partId1, index1);
1584 //btAdjustInternalEdgeContacts(cp,colObj1,colObj0, partId1,index1, BT_TRIANGLE_CONVEX_BACKFACE_MODE);
1585 //btAdjustInternalEdgeContacts(cp,colObj1,colObj0, partId1,index1, BT_TRIANGLE_CONVEX_DOUBLE_SIDED+BT_TRIANGLE_CONCAVE_DOUBLE_SIDED);
1586 return true;
1587 }
1588 #endif //USE_INTERNAL_EDGE_UTILITY
1589
1590 btCollisionObject* btWorldImporter::createCollisionObject(const btTransform& startTransform, btCollisionShape* shape, const char* bodyName)
1591 {
1592 return createRigidBody(false, 0, startTransform, shape, bodyName);
1593 }
1594
1595 void btWorldImporter::setDynamicsWorldInfo(const btVector3& gravity, const btContactSolverInfo& solverInfo)
1596 {
1597 if (m_dynamicsWorld)
1598 {
1599 m_dynamicsWorld->setGravity(gravity);
1600 m_dynamicsWorld->getSolverInfo() = solverInfo;
1601 }
1602 }
1603
1604 btRigidBody* btWorldImporter::createRigidBody(bool isDynamic, btScalar mass, const btTransform& startTransform, btCollisionShape* shape, const char* bodyName)
1605 {
1606 btVector3 localInertia;
1607 localInertia.setZero();
1608
1609 if (mass)
1610 shape->calculateLocalInertia(mass, localInertia);
1611
1612 btRigidBody* body = new btRigidBody(mass, 0, shape, localInertia);
1613 body->setWorldTransform(startTransform);
1614
1615 if (m_dynamicsWorld)
1616 m_dynamicsWorld->addRigidBody(body);
1617
1618 if (bodyName)
1619 {
1620 char* newname = duplicateName(bodyName);
1621 m_objectNameMap.insert(body, newname);
1622 m_nameBodyMap.insert(newname, body);
1623 }
1624 m_allocatedRigidBodies.push_back(body);
1625 return body;
1626 }
1627
1628 btCollisionShape* btWorldImporter::createPlaneShape(const btVector3& planeNormal, btScalar planeConstant)
1629 {
1630 btStaticPlaneShape* shape = new btStaticPlaneShape(planeNormal, planeConstant);
1631 m_allocatedCollisionShapes.push_back(shape);
1632 return shape;
1633 }
1634 btCollisionShape* btWorldImporter::createBoxShape(const btVector3& halfExtents)
1635 {
1636 btBoxShape* shape = new btBoxShape(halfExtents);
1637 m_allocatedCollisionShapes.push_back(shape);
1638 return shape;
1639 }
1640 btCollisionShape* btWorldImporter::createSphereShape(btScalar radius)
1641 {
1642 btSphereShape* shape = new btSphereShape(radius);
1643 m_allocatedCollisionShapes.push_back(shape);
1644 return shape;
1645 }
1646
1647 btCollisionShape* btWorldImporter::createCapsuleShapeX(btScalar radius, btScalar height)
1648 {
1649 btCapsuleShapeX* shape = new btCapsuleShapeX(radius, height);
1650 m_allocatedCollisionShapes.push_back(shape);
1651 return shape;
1652 }
1653
1654 btCollisionShape* btWorldImporter::createCapsuleShapeY(btScalar radius, btScalar height)
1655 {
1656 btCapsuleShape* shape = new btCapsuleShape(radius, height);
1657 m_allocatedCollisionShapes.push_back(shape);
1658 return shape;
1659 }
1660
1661 btCollisionShape* btWorldImporter::createCapsuleShapeZ(btScalar radius, btScalar height)
1662 {
1663 btCapsuleShapeZ* shape = new btCapsuleShapeZ(radius, height);
1664 m_allocatedCollisionShapes.push_back(shape);
1665 return shape;
1666 }
1667
1668 btCollisionShape* btWorldImporter::createCylinderShapeX(btScalar radius, btScalar height)
1669 {
1670 btCylinderShapeX* shape = new btCylinderShapeX(btVector3(height, radius, radius));
1671 m_allocatedCollisionShapes.push_back(shape);
1672 return shape;
1673 }
1674
1675 btCollisionShape* btWorldImporter::createCylinderShapeY(btScalar radius, btScalar height)
1676 {
1677 btCylinderShape* shape = new btCylinderShape(btVector3(radius, height, radius));
1678 m_allocatedCollisionShapes.push_back(shape);
1679 return shape;
1680 }
1681
1682 btCollisionShape* btWorldImporter::createCylinderShapeZ(btScalar radius, btScalar height)
1683 {
1684 btCylinderShapeZ* shape = new btCylinderShapeZ(btVector3(radius, radius, height));
1685 m_allocatedCollisionShapes.push_back(shape);
1686 return shape;
1687 }
1688
1689 btCollisionShape* btWorldImporter::createConeShapeX(btScalar radius, btScalar height)
1690 {
1691 btConeShapeX* shape = new btConeShapeX(radius, height);
1692 m_allocatedCollisionShapes.push_back(shape);
1693 return shape;
1694 }
1695
1696 btCollisionShape* btWorldImporter::createConeShapeY(btScalar radius, btScalar height)
1697 {
1698 btConeShape* shape = new btConeShape(radius, height);
1699 m_allocatedCollisionShapes.push_back(shape);
1700 return shape;
1701 }
1702
1703 btCollisionShape* btWorldImporter::createConeShapeZ(btScalar radius, btScalar height)
1704 {
1705 btConeShapeZ* shape = new btConeShapeZ(radius, height);
1706 m_allocatedCollisionShapes.push_back(shape);
1707 return shape;
1708 }
1709
1710 btTriangleIndexVertexArray* btWorldImporter::createTriangleMeshContainer()
1711 {
1712 btTriangleIndexVertexArray* in = new btTriangleIndexVertexArray();
1713 m_allocatedTriangleIndexArrays.push_back(in);
1714 return in;
1715 }
1716
1717 btOptimizedBvh* btWorldImporter::createOptimizedBvh()
1718 {
1719 btOptimizedBvh* bvh = new btOptimizedBvh();
1720 m_allocatedBvhs.push_back(bvh);
1721 return bvh;
1722 }
1723
1724 btTriangleInfoMap* btWorldImporter::createTriangleInfoMap()
1725 {
1726 btTriangleInfoMap* tim = new btTriangleInfoMap();
1727 m_allocatedTriangleInfoMaps.push_back(tim);
1728 return tim;
1729 }
1730
1731 btBvhTriangleMeshShape* btWorldImporter::createBvhTriangleMeshShape(btStridingMeshInterface* trimesh, btOptimizedBvh* bvh)
1732 {
1733 if (bvh)
1734 {
1735 btBvhTriangleMeshShape* bvhTriMesh = new btBvhTriangleMeshShape(trimesh, bvh->isQuantized(), false);
1736 bvhTriMesh->setOptimizedBvh(bvh);
1737 m_allocatedCollisionShapes.push_back(bvhTriMesh);
1738 return bvhTriMesh;
1739 }
1740
1741 btBvhTriangleMeshShape* ts = new btBvhTriangleMeshShape(trimesh, true);
1742 m_allocatedCollisionShapes.push_back(ts);
1743 return ts;
1744 }
1745 btCollisionShape* btWorldImporter::createConvexTriangleMeshShape(btStridingMeshInterface* trimesh)
1746 {
1747 return 0;
1748 }
1749 btGImpactMeshShape* btWorldImporter::createGimpactShape(btStridingMeshInterface* trimesh)
1750 {
1751 #ifdef USE_GIMPACT
1752 btGImpactMeshShape* shape = new btGImpactMeshShape(trimesh);
1753 m_allocatedCollisionShapes.push_back(shape);
1754 return shape;
1755 #else
1756 return 0;
1757 #endif
1758 }
1759 btConvexHullShape* btWorldImporter::createConvexHullShape()
1760 {
1761 btConvexHullShape* shape = new btConvexHullShape();
1762 m_allocatedCollisionShapes.push_back(shape);
1763 return shape;
1764 }
1765
1766 btCompoundShape* btWorldImporter::createCompoundShape()
1767 {
1768 btCompoundShape* shape = new btCompoundShape();
1769 m_allocatedCollisionShapes.push_back(shape);
1770 return shape;
1771 }
1772
1773 btScaledBvhTriangleMeshShape* btWorldImporter::createScaledTrangleMeshShape(btBvhTriangleMeshShape* meshShape, const btVector3& localScaling)
1774 {
1775 btScaledBvhTriangleMeshShape* shape = new btScaledBvhTriangleMeshShape(meshShape, localScaling);
1776 m_allocatedCollisionShapes.push_back(shape);
1777 return shape;
1778 }
1779
1780 btMultiSphereShape* btWorldImporter::createMultiSphereShape(const btVector3* positions, const btScalar* radi, int numSpheres)
1781 {
1782 btMultiSphereShape* shape = new btMultiSphereShape(positions, radi, numSpheres);
1783 m_allocatedCollisionShapes.push_back(shape);
1784 return shape;
1785 }
1786
1787 btRigidBody& btWorldImporter::getFixedBody()
1788 {
1789 static btRigidBody s_fixed(0, 0, 0);
1790 s_fixed.setMassProps(btScalar(0.), btVector3(btScalar(0.), btScalar(0.), btScalar(0.)));
1791 return s_fixed;
1792 }
1793
1794 btPoint2PointConstraint* btWorldImporter::createPoint2PointConstraint(btRigidBody& rbA, btRigidBody& rbB, const btVector3& pivotInA, const btVector3& pivotInB)
1795 {
1796 btPoint2PointConstraint* p2p = new btPoint2PointConstraint(rbA, rbB, pivotInA, pivotInB);
1797 m_allocatedConstraints.push_back(p2p);
1798 return p2p;
1799 }
1800
1801 btPoint2PointConstraint* btWorldImporter::createPoint2PointConstraint(btRigidBody& rbA, const btVector3& pivotInA)
1802 {
1803 btPoint2PointConstraint* p2p = new btPoint2PointConstraint(rbA, pivotInA);
1804 m_allocatedConstraints.push_back(p2p);
1805 return p2p;
1806 }
1807
1808 btHingeConstraint* btWorldImporter::createHingeConstraint(btRigidBody& rbA, btRigidBody& rbB, const btTransform& rbAFrame, const btTransform& rbBFrame, bool useReferenceFrameA)
1809 {
1810 btHingeConstraint* hinge = new btHingeConstraint(rbA, rbB, rbAFrame, rbBFrame, useReferenceFrameA);
1811 m_allocatedConstraints.push_back(hinge);
1812 return hinge;
1813 }
1814
1815 btHingeConstraint* btWorldImporter::createHingeConstraint(btRigidBody& rbA, const btTransform& rbAFrame, bool useReferenceFrameA)
1816 {
1817 btHingeConstraint* hinge = new btHingeConstraint(rbA, rbAFrame, useReferenceFrameA);
1818 m_allocatedConstraints.push_back(hinge);
1819 return hinge;
1820 }
1821
1822 btConeTwistConstraint* btWorldImporter::createConeTwistConstraint(btRigidBody& rbA, btRigidBody& rbB, const btTransform& rbAFrame, const btTransform& rbBFrame)
1823 {
1824 btConeTwistConstraint* cone = new btConeTwistConstraint(rbA, rbB, rbAFrame, rbBFrame);
1825 m_allocatedConstraints.push_back(cone);
1826 return cone;
1827 }
1828
1829 btConeTwistConstraint* btWorldImporter::createConeTwistConstraint(btRigidBody& rbA, const btTransform& rbAFrame)
1830 {
1831 btConeTwistConstraint* cone = new btConeTwistConstraint(rbA, rbAFrame);
1832 m_allocatedConstraints.push_back(cone);
1833 return cone;
1834 }
1835
1836 btGeneric6DofConstraint* btWorldImporter::createGeneric6DofConstraint(btRigidBody& rbA, btRigidBody& rbB, const btTransform& frameInA, const btTransform& frameInB, bool useLinearReferenceFrameA)
1837 {
1838 btGeneric6DofConstraint* dof = new btGeneric6DofConstraint(rbA, rbB, frameInA, frameInB, useLinearReferenceFrameA);
1839 m_allocatedConstraints.push_back(dof);
1840 return dof;
1841 }
1842
1843 btGeneric6DofConstraint* btWorldImporter::createGeneric6DofConstraint(btRigidBody& rbB, const btTransform& frameInB, bool useLinearReferenceFrameB)
1844 {
1845 btGeneric6DofConstraint* dof = new btGeneric6DofConstraint(rbB, frameInB, useLinearReferenceFrameB);
1846 m_allocatedConstraints.push_back(dof);
1847 return dof;
1848 }
1849
1850 btGeneric6DofSpring2Constraint* btWorldImporter::createGeneric6DofSpring2Constraint(btRigidBody& rbA, btRigidBody& rbB, const btTransform& frameInA, const btTransform& frameInB, int rotateOrder)
1851 {
1852 btGeneric6DofSpring2Constraint* dof = new btGeneric6DofSpring2Constraint(rbA, rbB, frameInA, frameInB, (RotateOrder)rotateOrder);
1853 m_allocatedConstraints.push_back(dof);
1854 return dof;
1855 }
1856
1857 btGeneric6DofSpringConstraint* btWorldImporter::createGeneric6DofSpringConstraint(btRigidBody& rbA, btRigidBody& rbB, const btTransform& frameInA, const btTransform& frameInB, bool useLinearReferenceFrameA)
1858 {
1859 btGeneric6DofSpringConstraint* dof = new btGeneric6DofSpringConstraint(rbA, rbB, frameInA, frameInB, useLinearReferenceFrameA);
1860 m_allocatedConstraints.push_back(dof);
1861 return dof;
1862 }
1863
1864 btSliderConstraint* btWorldImporter::createSliderConstraint(btRigidBody& rbA, btRigidBody& rbB, const btTransform& frameInA, const btTransform& frameInB, bool useLinearReferenceFrameA)
1865 {
1866 btSliderConstraint* slider = new btSliderConstraint(rbA, rbB, frameInA, frameInB, useLinearReferenceFrameA);
1867 m_allocatedConstraints.push_back(slider);
1868 return slider;
1869 }
1870
1871 btSliderConstraint* btWorldImporter::createSliderConstraint(btRigidBody& rbB, const btTransform& frameInB, bool useLinearReferenceFrameA)
1872 {
1873 btSliderConstraint* slider = new btSliderConstraint(rbB, frameInB, useLinearReferenceFrameA);
1874 m_allocatedConstraints.push_back(slider);
1875 return slider;
1876 }
1877
1878 btGearConstraint* btWorldImporter::createGearConstraint(btRigidBody& rbA, btRigidBody& rbB, const btVector3& axisInA, const btVector3& axisInB, btScalar ratio)
1879 {
1880 btGearConstraint* gear = new btGearConstraint(rbA, rbB, axisInA, axisInB, ratio);
1881 m_allocatedConstraints.push_back(gear);
1882 return gear;
1883 }
1884
1885 // query for data
1886 int btWorldImporter::getNumCollisionShapes() const
1887 {
1888 return m_allocatedCollisionShapes.size();
1889 }
1890
1891 btCollisionShape* btWorldImporter::getCollisionShapeByIndex(int index)
1892 {
1893 return m_allocatedCollisionShapes[index];
1894 }
1895
1896 btCollisionShape* btWorldImporter::getCollisionShapeByName(const char* name)
1897 {
1898 btCollisionShape** shapePtr = m_nameShapeMap.find(name);
1899 if (shapePtr && *shapePtr)
1900 {
1901 return *shapePtr;
1902 }
1903 return 0;
1904 }
1905
1906 btRigidBody* btWorldImporter::getRigidBodyByName(const char* name)
1907 {
1908 btRigidBody** bodyPtr = m_nameBodyMap.find(name);
1909 if (bodyPtr && *bodyPtr)
1910 {
1911 return *bodyPtr;
1912 }
1913 return 0;
1914 }
1915
1916 btTypedConstraint* btWorldImporter::getConstraintByName(const char* name)
1917 {
1918 btTypedConstraint** constraintPtr = m_nameConstraintMap.find(name);
1919 if (constraintPtr && *constraintPtr)
1920 {
1921 return *constraintPtr;
1922 }
1923 return 0;
1924 }
1925
1926 const char* btWorldImporter::getNameForPointer(const void* ptr) const
1927 {
1928 const char* const* namePtr = m_objectNameMap.find(ptr);
1929 if (namePtr && *namePtr)
1930 return *namePtr;
1931 return 0;
1932 }
1933
1934 int btWorldImporter::getNumRigidBodies() const
1935 {
1936 return m_allocatedRigidBodies.size();
1937 }
1938
1939 btCollisionObject* btWorldImporter::getRigidBodyByIndex(int index) const
1940 {
1941 return m_allocatedRigidBodies[index];
1942 }
1943 int btWorldImporter::getNumConstraints() const
1944 {
1945 return m_allocatedConstraints.size();
1946 }
1947
1948 btTypedConstraint* btWorldImporter::getConstraintByIndex(int index) const
1949 {
1950 return m_allocatedConstraints[index];
1951 }
1952
1953 int btWorldImporter::getNumBvhs() const
1954 {
1955 return m_allocatedBvhs.size();
1956 }
1957 btOptimizedBvh* btWorldImporter::getBvhByIndex(int index) const
1958 {
1959 return m_allocatedBvhs[index];
1960 }
1961
1962 int btWorldImporter::getNumTriangleInfoMaps() const
1963 {
1964 return m_allocatedTriangleInfoMaps.size();
1965 }
1966
1967 btTriangleInfoMap* btWorldImporter::getTriangleInfoMapByIndex(int index) const
1968 {
1969 return m_allocatedTriangleInfoMaps[index];
1970 }
1971
1972 void btWorldImporter::convertRigidBodyFloat(btRigidBodyFloatData* colObjData)
1973 {
1974 btScalar mass = btScalar(colObjData->m_inverseMass ? 1.f / colObjData->m_inverseMass : 0.f);
1975 btVector3 localInertia;
1976 localInertia.setZero();
1977 btCollisionShape** shapePtr = m_shapeMap.find(colObjData->m_collisionObjectData.m_collisionShape);
1978 if (shapePtr && *shapePtr)
1979 {
1980 btTransform startTransform;
1981 colObjData->m_collisionObjectData.m_worldTransform.m_origin.m_floats[3] = 0.f;
1982 startTransform.deSerializeFloat(colObjData->m_collisionObjectData.m_worldTransform);
1983
1984 // startTransform.setBasis(btMatrix3x3::getIdentity());
1985 btCollisionShape* shape = (btCollisionShape*)*shapePtr;
1986 if (shape->isNonMoving())
1987 {
1988 mass = 0.f;
1989 }
1990 if (mass)
1991 {
1992 shape->calculateLocalInertia(mass, localInertia);
1993 }
1994 bool isDynamic = mass != 0.f;
1995 btRigidBody* body = createRigidBody(isDynamic, mass, startTransform, shape, colObjData->m_collisionObjectData.m_name);
1996 body->setFriction(colObjData->m_collisionObjectData.m_friction);
1997 body->setRestitution(colObjData->m_collisionObjectData.m_restitution);
1998 btVector3 linearFactor, angularFactor;
1999 linearFactor.deSerializeFloat(colObjData->m_linearFactor);
2000 angularFactor.deSerializeFloat(colObjData->m_angularFactor);
2001 body->setLinearFactor(linearFactor);
2002 body->setAngularFactor(angularFactor);
2003
2004 #ifdef USE_INTERNAL_EDGE_UTILITY
2005 if (shape->getShapeType() == TRIANGLE_MESH_SHAPE_PROXYTYPE)
2006 {
2007 btBvhTriangleMeshShape* trimesh = (btBvhTriangleMeshShape*)shape;
2008 if (trimesh->getTriangleInfoMap())
2009 {
2010 body->setCollisionFlags(body->getCollisionFlags() | btCollisionObject::CF_CUSTOM_MATERIAL_CALLBACK);
2011 }
2012 }
2013 #endif //USE_INTERNAL_EDGE_UTILITY
2014 m_bodyMap.insert(colObjData, body);
2015 }
2016 else
2017 {
2018 printf("error: no shape found\n");
2019 }
2020 }
2021
2022 void btWorldImporter::convertRigidBodyDouble(btRigidBodyDoubleData* colObjData)
2023 {
2024 btScalar mass = btScalar(colObjData->m_inverseMass ? 1.f / colObjData->m_inverseMass : 0.f);
2025 btVector3 localInertia;
2026 localInertia.setZero();
2027 btCollisionShape** shapePtr = m_shapeMap.find(colObjData->m_collisionObjectData.m_collisionShape);
2028 if (shapePtr && *shapePtr)
2029 {
2030 btTransform startTransform;
2031 colObjData->m_collisionObjectData.m_worldTransform.m_origin.m_floats[3] = 0.f;
2032 startTransform.deSerializeDouble(colObjData->m_collisionObjectData.m_worldTransform);
2033
2034 // startTransform.setBasis(btMatrix3x3::getIdentity());
2035 btCollisionShape* shape = (btCollisionShape*)*shapePtr;
2036 if (shape->isNonMoving())
2037 {
2038 mass = 0.f;
2039 }
2040 if (mass)
2041 {
2042 shape->calculateLocalInertia(mass, localInertia);
2043 }
2044 bool isDynamic = mass != 0.f;
2045 btRigidBody* body = createRigidBody(isDynamic, mass, startTransform, shape, colObjData->m_collisionObjectData.m_name);
2046 body->setFriction(btScalar(colObjData->m_collisionObjectData.m_friction));
2047 body->setRestitution(btScalar(colObjData->m_collisionObjectData.m_restitution));
2048 btVector3 linearFactor, angularFactor;
2049 linearFactor.deSerializeDouble(colObjData->m_linearFactor);
2050 angularFactor.deSerializeDouble(colObjData->m_angularFactor);
2051 body->setLinearFactor(linearFactor);
2052 body->setAngularFactor(angularFactor);
2053
2054 #ifdef USE_INTERNAL_EDGE_UTILITY
2055 if (shape->getShapeType() == TRIANGLE_MESH_SHAPE_PROXYTYPE)
2056 {
2057 btBvhTriangleMeshShape* trimesh = (btBvhTriangleMeshShape*)shape;
2058 if (trimesh->getTriangleInfoMap())
2059 {
2060 body->setCollisionFlags(body->getCollisionFlags() | btCollisionObject::CF_CUSTOM_MATERIAL_CALLBACK);
2061 }
2062 }
2063 #endif //USE_INTERNAL_EDGE_UTILITY
2064 m_bodyMap.insert(colObjData, body);
2065 }
2066 else
2067 {
2068 printf("error: no shape found\n");
2069 }
2070 }
SCALED_TRIANGLE_MESH_SHAPE_PROXYTYPE
Definition: btBroadphaseProxy.h:55
btTransform::setOrigin
void setOrigin(const btVector3 &origin)
Set the translational element.
Definition: btTransform.h:146
btIndexedMesh::m_numTriangles
int m_numTriangles
Definition: btTriangleIndexVertexArray.h:30
btCollisionObjectFloatData::m_worldTransform
btTransformFloatData m_worldTransform
Definition: btCollisionObject.h:633
btRigidBody::upcast
static const btRigidBody * upcast(const btCollisionObject *colObj)
to keep collision detection and dynamics separate we don&#39;t store a rigidbody pointer but a rigidbody ...
Definition: btRigidBody.h:189
btTypedConstraintDoubleData::m_isEnabled
int m_isEnabled
Definition: btTypedConstraint.h:428
btHingeConstraintDoubleData::m_rbBFrame
btTransformDoubleData m_rbBFrame
Definition: btHingeConstraint.h:344
btBvhTriangleMeshShape::getTriangleInfoMap
const btTriangleInfoMap * getTriangleInfoMap() const
Definition: btBvhTriangleMeshShape.h:97
btSliderConstraintDoubleData::m_angularUpperLimit
double m_angularUpperLimit
Definition: btSliderConstraint.h:316
btHingeConstraintDoubleData2::m_biasFactor
double m_biasFactor
Definition: btHingeConstraint.h:431
btConeTwistConstraintData::m_damping
float m_damping
Definition: btConeTwistConstraint.h:391
btScaledTriangleMeshShapeData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
Definition: btScaledBvhTriangleMeshShape.h:64
btWorldImporter::createGeneric6DofSpringConstraint
virtual btGeneric6DofSpringConstraint * createGeneric6DofSpringConstraint(btRigidBody &rbA, btRigidBody &rbB, const btTransform &frameInA, const btTransform &frameInB, bool useLinearReferenceFrameA)
Definition: btWorldImporter.cpp:1857
btConeTwistConstraint::setLimit
void setLimit(int limitIndex, btScalar limitValue)
Definition: btConeTwistConstraint.h:170
btHingeConstraintFloatData::m_rbAFrame
btTransformFloatData m_rbAFrame
Definition: btHingeConstraint.h:400
btGeneric6DofSpring2ConstraintData::m_angularUpperLimit
btVector3FloatData m_angularUpperLimit
Definition: btGeneric6DofSpring2Constraint.h:512
btConeTwistConstraintDoubleData::m_rbAFrame
btTransformDoubleData m_rbAFrame
Definition: btConeTwistConstraint.h:361
btPoint2PointConstraintDoubleData::m_pivotInA
btVector3DoubleData m_pivotInA
Definition: btPoint2PointConstraint.h:151
btStridingMeshInterfaceData::m_meshPartsPtr
btMeshPartData * m_meshPartsPtr
Definition: btStridingMeshInterface.h:140
btWorldImporter::m_nameShapeMap
btHashMap< btHashString, btCollisionShape * > m_nameShapeMap
Definition: btWorldImporter.h:94
CONE_SHAPE_PROXYTYPE
Definition: btBroadphaseProxy.h:42
btGeneric6DofSpringConstraintDoubleData2::m_springStiffness
double m_springStiffness[6]
Definition: btGeneric6DofSpringConstraint.h:109
btGeneric6DofSpring2ConstraintDoubleData2::m_rbBFrame
btTransformDoubleData m_rbBFrame
Definition: btGeneric6DofSpring2Constraint.h:538
btWorldImporter::createGeneric6DofConstraint
virtual btGeneric6DofConstraint * createGeneric6DofConstraint(btRigidBody &rbA, btRigidBody &rbB, const btTransform &frameInA, const btTransform &frameInB, bool useLinearReferenceFrameA)
Definition: btWorldImporter.cpp:1836
btAlignedObjectArray::push_back
void push_back(const T &_Val)
Definition: btAlignedObjectArray.h:264
btSliderConstraint::setUpperLinLimit
void setUpperLinLimit(btScalar upperLimit)
Definition: btSliderConstraint.h:190
btGeneric6DofSpring2ConstraintData::m_rotateOrder
int m_rotateOrder
Definition: btGeneric6DofSpring2Constraint.h:531
SPHERE_SHAPE_PROXYTYPE
Definition: btBroadphaseProxy.h:39
btWorldImporter::convertConstraintBackwardsCompatible281
void convertConstraintBackwardsCompatible281(btTypedConstraintData *constraintData, btRigidBody *rbA, btRigidBody *rbB, int fileVersion)
Definition: btWorldImporter.cpp:505
btGeneric6DofSpringConstraintData
Definition: btGeneric6DofSpringConstraint.h:93
btGeneric6DofSpring2ConstraintData::m_angularSpringDampingLimited
char m_angularSpringDampingLimited[4]
Definition: btGeneric6DofSpring2Constraint.h:529
btCompoundShapeData::m_childShapePtr
btCompoundShapeChildData * m_childShapePtr
Definition: btCompoundShape.h:192
btWorldImporter::convertCollisionShape
btCollisionShape * convertCollisionShape(btCollisionShapeData *shapeData)
Definition: btWorldImporter.cpp:141
btWorldImporter::getTriangleInfoMapByIndex
btTriangleInfoMap * getTriangleInfoMapByIndex(int index) const
Definition: btWorldImporter.cpp:1967
btSliderConstraintDoubleData::m_angularLowerLimit
double m_angularLowerLimit
Definition: btSliderConstraint.h:317
btWorldImporter::createStridingMeshInterfaceData
virtual btStridingMeshInterfaceData * createStridingMeshInterfaceData(btStridingMeshInterfaceData *interfaceData)
Definition: btWorldImporter.cpp:1499
btGeneric6DofSpringConstraintDoubleData2::m_6dofData
btGeneric6DofConstraintDoubleData2 m_6dofData
Definition: btGeneric6DofSpringConstraint.h:105
btTypedConstraintDoubleData::m_breakingImpulseThreshold
double m_breakingImpulseThreshold
Definition: btTypedConstraint.h:427
btPoint2PointConstraint
point to point constraint between two rigidbodies each with a pivotpoint that descibes the &#39;ballsocke...
Definition: btPoint2PointConstraint.h:52
btConeTwistConstraintData::m_rbAFrame
btTransformFloatData m_rbAFrame
Definition: btConeTwistConstraint.h:380
btStaticPlaneShapeData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
Definition: btStaticPlaneShape.h:69
btTransform::deSerializeFloat
void deSerializeFloat(const struct btTransformFloatData &dataIn)
Definition: btTransform.h:274
SOFTBODY_SHAPE_PROXYTYPE
Definition: btBroadphaseProxy.h:73
btWorldImporter::createTriangleMeshContainer
virtual class btTriangleIndexVertexArray * createTriangleMeshContainer()
Definition: btWorldImporter.cpp:1710
btWorldImporter::convertRigidBodyDouble
void convertRigidBodyDouble(btRigidBodyDoubleData *colObjData)
Definition: btWorldImporter.cpp:2022
btWorldImporter::createBvhTriangleMeshShape
virtual btBvhTriangleMeshShape * createBvhTriangleMeshShape(btStridingMeshInterface *trimesh, btOptimizedBvh *bvh)
Definition: btWorldImporter.cpp:1731
btGeneric6DofSpring2ConstraintDoubleData2::m_linearEquilibriumPoint
btVector3DoubleData m_linearEquilibriumPoint
Definition: btGeneric6DofSpring2Constraint.h:552
btVector3::deSerializeDouble
void deSerializeDouble(const struct btVector3DoubleData &dataIn)
Definition: btVector3.h:1311
btWorldImporter::createSphereShape
virtual btCollisionShape * createSphereShape(btScalar radius)
Definition: btWorldImporter.cpp:1640
btTypedConstraintData::m_name
char * m_name
Definition: btTypedConstraint.h:391
btSliderConstraint::setLowerLinLimit
void setLowerLinLimit(btScalar lowerLimit)
Definition: btSliderConstraint.h:188
btIntIndexData::m_value
int m_value
Definition: btStridingMeshInterface.h:97
PHY_UCHAR
Definition: btConcaveShape.h:32
btCollisionShape::calculateLocalInertia
virtual void calculateLocalInertia(btScalar mass, btVector3 &inertia) const =0
btWorldImporter::createConeTwistConstraint
virtual btConeTwistConstraint * createConeTwistConstraint(btRigidBody &rbA, btRigidBody &rbB, const btTransform &rbAFrame, const btTransform &rbBFrame)
Definition: btWorldImporter.cpp:1822
btWorldImporter::createTriangleInfoMap
virtual btTriangleInfoMap * createTriangleInfoMap()
Definition: btWorldImporter.cpp:1724
btIndexedMesh
The btIndexedMesh indexes a single vertex and index array.
Definition: btTriangleIndexVertexArray.h:25
btWorldImporter::convertRigidBodyFloat
void convertRigidBodyFloat(btRigidBodyFloatData *colObjData)
Definition: btWorldImporter.cpp:1972
btSliderConstraint::setLowerAngLimit
void setLowerAngLimit(btScalar lowerLimit)
Definition: btSliderConstraint.h:192
btRigidBodyFloatData::m_angularFactor
btVector3FloatData m_angularFactor
Definition: btRigidBody.h:549
FIXED_CONSTRAINT_TYPE
Definition: btTypedConstraint.h:44
btWorldImporter::createCylinderShapeZ
virtual btCollisionShape * createCylinderShapeZ(btScalar radius, btScalar height)
Definition: btWorldImporter.cpp:1682
btGImpactMeshShape::setLocalScaling
virtual void setLocalScaling(const btVector3 &scaling)
Definition: btGImpactShape.h:912
btGeneric6DofSpring2ConstraintData::m_linearSpringStiffness
btVector3FloatData m_linearSpringStiffness
Definition: btGeneric6DofSpring2Constraint.h:502
btAlignedObjectArray< btVector3 >
btBulletDynamicsCommon.h
btGeneric6DofSpring2ConstraintData::m_linearEquilibriumPoint
btVector3FloatData m_linearEquilibriumPoint
Definition: btGeneric6DofSpring2Constraint.h:504
btWorldImporter::m_charIndexArrays
btAlignedObjectArray< unsigned char * > m_charIndexArrays
Definition: btWorldImporter.h:86
btTypedConstraintFloatData::m_breakingImpulseThreshold
float m_breakingImpulseThreshold
Definition: btTypedConstraint.h:375
btGeneric6DofSpringConstraintDoubleData2::m_springEnabled
int m_springEnabled[6]
Definition: btGeneric6DofSpringConstraint.h:107
btGeneric6DofSpring2ConstraintDoubleData2::m_linearSpringDamping
btVector3DoubleData m_linearSpringDamping
Definition: btGeneric6DofSpring2Constraint.h:551
btGeneric6DofSpring2ConstraintData::m_linearLowerLimit
btVector3FloatData m_linearLowerLimit
Definition: btGeneric6DofSpring2Constraint.h:493
btGearConstraintFloatData::m_ratio
float m_ratio
Definition: btGearConstraint.h:105
btVector3DoubleData::m_floats
double m_floats[4]
Definition: btVector3.h:1288
btSliderConstraintData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
Definition: btSliderConstraint.h:291
btTypedConstraintFloatData::m_objectType
int m_objectType
Definition: btTypedConstraint.h:364
btGeneric6DofConstraintDoubleData2
Definition: btGeneric6DofConstraint.h:570
btHashMap::find
const Value * find(const Key &key) const
Definition: btHashMap.h:424
btShortIntIndexData::m_value
short m_value
Definition: btStridingMeshInterface.h:102
btGeneric6DofSpring2ConstraintData::m_rbBFrame
btTransformFloatData m_rbBFrame
Definition: btGeneric6DofSpring2Constraint.h:490
btWorldImporter::m_nameBodyMap
btHashMap< btHashString, btRigidBody * > m_nameBodyMap
Definition: btWorldImporter.h:95
btHingeConstraintDoubleData2::m_motorTargetVelocity
double m_motorTargetVelocity
Definition: btHingeConstraint.h:425
btMultiSphereShapeData::m_localPositionArraySize
int m_localPositionArraySize
Definition: btMultiSphereShape.h:84
btGeneric6DofSpring2ConstraintDoubleData2::m_linearUpperLimit
btVector3DoubleData m_linearUpperLimit
Definition: btGeneric6DofSpring2Constraint.h:540
btHingeConstraintFloatData::m_motorTargetVelocity
float m_motorTargetVelocity
Definition: btHingeConstraint.h:406
btConeTwistConstraintData::m_limitSoftness
float m_limitSoftness
Definition: btConeTwistConstraint.h:387
btGeneric6DofConstraintData
Definition: btGeneric6DofConstraint.h:554
btGearConstraint
The btGeatConstraint will couple the angular velocity for two bodies around given local axis and rati...
Definition: btGearConstraint.h:31
btMultiSphereShape
The btMultiSphereShape represents the convex hull of a collection of spheres.
Definition: btMultiSphereShape.h:26
btWorldImporter::createRigidBody
virtual btRigidBody * createRigidBody(bool isDynamic, btScalar mass, const btTransform &startTransform, btCollisionShape *shape, const char *bodyName)
Definition: btWorldImporter.cpp:1604
btScaledTriangleMeshShapeData::m_trimeshShapeData
btTriangleMeshShapeData m_trimeshShapeData
Definition: btScaledBvhTriangleMeshShape.h:66
btGeneric6DofConstraint
btGeneric6DofConstraint between two rigidbodies each with a pivotpoint that descibes the axis locatio...
Definition: btGeneric6DofConstraint.h:266
CAPSULE_SHAPE_PROXYTYPE
Definition: btBroadphaseProxy.h:41
btCharIndexTripletData
Definition: btStridingMeshInterface.h:112
btWorldImporter::btWorldImporter
btWorldImporter(btDynamicsWorld *world)
Definition: btWorldImporter.cpp:21
btHingeConstraintDoubleData::m_lowerLimit
float m_lowerLimit
Definition: btHingeConstraint.h:351
btGeneric6DofSpring2ConstraintDoubleData2::m_angularSpringStiffnessLimited
char m_angularSpringStiffnessLimited[4]
Definition: btGeneric6DofSpring2Constraint.h:576
btStaticPlaneShapeData::m_planeConstant
float m_planeConstant
Definition: btStaticPlaneShape.h:75
btGeneric6DofSpring2ConstraintDoubleData2::m_rbAFrame
btTransformDoubleData m_rbAFrame
Definition: btGeneric6DofSpring2Constraint.h:537
btTypedConstraintFloatData::m_disableCollisionsBetweenLinkedBodies
int m_disableCollisionsBetweenLinkedBodies
Definition: btTypedConstraint.h:372
btTypedConstraintData::m_disableCollisionsBetweenLinkedBodies
int m_disableCollisionsBetweenLinkedBodies
Definition: btTypedConstraint.h:401
TRIANGLE_MESH_SHAPE_PROXYTYPE
Definition: btBroadphaseProxy.h:54
btCapsuleShape
The btCapsuleShape represents a capsule around the Y axis, there is also the btCapsuleShapeX aligned ...
Definition: btCapsuleShape.h:25
btConvexHullShapeData::m_unscaledPointsDoublePtr
btVector3DoubleData * m_unscaledPointsDoublePtr
Definition: btConvexHullShape.h:102
CONST_GIMPACT_TRIMESH_SHAPE
Definition: btGImpactShape.h:48
btHingeConstraintDoubleData
this structure is not used, except for loading pre-2.82 .bullet files
Definition: btHingeConstraint.h:340
btTransform::setIdentity
void setIdentity()
Set this transformation to the identity.
Definition: btTransform.h:166
btAssert
#define btAssert(x)
Definition: btScalar.h:133
btDynamicsWorld
The btDynamicsWorld is the interface class for several dynamics implementation, basic, discrete, parallel, and continuous etc.
Definition: btDynamicsWorld.h:41
btWorldImporter::m_bodyMap
btHashMap< btHashPtr, btCollisionObject * > m_bodyMap
Definition: btWorldImporter.h:100
btGeneric6DofSpring2ConstraintDoubleData2::m_linearEnableSpring
char m_linearEnableSpring[4]
Definition: btGeneric6DofSpring2Constraint.h:555
btGeneric6DofSpring2ConstraintData::m_angularLowerLimit
btVector3FloatData m_angularLowerLimit
Definition: btGeneric6DofSpring2Constraint.h:513
btWorldImporter::createConvexHullShape
virtual class btConvexHullShape * createConvexHullShape()
Definition: btWorldImporter.cpp:1759
btConeTwistConstraintDoubleData::m_swingSpan2
double m_swingSpan2
Definition: btConeTwistConstraint.h:366
btCollisionShape
The btCollisionShape class provides an interface for collision shapes that can be shared among btColl...
Definition: btCollisionShape.h:26
btGImpactShape.h
btWorldImporter::getNumCollisionShapes
int getNumCollisionShapes() const
Definition: btWorldImporter.cpp:1886
btCapsuleShapeX
btCapsuleShapeX represents a capsule around the Z axis the total height is height+2*radius, so the height is just the height between the center of each &#39;sphere&#39; of the capsule caps.
Definition: btCapsuleShape.h:114
btGeneric6DofConstraintData::m_linearLowerLimit
btVector3FloatData m_linearLowerLimit
Definition: btGeneric6DofConstraint.h:561
btConeShapeX
btConeShape implements a Cone shape, around the X axis
Definition: btConeShape.h:107
btGeneric6DofSpring2ConstraintDoubleData2::m_angularEquilibriumPoint
btVector3DoubleData m_angularEquilibriumPoint
Definition: btGeneric6DofSpring2Constraint.h:572
btWorldImporter::m_shortIndexArrays
btAlignedObjectArray< short int * > m_shortIndexArrays
Definition: btWorldImporter.h:85
btVector3::getY
const btScalar & getY() const
Return the y value.
Definition: btVector3.h:563
btConeTwistConstraint::setDamping
void setDamping(btScalar damping)
Definition: btConeTwistConstraint.h:296
btConeTwistConstraintDoubleData::m_swingSpan1
double m_swingSpan1
Definition: btConeTwistConstraint.h:365
btWorldImporter::createConvexTriangleMeshShape
virtual btCollisionShape * createConvexTriangleMeshShape(btStridingMeshInterface *trimesh)
Definition: btWorldImporter.cpp:1745
btSphereShape
The btSphereShape implements an implicit sphere, centered around a local origin with radius...
Definition: btSphereShape.h:22
btStridingMeshInterface::setScaling
void setScaling(const btVector3 &scaling)
Definition: btStridingMeshInterface.h:84
btWorldImporter::createCapsuleShapeY
virtual btCollisionShape * createCapsuleShapeY(btScalar radius, btScalar height)
Definition: btWorldImporter.cpp:1654
btWorldImporter::createCylinderShapeX
virtual btCollisionShape * createCylinderShapeX(btScalar radius, btScalar height)
Definition: btWorldImporter.cpp:1668
btCollisionObjectDoubleData::m_name
char * m_name
Definition: btCollisionObject.h:596
btWorldImporter::getCollisionShapeByName
btCollisionShape * getCollisionShapeByName(const char *name)
Definition: btWorldImporter.cpp:1896
btConeTwistConstraintData::m_rbBFrame
btTransformFloatData m_rbBFrame
Definition: btConeTwistConstraint.h:381
btTypedConstraintDoubleData::m_disableCollisionsBetweenLinkedBodies
int m_disableCollisionsBetweenLinkedBodies
Definition: btTypedConstraint.h:424
btPoint2PointConstraintFloatData::m_pivotInA
btVector3FloatData m_pivotInA
Definition: btPoint2PointConstraint.h:132
btGeneric6DofConstraint::setAngularUpperLimit
void setAngularUpperLimit(const btVector3 &angularUpper)
Definition: btGeneric6DofConstraint.h:465
btMeshPartData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
Definition: btStridingMeshInterface.h:121
btManifoldPoint
ManifoldContactPoint collects and maintains persistent contactpoints.
Definition: btManifoldPoint.h:51
btHingeConstraintFloatData::m_upperLimit
float m_upperLimit
Definition: btHingeConstraint.h:410
btSliderConstraint::setUseFrameOffset
void setUseFrameOffset(bool frameOffsetOnOff)
Definition: btSliderConstraint.h:262
btTriangleMeshShapeData::m_meshInterface
btStridingMeshInterfaceData m_meshInterface
Definition: btBvhTriangleMeshShape.h:124
btDynamicsWorld::setGravity
virtual void setGravity(const btVector3 &gravity)=0
btMeshPartData::m_numVertices
int m_numVertices
Definition: btStridingMeshInterface.h:133
btConvexInternalShapeData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
Definition: btConvexInternalShape.h:135
btGearConstraintDoubleData::m_axisInB
btVector3DoubleData m_axisInB
Definition: btGearConstraint.h:114
btCollisionShapeData::m_shapeType
int m_shapeType
Definition: btCollisionShape.h:154
GEAR_CONSTRAINT_TYPE
Definition: btTypedConstraint.h:43
btMeshPartData::m_vertices3f
btVector3FloatData * m_vertices3f
Definition: btStridingMeshInterface.h:123
btConeTwistConstraintDoubleData::m_relaxationFactor
double m_relaxationFactor
Definition: btConeTwistConstraint.h:370
btRigidBody::setLinearFactor
void setLinearFactor(const btVector3 &linearFactor)
Definition: btRigidBody.h:256
btWorldImporter::createCylinderShapeY
virtual btCollisionShape * createCylinderShapeY(btScalar radius, btScalar height)
Definition: btWorldImporter.cpp:1675
btWorldImporter::m_allocatedBvhs
btAlignedObjectArray< btOptimizedBvh * > m_allocatedBvhs
Definition: btWorldImporter.h:77
btGeneric6DofConstraintDoubleData2::m_linearLowerLimit
btVector3DoubleData m_linearLowerLimit
Definition: btGeneric6DofConstraint.h:577
btGearConstraintFloatData::m_axisInB
btVector3FloatData m_axisInB
Definition: btGearConstraint.h:103
btWorldImporter::createConeShapeX
virtual btCollisionShape * createConeShapeX(btScalar radius, btScalar height)
Definition: btWorldImporter.cpp:1689
btCompoundShape::addChildShape
void addChildShape(const btTransform &localTransform, btCollisionShape *shape)
Definition: btCompoundShape.cpp:50
btVector3FloatData::m_floats
float m_floats[4]
Definition: btVector3.h:1283
btTypedConstraintFloatData::m_name
char * m_name
Definition: btTypedConstraint.h:362
btCollisionObjectFloatData::m_restitution
float m_restitution
Definition: btCollisionObject.h:644
BOX_SHAPE_PROXYTYPE
Definition: btBroadphaseProxy.h:30
btGImpactMeshShape
This class manages a mesh supplied by the btStridingMeshInterface interface.
Definition: btGImpactShape.h:842
btGeneric6DofSpringConstraint::setStiffness
void setStiffness(int index, btScalar stiffness)
Definition: btGeneric6DofSpringConstraint.cpp:59
GIMPACT_SHAPE_PROXYTYPE
Used for GIMPACT Trimesh integration.
Definition: btBroadphaseProxy.h:61
btSliderConstraintDoubleData::m_linearLowerLimit
double m_linearLowerLimit
Definition: btSliderConstraint.h:314
btRigidBodyDoubleData::m_inverseMass
double m_inverseMass
Definition: btRigidBody.h:582
btTriangleMeshShapeData::m_triangleInfoMap
btTriangleInfoMapData * m_triangleInfoMap
Definition: btBvhTriangleMeshShape.h:129
btSliderConstraintData::m_linearLowerLimit
float m_linearLowerLimit
Definition: btSliderConstraint.h:298
btConcaveShape::setMargin
virtual void setMargin(btScalar collisionMargin)
Definition: btConcaveShape.h:56
btMeshPartData::m_numTriangles
int m_numTriangles
Definition: btStridingMeshInterface.h:132
btConeTwistConstraintDoubleData::m_twistSpan
double m_twistSpan
Definition: btConeTwistConstraint.h:367
btWorldImporter::createCapsuleShapeZ
virtual btCollisionShape * createCapsuleShapeZ(btScalar radius, btScalar height)
Definition: btWorldImporter.cpp:1661
btSliderConstraintData::m_rbBFrame
btTransformFloatData m_rbBFrame
Definition: btSliderConstraint.h:295
btHingeConstraint
hinge constraint between two rigidbodies each with a pivotpoint that descibes the axis location in lo...
Definition: btHingeConstraint.h:47
btSliderConstraintData::m_linearUpperLimit
float m_linearUpperLimit
Definition: btSliderConstraint.h:297
btGeneric6DofSpring2Constraint
Definition: btGeneric6DofSpring2Constraint.h:271
btShortIntIndexTripletData
Definition: btStridingMeshInterface.h:106
btHingeConstraintDoubleData2::m_maxMotorImpulse
double m_maxMotorImpulse
Definition: btHingeConstraint.h:426
btConeTwistConstraintData::m_twistSpan
float m_twistSpan
Definition: btConeTwistConstraint.h:386
btGeneric6DofConstraintData::m_rbBFrame
btTransformFloatData m_rbBFrame
Definition: btGeneric6DofConstraint.h:558
btConeTwistConstraintData::m_swingSpan2
float m_swingSpan2
Definition: btConeTwistConstraint.h:385
btCollisionObject::setRestitution
void setRestitution(btScalar rest)
Definition: btCollisionObject.h:297
btRigidBodyFloatData::m_collisionObjectData
btCollisionObjectFloatData m_collisionObjectData
Definition: btRigidBody.h:545
btRigidBodyDoubleData::m_linearFactor
btVector3DoubleData m_linearFactor
Definition: btRigidBody.h:576
btWorldImporter::createPlaneShape
virtual btCollisionShape * createPlaneShape(const btVector3 &planeNormal, btScalar planeConstant)
shapes
Definition: btWorldImporter.cpp:1628
btShortIntIndexTripletData::m_values
short m_values[3]
Definition: btStridingMeshInterface.h:108
btHingeConstraintFloatData::m_limitSoftness
float m_limitSoftness
Definition: btHingeConstraint.h:411
btWorldImporter::m_allocatedTriangleInfoMaps
btAlignedObjectArray< btTriangleInfoMap * > m_allocatedTriangleInfoMaps
Definition: btWorldImporter.h:78
btSliderConstraintData::m_angularUpperLimit
float m_angularUpperLimit
Definition: btSliderConstraint.h:300
btConvexInternalShapeData::m_collisionMargin
float m_collisionMargin
Definition: btConvexInternalShape.h:143
btWorldImporter::deleteAllData
virtual void deleteAllData()
delete all memory collision shapes, rigid bodies, constraints etc.
Definition: btWorldImporter.cpp:32
btIndexedMesh::m_indexType
PHY_ScalarType m_indexType
Definition: btTriangleIndexVertexArray.h:41
btGeneric6DofSpringConstraintData::m_6dofData
btGeneric6DofConstraintData m_6dofData
Definition: btGeneric6DofSpringConstraint.h:95
btMeshPartData::m_indices16
btShortIntIndexData * m_indices16
Definition: btStridingMeshInterface.h:130
btTypedConstraintDoubleData::m_objectType
int m_objectType
Definition: btTypedConstraint.h:416
btAlignedObjectArray::clear
void clear()
clear the array, deallocated memory. Generally it is better to use array.resize(0), to reduce performance overhead of run-time memory (de)allocations.
Definition: btAlignedObjectArray.h:183
btWorldImporter::getConstraintByName
btTypedConstraint * getConstraintByName(const char *name)
Definition: btWorldImporter.cpp:1916
btDynamicsWorld::addRigidBody
virtual void addRigidBody(btRigidBody *body)=0
btMeshPartData::m_3indices8
btCharIndexTripletData * m_3indices8
Definition: btStridingMeshInterface.h:128
btPoint2PointConstraintDoubleData2
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
Definition: btPoint2PointConstraint.h:137
btTypedConstraint::setBreakingImpulseThreshold
void setBreakingImpulseThreshold(btScalar threshold)
Definition: btTypedConstraint.h:196
btConeTwistConstraintDoubleData::m_damping
double m_damping
Definition: btConeTwistConstraint.h:372
btPoint2PointConstraintDoubleData2::m_pivotInA
btVector3DoubleData m_pivotInA
Definition: btPoint2PointConstraint.h:140
btVector3::getZ
const btScalar & getZ() const
Return the z value.
Definition: btVector3.h:565
D6_SPRING_2_CONSTRAINT_TYPE
Definition: btTypedConstraint.h:45
btCylinderShapeZ
Definition: btCylinderShape.h:151
btTypedConstraintDoubleData::m_name
char * m_name
Definition: btTypedConstraint.h:414
btWorldImporter::m_objectNameMap
btHashMap< btHashPtr, const char * > m_objectNameMap
Definition: btWorldImporter.h:97
btWorldImporter::getNumRigidBodies
int getNumRigidBodies() const
Definition: btWorldImporter.cpp:1934
btWorldImporter::createCompoundShape
virtual class btCompoundShape * createCompoundShape()
Definition: btWorldImporter.cpp:1766
btBvhTriangleMeshShape
The btBvhTriangleMeshShape is a static-triangle mesh shape, it can only be used for fixed/non-moving ...
Definition: btBvhTriangleMeshShape.h:34
btWorldImporter::getRigidBodyByIndex
btCollisionObject * getRigidBodyByIndex(int index) const
Definition: btWorldImporter.cpp:1939
btTypedConstraint::setDbgDrawSize
void setDbgDrawSize(btScalar dbgDrawSize)
Definition: btTypedConstraint.h:307
btStridingMeshInterfaceData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
Definition: btStridingMeshInterface.h:138
btHingeConstraintDoubleData2::m_angularOnly
int m_angularOnly
Definition: btHingeConstraint.h:423
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
btGImpactMeshShapeData::m_collisionMargin
float m_collisionMargin
Definition: btGImpactShape.h:1097
btHingeConstraintFloatData::m_biasFactor
float m_biasFactor
Definition: btHingeConstraint.h:412
btTriangleIndexVertexArray
The btTriangleIndexVertexArray allows to access multiple triangle meshes, by indexing into existing t...
Definition: btTriangleIndexVertexArray.h:65
btCollisionObjectFloatData::m_collisionShape
void * m_collisionShape
Definition: btCollisionObject.h:629
btCollisionObject::getWorldTransform
btTransform & getWorldTransform()
Definition: btCollisionObject.h:365
CYLINDER_SHAPE_PROXYTYPE
Definition: btBroadphaseProxy.h:44
btConvexInternalShape::setMargin
virtual void setMargin(btScalar margin)
Definition: btConvexInternalShape.h:102
btCapsuleShapeData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
Definition: btCapsuleShape.h:141
btGeneric6DofSpring2ConstraintData::m_angularEnableSpring
char m_angularEnableSpring[4]
Definition: btGeneric6DofSpring2Constraint.h:527
btGeneric6DofSpring2ConstraintDoubleData2::m_angularLowerLimit
btVector3DoubleData m_angularLowerLimit
Definition: btGeneric6DofSpring2Constraint.h:561
btGeneric6DofConstraintData::m_angularLowerLimit
btVector3FloatData m_angularLowerLimit
Definition: btGeneric6DofConstraint.h:564
btConvexHullShapeData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
Definition: btConvexHullShape.h:97
btDynamicsWorld::removeConstraint
virtual void removeConstraint(btTypedConstraint *constraint)
Definition: btDynamicsWorld.h:74
btMeshPartData::m_3indices16
btShortIntIndexTripletData * m_3indices16
Definition: btStridingMeshInterface.h:127
btGeneric6DofSpring2ConstraintData::m_linearUpperLimit
btVector3FloatData m_linearUpperLimit
Definition: btGeneric6DofSpring2Constraint.h:492
btTransform::getOrigin
btVector3 & getOrigin()
Return the origin vector translation.
Definition: btTransform.h:113
btWorldImporter::m_doubleVertexArrays
btAlignedObjectArray< btVector3DoubleData * > m_doubleVertexArrays
Definition: btWorldImporter.h:89
btConeTwistConstraintDoubleData::m_limitSoftness
double m_limitSoftness
Definition: btConeTwistConstraint.h:368
btWorldImporter::m_allocatedbtStridingMeshInterfaceDatas
btAlignedObjectArray< btStridingMeshInterfaceData * > m_allocatedbtStridingMeshInterfaceDatas
Definition: btWorldImporter.h:80
btSliderConstraintData::m_useLinearReferenceFrameA
int m_useLinearReferenceFrameA
Definition: btSliderConstraint.h:303
btTriangleIndexVertexArray::addIndexedMesh
void addIndexedMesh(const btIndexedMesh &mesh, PHY_ScalarType indexType=PHY_INTEGER)
Definition: btTriangleIndexVertexArray.h:87
btIndexedMesh::m_triangleIndexStride
int m_triangleIndexStride
Definition: btTriangleIndexVertexArray.h:33
btHingeConstraintDoubleData::m_motorTargetVelocity
float m_motorTargetVelocity
Definition: btHingeConstraint.h:348
btWorldImporter::createGimpactShape
virtual btGImpactMeshShape * createGimpactShape(btStridingMeshInterface *trimesh)
Definition: btWorldImporter.cpp:1749
btTransformFloatData::m_origin
btVector3FloatData m_origin
Definition: btTransform.h:247
btCollisionObject::setFriction
void setFriction(btScalar frict)
Definition: btCollisionObject.h:306
btSliderConstraintDoubleData::m_useOffsetForConstraintFrame
int m_useOffsetForConstraintFrame
Definition: btSliderConstraint.h:320
btWorldImporter::createGearConstraint
virtual btGearConstraint * createGearConstraint(btRigidBody &rbA, btRigidBody &rbB, const btVector3 &axisInA, const btVector3 &axisInB, btScalar ratio)
Definition: btWorldImporter.cpp:1878
btConeShapeData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
Definition: btConeShape.h:143
btGearConstraintFloatData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
Definition: btGearConstraint.h:98
btWorldImporter::getBvhByIndex
btOptimizedBvh * getBvhByIndex(int index) const
Definition: btWorldImporter.cpp:1957
btHingeConstraintDoubleData2::m_relaxationFactor
double m_relaxationFactor
Definition: btHingeConstraint.h:432
btRigidBodyDoubleData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
Definition: btRigidBody.h:569
btShortIntIndexData
Definition: btStridingMeshInterface.h:100
btGeneric6DofSpringConstraint::enableSpring
void enableSpring(int index, bool onOff)
Definition: btGeneric6DofSpringConstraint.cpp:45
btGeneric6DofConstraintData::m_useLinearReferenceFrameA
int m_useLinearReferenceFrameA
Definition: btGeneric6DofConstraint.h:566
btHingeConstraintDoubleData::m_relaxationFactor
float m_relaxationFactor
Definition: btHingeConstraint.h:355
btTypedConstraintData::m_dbgDrawSize
float m_dbgDrawSize
Definition: btTypedConstraint.h:399
btQuantizedBvh::deSerializeDouble
virtual void deSerializeDouble(struct btQuantizedBvhDoubleData &quantizedBvhDoubleData)
Definition: btQuantizedBvh.cpp:1200
btGeneric6DofConstraintDoubleData2::m_angularLowerLimit
btVector3DoubleData m_angularLowerLimit
Definition: btGeneric6DofConstraint.h:580
btGeneric6DofSpring2ConstraintDoubleData2::m_linearSpringStiffnessLimited
char m_linearSpringStiffnessLimited[4]
Definition: btGeneric6DofSpring2Constraint.h:556
btGeneric6DofConstraintData::m_linearUpperLimit
btVector3FloatData m_linearUpperLimit
Definition: btGeneric6DofConstraint.h:560
btPoint2PointConstraintFloatData::m_pivotInB
btVector3FloatData m_pivotInB
Definition: btPoint2PointConstraint.h:133
btConeShape
The btConeShape implements a cone shape primitive, centered around the origin and aligned with the Y ...
Definition: btConeShape.h:23
btWorldImporter::createConeShapeZ
virtual btCollisionShape * createConeShapeZ(btScalar radius, btScalar height)
Definition: btWorldImporter.cpp:1703
PHY_DOUBLE
Definition: btConcaveShape.h:28
PHY_SHORT
Definition: btConcaveShape.h:30
btTypedConstraint::setOverrideNumSolverIterations
void setOverrideNumSolverIterations(int overideNumIterations)
override the number of constraint solver iterations used to solve this constraint -1 will use the def...
Definition: btTypedConstraint.h:157
btWorldImporter::createOptimizedBvh
virtual btOptimizedBvh * createOptimizedBvh()
acceleration and connectivity structures
Definition: btWorldImporter.cpp:1717
btGeneric6DofSpringConstraint::setEquilibriumPoint
void setEquilibriumPoint()
Definition: btGeneric6DofSpringConstraint.cpp:71
btGearConstraintDoubleData
Definition: btGearConstraint.h:109
btGeneric6DofSpringConstraint::setDamping
void setDamping(int index, btScalar damping)
Definition: btGeneric6DofSpringConstraint.cpp:65
btCharIndexTripletData::m_values
unsigned char m_values[3]
Definition: btStridingMeshInterface.h:114
btGeneric6DofSpringConstraintData::m_springEnabled
int m_springEnabled[6]
Definition: btGeneric6DofSpringConstraint.h:97
btMultiSphereShapeData::m_localPositionArrayPtr
btPositionAndRadius * m_localPositionArrayPtr
Definition: btMultiSphereShape.h:83
btGImpactMeshShapeData::m_meshInterface
btStridingMeshInterfaceData m_meshInterface
Definition: btGImpactShape.h:1093
btVector3::setW
void setW(btScalar _w)
Set the w value.
Definition: btVector3.h:573
btDynamicsWorld::removeRigidBody
virtual void removeRigidBody(btRigidBody *body)=0
btStridingMeshInterfaceData::m_numMeshParts
int m_numMeshParts
Definition: btStridingMeshInterface.h:142
btCompoundShapeChildData::m_transform
btTransformFloatData m_transform
Definition: btCompoundShape.h:181
btConeTwistConstraintDoubleData
Definition: btConeTwistConstraint.h:358
btSliderConstraint::setUpperAngLimit
void setUpperAngLimit(btScalar upperLimit)
Definition: btSliderConstraint.h:194
MULTI_SPHERE_SHAPE_PROXYTYPE
Definition: btBroadphaseProxy.h:40
btCollisionObjectDoubleData::m_friction
double m_friction
Definition: btCollisionObject.h:605
btGeneric6DofSpring2ConstraintDoubleData2::m_rotateOrder
int m_rotateOrder
Definition: btGeneric6DofSpring2Constraint.h:579
btWorldImporter::duplicateName
char * duplicateName(const char *name)
Definition: btWorldImporter.cpp:491
btAlignedFree
#define btAlignedFree(ptr)
Definition: btAlignedAllocator.h:47
btWorldImporter::m_nameConstraintMap
btHashMap< btHashString, btTypedConstraint * > m_nameConstraintMap
Definition: btWorldImporter.h:96
btPositionAndRadius::m_pos
btVector3FloatData m_pos
Definition: btMultiSphereShape.h:73
btTypedConstraintDoubleData
Definition: btTypedConstraint.h:410
btCollisionObject
btCollisionObject can be used to manage collision detection objects.
Definition: btCollisionObject.h:48
btWorldImporter::createBoxShape
virtual btCollisionShape * createBoxShape(const btVector3 &halfExtents)
Definition: btWorldImporter.cpp:1634
btHingeConstraintFloatData::m_relaxationFactor
float m_relaxationFactor
Definition: btHingeConstraint.h:413
btBvhTriangleMeshShape::setOptimizedBvh
void setOptimizedBvh(btOptimizedBvh *bvh, const btVector3 &localScaling=btVector3(1, 1, 1))
Definition: btBvhTriangleMeshShape.cpp:345
btHashMap::insert
void insert(const Key &key, const Value &value)
Definition: btHashMap.h:264
btWorldImporter::m_allocatedConstraints
btAlignedObjectArray< btTypedConstraint * > m_allocatedConstraints
Definition: btWorldImporter.h:76
btHingeConstraintDoubleData2::m_limitSoftness
double m_limitSoftness
Definition: btHingeConstraint.h:430
btWorldImporter::createScaledTrangleMeshShape
virtual class btScaledBvhTriangleMeshShape * createScaledTrangleMeshShape(btBvhTriangleMeshShape *meshShape, const btVector3 &localScalingbtBvhTriangleMeshShape)
Definition: btWorldImporter.cpp:1773
btVector3::setZero
void setZero()
Definition: btVector3.h:671
btGeneric6DofConstraintDoubleData2::m_angularUpperLimit
btVector3DoubleData m_angularUpperLimit
Definition: btGeneric6DofConstraint.h:579
btConeTwistConstraintData::m_biasFactor
float m_biasFactor
Definition: btConeTwistConstraint.h:388
btWorldImporter::createGeneric6DofSpring2Constraint
virtual btGeneric6DofSpring2Constraint * createGeneric6DofSpring2Constraint(btRigidBody &rbA, btRigidBody &rbB, const btTransform &frameInA, const btTransform &frameInB, int rotateOrder)
Definition: btWorldImporter.cpp:1850
btRigidBody
The btRigidBody is the main class for rigid body objects.
Definition: btRigidBody.h:59
btSliderConstraintDoubleData::m_linearUpperLimit
double m_linearUpperLimit
Definition: btSliderConstraint.h:313
btOptimizedBvh
The btOptimizedBvh extends the btQuantizedBvh to create AABB tree for triangle meshes, through the btStridingMeshInterface.
Definition: btOptimizedBvh.h:26
btSliderConstraintDoubleData::m_useLinearReferenceFrameA
int m_useLinearReferenceFrameA
Definition: btSliderConstraint.h:319
btConvexInternalShapeData::m_localScaling
btVector3FloatData m_localScaling
Definition: btConvexInternalShape.h:139
btGeneric6DofSpring2ConstraintDoubleData2::m_linearLowerLimit
btVector3DoubleData m_linearLowerLimit
Definition: btGeneric6DofSpring2Constraint.h:541
btStridingMeshInterfaceData::m_scaling
btVector3FloatData m_scaling
Definition: btStridingMeshInterface.h:141
D6_SPRING_CONSTRAINT_TYPE
Definition: btTypedConstraint.h:42
btGeneric6DofConstraintDoubleData2::m_useLinearReferenceFrameA
int m_useLinearReferenceFrameA
Definition: btGeneric6DofConstraint.h:582
btCollisionShape::setMargin
virtual void setMargin(btScalar margin)=0
btGImpactMeshShapeData::m_gimpactSubType
int m_gimpactSubType
Definition: btGImpactShape.h:1099
btGeneric6DofSpring2Constraint::setEquilibriumPoint
void setEquilibriumPoint()
Definition: btGeneric6DofSpring2Constraint.cpp:1165
btWorldImporter::createCollisionObject
virtual btCollisionObject * createCollisionObject(const btTransform &startTransform, btCollisionShape *shape, const char *bodyName)
Definition: btWorldImporter.cpp:1590
btIndexedMesh::m_triangleIndexBase
const unsigned char * m_triangleIndexBase
Definition: btTriangleIndexVertexArray.h:31
btGeneric6DofSpring2ConstraintData::m_linearSpringStiffnessLimited
char m_linearSpringStiffnessLimited[4]
Definition: btGeneric6DofSpring2Constraint.h:508
btGeneric6DofSpring2Constraint::setLinearUpperLimit
void setLinearUpperLimit(const btVector3 &linearUpper)
Definition: btGeneric6DofSpring2Constraint.h:358
btRigidBodyFloatData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
Definition: btRigidBody.h:543
btTypedConstraintData
this structure is not used, except for loading pre-2.82 .bullet files
Definition: btTypedConstraint.h:387
btGeneric6DofSpring2Constraint::setLinearLowerLimit
void setLinearLowerLimit(const btVector3 &linearLower)
Definition: btGeneric6DofSpring2Constraint.h:356
SLIDER_CONSTRAINT_TYPE
Definition: btTypedConstraint.h:40
btRigidBodyDoubleData::m_angularFactor
btVector3DoubleData m_angularFactor
Definition: btRigidBody.h:575
btGeneric6DofConstraintDoubleData2::m_rbAFrame
btTransformDoubleData m_rbAFrame
Definition: btGeneric6DofConstraint.h:573
btHingeConstraintDoubleData::m_upperLimit
float m_upperLimit
Definition: btHingeConstraint.h:352
btGeneric6DofSpring2Constraint::setAngularLowerLimit
void setAngularLowerLimit(const btVector3 &angularLower)
Definition: btGeneric6DofSpring2Constraint.h:361
btPositionAndRadius::m_radius
float m_radius
Definition: btMultiSphereShape.h:74
btCollisionObject::setWorldTransform
void setWorldTransform(const btTransform &worldTrans)
Definition: btCollisionObject.h:375
btConvexInternalShapeData::m_implicitShapeDimensions
btVector3FloatData m_implicitShapeDimensions
Definition: btConvexInternalShape.h:141
btConvexHullShapeData::m_unscaledPointsFloatPtr
btVector3FloatData * m_unscaledPointsFloatPtr
Definition: btConvexHullShape.h:101
btWorldImporter::m_indexArrays
btAlignedObjectArray< int * > m_indexArrays
Definition: btWorldImporter.h:84
btScaledTriangleMeshShapeData::m_localScaling
btVector3FloatData m_localScaling
Definition: btScaledBvhTriangleMeshShape.h:68
btTypedConstraintFloatData::m_isEnabled
int m_isEnabled
Definition: btTypedConstraint.h:376
btCollisionShape::setLocalScaling
virtual void setLocalScaling(const btVector3 &scaling)=0
btWorldImporter::convertConstraintFloat
void convertConstraintFloat(btTypedConstraintFloatData *constraintData, btRigidBody *rbA, btRigidBody *rbB, int fileVersion)
Definition: btWorldImporter.cpp:728
btSliderConstraintDoubleData
Definition: btSliderConstraint.h:307
btTriangleMeshShapeData::m_quantizedDoubleBvh
btQuantizedBvhDoubleData * m_quantizedDoubleBvh
Definition: btBvhTriangleMeshShape.h:127
btGearConstraintDoubleData::m_axisInA
btVector3DoubleData m_axisInA
Definition: btGearConstraint.h:113
btCollisionObject::getCollisionFlags
int getCollisionFlags() const
Definition: btCollisionObject.h:475
btGearConstraintFloatData::m_axisInA
btVector3FloatData m_axisInA
Definition: btGearConstraint.h:102
btWorldImporter::setDynamicsWorldInfo
virtual void setDynamicsWorldInfo(const btVector3 &gravity, const btContactSolverInfo &solverInfo)
those virtuals are called by load and can be overridden by the user
Definition: btWorldImporter.cpp:1595
btConeTwistConstraintDoubleData::m_rbBFrame
btTransformDoubleData m_rbBFrame
Definition: btConeTwistConstraint.h:362
btBoxShape
The btBoxShape is a box primitive around the origin, its sides axis aligned with length specified by ...
Definition: btBoxShape.h:26
btConeTwistConstraintDoubleData::m_biasFactor
double m_biasFactor
Definition: btConeTwistConstraint.h:369
btWorldImporter::createMeshInterface
virtual btTriangleIndexVertexArray * createMeshInterface(btStridingMeshInterfaceData &meshData)
Definition: btWorldImporter.cpp:1382
btWorldImporter::createConeShapeY
virtual btCollisionShape * createConeShapeY(btScalar radius, btScalar height)
Definition: btWorldImporter.cpp:1696
btGeneric6DofSpring2ConstraintData
Definition: btGeneric6DofSpring2Constraint.h:486
btVector3
btVector3 can be used to represent 3D points and vectors.
Definition: btVector3.h:80
btWorldImporter::getNumConstraints
int getNumConstraints() const
Definition: btWorldImporter.cpp:1943
ContactAddedCallback
bool(* ContactAddedCallback)(btManifoldPoint &cp, const btCollisionObjectWrapper *colObj0Wrap, int partId0, int index0, const btCollisionObjectWrapper *colObj1Wrap, int partId1, int index1)
Definition: btManifoldResult.h:31
btGeneric6DofSpring2ConstraintData::m_linearSpringDamping
btVector3FloatData m_linearSpringDamping
Definition: btGeneric6DofSpring2Constraint.h:503
btGeneric6DofSpring2ConstraintData::m_angularSpringStiffnessLimited
char m_angularSpringStiffnessLimited[4]
Definition: btGeneric6DofSpring2Constraint.h:528
btRigidBodyFloatData::m_inverseMass
float m_inverseMass
Definition: btRigidBody.h:556
btAlignedObjectArray::size
int size() const
return the number of elements in the array
Definition: btAlignedObjectArray.h:149
btHingeConstraintFloatData::m_useReferenceFrameA
int m_useReferenceFrameA
Definition: btHingeConstraint.h:402
btTypedConstraintData::m_objectType
int m_objectType
Definition: btTypedConstraint.h:393
btWorldImporter::createPoint2PointConstraint
virtual btPoint2PointConstraint * createPoint2PointConstraint(btRigidBody &rbA, btRigidBody &rbB, const btVector3 &pivotInA, const btVector3 &pivotInB)
constraints
Definition: btWorldImporter.cpp:1794
btHingeConstraint::setAngularOnly
void setAngularOnly(bool angularOnly)
Definition: btHingeConstraint.h:154
btTransform
The btTransform class supports rigid transforms with only translation and rotation and no scaling/she...
Definition: btTransform.h:28
btConeTwistConstraint
btConeTwistConstraint can be used to simulate ragdoll joints (upper arm, leg etc) ...
Definition: btConeTwistConstraint.h:57
btTypedConstraintData::m_overrideNumSolverIterations
int m_overrideNumSolverIterations
Definition: btTypedConstraint.h:402
btRigidBody::setMassProps
void setMassProps(btScalar mass, const btVector3 &inertia)
Definition: btRigidBody.cpp:214
btContactSolverInfo
Definition: btContactSolverInfo.h:69
btTypedConstraintData::m_breakingImpulseThreshold
float m_breakingImpulseThreshold
Definition: btTypedConstraint.h:404
btCollisionObjectFloatData::m_friction
float m_friction
Definition: btCollisionObject.h:640
btStridingMeshInterface
The btStridingMeshInterface is the interface class for high performance generic access to triangle me...
Definition: btStridingMeshInterface.h:26
btConeShapeZ
btConeShapeZ implements a Cone shape, around the Z axis
Definition: btConeShape.h:125
btCollisionShape::isNonMoving
bool isNonMoving() const
Definition: btCollisionShape.h:73
btHingeConstraintDoubleData::m_angularOnly
int m_angularOnly
Definition: btHingeConstraint.h:346
btWorldImporter::m_allocatedNames
btAlignedObjectArray< char * > m_allocatedNames
Definition: btWorldImporter.h:82
btCollisionObject::setCollisionFlags
void setCollisionFlags(int flags)
Definition: btCollisionObject.h:480
btGeneric6DofSpring2ConstraintData::m_rbAFrame
btTransformFloatData m_rbAFrame
Definition: btGeneric6DofSpring2Constraint.h:489
btRigidBodyDoubleData::m_collisionObjectData
btCollisionObjectDoubleData m_collisionObjectData
Definition: btRigidBody.h:571
btHingeConstraintDoubleData::m_biasFactor
float m_biasFactor
Definition: btHingeConstraint.h:354
btGeneric6DofSpring2ConstraintData::m_angularEquilibriumPoint
btVector3FloatData m_angularEquilibriumPoint
Definition: btGeneric6DofSpring2Constraint.h:524
btConeShapeData::m_upIndex
int m_upIndex
Definition: btConeShape.h:147
btCollisionObjectFloatData::m_name
char * m_name
Definition: btCollisionObject.h:631
btHingeConstraintDoubleData::m_rbAFrame
btTransformDoubleData m_rbAFrame
Definition: btHingeConstraint.h:343
btCollisionObjectDoubleData::m_worldTransform
btTransformDoubleData m_worldTransform
Definition: btCollisionObject.h:598
btQuantizedBvh::deSerializeFloat
virtual void deSerializeFloat(struct btQuantizedBvhFloatData &quantizedBvhFloatData)
Definition: btQuantizedBvh.cpp:1129
btTriangleMeshShapeData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
Definition: btBvhTriangleMeshShape.h:120
PHY_INTEGER
Definition: btConcaveShape.h:29
btWorldImporter::getConstraintByIndex
btTypedConstraint * getConstraintByIndex(int index) const
Definition: btWorldImporter.cpp:1948
CONETWIST_CONSTRAINT_TYPE
Definition: btTypedConstraint.h:38
btGeneric6DofSpringConstraintData::m_equilibriumPoint
float m_equilibriumPoint[6]
Definition: btGeneric6DofSpringConstraint.h:98
btTypedConstraint
TypedConstraint is the baseclass for Bullet constraints and vehicles.
Definition: btTypedConstraint.h:74
btHingeConstraint::setLimit
void setLimit(btScalar low, btScalar high, btScalar _softness=0.9f, btScalar _biasFactor=0.3f, btScalar _relaxationFactor=1.0f)
Definition: btHingeConstraint.h:175
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
btWorldImporter::getNameForPointer
const char * getNameForPointer(const void *ptr) const
Definition: btWorldImporter.cpp:1926
btAlignedObjectArray::resize
void resize(int newsize, const T &fillData=T())
Definition: btAlignedObjectArray.h:210
CONVEX_HULL_SHAPE_PROXYTYPE
Definition: btBroadphaseProxy.h:34
btGeneric6DofSpringConstraintDoubleData2
Definition: btGeneric6DofSpringConstraint.h:103
btSliderConstraintData::m_rbAFrame
btTransformFloatData m_rbAFrame
Definition: btSliderConstraint.h:294
btCompoundShapeData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
Definition: btCompoundShape.h:188
btTypedConstraintFloatData::m_dbgDrawSize
float m_dbgDrawSize
Definition: btTypedConstraint.h:370
btWorldImporter::getFixedBody
static btRigidBody & getFixedBody()
Definition: btWorldImporter.cpp:1787
btHingeConstraintFloatData::m_angularOnly
int m_angularOnly
Definition: btHingeConstraint.h:403
btQuantizedBvh::isQuantized
bool isQuantized()
Definition: btQuantizedBvh.h:453
btHingeConstraintFloatData::m_enableAngularMotor
int m_enableAngularMotor
Definition: btHingeConstraint.h:405
btHingeConstraintDoubleData2::m_upperLimit
double m_upperLimit
Definition: btHingeConstraint.h:429
btDynamicsWorld::addConstraint
virtual void addConstraint(btTypedConstraint *constraint, bool disableCollisionsBetweenLinkedBodies=false)
Definition: btDynamicsWorld.h:68
btGeneric6DofSpring2Constraint::setStiffness
void setStiffness(int index, btScalar stiffness, bool limitIfNeeded=true)
Definition: btGeneric6DofSpring2Constraint.cpp:1135
btTypedConstraint::setEnabled
void setEnabled(bool enabled)
Definition: btTypedConstraint.h:206
btHingeConstraintFloatData
Definition: btHingeConstraint.h:397
btGeneric6DofSpringConstraintDoubleData2::m_equilibriumPoint
double m_equilibriumPoint[6]
Definition: btGeneric6DofSpringConstraint.h:108
btGImpactMeshShapeData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
Definition: btGImpactShape.h:1089
btGeneric6DofSpring2ConstraintDoubleData2::m_angularUpperLimit
btVector3DoubleData m_angularUpperLimit
Definition: btGeneric6DofSpring2Constraint.h:560
btPoint2PointConstraintDoubleData::m_pivotInB
btVector3DoubleData m_pivotInB
Definition: btPoint2PointConstraint.h:152
btWorldImporter::getNumTriangleInfoMaps
int getNumTriangleInfoMaps() const
Definition: btWorldImporter.cpp:1962
btWorldImporter::m_allocatedCollisionShapes
btAlignedObjectArray< btCollisionShape * > m_allocatedCollisionShapes
Definition: btWorldImporter.h:74
btTriangleInfoMap::deSerialize
void deSerialize(struct btTriangleInfoMapData &data)
fills the dataBuffer and returns the struct name (and 0 on failure)
Definition: btTriangleInfoMap.h:204
btWorldImporter::createHingeConstraint
virtual btHingeConstraint * createHingeConstraint(btRigidBody &rbA, btRigidBody &rbB, const btTransform &rbAFrame, const btTransform &rbBFrame, bool useReferenceFrameA=false)
Definition: btWorldImporter.cpp:1808
btStaticPlaneShapeData::m_localScaling
btVector3FloatData m_localScaling
Definition: btStaticPlaneShape.h:73
btGeneric6DofSpring2ConstraintDoubleData2::m_angularSpringStiffness
btVector3DoubleData m_angularSpringStiffness
Definition: btGeneric6DofSpring2Constraint.h:570
btCylinderShape
The btCylinderShape class implements a cylinder shape primitive, centered around the origin...
Definition: btCylinderShape.h:24
btIndexedMesh::m_numVertices
int m_numVertices
Definition: btTriangleIndexVertexArray.h:34
btGeneric6DofSpringConstraintData::m_springStiffness
float m_springStiffness[6]
Definition: btGeneric6DofSpringConstraint.h:99
gContactAddedCallback
ContactAddedCallback gContactAddedCallback
This is to allow MaterialCombiner/Custom Friction/Restitution values.
Definition: btManifoldResult.cpp:22
btGeneric6DofSpring2ConstraintDoubleData2
Definition: btGeneric6DofSpring2Constraint.h:534
btIntIndexData
Definition: btStridingMeshInterface.h:95
RotateOrder
RotateOrder
Definition: btGeneric6DofSpring2Constraint.h:57
btGearConstraintDoubleData::m_ratio
double m_ratio
Definition: btGearConstraint.h:116
btGeneric6DofSpringConstraintDoubleData2::m_springDamping
double m_springDamping[6]
Definition: btGeneric6DofSpringConstraint.h:110
btScaledBvhTriangleMeshShape
The btScaledBvhTriangleMeshShape allows to instance a scaled version of an existing btBvhTriangleMesh...
Definition: btScaledBvhTriangleMeshShape.h:23
btGeneric6DofConstraint::setLinearLowerLimit
void setLinearLowerLimit(const btVector3 &linearLower)
Definition: btGeneric6DofConstraint.h:433
btWorldImporter.h
btGeneric6DofConstraintDoubleData2::m_linearUpperLimit
btVector3DoubleData m_linearUpperLimit
Definition: btGeneric6DofConstraint.h:576
btGeneric6DofSpring2ConstraintData::m_angularSpringStiffness
btVector3FloatData m_angularSpringStiffness
Definition: btGeneric6DofSpring2Constraint.h:522
btGeneric6DofSpring2ConstraintDoubleData2::m_linearSpringStiffness
btVector3DoubleData m_linearSpringStiffness
Definition: btGeneric6DofSpring2Constraint.h:550
btWorldImporter::getCollisionShapeByIndex
btCollisionShape * getCollisionShapeByIndex(int index)
Definition: btWorldImporter.cpp:1891
btWorldImporter::getRigidBodyByName
btRigidBody * getRigidBodyByName(const char *name)
Definition: btWorldImporter.cpp:1906
btHingeConstraintFloatData::m_maxMotorImpulse
float m_maxMotorImpulse
Definition: btHingeConstraint.h:407
btSliderConstraint
Definition: btSliderConstraint.h:65
btHingeConstraintDoubleData2::m_rbBFrame
btTransformDoubleData m_rbBFrame
Definition: btHingeConstraint.h:421
btAlignedAlloc
#define btAlignedAlloc(size, alignment)
Definition: btAlignedAllocator.h:46
btGeneric6DofSpring2ConstraintDoubleData2::m_angularSpringDamping
btVector3DoubleData m_angularSpringDamping
Definition: btGeneric6DofSpring2Constraint.h:571
btCapsuleShapeZ
btCapsuleShapeZ represents a capsule around the Z axis the total height is height+2*radius, so the height is just the height between the center of each &#39;sphere&#39; of the capsule caps.
Definition: btCapsuleShape.h:128
btMeshPartData::m_indices32
btIntIndexData * m_indices32
Definition: btStridingMeshInterface.h:126
btCapsuleShape::deSerializeFloat
void deSerializeFloat(struct btCapsuleShapeData *dataBuffer)
Definition: btCapsuleShape.h:173
btBvhTriangleMeshShape::setTriangleInfoMap
void setTriangleInfoMap(btTriangleInfoMap *triangleInfoMap)
Definition: btBvhTriangleMeshShape.h:92
btStaticPlaneShapeData::m_planeNormal
btVector3FloatData m_planeNormal
Definition: btStaticPlaneShape.h:74
btSliderConstraintDoubleData::m_rbBFrame
btTransformDoubleData m_rbBFrame
Definition: btSliderConstraint.h:311
btConvexHullShape::addPoint
void addPoint(const btVector3 &point, bool recalculateLocalAabb=true)
Definition: btConvexHullShape.cpp:51
btWorldImporter::createSliderConstraint
virtual btSliderConstraint * createSliderConstraint(btRigidBody &rbA, btRigidBody &rbB, const btTransform &frameInA, const btTransform &frameInB, bool useLinearReferenceFrameA)
Definition: btWorldImporter.cpp:1864
btCompoundShapeData::m_numChildShapes
int m_numChildShapes
Definition: btCompoundShape.h:194
btGeneric6DofSpringConstraintData::m_springDamping
float m_springDamping[6]
Definition: btGeneric6DofSpringConstraint.h:100
COMPOUND_SHAPE_PROXYTYPE
Definition: btBroadphaseProxy.h:71
btConeTwistConstraintData
this structure is not used, except for loading pre-2.82 .bullet files
Definition: btConeTwistConstraint.h:377
btConvexHullShape
The btConvexHullShape implements an implicit convex hull of an array of vertices. ...
Definition: btConvexHullShape.h:25
btHingeConstraintDoubleData::m_enableAngularMotor
int m_enableAngularMotor
Definition: btHingeConstraint.h:347
btCollisionObjectDoubleData::m_collisionShape
void * m_collisionShape
Definition: btCollisionObject.h:594
btCollisionShape::getShapeType
int getShapeType() const
Definition: btCollisionShape.h:106
POINT2POINT_CONSTRAINT_TYPE
Definition: btTypedConstraint.h:36
btGeneric6DofSpring2Constraint::enableSpring
void enableSpring(int index, bool onOff)
Definition: btGeneric6DofSpring2Constraint.cpp:1126
btWorldImporter::m_shapeMap
btHashMap< btHashPtr, btCollisionShape * > m_shapeMap
Definition: btWorldImporter.h:99
D6_CONSTRAINT_TYPE
Definition: btTypedConstraint.h:39
btGeneric6DofSpring2Constraint::setAngularUpperLimit
void setAngularUpperLimit(const btVector3 &angularUpper)
Definition: btGeneric6DofSpring2Constraint.h:385
btVector3FloatData
Definition: btVector3.h:1281
btTypedConstraintDoubleData::m_dbgDrawSize
double m_dbgDrawSize
Definition: btTypedConstraint.h:422
btTriangleMeshShapeData::m_collisionMargin
float m_collisionMargin
Definition: btBvhTriangleMeshShape.h:131
btTriangleInfoMap
The btTriangleInfoMap stores edge angle information for some triangles. You can compute this informat...
Definition: btTriangleInfoMap.h:53
btHingeConstraintDoubleData2::m_lowerLimit
double m_lowerLimit
Definition: btHingeConstraint.h:428
btTriangleMeshShapeData::m_quantizedFloatBvh
btQuantizedBvhFloatData * m_quantizedFloatBvh
Definition: btBvhTriangleMeshShape.h:126
btHingeConstraintDoubleData2::m_rbAFrame
btTransformDoubleData m_rbAFrame
Definition: btHingeConstraint.h:420
btCompoundShape
The btCompoundShape allows to store multiple other btCollisionShapes This allows for moving concave c...
Definition: btCompoundShape.h:55
btGeneric6DofSpring2ConstraintDoubleData2::m_angularSpringDampingLimited
char m_angularSpringDampingLimited[4]
Definition: btGeneric6DofSpring2Constraint.h:577
HINGE_CONSTRAINT_TYPE
Definition: btTypedConstraint.h:37
btHingeConstraintFloatData::m_lowerLimit
float m_lowerLimit
Definition: btHingeConstraint.h:409
btGImpactShapeInterface::updateBound
void updateBound()
performs refit operation
Definition: btGImpactShape.h:115
btVector3::deSerializeFloat
void deSerializeFloat(const struct btVector3FloatData &dataIn)
Definition: btVector3.h:1298
btCapsuleShapeData::m_upAxis
int m_upAxis
Definition: btCapsuleShape.h:145
btCompoundShapeChildData::m_childShape
btCollisionShapeData * m_childShape
Definition: btCompoundShape.h:182
btWorldImporter::m_allocatedTriangleIndexArrays
btAlignedObjectArray< btTriangleIndexVertexArray * > m_allocatedTriangleIndexArrays
Definition: btWorldImporter.h:79
btGeneric6DofSpring2ConstraintData::m_linearEnableSpring
char m_linearEnableSpring[4]
Definition: btGeneric6DofSpring2Constraint.h:507
btPoint2PointConstraintDoubleData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 th...
Definition: btPoint2PointConstraint.h:148
btStaticPlaneShape
The btStaticPlaneShape simulates an infinite non-moving (static) collision plane. ...
Definition: btStaticPlaneShape.h:22
btGeneric6DofSpring2ConstraintData::m_linearSpringDampingLimited
char m_linearSpringDampingLimited[4]
Definition: btGeneric6DofSpring2Constraint.h:509
btTransform::deSerializeDouble
void deSerializeDouble(const struct btTransformDoubleData &dataIn)
Definition: btTransform.h:280
btWorldImporter::m_allocatedRigidBodies
btAlignedObjectArray< btCollisionObject * > m_allocatedRigidBodies
Definition: btWorldImporter.h:75
btCollisionObjectDoubleData::m_restitution
double m_restitution
Definition: btCollisionObject.h:609
btGeneric6DofConstraint::setLinearUpperLimit
void setLinearUpperLimit(const btVector3 &linearUpper)
Definition: btGeneric6DofConstraint.h:443
btWorldImporter::~btWorldImporter
virtual ~btWorldImporter()
Definition: btWorldImporter.cpp:28
btWorldImporter::m_bvhMap
btHashMap< btHashPtr, btOptimizedBvh * > m_bvhMap
Definition: btWorldImporter.h:91
btHingeConstraintDoubleData::m_limitSoftness
float m_limitSoftness
Definition: btHingeConstraint.h:353
btIndexedMesh::m_vertexStride
int m_vertexStride
Definition: btTriangleIndexVertexArray.h:37
btSliderConstraintDoubleData::m_rbAFrame
btTransformDoubleData m_rbAFrame
Definition: btSliderConstraint.h:310
btGImpactMeshShapeData::m_localScaling
btVector3FloatData m_localScaling
Definition: btGImpactShape.h:1095
btHingeConstraintDoubleData2::m_enableAngularMotor
int m_enableAngularMotor
Definition: btHingeConstraint.h:424
btGeneric6DofConstraintData::m_angularUpperLimit
btVector3FloatData m_angularUpperLimit
Definition: btGeneric6DofConstraint.h:563
btWorldImporter::m_dynamicsWorld
btDynamicsWorld * m_dynamicsWorld
Definition: btWorldImporter.h:69
btGeneric6DofConstraintData::m_rbAFrame
btTransformFloatData m_rbAFrame
Definition: btGeneric6DofConstraint.h:557
btPoint2PointConstraintFloatData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
Definition: btPoint2PointConstraint.h:129
btGeneric6DofSpring2Constraint::setDamping
void setDamping(int index, btScalar damping, bool limitIfNeeded=true)
Definition: btGeneric6DofSpring2Constraint.cpp:1150
btWorldImporter::m_floatVertexArrays
btAlignedObjectArray< btVector3FloatData * > m_floatVertexArrays
Definition: btWorldImporter.h:88
btRigidBody::setAngularFactor
void setAngularFactor(const btVector3 &angFac)
Definition: btRigidBody.h:476
btTypedConstraintDoubleData::m_overrideNumSolverIterations
int m_overrideNumSolverIterations
Definition: btTypedConstraint.h:425
btConeTwistConstraintData::m_relaxationFactor
float m_relaxationFactor
Definition: btConeTwistConstraint.h:389
btTypedConstraintData::m_isEnabled
int m_isEnabled
Definition: btTypedConstraint.h:405
btHingeConstraintDoubleData::m_maxMotorImpulse
float m_maxMotorImpulse
Definition: btHingeConstraint.h:349
btCollisionObject::CF_CUSTOM_MATERIAL_CALLBACK
Definition: btCollisionObject.h:131
btTransform::inverse
btTransform inverse() const
Return the inverse of this transform.
Definition: btTransform.h:182
btDynamicsWorld::getSolverInfo
btContactSolverInfo & getSolverInfo()
Definition: btDynamicsWorld.h:139
btTransformDoubleData::m_origin
btVector3DoubleData m_origin
Definition: btTransform.h:253
btWorldImporter::createCapsuleShapeX
virtual btCollisionShape * createCapsuleShapeX(btScalar radius, btScalar height)
Definition: btWorldImporter.cpp:1647
RO_XYZ
Definition: btGeneric6DofSpring2Constraint.h:59
btGeneric6DofSpring2ConstraintDoubleData2::m_linearSpringDampingLimited
char m_linearSpringDampingLimited[4]
Definition: btGeneric6DofSpring2Constraint.h:557
btGeneric6DofSpring2ConstraintDoubleData2::m_angularEnableSpring
char m_angularEnableSpring[4]
Definition: btGeneric6DofSpring2Constraint.h:575
btGeneric6DofConstraint::setAngularLowerLimit
void setAngularLowerLimit(const btVector3 &angularLower)
Definition: btGeneric6DofConstraint.h:453
btGeneric6DofSpringConstraint
Generic 6 DOF constraint that allows to set spring motors to any translational and rotational DOF...
Definition: btGeneric6DofSpringConstraint.h:41
btSliderConstraintData::m_angularLowerLimit
float m_angularLowerLimit
Definition: btSliderConstraint.h:301
btCollisionShapeData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
Definition: btCollisionShape.h:151
btHingeConstraintDoubleData::m_useReferenceFrameA
int m_useReferenceFrameA
Definition: btHingeConstraint.h:345
btWorldImporter::createMultiSphereShape
virtual class btMultiSphereShape * createMultiSphereShape(const btVector3 *positions, const btScalar *radi, int numSpheres)
Definition: btWorldImporter.cpp:1780
btTypedConstraintFloatData::m_overrideNumSolverIterations
int m_overrideNumSolverIterations
Definition: btTypedConstraint.h:373
btVector3::getX
const btScalar & getX() const
Return the x value.
Definition: btVector3.h:561
btCylinderShapeData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
Definition: btCylinderShape.h:174
btHingeConstraintDoubleData2
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
Definition: btHingeConstraint.h:417
btGeneric6DofSpring2ConstraintData::m_angularSpringDamping
btVector3FloatData m_angularSpringDamping
Definition: btGeneric6DofSpring2Constraint.h:523
btTypedConstraintFloatData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
Definition: btTypedConstraint.h:358
btWorldImporter::convertConstraintDouble
void convertConstraintDouble(btTypedConstraintDoubleData *constraintData, btRigidBody *rbA, btRigidBody *rbB, int fileVersion)
Definition: btWorldImporter.cpp:1053
btScalar
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
Definition: btScalar.h:294
btCylinderShapeX
Definition: btCylinderShape.h:129
btIndexedMesh::m_vertexType
PHY_ScalarType m_vertexType
Definition: btTriangleIndexVertexArray.h:46
btVector3DoubleData
Definition: btVector3.h:1286
btSliderConstraintData::m_useOffsetForConstraintFrame
int m_useOffsetForConstraintFrame
Definition: btSliderConstraint.h:304
btConeTwistConstraintData::m_swingSpan1
float m_swingSpan1
Definition: btConeTwistConstraint.h:384
btCylinderShapeData::m_upAxis
int m_upAxis
Definition: btCylinderShape.h:178
btHingeConstraintDoubleData2::m_useReferenceFrameA
int m_useReferenceFrameA
Definition: btHingeConstraint.h:422
btRigidBodyFloatData::m_linearFactor
btVector3FloatData m_linearFactor
Definition: btRigidBody.h:550
PHY_FLOAT
Definition: btConcaveShape.h:27
btIndexedMesh::m_vertexBase
const unsigned char * m_vertexBase
Definition: btTriangleIndexVertexArray.h:35
btHingeConstraint::enableAngularMotor
void enableAngularMotor(bool enableMotor, btScalar targetVelocity, btScalar maxMotorImpulse)
Definition: btHingeConstraint.h:159
btWorldImporter::getNumBvhs
int getNumBvhs() const
Definition: btWorldImporter.cpp:1953
btHingeConstraintFloatData::m_rbBFrame
btTransformFloatData m_rbBFrame
Definition: btHingeConstraint.h:401
STATIC_PLANE_PROXYTYPE
Definition: btBroadphaseProxy.h:66
btPoint2PointConstraintDoubleData2::m_pivotInB
btVector3DoubleData m_pivotInB
Definition: btPoint2PointConstraint.h:141
btMultiSphereShapeData
Definition: btMultiSphereShape.h:79
btGImpactMeshShape::setMargin
virtual void setMargin(btScalar margin)
Definition: btGImpactShape.h:926
btConvexHullShapeData::m_numUnscaledPoints
int m_numUnscaledPoints
Definition: btConvexHullShape.h:104
btGeneric6DofConstraintDoubleData2::m_rbBFrame
btTransformDoubleData m_rbBFrame
Definition: btGeneric6DofConstraint.h:574
btMeshPartData::m_vertices3d
btVector3DoubleData * m_vertices3d
Definition: btStridingMeshInterface.h:124