Bullet Collision Detection & Physics Library: btGImpactShape.h Source File

Bullet Collision Detection & Physics Library

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

btGImpactShape.h
Go to the documentation of this file.
1
4 /*
5 This source file is part of GIMPACT Library.
6
7 For the latest info, see http://gimpact.sourceforge.net/
8
9 Copyright (c) 2007 Francisco Leon Najera. C.C. 80087371.
10 email: projectileman@yahoo.com
11
12
13 This software is provided 'as-is', without any express or implied warranty.
14 In no event will the authors be held liable for any damages arising from the use of this software.
15 Permission is granted to anyone to use this software for any purpose,
16 including commercial applications, and to alter it and redistribute it freely,
17 subject to the following restrictions:
18
19 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.
20 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
21 3. This notice may not be removed or altered from any source distribution.
22 */
23
24
25 #ifndef GIMPACT_SHAPE_H
26 #define GIMPACT_SHAPE_H
27
28 #include "BulletCollision/CollisionShapes/btCollisionShape.h"
29 #include "BulletCollision/CollisionShapes/btTriangleShape.h"
30 #include "BulletCollision/CollisionShapes/btStridingMeshInterface.h"
31 #include "BulletCollision/CollisionShapes/btCollisionMargin.h"
32 #include "BulletCollision/CollisionDispatch/btCollisionWorld.h"
33 #include "BulletCollision/CollisionShapes/btConcaveShape.h"
34 #include "BulletCollision/CollisionShapes/btTetrahedronShape.h"
35 #include "LinearMath/btVector3.h"
36 #include "LinearMath/btTransform.h"
37 #include "LinearMath/btMatrix3x3.h"
38 #include "LinearMath/btAlignedObjectArray.h"
39
40 #include "btGImpactQuantizedBvh.h" // box tree class
41
42
44 typedef btGImpactQuantizedBvh btGImpactBoxSet;
45
46 enum eGIMPACT_SHAPE_TYPE
47 {
48 CONST_GIMPACT_COMPOUND_SHAPE = 0,
49 CONST_GIMPACT_TRIMESH_SHAPE_PART,
50 CONST_GIMPACT_TRIMESH_SHAPE
51 };
52
53
54
56 class btTetrahedronShapeEx:public btBU_Simplex1to4
57 {
58 public:
59 btTetrahedronShapeEx()
60 {
61 m_numVertices = 4;
62 }
63
64
65 SIMD_FORCE_INLINE void setVertices(
66 const btVector3 & v0,const btVector3 & v1,
67 const btVector3 & v2,const btVector3 & v3)
68 {
69 m_vertices[0] = v0;
70 m_vertices[1] = v1;
71 m_vertices[2] = v2;
72 m_vertices[3] = v3;
73 recalcLocalAabb();
74 }
75 };
76
77
79 class btGImpactShapeInterface : public btConcaveShape
80 {
81 protected:
82 btAABB m_localAABB;
83 bool m_needs_update;
84 btVector3 localScaling;
85 btGImpactBoxSet m_box_set;// optionally boxset
86
89 virtual void calcLocalAABB()
90 {
91 lockChildShapes();
92 if(m_box_set.getNodeCount() == 0)
93 {
94 m_box_set.buildSet();
95 }
96 else
97 {
98 m_box_set.update();
99 }
100 unlockChildShapes();
101
102 m_localAABB = m_box_set.getGlobalBox();
103 }
104
105
106 public:
107 btGImpactShapeInterface()
108 {
109 m_shapeType=GIMPACT_SHAPE_PROXYTYPE;
110 m_localAABB.invalidate();
111 m_needs_update = true;
112 localScaling.setValue(1.f,1.f,1.f);
113 }
114
115
117
123 SIMD_FORCE_INLINE void updateBound()
124 {
125 if(!m_needs_update) return;
126 calcLocalAABB();
127 m_needs_update = false;
128 }
129
131
134 void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const
135 {
136 btAABB transformedbox = m_localAABB;
137 transformedbox.appy_transform(t);
138 aabbMin = transformedbox.m_min;
139 aabbMax = transformedbox.m_max;
140 }
141
143 virtual void postUpdate()
144 {
145 m_needs_update = true;
146 }
147
149 SIMD_FORCE_INLINE const btAABB & getLocalBox()
150 {
151 return m_localAABB;
152 }
153
154
155 virtual int getShapeType() const
156 {
157 return GIMPACT_SHAPE_PROXYTYPE;
158 }
159
163 virtual void setLocalScaling(const btVector3& scaling)
164 {
165 localScaling = scaling;
166 postUpdate();
167 }
168
169 virtual const btVector3& getLocalScaling() const
170 {
171 return localScaling;
172 }
173
174
175 virtual void setMargin(btScalar margin)
176 {
177 m_collisionMargin = margin;
178 int i = getNumChildShapes();
179 while(i--)
180 {
181 btCollisionShape* child = getChildShape(i);
182 child->setMargin(margin);
183 }
184
185 m_needs_update = true;
186 }
187
188
191
193 virtual eGIMPACT_SHAPE_TYPE getGImpactShapeType() const = 0 ;
194
196 SIMD_FORCE_INLINE const btGImpactBoxSet * getBoxSet() const
197 {
198 return &m_box_set;
199 }
200
202 SIMD_FORCE_INLINE bool hasBoxSet() const
203 {
204 if(m_box_set.getNodeCount() == 0) return false;
205 return true;
206 }
207
209 virtual const btPrimitiveManagerBase * getPrimitiveManager() const = 0;
210
211
213 virtual int getNumChildShapes() const = 0;
214
216 virtual bool childrenHasTransform() const = 0;
217
219 virtual bool needsRetrieveTriangles() const = 0;
220
222 virtual bool needsRetrieveTetrahedrons() const = 0;
223
224 virtual void getBulletTriangle(int prim_index,btTriangleShapeEx & triangle) const = 0;
225
226 virtual void getBulletTetrahedron(int prim_index,btTetrahedronShapeEx & tetrahedron) const = 0;
227
228
229
231 virtual void lockChildShapes() const
232 {
233 }
234
235 virtual void unlockChildShapes() const
236 {
237 }
238
240 SIMD_FORCE_INLINE void getPrimitiveTriangle(int index,btPrimitiveTriangle & triangle) const
241 {
242 getPrimitiveManager()->get_primitive_triangle(index,triangle);
243 }
244
245
247
249 virtual void getChildAabb(int child_index,const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const
250 {
251 btAABB child_aabb;
252 getPrimitiveManager()->get_primitive_box(child_index,child_aabb);
253 child_aabb.appy_transform(t);
254 aabbMin = child_aabb.m_min;
255 aabbMax = child_aabb.m_max;
256 }
257
259 virtual btCollisionShape* getChildShape(int index) = 0;
260
261
263 virtual const btCollisionShape* getChildShape(int index) const = 0;
264
266 virtual btTransform getChildTransform(int index) const = 0;
267
269
272 virtual void setChildTransform(int index, const btTransform & transform) = 0;
273
275
276
278 virtual void rayTest(const btVector3& rayFrom, const btVector3& rayTo, btCollisionWorld::RayResultCallback& resultCallback) const
279 {
280 (void) rayFrom; (void) rayTo; (void) resultCallback;
281 }
282
284
287 virtual void processAllTriangles(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const
288 {
289 (void) callback; (void) aabbMin; (void) aabbMax;
290 }
291
293
296 virtual void processAllTrianglesRay(btTriangleCallback* /*callback*/,const btVector3& /*rayFrom*/, const btVector3& /*rayTo*/) const
297 {
298
299 }
300
302
303 };
304
305
307
310 class btGImpactCompoundShape : public btGImpactShapeInterface
311 {
312 public:
314 class CompoundPrimitiveManager:public btPrimitiveManagerBase
315 {
316 public:
317 virtual ~CompoundPrimitiveManager() {}
318 btGImpactCompoundShape * m_compoundShape;
319
320
321 CompoundPrimitiveManager(const CompoundPrimitiveManager& compound)
322 : btPrimitiveManagerBase()
323 {
324 m_compoundShape = compound.m_compoundShape;
325 }
326
327 CompoundPrimitiveManager(btGImpactCompoundShape * compoundShape)
328 {
329 m_compoundShape = compoundShape;
330 }
331
332 CompoundPrimitiveManager()
333 {
334 m_compoundShape = NULL;
335 }
336
337 virtual bool is_trimesh() const
338 {
339 return false;
340 }
341
342 virtual int get_primitive_count() const
343 {
344 return (int )m_compoundShape->getNumChildShapes();
345 }
346
347 virtual void get_primitive_box(int prim_index ,btAABB & primbox) const
348 {
349 btTransform prim_trans;
350 if(m_compoundShape->childrenHasTransform())
351 {
352 prim_trans = m_compoundShape->getChildTransform(prim_index);
353 }
354 else
355 {
356 prim_trans.setIdentity();
357 }
358 const btCollisionShape* shape = m_compoundShape->getChildShape(prim_index);
359 shape->getAabb(prim_trans,primbox.m_min,primbox.m_max);
360 }
361
362 virtual void get_primitive_triangle(int prim_index,btPrimitiveTriangle & triangle) const
363 {
364 btAssert(0);
365 (void) prim_index; (void) triangle;
366 }
367
368 };
369
370
371
372 protected:
373 CompoundPrimitiveManager m_primitive_manager;
374 btAlignedObjectArray<btTransform> m_childTransforms;
375 btAlignedObjectArray<btCollisionShape*> m_childShapes;
376
377
378 public:
379
380 btGImpactCompoundShape(bool children_has_transform = true)
381 {
382 (void) children_has_transform;
383 m_primitive_manager.m_compoundShape = this;
384 m_box_set.setPrimitiveManager(&m_primitive_manager);
385 }
386
387 virtual ~btGImpactCompoundShape()
388 {
389 }
390
391
393 virtual bool childrenHasTransform() const
394 {
395 if(m_childTransforms.size()==0) return false;
396 return true;
397 }
398
399
401 virtual const btPrimitiveManagerBase * getPrimitiveManager() const
402 {
403 return &m_primitive_manager;
404 }
405
407 SIMD_FORCE_INLINE CompoundPrimitiveManager * getCompoundPrimitiveManager()
408 {
409 return &m_primitive_manager;
410 }
411
413 virtual int getNumChildShapes() const
414 {
415 return m_childShapes.size();
416 }
417
418
420 void addChildShape(const btTransform& localTransform,btCollisionShape* shape)
421 {
422 btAssert(shape->isConvex());
423 m_childTransforms.push_back(localTransform);
424 m_childShapes.push_back(shape);
425 }
426
428 void addChildShape(btCollisionShape* shape)
429 {
430 btAssert(shape->isConvex());
431 m_childShapes.push_back(shape);
432 }
433
435 virtual btCollisionShape* getChildShape(int index)
436 {
437 return m_childShapes[index];
438 }
439
441 virtual const btCollisionShape* getChildShape(int index) const
442 {
443 return m_childShapes[index];
444 }
445
447
449 virtual void getChildAabb(int child_index,const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const
450 {
451
452 if(childrenHasTransform())
453 {
454 m_childShapes[child_index]->getAabb(t*m_childTransforms[child_index],aabbMin,aabbMax);
455 }
456 else
457 {
458 m_childShapes[child_index]->getAabb(t,aabbMin,aabbMax);
459 }
460 }
461
462
464 virtual btTransform getChildTransform(int index) const
465 {
466 btAssert(m_childTransforms.size() == m_childShapes.size());
467 return m_childTransforms[index];
468 }
469
471
474 virtual void setChildTransform(int index, const btTransform & transform)
475 {
476 btAssert(m_childTransforms.size() == m_childShapes.size());
477 m_childTransforms[index] = transform;
478 postUpdate();
479 }
480
482 virtual bool needsRetrieveTriangles() const
483 {
484 return false;
485 }
486
488 virtual bool needsRetrieveTetrahedrons() const
489 {
490 return false;
491 }
492
493
494 virtual void getBulletTriangle(int prim_index,btTriangleShapeEx & triangle) const
495 {
496 (void) prim_index; (void) triangle;
497 btAssert(0);
498 }
499
500 virtual void getBulletTetrahedron(int prim_index,btTetrahedronShapeEx & tetrahedron) const
501 {
502 (void) prim_index; (void) tetrahedron;
503 btAssert(0);
504 }
505
506
508 virtual void calculateLocalInertia(btScalar mass,btVector3& inertia) const;
509
510 virtual const char* getName()const
511 {
512 return "GImpactCompound";
513 }
514
515 virtual eGIMPACT_SHAPE_TYPE getGImpactShapeType() const
516 {
517 return CONST_GIMPACT_COMPOUND_SHAPE;
518 }
519
520 };
521
522
523
525
531 class btGImpactMeshShapePart : public btGImpactShapeInterface
532 {
533 public:
535
538 class TrimeshPrimitiveManager:public btPrimitiveManagerBase
539 {
540 public:
541 btScalar m_margin;
542 btStridingMeshInterface * m_meshInterface;
543 btVector3 m_scale;
544 int m_part;
545 int m_lock_count;
546 const unsigned char *vertexbase;
547 int numverts;
548 PHY_ScalarType type;
549 int stride;
550 const unsigned char *indexbase;
551 int indexstride;
552 int numfaces;
553 PHY_ScalarType indicestype;
554
555 TrimeshPrimitiveManager()
556 {
557 m_meshInterface = NULL;
558 m_part = 0;
559 m_margin = 0.01f;
560 m_scale = btVector3(1.f,1.f,1.f);
561 m_lock_count = 0;
562 vertexbase = 0;
563 numverts = 0;
564 stride = 0;
565 indexbase = 0;
566 indexstride = 0;
567 numfaces = 0;
568 }
569
570 TrimeshPrimitiveManager(const TrimeshPrimitiveManager & manager)
571 : btPrimitiveManagerBase()
572 {
573 m_meshInterface = manager.m_meshInterface;
574 m_part = manager.m_part;
575 m_margin = manager.m_margin;
576 m_scale = manager.m_scale;
577 m_lock_count = 0;
578 vertexbase = 0;
579 numverts = 0;
580 stride = 0;
581 indexbase = 0;
582 indexstride = 0;
583 numfaces = 0;
584
585 }
586
587 TrimeshPrimitiveManager(
588 btStridingMeshInterface * meshInterface, int part)
589 {
590 m_meshInterface = meshInterface;
591 m_part = part;
592 m_scale = m_meshInterface->getScaling();
593 m_margin = 0.1f;
594 m_lock_count = 0;
595 vertexbase = 0;
596 numverts = 0;
597 stride = 0;
598 indexbase = 0;
599 indexstride = 0;
600 numfaces = 0;
601
602 }
603
604 virtual ~TrimeshPrimitiveManager() {}
605
606 void lock()
607 {
608 if(m_lock_count>0)
609 {
610 m_lock_count++;
611 return;
612 }
613 m_meshInterface->getLockedReadOnlyVertexIndexBase(
614 &vertexbase,numverts,
615 type, stride,&indexbase, indexstride, numfaces,indicestype,m_part);
616
617 m_lock_count = 1;
618 }
619
620 void unlock()
621 {
622 if(m_lock_count == 0) return;
623 if(m_lock_count>1)
624 {
625 --m_lock_count;
626 return;
627 }
628 m_meshInterface->unLockReadOnlyVertexBase(m_part);
629 vertexbase = NULL;
630 m_lock_count = 0;
631 }
632
633 virtual bool is_trimesh() const
634 {
635 return true;
636 }
637
638 virtual int get_primitive_count() const
639 {
640 return (int )numfaces;
641 }
642
643 SIMD_FORCE_INLINE int get_vertex_count() const
644 {
645 return (int )numverts;
646 }
647
648 SIMD_FORCE_INLINE void get_indices(int face_index,unsigned int &i0,unsigned int &i1,unsigned int &i2) const
649 {
650 if(indicestype == PHY_SHORT)
651 {
652 unsigned short* s_indices = (unsigned short *)(indexbase + face_index * indexstride);
653 i0 = s_indices[0];
654 i1 = s_indices[1];
655 i2 = s_indices[2];
656 }
657 else
658 {
659 unsigned int * i_indices = (unsigned int *)(indexbase + face_index*indexstride);
660 i0 = i_indices[0];
661 i1 = i_indices[1];
662 i2 = i_indices[2];
663 }
664 }
665
666 SIMD_FORCE_INLINE void get_vertex(unsigned int vertex_index, btVector3 & vertex) const
667 {
668 if(type == PHY_DOUBLE)
669 {
670 double * dvertices = (double *)(vertexbase + vertex_index*stride);
671 vertex[0] = btScalar(dvertices[0]*m_scale[0]);
672 vertex[1] = btScalar(dvertices[1]*m_scale[1]);
673 vertex[2] = btScalar(dvertices[2]*m_scale[2]);
674 }
675 else
676 {
677 float * svertices = (float *)(vertexbase + vertex_index*stride);
678 vertex[0] = svertices[0]*m_scale[0];
679 vertex[1] = svertices[1]*m_scale[1];
680 vertex[2] = svertices[2]*m_scale[2];
681 }
682 }
683
684 virtual void get_primitive_box(int prim_index ,btAABB & primbox) const
685 {
686 btPrimitiveTriangle triangle;
687 get_primitive_triangle(prim_index,triangle);
688 primbox.calc_from_triangle_margin(
689 triangle.m_vertices[0],
690 triangle.m_vertices[1],triangle.m_vertices[2],triangle.m_margin);
691 }
692
693 virtual void get_primitive_triangle(int prim_index,btPrimitiveTriangle & triangle) const
694 {
695 unsigned int indices[3];
696 get_indices(prim_index,indices[0],indices[1],indices[2]);
697 get_vertex(indices[0],triangle.m_vertices[0]);
698 get_vertex(indices[1],triangle.m_vertices[1]);
699 get_vertex(indices[2],triangle.m_vertices[2]);
700 triangle.m_margin = m_margin;
701 }
702
703 SIMD_FORCE_INLINE void get_bullet_triangle(int prim_index,btTriangleShapeEx & triangle) const
704 {
705 unsigned int indices[3];
706 get_indices(prim_index,indices[0],indices[1],indices[2]);
707 get_vertex(indices[0],triangle.m_vertices1[0]);
708 get_vertex(indices[1],triangle.m_vertices1[1]);
709 get_vertex(indices[2],triangle.m_vertices1[2]);
710 triangle.setMargin(m_margin);
711 }
712
713 };
714
715
716 protected:
717 TrimeshPrimitiveManager m_primitive_manager;
718 public:
719
720 btGImpactMeshShapePart()
721 {
722 m_box_set.setPrimitiveManager(&m_primitive_manager);
723 }
724
725
726 btGImpactMeshShapePart(btStridingMeshInterface * meshInterface, int part)
727 {
728 m_primitive_manager.m_meshInterface = meshInterface;
729 m_primitive_manager.m_part = part;
730 m_box_set.setPrimitiveManager(&m_primitive_manager);
731 }
732
733 virtual ~btGImpactMeshShapePart()
734 {
735 }
736
738 virtual bool childrenHasTransform() const
739 {
740 return false;
741 }
742
743
745 virtual void lockChildShapes() const
746 {
747 void * dummy = (void*)(m_box_set.getPrimitiveManager());
748 TrimeshPrimitiveManager * dummymanager = static_cast<TrimeshPrimitiveManager *>(dummy);
749 dummymanager->lock();
750 }
751
752 virtual void unlockChildShapes() const
753 {
754 void * dummy = (void*)(m_box_set.getPrimitiveManager());
755 TrimeshPrimitiveManager * dummymanager = static_cast<TrimeshPrimitiveManager *>(dummy);
756 dummymanager->unlock();
757 }
758
760 virtual int getNumChildShapes() const
761 {
762 return m_primitive_manager.get_primitive_count();
763 }
764
765
767 virtual btCollisionShape* getChildShape(int index)
768 {
769 (void) index;
770 btAssert(0);
771 return NULL;
772 }
773
774
775
777 virtual const btCollisionShape* getChildShape(int index) const
778 {
779 (void) index;
780 btAssert(0);
781 return NULL;
782 }
783
785 virtual btTransform getChildTransform(int index) const
786 {
787 (void) index;
788 btAssert(0);
789 return btTransform();
790 }
791
793
796 virtual void setChildTransform(int index, const btTransform & transform)
797 {
798 (void) index;
799 (void) transform;
800 btAssert(0);
801 }
802
803
805 virtual const btPrimitiveManagerBase * getPrimitiveManager() const
806 {
807 return &m_primitive_manager;
808 }
809
810 SIMD_FORCE_INLINE TrimeshPrimitiveManager * getTrimeshPrimitiveManager()
811 {
812 return &m_primitive_manager;
813 }
814
815
816
817
818
819 virtual void calculateLocalInertia(btScalar mass,btVector3& inertia) const;
820
821
822
823
824 virtual const char* getName()const
825 {
826 return "GImpactMeshShapePart";
827 }
828
829 virtual eGIMPACT_SHAPE_TYPE getGImpactShapeType() const
830 {
831 return CONST_GIMPACT_TRIMESH_SHAPE_PART;
832 }
833
835 virtual bool needsRetrieveTriangles() const
836 {
837 return true;
838 }
839
841 virtual bool needsRetrieveTetrahedrons() const
842 {
843 return false;
844 }
845
846 virtual void getBulletTriangle(int prim_index,btTriangleShapeEx & triangle) const
847 {
848 m_primitive_manager.get_bullet_triangle(prim_index,triangle);
849 }
850
851 virtual void getBulletTetrahedron(int prim_index,btTetrahedronShapeEx & tetrahedron) const
852 {
853 (void) prim_index;
854 (void) tetrahedron;
855 btAssert(0);
856 }
857
858
859
860 SIMD_FORCE_INLINE int getVertexCount() const
861 {
862 return m_primitive_manager.get_vertex_count();
863 }
864
865 SIMD_FORCE_INLINE void getVertex(int vertex_index, btVector3 & vertex) const
866 {
867 m_primitive_manager.get_vertex(vertex_index,vertex);
868 }
869
870 SIMD_FORCE_INLINE void setMargin(btScalar margin)
871 {
872 m_primitive_manager.m_margin = margin;
873 postUpdate();
874 }
875
876 SIMD_FORCE_INLINE btScalar getMargin() const
877 {
878 return m_primitive_manager.m_margin;
879 }
880
881 virtual void setLocalScaling(const btVector3& scaling)
882 {
883 m_primitive_manager.m_scale = scaling;
884 postUpdate();
885 }
886
887 virtual const btVector3& getLocalScaling() const
888 {
889 return m_primitive_manager.m_scale;
890 }
891
892 SIMD_FORCE_INLINE int getPart() const
893 {
894 return (int)m_primitive_manager.m_part;
895 }
896
897 virtual void processAllTriangles(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const;
898 virtual void processAllTrianglesRay(btTriangleCallback* callback,const btVector3& rayFrom,const btVector3& rayTo) const;
899 };
900
901
903
910 class btGImpactMeshShape : public btGImpactShapeInterface
911 {
912 btStridingMeshInterface* m_meshInterface;
913
914 protected:
915 btAlignedObjectArray<btGImpactMeshShapePart*> m_mesh_parts;
916 void buildMeshParts(btStridingMeshInterface * meshInterface)
917 {
918 for (int i=0;i<meshInterface->getNumSubParts() ;++i )
919 {
920 btGImpactMeshShapePart * newpart = new btGImpactMeshShapePart(meshInterface,i);
921 m_mesh_parts.push_back(newpart);
922 }
923 }
924
926 virtual void calcLocalAABB()
927 {
928 m_localAABB.invalidate();
929 int i = m_mesh_parts.size();
930 while(i--)
931 {
932 m_mesh_parts[i]->updateBound();
933 m_localAABB.merge(m_mesh_parts[i]->getLocalBox());
934 }
935 }
936
937 public:
938 btGImpactMeshShape(btStridingMeshInterface * meshInterface)
939 {
940 m_meshInterface = meshInterface;
941 buildMeshParts(meshInterface);
942 }
943
944 virtual ~btGImpactMeshShape()
945 {
946 int i = m_mesh_parts.size();
947 while(i--)
948 {
949 btGImpactMeshShapePart * part = m_mesh_parts[i];
950 delete part;
951 }
952 m_mesh_parts.clear();
953 }
954
955
956 btStridingMeshInterface* getMeshInterface()
957 {
958 return m_meshInterface;
959 }
960
961 const btStridingMeshInterface* getMeshInterface() const
962 {
963 return m_meshInterface;
964 }
965
966 int getMeshPartCount() const
967 {
968 return m_mesh_parts.size();
969 }
970
971 btGImpactMeshShapePart * getMeshPart(int index)
972 {
973 return m_mesh_parts[index];
974 }
975
976
977
978 const btGImpactMeshShapePart * getMeshPart(int index) const
979 {
980 return m_mesh_parts[index];
981 }
982
983
984 virtual void setLocalScaling(const btVector3& scaling)
985 {
986 localScaling = scaling;
987
988 int i = m_mesh_parts.size();
989 while(i--)
990 {
991 btGImpactMeshShapePart * part = m_mesh_parts[i];
992 part->setLocalScaling(scaling);
993 }
994
995 m_needs_update = true;
996 }
997
998 virtual void setMargin(btScalar margin)
999 {
1000 m_collisionMargin = margin;
1001
1002 int i = m_mesh_parts.size();
1003 while(i--)
1004 {
1005 btGImpactMeshShapePart * part = m_mesh_parts[i];
1006 part->setMargin(margin);
1007 }
1008
1009 m_needs_update = true;
1010 }
1011
1013 virtual void postUpdate()
1014 {
1015 int i = m_mesh_parts.size();
1016 while(i--)
1017 {
1018 btGImpactMeshShapePart * part = m_mesh_parts[i];
1019 part->postUpdate();
1020 }
1021
1022 m_needs_update = true;
1023 }
1024
1025 virtual void calculateLocalInertia(btScalar mass,btVector3& inertia) const;
1026
1027
1029 virtual const btPrimitiveManagerBase * getPrimitiveManager() const
1030 {
1031 btAssert(0);
1032 return NULL;
1033 }
1034
1035
1037 virtual int getNumChildShapes() const
1038 {
1039 btAssert(0);
1040 return 0;
1041 }
1042
1043
1045 virtual bool childrenHasTransform() const
1046 {
1047 btAssert(0);
1048 return false;
1049 }
1050
1052 virtual bool needsRetrieveTriangles() const
1053 {
1054 btAssert(0);
1055 return false;
1056 }
1057
1059 virtual bool needsRetrieveTetrahedrons() const
1060 {
1061 btAssert(0);
1062 return false;
1063 }
1064
1065 virtual void getBulletTriangle(int prim_index,btTriangleShapeEx & triangle) const
1066 {
1067 (void) prim_index; (void) triangle;
1068 btAssert(0);
1069 }
1070
1071 virtual void getBulletTetrahedron(int prim_index,btTetrahedronShapeEx & tetrahedron) const
1072 {
1073 (void) prim_index; (void) tetrahedron;
1074 btAssert(0);
1075 }
1076
1078 virtual void lockChildShapes() const
1079 {
1080 btAssert(0);
1081 }
1082
1083 virtual void unlockChildShapes() const
1084 {
1085 btAssert(0);
1086 }
1087
1088
1089
1090
1092
1094 virtual void getChildAabb(int child_index,const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const
1095 {
1096 (void) child_index; (void) t; (void) aabbMin; (void) aabbMax;
1097 btAssert(0);
1098 }
1099
1101 virtual btCollisionShape* getChildShape(int index)
1102 {
1103 (void) index;
1104 btAssert(0);
1105 return NULL;
1106 }
1107
1108
1110 virtual const btCollisionShape* getChildShape(int index) const
1111 {
1112 (void) index;
1113 btAssert(0);
1114 return NULL;
1115 }
1116
1118 virtual btTransform getChildTransform(int index) const
1119 {
1120 (void) index;
1121 btAssert(0);
1122 return btTransform();
1123 }
1124
1126
1129 virtual void setChildTransform(int index, const btTransform & transform)
1130 {
1131 (void) index; (void) transform;
1132 btAssert(0);
1133 }
1134
1135
1136 virtual eGIMPACT_SHAPE_TYPE getGImpactShapeType() const
1137 {
1138 return CONST_GIMPACT_TRIMESH_SHAPE;
1139 }
1140
1141
1142 virtual const char* getName()const
1143 {
1144 return "GImpactMesh";
1145 }
1146
1147 virtual void rayTest(const btVector3& rayFrom, const btVector3& rayTo, btCollisionWorld::RayResultCallback& resultCallback) const;
1148
1150
1153 virtual void processAllTriangles(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const;
1154
1155 virtual void processAllTrianglesRay (btTriangleCallback* callback,const btVector3& rayFrom,const btVector3& rayTo) const;
1156
1157 virtual int calculateSerializeBufferSize() const;
1158
1160 virtual const char* serialize(void* dataBuffer, btSerializer* serializer) const;
1161
1162 };
1163
1165 struct btGImpactMeshShapeData
1166 {
1167 btCollisionShapeData m_collisionShapeData;
1168
1169 btStridingMeshInterfaceData m_meshInterface;
1170
1171 btVector3FloatData m_localScaling;
1172
1173 float m_collisionMargin;
1174
1175 int m_gimpactSubType;
1176 };
1177
1178 SIMD_FORCE_INLINE int btGImpactMeshShape::calculateSerializeBufferSize() const
1179 {
1180 return sizeof(btGImpactMeshShapeData);
1181 }
1182
1183
1184 #endif //GIMPACT_MESH_SHAPE_H
btGImpactMeshShape::getMeshInterface
const btStridingMeshInterface * getMeshInterface() const
Definition: btGImpactShape.h:961
btGImpactShapeInterface::childrenHasTransform
virtual bool childrenHasTransform() const =0
if true, then its children must get transforms.
btGImpactMeshShapePart::TrimeshPrimitiveManager::get_bullet_triangle
void get_bullet_triangle(int prim_index, btTriangleShapeEx &triangle) const
Definition: btGImpactShape.h:703
btGImpactCompoundShape::needsRetrieveTetrahedrons
virtual bool needsRetrieveTetrahedrons() const
Determines if this shape has tetrahedrons.
Definition: btGImpactShape.h:488
btAlignedObjectArray::push_back
void push_back(const T &_Val)
Definition: btAlignedObjectArray.h:268
btCollisionWorld.h
btGImpactCompoundShape::getChildAabb
virtual void getChildAabb(int child_index, const btTransform &t, btVector3 &aabbMin, btVector3 &aabbMax) const
Retrieves the bound from a child.
Definition: btGImpactShape.h:449
btGImpactShapeInterface::needsRetrieveTetrahedrons
virtual bool needsRetrieveTetrahedrons() const =0
Determines if this shape has tetrahedrons.
btGImpactMeshShapePart::TrimeshPrimitiveManager::type
PHY_ScalarType type
Definition: btGImpactShape.h:548
btGImpactMeshShape::~btGImpactMeshShape
virtual ~btGImpactMeshShape()
Definition: btGImpactShape.h:944
btPrimitiveTriangle
Definition: btTriangleShapeEx.h:74
btTriangleShapeEx
Helper class for colliding Bullet Triangle Shapes.
Definition: btTriangleShapeEx.h:135
btGImpactCompoundShape::CompoundPrimitiveManager::CompoundPrimitiveManager
CompoundPrimitiveManager()
Definition: btGImpactShape.h:332
btGImpactMeshShapePart::childrenHasTransform
virtual bool childrenHasTransform() const
if true, then its children must get transforms.
Definition: btGImpactShape.h:738
btGImpactMeshShapePart::TrimeshPrimitiveManager::numfaces
int numfaces
Definition: btGImpactShape.h:552
btGImpactCompoundShape::CompoundPrimitiveManager::is_trimesh
virtual bool is_trimesh() const
determines if this manager consist on only triangles, which special case will be optimized ...
Definition: btGImpactShape.h:337
btVector3::setValue
void setValue(const btScalar &_x, const btScalar &_y, const btScalar &_z)
Definition: btVector3.h:640
btGImpactShapeInterface::setMargin
virtual void setMargin(btScalar margin)
Definition: btGImpactShape.h:175
btGImpactMeshShape::postUpdate
virtual void postUpdate()
Tells to this object that is needed to refit all the meshes.
Definition: btGImpactShape.h:1013
btTetrahedronShapeEx::setVertices
void setVertices(const btVector3 &v0, const btVector3 &v1, const btVector3 &v2, const btVector3 &v3)
Definition: btGImpactShape.h:65
btGImpactCompoundShape::getChildTransform
virtual btTransform getChildTransform(int index) const
Gets the children transform.
Definition: btGImpactShape.h:464
btGImpactMeshShape::rayTest
virtual void rayTest(const btVector3 &rayFrom, const btVector3 &rayTo, btCollisionWorld::RayResultCallback &resultCallback) const
virtual method for ray collision
Definition: btGImpactShape.cpp:144
btBU_Simplex1to4::m_numVertices
int m_numVertices
Definition: btTetrahedronShape.h:29
btGImpactShapeInterface::localScaling
btVector3 localScaling
Definition: btGImpactShape.h:84
btGImpactMeshShape::lockChildShapes
virtual void lockChildShapes() const
call when reading child shapes
Definition: btGImpactShape.h:1078
btGImpactMeshShape::setLocalScaling
virtual void setLocalScaling(const btVector3 &scaling)
Definition: btGImpactShape.h:984
btAlignedObjectArray< btTransform >
btVector3.h
btGImpactMeshShapePart::TrimeshPrimitiveManager::is_trimesh
virtual bool is_trimesh() const
determines if this manager consist on only triangles, which special case will be optimized ...
Definition: btGImpactShape.h:633
eGIMPACT_SHAPE_TYPE
eGIMPACT_SHAPE_TYPE
Definition: btGImpactShape.h:46
btGImpactShapeInterface::needsRetrieveTriangles
virtual bool needsRetrieveTriangles() const =0
Determines if this shape has triangles.
btAABB::m_max
btVector3 m_max
Definition: btBoxCollision.h:233
btGImpactShapeInterface::getLocalBox
const btAABB & getLocalBox()
Obtains the local box, which is the global calculated box of the total of subshapes.
Definition: btGImpactShape.h:149
btGImpactMeshShapePart::TrimeshPrimitiveManager::get_indices
void get_indices(int face_index, unsigned int &i0, unsigned int &i1, unsigned int &i2) const
Definition: btGImpactShape.h:648
btGImpactMeshShapePart::getPrimitiveManager
virtual const btPrimitiveManagerBase * getPrimitiveManager() const
Obtains the primitive manager.
Definition: btGImpactShape.h:805
btGImpactMeshShapePart::getVertex
void getVertex(int vertex_index, btVector3 &vertex) const
Definition: btGImpactShape.h:865
btGImpactShapeInterface::btGImpactShapeInterface
btGImpactShapeInterface()
Definition: btGImpactShape.h:107
btGImpactMeshShape::childrenHasTransform
virtual bool childrenHasTransform() const
if true, then its children must get transforms.
Definition: btGImpactShape.h:1045
btGImpactMeshShapePart::TrimeshPrimitiveManager::TrimeshPrimitiveManager
TrimeshPrimitiveManager(btStridingMeshInterface *meshInterface, int part)
Definition: btGImpactShape.h:587
btGImpactShapeInterface::setLocalScaling
virtual void setLocalScaling(const btVector3 &scaling)
Definition: btGImpactShape.h:163
btGImpactMeshShapePart::setMargin
void setMargin(btScalar margin)
Definition: btGImpactShape.h:870
btGImpactMeshShape::calculateSerializeBufferSize
virtual int calculateSerializeBufferSize() const
Definition: btGImpactShape.h:1178
btGImpactMeshShape::calculateLocalInertia
virtual void calculateLocalInertia(btScalar mass, btVector3 &inertia) const
Definition: btGImpactShape.cpp:111
btGImpactCompoundShape::CompoundPrimitiveManager::CompoundPrimitiveManager
CompoundPrimitiveManager(const CompoundPrimitiveManager &compound)
Definition: btGImpactShape.h:321
btGImpactMeshShapePart::TrimeshPrimitiveManager::unlock
void unlock()
Definition: btGImpactShape.h:620
btGImpactMeshShapePart::TrimeshPrimitiveManager::lock
void lock()
Definition: btGImpactShape.h:606
CONST_GIMPACT_TRIMESH_SHAPE
Definition: btGImpactShape.h:50
btTransform::setIdentity
void setIdentity()
Set this transformation to the identity.
Definition: btTransform.h:172
btGImpactCompoundShape::addChildShape
void addChildShape(const btTransform &localTransform, btCollisionShape *shape)
Use this method for adding children. Only Convex shapes are allowed.
Definition: btGImpactShape.h:420
btAssert
#define btAssert(x)
Definition: btScalar.h:113
btGImpactShapeInterface::calcLocalAABB
virtual void calcLocalAABB()
use this function for perfofm refit in bounding boxes
Definition: btGImpactShape.h:89
btConcaveShape::m_collisionMargin
btScalar m_collisionMargin
Definition: btConcaveShape.h:39
btStridingMeshInterface.h
btCollisionShape
The btCollisionShape class provides an interface for collision shapes that can be shared among btColl...
Definition: btCollisionShape.h:27
btCollisionWorld::RayResultCallback
RayResultCallback is used to report new raycast results.
Definition: btCollisionWorld.h:204
btStridingMeshInterface::getScaling
const btVector3 & getScaling() const
Definition: btStridingMeshInterface.h:88
SIMD_FORCE_INLINE
#define SIMD_FORCE_INLINE
Definition: btScalar.h:63
btGImpactCompoundShape::m_primitive_manager
CompoundPrimitiveManager m_primitive_manager
Definition: btGImpactShape.h:373
btGImpactCompoundShape::addChildShape
void addChildShape(btCollisionShape *shape)
Use this method for adding children. Only Convex shapes are allowed.
Definition: btGImpactShape.h:428
btTriangleShape.h
btGImpactMeshShapePart::calculateLocalInertia
virtual void calculateLocalInertia(btScalar mass, btVector3 &inertia) const
Definition: btGImpactShape.cpp:73
btTransform.h
btAABB::m_min
btVector3 m_min
Definition: btBoxCollision.h:232
btGImpactMeshShape::buildMeshParts
void buildMeshParts(btStridingMeshInterface *meshInterface)
Definition: btGImpactShape.h:916
btGImpactMeshShape::getChildTransform
virtual btTransform getChildTransform(int index) const
Gets the children transform.
Definition: btGImpactShape.h:1118
btAABB::merge
void merge(const btAABB &box)
Merges a Box.
Definition: btBoxCollision.h:391
btMatrix3x3.h
btGImpactMeshShapePart::getGImpactShapeType
virtual eGIMPACT_SHAPE_TYPE getGImpactShapeType() const
Subshape member functions.
Definition: btGImpactShape.h:829
btGImpactMeshShape
This class manages a mesh supplied by the btStridingMeshInterface interface.
Definition: btGImpactShape.h:910
btCollisionMargin.h
GIMPACT_SHAPE_PROXYTYPE
Used for GIMPACT Trimesh integration.
Definition: btBroadphaseProxy.h:62
btGImpactMeshShapePart::TrimeshPrimitiveManager::vertexbase
const unsigned char * vertexbase
Definition: btGImpactShape.h:546
btGImpactMeshShapePart::needsRetrieveTetrahedrons
virtual bool needsRetrieveTetrahedrons() const
Determines if this shape has tetrahedrons.
Definition: btGImpactShape.h:841
btGImpactCompoundShape::getName
virtual const char * getName() const
Definition: btGImpactShape.h:510
btGImpactMeshShapePart::TrimeshPrimitiveManager::m_part
int m_part
Definition: btGImpactShape.h:544
btGImpactMeshShapePart::TrimeshPrimitiveManager::stride
int stride
Definition: btGImpactShape.h:549
btGImpactMeshShape::getBulletTetrahedron
virtual void getBulletTetrahedron(int prim_index, btTetrahedronShapeEx &tetrahedron) const
Definition: btGImpactShape.h:1071
btGImpactShapeInterface::m_box_set
btGImpactBoxSet m_box_set
Definition: btGImpactShape.h:85
btGImpactCompoundShape::childrenHasTransform
virtual bool childrenHasTransform() const
if true, then its children must get transforms.
Definition: btGImpactShape.h:393
btPrimitiveManagerBase
Prototype Base class for primitive classification.
Definition: btGImpactBvh.h:230
btGImpactShapeInterface::getAabb
void getAabb(const btTransform &t, btVector3 &aabbMin, btVector3 &aabbMax) const
If the Bounding box is not updated, then this class attemps to calculate it.
Definition: btGImpactShape.h:134
btCollisionShape::getAabb
virtual void getAabb(const btTransform &t, btVector3 &aabbMin, btVector3 &aabbMax) const =0
getAabb returns the axis aligned bounding box in the coordinate frame of the given transform t...
btGImpactMeshShapePart::getBulletTriangle
virtual void getBulletTriangle(int prim_index, btTriangleShapeEx &triangle) const
Definition: btGImpactShape.h:846
btGImpactCompoundShape::getPrimitiveManager
virtual const btPrimitiveManagerBase * getPrimitiveManager() const
Obtains the primitive manager.
Definition: btGImpactShape.h:401
btSerializer
Definition: btSerializer.h:68
btConcaveShape.h
btGImpactCompoundShape::CompoundPrimitiveManager::CompoundPrimitiveManager
CompoundPrimitiveManager(btGImpactCompoundShape *compoundShape)
Definition: btGImpactShape.h:327
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:184
btGImpactMeshShape::getGImpactShapeType
virtual eGIMPACT_SHAPE_TYPE getGImpactShapeType() const
Subshape member functions.
Definition: btGImpactShape.h:1136
btGImpactShapeInterface::getBulletTetrahedron
virtual void getBulletTetrahedron(int prim_index, btTetrahedronShapeEx &tetrahedron) const =0
btGImpactCompoundShape::CompoundPrimitiveManager
compound primitive manager
Definition: btGImpactShape.h:314
btGImpactCompoundShape::btGImpactCompoundShape
btGImpactCompoundShape(bool children_has_transform=true)
Definition: btGImpactShape.h:380
btGImpactShapeInterface::processAllTrianglesRay
virtual void processAllTrianglesRay(btTriangleCallback *, const btVector3 &, const btVector3 &) const
Function for retrieve triangles.
Definition: btGImpactShape.h:296
btGImpactShapeInterface::hasBoxSet
bool hasBoxSet() const
Determines if this class has a hierarchy structure for sorting its primitives.
Definition: btGImpactShape.h:202
btGImpactMeshShape::getMeshPart
btGImpactMeshShapePart * getMeshPart(int index)
Definition: btGImpactShape.h:971
btStridingMeshInterfaceData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
Definition: btStridingMeshInterface.h:146
btGImpactMeshShapePart::TrimeshPrimitiveManager::get_vertex
void get_vertex(unsigned int vertex_index, btVector3 &vertex) const
Definition: btGImpactShape.h:666
btGImpactMeshShape::getMeshInterface
btStridingMeshInterface * getMeshInterface()
Definition: btGImpactShape.h:956
btGImpactMeshShapeData::m_collisionMargin
float m_collisionMargin
Definition: btGImpactShape.h:1173
btGImpactMeshShapePart::getTrimeshPrimitiveManager
TrimeshPrimitiveManager * getTrimeshPrimitiveManager()
Definition: btGImpactShape.h:810
btConvexInternalShape::setMargin
virtual void setMargin(btScalar margin)
Definition: btConvexInternalShape.h:109
btGImpactCompoundShape::m_childTransforms
btAlignedObjectArray< btTransform > m_childTransforms
Definition: btGImpactShape.h:374
btGImpactShapeInterface
Base class for gimpact shapes.
Definition: btGImpactShape.h:79
btGImpactMeshShapePart
This class manages a sub part of a mesh supplied by the btStridingMeshInterface interface.
Definition: btGImpactShape.h:531
btGImpactShapeInterface::getBoxSet
const btGImpactBoxSet * getBoxSet() const
gets boxset
Definition: btGImpactShape.h:196
btGImpactMeshShape::getPrimitiveManager
virtual const btPrimitiveManagerBase * getPrimitiveManager() const
Obtains the primitive manager.
Definition: btGImpactShape.h:1029
btAlignedObjectArray::size
int size() const
return the number of elements in the array
Definition: btAlignedObjectArray.h:149
btGImpactMeshShape::getNumChildShapes
virtual int getNumChildShapes() const
Gets the number of children.
Definition: btGImpactShape.h:1037
btGImpactShapeInterface::postUpdate
virtual void postUpdate()
Tells to this object that is needed to refit the box set.
Definition: btGImpactShape.h:143
btGImpactMeshShapePart::TrimeshPrimitiveManager::numverts
int numverts
Definition: btGImpactShape.h:547
btTriangleCallback
The btTriangleCallback provides a callback for each overlapping triangle when calling processAllTrian...
Definition: btTriangleCallback.h:24
btGImpactMeshShape::processAllTrianglesRay
virtual void processAllTrianglesRay(btTriangleCallback *callback, const btVector3 &rayFrom, const btVector3 &rayTo) const
Function for retrieve triangles.
Definition: btGImpactShape.cpp:211
btGImpactMeshShapePart::getNumChildShapes
virtual int getNumChildShapes() const
Gets the number of children.
Definition: btGImpactShape.h:760
btGImpactCompoundShape::CompoundPrimitiveManager::get_primitive_triangle
virtual void get_primitive_triangle(int prim_index, btPrimitiveTriangle &triangle) const
retrieves only the points of the triangle, and the collision margin
Definition: btGImpactShape.h:362
PHY_DOUBLE
Definition: btConcaveShape.h:27
PHY_SHORT
Definition: btConcaveShape.h:29
btGImpactMeshShape::processAllTriangles
virtual void processAllTriangles(btTriangleCallback *callback, const btVector3 &aabbMin, const btVector3 &aabbMax) const
Function for retrieve triangles.
Definition: btGImpactShape.cpp:202
btBU_Simplex1to4
The btBU_Simplex1to4 implements tetrahedron, triangle, line, vertex collision shapes. In most cases it is better to use btConvexHullShape instead.
Definition: btTetrahedronShape.h:25
btGImpactShapeInterface::lockChildShapes
virtual void lockChildShapes() const
call when reading child shapes
Definition: btGImpactShape.h:231
btGImpactMeshShapePart::processAllTriangles
virtual void processAllTriangles(btTriangleCallback *callback, const btVector3 &aabbMin, const btVector3 &aabbMax) const
Function for retrieve triangles.
Definition: btGImpactShape.cpp:174
btGImpactMeshShapePart::TrimeshPrimitiveManager::m_lock_count
int m_lock_count
Definition: btGImpactShape.h:545
btGImpactQuantizedBvh::update
void update()
node manager prototype functions
Definition: btGImpactQuantizedBvh.h:271
btGImpactMeshShapeData::m_meshInterface
btStridingMeshInterfaceData m_meshInterface
Definition: btGImpactShape.h:1169
btGImpactMeshShapePart::m_primitive_manager
TrimeshPrimitiveManager m_primitive_manager
Definition: btGImpactShape.h:717
btGImpactShapeInterface::getGImpactShapeType
virtual eGIMPACT_SHAPE_TYPE getGImpactShapeType() const =0
Subshape member functions.
btGImpactMeshShape::serialize
virtual const char * serialize(void *dataBuffer, btSerializer *serializer) const
fills the dataBuffer and returns the struct name (and 0 on failure)
Definition: btGImpactShape.cpp:222
btGImpactMeshShapePart::getChildTransform
virtual btTransform getChildTransform(int index) const
Gets the children transform.
Definition: btGImpactShape.h:785
btGImpactMeshShape::getChildShape
virtual const btCollisionShape * getChildShape(int index) const
Gets the child.
Definition: btGImpactShape.h:1110
btGImpactMeshShapePart::TrimeshPrimitiveManager::~TrimeshPrimitiveManager
virtual ~TrimeshPrimitiveManager()
Definition: btGImpactShape.h:604
btAABB::calc_from_triangle_margin
void calc_from_triangle_margin(const CLASS_POINT &V1, const CLASS_POINT &V2, const CLASS_POINT &V3, btScalar margin)
Definition: btBoxCollision.h:336
btGImpactMeshShapePart::TrimeshPrimitiveManager::get_primitive_triangle
virtual void get_primitive_triangle(int prim_index, btPrimitiveTriangle &triangle) const
retrieves only the points of the triangle, and the collision margin
Definition: btGImpactShape.h:693
btGImpactQuantizedBvh::getNodeCount
int getNodeCount() const
node count
Definition: btGImpactQuantizedBvh.h:309
btGImpactCompoundShape::setChildTransform
virtual void setChildTransform(int index, const btTransform &transform)
Sets the children transform.
Definition: btGImpactShape.h:474
btGImpactMeshShapePart::TrimeshPrimitiveManager::get_vertex_count
int get_vertex_count() const
Definition: btGImpactShape.h:643
btGImpactQuantizedBvh::setPrimitiveManager
void setPrimitiveManager(btPrimitiveManagerBase *primitive_manager)
Definition: btGImpactQuantizedBvh.h:256
btPrimitiveManagerBase::get_primitive_box
virtual void get_primitive_box(int prim_index, btAABB &primbox) const =0
btAABB
Axis aligned box.
Definition: btBoxCollision.h:229
btGImpactShapeInterface::unlockChildShapes
virtual void unlockChildShapes() const
Definition: btGImpactShape.h:235
btGImpactCompoundShape::getBulletTetrahedron
virtual void getBulletTetrahedron(int prim_index, btTetrahedronShapeEx &tetrahedron) const
Definition: btGImpactShape.h:500
btTetrahedronShape.h
btGImpactMeshShapePart::needsRetrieveTriangles
virtual bool needsRetrieveTriangles() const
Determines if this shape has triangles.
Definition: btGImpactShape.h:835
btGImpactMeshShape::unlockChildShapes
virtual void unlockChildShapes() const
Definition: btGImpactShape.h:1083
btCollisionShape::setMargin
virtual void setMargin(btScalar margin)=0
btGImpactMeshShapeData::m_gimpactSubType
int m_gimpactSubType
Definition: btGImpactShape.h:1175
btTetrahedronShapeEx
Helper class for tetrahedrons.
Definition: btGImpactShape.h:56
btGImpactShapeInterface::getChildShape
virtual btCollisionShape * getChildShape(int index)=0
Gets the children.
btGImpactMeshShapePart::TrimeshPrimitiveManager::TrimeshPrimitiveManager
TrimeshPrimitiveManager(const TrimeshPrimitiveManager &manager)
Definition: btGImpactShape.h:570
CONST_GIMPACT_TRIMESH_SHAPE_PART
Definition: btGImpactShape.h:49
btAABB::appy_transform
void appy_transform(const btTransform &trans)
Apply a transform to an AABB.
Definition: btBoxCollision.h:358
btGImpactMeshShape::needsRetrieveTetrahedrons
virtual bool needsRetrieveTetrahedrons() const
Determines if this shape has tetrahedrons.
Definition: btGImpactShape.h:1059
btGImpactMeshShapePart::getMargin
btScalar getMargin() const
Definition: btGImpactShape.h:876
btGImpactMeshShapePart::btGImpactMeshShapePart
btGImpactMeshShapePart(btStridingMeshInterface *meshInterface, int part)
Definition: btGImpactShape.h:726
btGImpactShapeInterface::getBulletTriangle
virtual void getBulletTriangle(int prim_index, btTriangleShapeEx &triangle) const =0
btGImpactMeshShapePart::TrimeshPrimitiveManager::get_primitive_box
virtual void get_primitive_box(int prim_index, btAABB &primbox) const
Definition: btGImpactShape.h:684
btGImpactQuantizedBvh.h
btGImpactMeshShapePart::TrimeshPrimitiveManager
Trimesh primitive manager.
Definition: btGImpactShape.h:538
btGImpactCompoundShape::getCompoundPrimitiveManager
CompoundPrimitiveManager * getCompoundPrimitiveManager()
Obtains the compopund primitive manager.
Definition: btGImpactShape.h:407
btGImpactMeshShape::getName
virtual const char * getName() const
Definition: btGImpactShape.h:1142
btGImpactMeshShapeData::m_collisionShapeData
btCollisionShapeData m_collisionShapeData
Definition: btGImpactShape.h:1167
btGImpactShapeInterface::m_needs_update
bool m_needs_update
Definition: btGImpactShape.h:83
btGImpactQuantizedBvh::getPrimitiveManager
btPrimitiveManagerBase * getPrimitiveManager() const
Definition: btGImpactQuantizedBvh.h:261
btCollisionShape.h
btVector3
btVector3 can be used to represent 3D points and vectors.
Definition: btVector3.h:83
btStridingMeshInterface::getNumSubParts
virtual int getNumSubParts() const =0
getNumSubParts returns the number of seperate subparts each subpart has a continuous array of vertice...
btGImpactMeshShape::calcLocalAABB
virtual void calcLocalAABB()
use this function for perfofm refit in bounding boxes
Definition: btGImpactShape.h:926
btPrimitiveManagerBase::get_primitive_triangle
virtual void get_primitive_triangle(int prim_index, btPrimitiveTriangle &triangle) const =0
retrieves only the points of the triangle, and the collision margin
btGImpactMeshShapePart::TrimeshPrimitiveManager::m_scale
btVector3 m_scale
Definition: btGImpactShape.h:543
btGImpactMeshShapePart::TrimeshPrimitiveManager::indicestype
PHY_ScalarType indicestype
Definition: btGImpactShape.h:553
btGImpactShapeInterface::getPrimitiveManager
virtual const btPrimitiveManagerBase * getPrimitiveManager() const =0
Obtains the primitive manager.
btGImpactMeshShape::needsRetrieveTriangles
virtual bool needsRetrieveTriangles() const
Determines if this shape has triangles.
Definition: btGImpactShape.h:1052
btGImpactMeshShapePart::getChildShape
virtual btCollisionShape * getChildShape(int index)
Gets the children.
Definition: btGImpactShape.h:767
btGImpactShapeInterface::getChildTransform
virtual btTransform getChildTransform(int index) const =0
Gets the children transform.
btTransform
The btTransform class supports rigid transforms with only translation and rotation and no scaling/she...
Definition: btTransform.h:34
btGImpactMeshShapePart::lockChildShapes
virtual void lockChildShapes() const
call when reading child shapes
Definition: btGImpactShape.h:745
btGImpactMeshShapePart::unlockChildShapes
virtual void unlockChildShapes() const
Definition: btGImpactShape.h:752
btStridingMeshInterface
The btStridingMeshInterface is the interface class for high performance generic access to triangle me...
Definition: btStridingMeshInterface.h:30
btCollisionShape::isConvex
bool isConvex() const
Definition: btCollisionShape.h:73
btGImpactMeshShapePart::~btGImpactMeshShapePart
virtual ~btGImpactMeshShapePart()
Definition: btGImpactShape.h:733
btGImpactCompoundShape::needsRetrieveTriangles
virtual bool needsRetrieveTriangles() const
Determines if this shape has triangles.
Definition: btGImpactShape.h:482
btGImpactMeshShapePart::setLocalScaling
virtual void setLocalScaling(const btVector3 &scaling)
Definition: btGImpactShape.h:881
btGImpactCompoundShape::getBulletTriangle
virtual void getBulletTriangle(int prim_index, btTriangleShapeEx &triangle) const
Definition: btGImpactShape.h:494
btConcaveShape
The btConcaveShape class provides an interface for non-moving (static) concave shapes.
Definition: btConcaveShape.h:36
btGImpactShapeInterface::getNumChildShapes
virtual int getNumChildShapes() const =0
Gets the number of children.
btGImpactCompoundShape::getChildShape
virtual btCollisionShape * getChildShape(int index)
Gets the children.
Definition: btGImpactShape.h:435
btGImpactShapeInterface::getChildAabb
virtual void getChildAabb(int child_index, const btTransform &t, btVector3 &aabbMin, btVector3 &aabbMax) const
Retrieves the bound from a child.
Definition: btGImpactShape.h:249
btPrimitiveTriangle::m_margin
btScalar m_margin
Definition: btTriangleShapeEx.h:79
btGImpactMeshShapePart::getLocalScaling
virtual const btVector3 & getLocalScaling() const
Definition: btGImpactShape.h:887
btGImpactMeshShapePart::TrimeshPrimitiveManager::indexbase
const unsigned char * indexbase
Definition: btGImpactShape.h:550
btGImpactMeshShape::setChildTransform
virtual void setChildTransform(int index, const btTransform &transform)
Sets the children transform.
Definition: btGImpactShape.h:1129
btGImpactMeshShapePart::TrimeshPrimitiveManager::get_primitive_count
virtual int get_primitive_count() const
Definition: btGImpactShape.h:638
btGImpactMeshShapeData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
Definition: btGImpactShape.h:1165
btGImpactMeshShapePart::TrimeshPrimitiveManager::indexstride
int indexstride
Definition: btGImpactShape.h:551
btAABB::invalidate
void invalidate()
Definition: btBoxCollision.h:289
btGImpactMeshShape::getMeshPart
const btGImpactMeshShapePart * getMeshPart(int index) const
Definition: btGImpactShape.h:978
btGImpactMeshShape::getBulletTriangle
virtual void getBulletTriangle(int prim_index, btTriangleShapeEx &triangle) const
Definition: btGImpactShape.h:1065
btGImpactMeshShape::m_meshInterface
btStridingMeshInterface * m_meshInterface
Definition: btGImpactShape.h:912
btStridingMeshInterface::getLockedReadOnlyVertexIndexBase
virtual void getLockedReadOnlyVertexIndexBase(const unsigned char **vertexbase, int &numverts, PHY_ScalarType &type, int &stride, const unsigned char **indexbase, int &indexstride, int &numfaces, PHY_ScalarType &indicestype, int subpart=0) const =0
CONST_GIMPACT_COMPOUND_SHAPE
Definition: btGImpactShape.h:48
btGImpactShapeInterface::processAllTriangles
virtual void processAllTriangles(btTriangleCallback *callback, const btVector3 &aabbMin, const btVector3 &aabbMax) const
Function for retrieve triangles.
Definition: btGImpactShape.h:287
btGImpactShapeInterface::rayTest
virtual void rayTest(const btVector3 &rayFrom, const btVector3 &rayTo, btCollisionWorld::RayResultCallback &resultCallback) const
virtual method for ray collision
Definition: btGImpactShape.h:278
btGImpactShapeInterface::getLocalScaling
virtual const btVector3 & getLocalScaling() const
Definition: btGImpactShape.h:169
btGImpactMeshShapePart::TrimeshPrimitiveManager::m_margin
btScalar m_margin
Definition: btGImpactShape.h:541
btAlignedObjectArray.h
btGImpactMeshShapePart::btGImpactMeshShapePart
btGImpactMeshShapePart()
Definition: btGImpactShape.h:720
btGImpactCompoundShape::calculateLocalInertia
virtual void calculateLocalInertia(btScalar mass, btVector3 &inertia) const
Calculates the exact inertia tensor for this shape.
Definition: btGImpactShape.cpp:29
btGImpactCompoundShape::CompoundPrimitiveManager::~CompoundPrimitiveManager
virtual ~CompoundPrimitiveManager()
Definition: btGImpactShape.h:317
btVector3FloatData
Definition: btVector3.h:1301
btGImpactMeshShape::getChildShape
virtual btCollisionShape * getChildShape(int index)
Gets the children.
Definition: btGImpactShape.h:1101
btPrimitiveTriangle::m_vertices
btVector3 m_vertices[3]
Definition: btTriangleShapeEx.h:77
btStridingMeshInterface::unLockReadOnlyVertexBase
virtual void unLockReadOnlyVertexBase(int subpart) const =0
btGImpactShapeInterface::updateBound
void updateBound()
performs refit operation
Definition: btGImpactShape.h:123
btBU_Simplex1to4::m_vertices
btVector3 m_vertices[4]
Definition: btTetrahedronShape.h:30
btGImpactQuantizedBvh::getGlobalBox
btAABB getGlobalBox() const
Definition: btGImpactQuantizedBvh.h:249
btGImpactCompoundShape::getGImpactShapeType
virtual eGIMPACT_SHAPE_TYPE getGImpactShapeType() const
Subshape member functions.
Definition: btGImpactShape.h:515
btGImpactCompoundShape::~btGImpactCompoundShape
virtual ~btGImpactCompoundShape()
Definition: btGImpactShape.h:387
btGImpactShapeInterface::getPrimitiveTriangle
void getPrimitiveTriangle(int index, btPrimitiveTriangle &triangle) const
if this trimesh
Definition: btGImpactShape.h:240
btGImpactMeshShape::m_mesh_parts
btAlignedObjectArray< btGImpactMeshShapePart * > m_mesh_parts
Definition: btGImpactShape.h:915
btGImpactMeshShapePart::getBulletTetrahedron
virtual void getBulletTetrahedron(int prim_index, btTetrahedronShapeEx &tetrahedron) const
Definition: btGImpactShape.h:851
btGImpactMeshShapeData::m_localScaling
btVector3FloatData m_localScaling
Definition: btGImpactShape.h:1171
btGImpactQuantizedBvh
Structure for containing Boxes.
Definition: btGImpactQuantizedBvh.h:226
btGImpactMeshShape::getMeshPartCount
int getMeshPartCount() const
Definition: btGImpactShape.h:966
btGImpactCompoundShape::m_childShapes
btAlignedObjectArray< btCollisionShape * > m_childShapes
Definition: btGImpactShape.h:375
btGImpactCompoundShape::CompoundPrimitiveManager::get_primitive_box
virtual void get_primitive_box(int prim_index, btAABB &primbox) const
Definition: btGImpactShape.h:347
btGImpactCompoundShape::CompoundPrimitiveManager::m_compoundShape
btGImpactCompoundShape * m_compoundShape
Definition: btGImpactShape.h:318
btGImpactMeshShapePart::TrimeshPrimitiveManager::TrimeshPrimitiveManager
TrimeshPrimitiveManager()
Definition: btGImpactShape.h:555
btCollisionShape::m_shapeType
int m_shapeType
Definition: btCollisionShape.h:30
btTetrahedronShapeEx::btTetrahedronShapeEx
btTetrahedronShapeEx()
Definition: btGImpactShape.h:59
btGImpactMeshShape::getChildAabb
virtual void getChildAabb(int child_index, const btTransform &t, btVector3 &aabbMin, btVector3 &aabbMax) const
Retrieves the bound from a child.
Definition: btGImpactShape.h:1094
btGImpactMeshShapePart::getPart
int getPart() const
Definition: btGImpactShape.h:892
btGImpactMeshShapePart::setChildTransform
virtual void setChildTransform(int index, const btTransform &transform)
Sets the children transform.
Definition: btGImpactShape.h:796
btPolyhedralConvexAabbCachingShape::recalcLocalAabb
void recalcLocalAabb()
Definition: btPolyhedralConvexShape.cpp:450
btGImpactCompoundShape::getNumChildShapes
virtual int getNumChildShapes() const
Gets the number of children.
Definition: btGImpactShape.h:413
btTriangleShape::m_vertices1
btVector3 m_vertices1[3]
Definition: btTriangleShape.h:30
btCollisionShapeData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
Definition: btCollisionShape.h:155
btGImpactCompoundShape::getChildShape
virtual const btCollisionShape * getChildShape(int index) const
Gets the children.
Definition: btGImpactShape.h:441
btGImpactMeshShapePart::getName
virtual const char * getName() const
Definition: btGImpactShape.h:824
btGImpactShapeInterface::getShapeType
virtual int getShapeType() const
Definition: btGImpactShape.h:155
btGImpactShapeInterface::setChildTransform
virtual void setChildTransform(int index, const btTransform &transform)=0
Sets the children transform.
btGImpactMeshShapePart::processAllTrianglesRay
virtual void processAllTrianglesRay(btTriangleCallback *callback, const btVector3 &rayFrom, const btVector3 &rayTo) const
Function for retrieve triangles.
Definition: btGImpactShape.cpp:148
btScalar
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
Definition: btScalar.h:278
btGImpactCompoundShape
btGImpactCompoundShape allows to handle multiple btCollisionShape objects at once ...
Definition: btGImpactShape.h:310
PHY_ScalarType
PHY_ScalarType
PHY_ScalarType enumerates possible scalar types.
Definition: btConcaveShape.h:25
btGImpactMeshShape::btGImpactMeshShape
btGImpactMeshShape(btStridingMeshInterface *meshInterface)
Definition: btGImpactShape.h:938
btGImpactMeshShapePart::TrimeshPrimitiveManager::m_meshInterface
btStridingMeshInterface * m_meshInterface
Definition: btGImpactShape.h:542
btGImpactBoxSet
btGImpactQuantizedBvh btGImpactBoxSet
declare Quantized trees, (you can change to float based trees)
Definition: btGImpactShape.h:44
btGImpactShapeInterface::m_localAABB
btAABB m_localAABB
Definition: btGImpactShape.h:82
btGImpactQuantizedBvh::buildSet
void buildSet()
this rebuild the entire set
Definition: btGImpactQuantizedBvh.cpp:287
btGImpactMeshShapePart::getVertexCount
int getVertexCount() const
Definition: btGImpactShape.h:860
btGImpactCompoundShape::CompoundPrimitiveManager::get_primitive_count
virtual int get_primitive_count() const
Definition: btGImpactShape.h:342
btGImpactMeshShapePart::getChildShape
virtual const btCollisionShape * getChildShape(int index) const
Gets the child.
Definition: btGImpactShape.h:777
btGImpactMeshShape::setMargin
virtual void setMargin(btScalar margin)
Definition: btGImpactShape.h:998