Blender  V3.3
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 #ifndef GIMPACT_SHAPE_H
25 #define GIMPACT_SHAPE_H
26 
34 #include "LinearMath/btVector3.h"
35 #include "LinearMath/btTransform.h"
36 #include "LinearMath/btMatrix3x3.h"
38 
39 #include "btGImpactQuantizedBvh.h" // box tree class
40 
43 
45 {
49 };
50 
53 {
54 public:
56  {
57  m_numVertices = 4;
58  }
59 
61  const btVector3& v0, const btVector3& v1,
62  const btVector3& v2, const btVector3& v3)
63  {
64  m_vertices[0] = v0;
65  m_vertices[1] = v1;
66  m_vertices[2] = v2;
67  m_vertices[3] = v3;
69  }
70 };
71 
74 {
75 protected:
79  btGImpactBoxSet m_box_set; // optionally boxset
80 
83  virtual void calcLocalAABB()
84  {
86  if (m_box_set.getNodeCount() == 0)
87  {
89  }
90  else
91  {
92  m_box_set.update();
93  }
95 
97  }
98 
99 public:
101  {
102  m_shapeType = GIMPACT_SHAPE_PROXYTYPE;
103  m_localAABB.invalidate();
104  m_needs_update = true;
105  localScaling.setValue(1.f, 1.f, 1.f);
106  }
107 
109 
116  {
117  if (!m_needs_update) return;
118  calcLocalAABB();
119  m_needs_update = false;
120  }
121 
123 
126  void getAabb(const btTransform& t, btVector3& aabbMin, btVector3& aabbMax) const
127  {
128  btAABB transformedbox = m_localAABB;
129  transformedbox.appy_transform(t);
130  aabbMin = transformedbox.m_min;
131  aabbMax = transformedbox.m_max;
132  }
133 
135  virtual void postUpdate()
136  {
137  m_needs_update = true;
138  }
139 
142  {
143  return m_localAABB;
144  }
145 
146  virtual int getShapeType() const
147  {
149  }
150 
154  virtual void setLocalScaling(const btVector3& scaling)
155  {
156  localScaling = scaling;
157  postUpdate();
158  }
159 
160  virtual const btVector3& getLocalScaling() const
161  {
162  return localScaling;
163  }
164 
165  virtual void setMargin(btScalar margin)
166  {
167  m_collisionMargin = margin;
168  int i = getNumChildShapes();
169  while (i--)
170  {
171  btCollisionShape* child = getChildShape(i);
172  child->setMargin(margin);
173  }
174 
175  m_needs_update = true;
176  }
177 
180 
183 
186  {
187  return &m_box_set;
188  }
189 
192  {
193  if (m_box_set.getNodeCount() == 0) return false;
194  return true;
195  }
196 
198  virtual const btPrimitiveManagerBase* getPrimitiveManager() const = 0;
199 
201  virtual int getNumChildShapes() const = 0;
202 
204  virtual bool childrenHasTransform() const = 0;
205 
207  virtual bool needsRetrieveTriangles() const = 0;
208 
210  virtual bool needsRetrieveTetrahedrons() const = 0;
211 
212  virtual void getBulletTriangle(int prim_index, btTriangleShapeEx& triangle) const = 0;
213 
214  virtual void getBulletTetrahedron(int prim_index, btTetrahedronShapeEx& tetrahedron) const = 0;
215 
217  virtual void lockChildShapes() const
218  {
219  }
220 
221  virtual void unlockChildShapes() const
222  {
223  }
224 
227  {
228  getPrimitiveManager()->get_primitive_triangle(index, triangle);
229  }
230 
232 
234  virtual void getChildAabb(int child_index, const btTransform& t, btVector3& aabbMin, btVector3& aabbMax) const
235  {
236  btAABB child_aabb;
237  getPrimitiveManager()->get_primitive_box(child_index, child_aabb);
238  child_aabb.appy_transform(t);
239  aabbMin = child_aabb.m_min;
240  aabbMax = child_aabb.m_max;
241  }
242 
244  virtual btCollisionShape* getChildShape(int index) = 0;
245 
247  virtual const btCollisionShape* getChildShape(int index) const = 0;
248 
250  virtual btTransform getChildTransform(int index) const = 0;
251 
253 
256  virtual void setChildTransform(int index, const btTransform& transform) = 0;
257 
259 
261  virtual void rayTest(const btVector3& rayFrom, const btVector3& rayTo, btCollisionWorld::RayResultCallback& resultCallback) const
262  {
263  (void)rayFrom;
264  (void)rayTo;
265  (void)resultCallback;
266  }
267 
269 
272  virtual void processAllTriangles(btTriangleCallback* callback, const btVector3& aabbMin, const btVector3& aabbMax) const
273  {
274  (void)callback;
275  (void)aabbMin;
276  (void)aabbMax;
277  }
278 
280 
283  virtual void processAllTrianglesRay(btTriangleCallback* /*callback*/, const btVector3& /*rayFrom*/, const btVector3& /*rayTo*/) const
284  {
285  }
286 
288 };
289 
291 
295 {
296 public:
299  {
300  public:
303 
306  {
307  m_compoundShape = compound.m_compoundShape;
308  }
309 
311  {
312  m_compoundShape = compoundShape;
313  }
314 
316  {
318  }
319 
320  virtual bool is_trimesh() const
321  {
322  return false;
323  }
324 
325  virtual int get_primitive_count() const
326  {
327  return (int)m_compoundShape->getNumChildShapes();
328  }
329 
330  virtual void get_primitive_box(int prim_index, btAABB& primbox) const
331  {
332  btTransform prim_trans;
334  {
335  prim_trans = m_compoundShape->getChildTransform(prim_index);
336  }
337  else
338  {
339  prim_trans.setIdentity();
340  }
341  const btCollisionShape* shape = m_compoundShape->getChildShape(prim_index);
342  shape->getAabb(prim_trans, primbox.m_min, primbox.m_max);
343  }
344 
345  virtual void get_primitive_triangle(int prim_index, btPrimitiveTriangle& triangle) const
346  {
347  btAssert(0);
348  (void)prim_index;
349  (void)triangle;
350  }
351  };
352 
353 protected:
357 
358 public:
359  btGImpactCompoundShape(bool children_has_transform = true)
360  {
361  (void)children_has_transform;
364  }
365 
367  {
368  }
369 
371  virtual bool childrenHasTransform() const
372  {
373  if (m_childTransforms.size() == 0) return false;
374  return true;
375  }
376 
379  {
380  return &m_primitive_manager;
381  }
382 
385  {
386  return &m_primitive_manager;
387  }
388 
390  virtual int getNumChildShapes() const
391  {
392  return m_childShapes.size();
393  }
394 
396  void addChildShape(const btTransform& localTransform, btCollisionShape* shape)
397  {
398  btAssert(shape->isConvex());
399  m_childTransforms.push_back(localTransform);
400  m_childShapes.push_back(shape);
401  }
402 
405  {
406  btAssert(shape->isConvex());
407  m_childShapes.push_back(shape);
408  }
409 
411  virtual btCollisionShape* getChildShape(int index)
412  {
413  return m_childShapes[index];
414  }
415 
417  virtual const btCollisionShape* getChildShape(int index) const
418  {
419  return m_childShapes[index];
420  }
421 
423 
425  virtual void getChildAabb(int child_index, const btTransform& t, btVector3& aabbMin, btVector3& aabbMax) const
426  {
427  if (childrenHasTransform())
428  {
429  m_childShapes[child_index]->getAabb(t * m_childTransforms[child_index], aabbMin, aabbMax);
430  }
431  else
432  {
433  m_childShapes[child_index]->getAabb(t, aabbMin, aabbMax);
434  }
435  }
436 
438  virtual btTransform getChildTransform(int index) const
439  {
441  return m_childTransforms[index];
442  }
443 
445 
448  virtual void setChildTransform(int index, const btTransform& transform)
449  {
451  m_childTransforms[index] = transform;
452  postUpdate();
453  }
454 
456  virtual bool needsRetrieveTriangles() const
457  {
458  return false;
459  }
460 
462  virtual bool needsRetrieveTetrahedrons() const
463  {
464  return false;
465  }
466 
467  virtual void getBulletTriangle(int prim_index, btTriangleShapeEx& triangle) const
468  {
469  (void)prim_index;
470  (void)triangle;
471  btAssert(0);
472  }
473 
474  virtual void getBulletTetrahedron(int prim_index, btTetrahedronShapeEx& tetrahedron) const
475  {
476  (void)prim_index;
477  (void)tetrahedron;
478  btAssert(0);
479  }
480 
482  virtual void calculateLocalInertia(btScalar mass, btVector3& inertia) const;
483 
484  virtual const char* getName() const
485  {
486  return "GImpactCompound";
487  }
488 
490  {
492  }
493 };
494 
496 
503 {
504 public:
506 
510  {
511  public:
515  int m_part;
517  const unsigned char* vertexbase;
518  int numverts;
520  int stride;
521  const unsigned char* indexbase;
523  int numfaces;
525 
527  {
529  m_part = 0;
530  m_margin = 0.01f;
531  m_scale = btVector3(1.f, 1.f, 1.f);
532  m_lock_count = 0;
533  vertexbase = 0;
534  numverts = 0;
535  stride = 0;
536  indexbase = 0;
537  indexstride = 0;
538  numfaces = 0;
539  }
540 
543  {
545  m_part = manager.m_part;
546  m_margin = manager.m_margin;
547  m_scale = manager.m_scale;
548  m_lock_count = 0;
549  vertexbase = 0;
550  numverts = 0;
551  stride = 0;
552  indexbase = 0;
553  indexstride = 0;
554  numfaces = 0;
555  }
556 
558  btStridingMeshInterface* meshInterface, int part)
559  {
560  m_meshInterface = meshInterface;
561  m_part = part;
562  m_scale = m_meshInterface->getScaling();
563  m_margin = 0.1f;
564  m_lock_count = 0;
565  vertexbase = 0;
566  numverts = 0;
567  stride = 0;
568  indexbase = 0;
569  indexstride = 0;
570  numfaces = 0;
571  }
572 
574 
575  void lock()
576  {
577  if (m_lock_count > 0)
578  {
579  m_lock_count++;
580  return;
581  }
582  m_meshInterface->getLockedReadOnlyVertexIndexBase(
585 
586  m_lock_count = 1;
587  }
588 
589  void unlock()
590  {
591  if (m_lock_count == 0) return;
592  if (m_lock_count > 1)
593  {
594  --m_lock_count;
595  return;
596  }
597  m_meshInterface->unLockReadOnlyVertexBase(m_part);
598  vertexbase = NULL;
599  m_lock_count = 0;
600  }
601 
602  virtual bool is_trimesh() const
603  {
604  return true;
605  }
606 
607  virtual int get_primitive_count() const
608  {
609  return (int)numfaces;
610  }
611 
613  {
614  return (int)numverts;
615  }
616 
617  SIMD_FORCE_INLINE void get_indices(int face_index, unsigned int& i0, unsigned int& i1, unsigned int& i2) const
618  {
619  if (indicestype == PHY_SHORT)
620  {
621  unsigned short* s_indices = (unsigned short*)(indexbase + face_index * indexstride);
622  i0 = s_indices[0];
623  i1 = s_indices[1];
624  i2 = s_indices[2];
625  }
626  else if (indicestype == PHY_INTEGER)
627  {
628  unsigned int* i_indices = (unsigned int*)(indexbase + face_index * indexstride);
629  i0 = i_indices[0];
630  i1 = i_indices[1];
631  i2 = i_indices[2];
632  }
633  else
634  {
636  unsigned char* i_indices = (unsigned char*)(indexbase + face_index * indexstride);
637  i0 = i_indices[0];
638  i1 = i_indices[1];
639  i2 = i_indices[2];
640  }
641  }
642 
643  SIMD_FORCE_INLINE void get_vertex(unsigned int vertex_index, btVector3& vertex) const
644  {
645  if (type == PHY_DOUBLE)
646  {
647  double* dvertices = (double*)(vertexbase + vertex_index * stride);
648  vertex[0] = btScalar(dvertices[0] * m_scale[0]);
649  vertex[1] = btScalar(dvertices[1] * m_scale[1]);
650  vertex[2] = btScalar(dvertices[2] * m_scale[2]);
651  }
652  else
653  {
654  float* svertices = (float*)(vertexbase + vertex_index * stride);
655  vertex[0] = svertices[0] * m_scale[0];
656  vertex[1] = svertices[1] * m_scale[1];
657  vertex[2] = svertices[2] * m_scale[2];
658  }
659  }
660 
661  virtual void get_primitive_box(int prim_index, btAABB& primbox) const
662  {
663  btPrimitiveTriangle triangle;
664  get_primitive_triangle(prim_index, triangle);
665  primbox.calc_from_triangle_margin(
666  triangle.m_vertices[0],
667  triangle.m_vertices[1], triangle.m_vertices[2], triangle.m_margin);
668  }
669 
670  virtual void get_primitive_triangle(int prim_index, btPrimitiveTriangle& triangle) const
671  {
672  unsigned int indices[3];
673  get_indices(prim_index, indices[0], indices[1], indices[2]);
674  get_vertex(indices[0], triangle.m_vertices[0]);
675  get_vertex(indices[1], triangle.m_vertices[1]);
676  get_vertex(indices[2], triangle.m_vertices[2]);
677  triangle.m_margin = m_margin;
678  }
679 
680  SIMD_FORCE_INLINE void get_bullet_triangle(int prim_index, btTriangleShapeEx& triangle) const
681  {
682  unsigned int indices[3];
683  get_indices(prim_index, indices[0], indices[1], indices[2]);
684  get_vertex(indices[0], triangle.m_vertices1[0]);
685  get_vertex(indices[1], triangle.m_vertices1[1]);
686  get_vertex(indices[2], triangle.m_vertices1[2]);
687  triangle.setMargin(m_margin);
688  }
689  };
690 
691 protected:
693 
694 public:
696  {
698  }
699 
700  btGImpactMeshShapePart(btStridingMeshInterface* meshInterface, int part);
701  virtual ~btGImpactMeshShapePart();
702 
704  virtual bool childrenHasTransform() const
705  {
706  return false;
707  }
708 
710  virtual void lockChildShapes() const;
711  virtual void unlockChildShapes() const;
712 
714  virtual int getNumChildShapes() const
715  {
717  }
718 
720  virtual btCollisionShape* getChildShape(int index)
721  {
722  (void)index;
723  btAssert(0);
724  return NULL;
725  }
726 
728  virtual const btCollisionShape* getChildShape(int index) const
729  {
730  (void)index;
731  btAssert(0);
732  return NULL;
733  }
734 
736  virtual btTransform getChildTransform(int index) const
737  {
738  (void)index;
739  btAssert(0);
740  return btTransform();
741  }
742 
744 
747  virtual void setChildTransform(int index, const btTransform& transform)
748  {
749  (void)index;
750  (void)transform;
751  btAssert(0);
752  }
753 
756  {
757  return &m_primitive_manager;
758  }
759 
761  {
762  return &m_primitive_manager;
763  }
764 
765  virtual void calculateLocalInertia(btScalar mass, btVector3& inertia) const;
766 
767  virtual const char* getName() const
768  {
769  return "GImpactMeshShapePart";
770  }
771 
773  {
775  }
776 
778  virtual bool needsRetrieveTriangles() const
779  {
780  return true;
781  }
782 
784  virtual bool needsRetrieveTetrahedrons() const
785  {
786  return false;
787  }
788 
789  virtual void getBulletTriangle(int prim_index, btTriangleShapeEx& triangle) const
790  {
791  m_primitive_manager.get_bullet_triangle(prim_index, triangle);
792  }
793 
794  virtual void getBulletTetrahedron(int prim_index, btTetrahedronShapeEx& tetrahedron) const
795  {
796  (void)prim_index;
797  (void)tetrahedron;
798  btAssert(0);
799  }
800 
802  {
804  }
805 
806  SIMD_FORCE_INLINE void getVertex(int vertex_index, btVector3& vertex) const
807  {
808  m_primitive_manager.get_vertex(vertex_index, vertex);
809  }
810 
812  {
813  m_primitive_manager.m_margin = margin;
814  postUpdate();
815  }
816 
818  {
820  }
821 
822  virtual void setLocalScaling(const btVector3& scaling)
823  {
824  m_primitive_manager.m_scale = scaling;
825  postUpdate();
826  }
827 
828  virtual const btVector3& getLocalScaling() const
829  {
831  }
832 
834  {
835  return (int)m_primitive_manager.m_part;
836  }
837 
838  virtual void processAllTriangles(btTriangleCallback* callback, const btVector3& aabbMin, const btVector3& aabbMax) const;
839  virtual void processAllTrianglesRay(btTriangleCallback* callback, const btVector3& rayFrom, const btVector3& rayTo) const;
840 };
841 
843 
851 {
852  btStridingMeshInterface* m_meshInterface;
853 
854 protected:
857  {
858  for (int i = 0; i < meshInterface->getNumSubParts(); ++i)
859  {
860  btGImpactMeshShapePart* newpart = new btGImpactMeshShapePart(meshInterface, i);
861  m_mesh_parts.push_back(newpart);
862  }
863  }
864 
866  virtual void calcLocalAABB()
867  {
868  m_localAABB.invalidate();
869  int i = m_mesh_parts.size();
870  while (i--)
871  {
872  m_mesh_parts[i]->updateBound();
873  m_localAABB.merge(m_mesh_parts[i]->getLocalBox());
874  }
875  }
876 
877 public:
879  {
880  m_meshInterface = meshInterface;
881  buildMeshParts(meshInterface);
882  }
883 
885  {
886  int i = m_mesh_parts.size();
887  while (i--)
888  {
890  delete part;
891  }
893  }
894 
896  {
897  return m_meshInterface;
898  }
899 
901  {
902  return m_meshInterface;
903  }
904 
905  int getMeshPartCount() const
906  {
907  return m_mesh_parts.size();
908  }
909 
911  {
912  return m_mesh_parts[index];
913  }
914 
915  const btGImpactMeshShapePart* getMeshPart(int index) const
916  {
917  return m_mesh_parts[index];
918  }
919 
920  virtual void setLocalScaling(const btVector3& scaling)
921  {
922  localScaling = scaling;
923 
924  int i = m_mesh_parts.size();
925  while (i--)
926  {
928  part->setLocalScaling(scaling);
929  }
930 
931  m_needs_update = true;
932  }
933 
934  virtual void setMargin(btScalar margin)
935  {
936  m_collisionMargin = margin;
937 
938  int i = m_mesh_parts.size();
939  while (i--)
940  {
942  part->setMargin(margin);
943  }
944 
945  m_needs_update = true;
946  }
947 
949  virtual void postUpdate()
950  {
951  int i = m_mesh_parts.size();
952  while (i--)
953  {
955  part->postUpdate();
956  }
957 
958  m_needs_update = true;
959  }
960 
961  virtual void calculateLocalInertia(btScalar mass, btVector3& inertia) const;
962 
965  {
966  btAssert(0);
967  return NULL;
968  }
969 
971  virtual int getNumChildShapes() const
972  {
973  btAssert(0);
974  return 0;
975  }
976 
978  virtual bool childrenHasTransform() const
979  {
980  btAssert(0);
981  return false;
982  }
983 
985  virtual bool needsRetrieveTriangles() const
986  {
987  btAssert(0);
988  return false;
989  }
990 
992  virtual bool needsRetrieveTetrahedrons() const
993  {
994  btAssert(0);
995  return false;
996  }
997 
998  virtual void getBulletTriangle(int prim_index, btTriangleShapeEx& triangle) const
999  {
1000  (void)prim_index;
1001  (void)triangle;
1002  btAssert(0);
1003  }
1004 
1005  virtual void getBulletTetrahedron(int prim_index, btTetrahedronShapeEx& tetrahedron) const
1006  {
1007  (void)prim_index;
1008  (void)tetrahedron;
1009  btAssert(0);
1010  }
1011 
1013  virtual void lockChildShapes() const
1014  {
1015  btAssert(0);
1016  }
1017 
1018  virtual void unlockChildShapes() const
1019  {
1020  btAssert(0);
1021  }
1022 
1024 
1026  virtual void getChildAabb(int child_index, const btTransform& t, btVector3& aabbMin, btVector3& aabbMax) const
1027  {
1028  (void)child_index;
1029  (void)t;
1030  (void)aabbMin;
1031  (void)aabbMax;
1032  btAssert(0);
1033  }
1034 
1036  virtual btCollisionShape* getChildShape(int index)
1037  {
1038  (void)index;
1039  btAssert(0);
1040  return NULL;
1041  }
1042 
1044  virtual const btCollisionShape* getChildShape(int index) const
1045  {
1046  (void)index;
1047  btAssert(0);
1048  return NULL;
1049  }
1050 
1052  virtual btTransform getChildTransform(int index) const
1053  {
1054  (void)index;
1055  btAssert(0);
1056  return btTransform();
1057  }
1058 
1060 
1063  virtual void setChildTransform(int index, const btTransform& transform)
1064  {
1065  (void)index;
1066  (void)transform;
1067  btAssert(0);
1068  }
1069 
1071  {
1073  }
1074 
1075  virtual const char* getName() const
1076  {
1077  return "GImpactMesh";
1078  }
1079 
1080  virtual void rayTest(const btVector3& rayFrom, const btVector3& rayTo, btCollisionWorld::RayResultCallback& resultCallback) const;
1081 
1083 
1086  virtual void processAllTriangles(btTriangleCallback* callback, const btVector3& aabbMin, const btVector3& aabbMax) const;
1087 
1088  virtual void processAllTrianglesRay(btTriangleCallback* callback, const btVector3& rayFrom, const btVector3& rayTo) const;
1089 
1090  virtual int calculateSerializeBufferSize() const;
1091 
1093  virtual const char* serialize(void* dataBuffer, btSerializer* serializer) const;
1094 };
1095 
1098 {
1100 
1102 
1104 
1106 
1108 };
1109 
1111 {
1112  return sizeof(btGImpactMeshShapeData);
1113 }
1114 
1115 #endif //GIMPACT_MESH_SHAPE_H
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint i1
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble t
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble v1
ATTR_WARN_UNUSED_RESULT const BMVert * v2
btVector3 m_vertices[4]
Definition: btBox2dShape.h:32
btAABB
Axis aligned box.
SIMD_FORCE_INLINE btVector3 transform(const btVector3 &point) const
@ GIMPACT_SHAPE_PROXYTYPE
Used for GIMPACT Trimesh integration.
btCollisionShape
The btCollisionShape class provides an interface for collision shapes that can be shared among btColl...
btScalar m_collisionMargin
btConcaveShape()
PHY_ScalarType
@ PHY_UCHAR
@ PHY_DOUBLE
@ PHY_SHORT
@ PHY_INTEGER
eGIMPACT_SHAPE_TYPE
@ CONST_GIMPACT_TRIMESH_SHAPE
@ CONST_GIMPACT_TRIMESH_SHAPE_PART
@ CONST_GIMPACT_COMPOUND_SHAPE
btGImpactQuantizedBvh btGImpactBoxSet
declare Quantized trees, (you can change to float based trees)
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
Definition: btScalar.h:314
#define SIMD_FORCE_INLINE
Definition: btScalar.h:280
#define btAssert(x)
Definition: btScalar.h:295
btStridingMeshInterface
btBU_Simplex1to4()
btTransform
The btTransform class supports rigid transforms with only translation and rotation and no scaling/she...
Definition: btTransform.h:30
btStridingMeshInterface * m_meshInterface
void recalcLocalAabb()
btVector3
btVector3 can be used to represent 3D points and vectors. It has an un-used w component to suit 16-by...
Definition: btVector3.h:82
SIMD_FORCE_INLINE void clear()
clear the array, deallocated memory. Generally it is better to use array.resize(0),...
SIMD_FORCE_INLINE int size() const
return the number of elements in the array
SIMD_FORCE_INLINE void push_back(const T &_Val)
CompoundPrimitiveManager(btGImpactCompoundShape *compoundShape)
CompoundPrimitiveManager(const CompoundPrimitiveManager &compound)
virtual void get_primitive_box(int prim_index, btAABB &primbox) const
virtual bool is_trimesh() const
determines if this manager consist on only triangles, which special case will be optimized
virtual void get_primitive_triangle(int prim_index, btPrimitiveTriangle &triangle) const
retrieves only the points of the triangle, and the collision margin
btGImpactCompoundShape allows to handle multiple btCollisionShape objects at once
void addChildShape(btCollisionShape *shape)
Use this method for adding children. Only Convex shapes are allowed.
virtual const btCollisionShape * getChildShape(int index) const
Gets the children.
btGImpactCompoundShape(bool children_has_transform=true)
virtual void calculateLocalInertia(btScalar mass, btVector3 &inertia) const
Calculates the exact inertia tensor for this shape.
virtual void getBulletTriangle(int prim_index, btTriangleShapeEx &triangle) const
void addChildShape(const btTransform &localTransform, btCollisionShape *shape)
Use this method for adding children. Only Convex shapes are allowed.
virtual void setChildTransform(int index, const btTransform &transform)
Sets the children transform.
SIMD_FORCE_INLINE CompoundPrimitiveManager * getCompoundPrimitiveManager()
Obtains the compopund primitive manager.
virtual const char * getName() const
btAlignedObjectArray< btTransform > m_childTransforms
virtual eGIMPACT_SHAPE_TYPE getGImpactShapeType() const
Base method for determinig which kind of GIMPACT shape we get.
virtual btCollisionShape * getChildShape(int index)
Gets the children.
btAlignedObjectArray< btCollisionShape * > m_childShapes
virtual bool needsRetrieveTriangles() const
Determines if this shape has triangles.
virtual bool childrenHasTransform() const
if true, then its children must get transforms.
virtual bool needsRetrieveTetrahedrons() const
Determines if this shape has tetrahedrons.
virtual const btPrimitiveManagerBase * getPrimitiveManager() const
Obtains the primitive manager.
virtual btTransform getChildTransform(int index) const
Gets the children transform.
virtual void getChildAabb(int child_index, const btTransform &t, btVector3 &aabbMin, btVector3 &aabbMax) const
Retrieves the bound from a child.
virtual ~btGImpactCompoundShape()
virtual int getNumChildShapes() const
Gets the number of children.
CompoundPrimitiveManager m_primitive_manager
virtual void getBulletTetrahedron(int prim_index, btTetrahedronShapeEx &tetrahedron) const
SIMD_FORCE_INLINE void get_bullet_triangle(int prim_index, btTriangleShapeEx &triangle) const
SIMD_FORCE_INLINE void get_indices(int face_index, unsigned int &i0, unsigned int &i1, unsigned int &i2) const
SIMD_FORCE_INLINE int get_vertex_count() const
TrimeshPrimitiveManager(btStridingMeshInterface *meshInterface, int part)
virtual void get_primitive_triangle(int prim_index, btPrimitiveTriangle &triangle) const
retrieves only the points of the triangle, and the collision margin
SIMD_FORCE_INLINE void get_vertex(unsigned int vertex_index, btVector3 &vertex) const
virtual bool is_trimesh() const
determines if this manager consist on only triangles, which special case will be optimized
TrimeshPrimitiveManager(const TrimeshPrimitiveManager &manager)
virtual void get_primitive_box(int prim_index, btAABB &primbox) const
This class manages a sub part of a mesh supplied by the btStridingMeshInterface interface.
virtual btTransform getChildTransform(int index) const
Gets the children transform.
virtual void processAllTriangles(btTriangleCallback *callback, const btVector3 &aabbMin, const btVector3 &aabbMax) const
Function for retrieve triangles.
virtual void setChildTransform(int index, const btTransform &transform)
Sets the children transform.
SIMD_FORCE_INLINE int getPart() const
virtual void calculateLocalInertia(btScalar mass, btVector3 &inertia) const
SIMD_FORCE_INLINE int getVertexCount() const
virtual void setLocalScaling(const btVector3 &scaling)
SIMD_FORCE_INLINE void getVertex(int vertex_index, btVector3 &vertex) const
virtual void getBulletTriangle(int prim_index, btTriangleShapeEx &triangle) const
virtual const char * getName() const
virtual void processAllTrianglesRay(btTriangleCallback *callback, const btVector3 &rayFrom, const btVector3 &rayTo) const
Function for retrieve triangles.
SIMD_FORCE_INLINE void setMargin(btScalar margin)
virtual int getNumChildShapes() const
Gets the number of children.
SIMD_FORCE_INLINE TrimeshPrimitiveManager * getTrimeshPrimitiveManager()
virtual bool needsRetrieveTriangles() const
Determines if this shape has triangles.
virtual eGIMPACT_SHAPE_TYPE getGImpactShapeType() const
Base method for determinig which kind of GIMPACT shape we get.
virtual btCollisionShape * getChildShape(int index)
Gets the children.
TrimeshPrimitiveManager m_primitive_manager
virtual bool needsRetrieveTetrahedrons() const
Determines if this shape has tetrahedrons.
virtual bool childrenHasTransform() const
if true, then its children must get transforms.
virtual void lockChildShapes() const
call when reading child shapes
virtual const btCollisionShape * getChildShape(int index) const
Gets the child.
SIMD_FORCE_INLINE btScalar getMargin() const
virtual const btPrimitiveManagerBase * getPrimitiveManager() const
Obtains the primitive manager.
virtual void getBulletTetrahedron(int prim_index, btTetrahedronShapeEx &tetrahedron) const
virtual void unlockChildShapes() const
virtual const btVector3 & getLocalScaling() const
This class manages a mesh supplied by the btStridingMeshInterface interface.
virtual bool childrenHasTransform() const
if true, then its children must get transforms.
const btGImpactMeshShapePart * getMeshPart(int index) const
const btStridingMeshInterface * getMeshInterface() const
int getMeshPartCount() const
virtual int getNumChildShapes() const
Gets the number of children.
virtual void getBulletTetrahedron(int prim_index, btTetrahedronShapeEx &tetrahedron) const
virtual void setChildTransform(int index, const btTransform &transform)
Sets the children transform.
virtual const btPrimitiveManagerBase * getPrimitiveManager() const
Obtains the primitive manager.
virtual void rayTest(const btVector3 &rayFrom, const btVector3 &rayTo, btCollisionWorld::RayResultCallback &resultCallback) const
virtual method for ray collision
virtual btTransform getChildTransform(int index) const
Gets the children transform.
virtual void calculateLocalInertia(btScalar mass, btVector3 &inertia) const
virtual const btCollisionShape * getChildShape(int index) const
Gets the child.
virtual ~btGImpactMeshShape()
virtual void lockChildShapes() const
call when reading child shapes
virtual void getChildAabb(int child_index, const btTransform &t, btVector3 &aabbMin, btVector3 &aabbMax) const
Retrieves the bound from a child.
virtual void getBulletTriangle(int prim_index, btTriangleShapeEx &triangle) const
void buildMeshParts(btStridingMeshInterface *meshInterface)
virtual void processAllTriangles(btTriangleCallback *callback, const btVector3 &aabbMin, const btVector3 &aabbMax) const
Function for retrieve triangles.
btGImpactMeshShape(btStridingMeshInterface *meshInterface)
virtual void calcLocalAABB()
use this function for perfofm refit in bounding boxes
virtual void setMargin(btScalar margin)
virtual void processAllTrianglesRay(btTriangleCallback *callback, const btVector3 &rayFrom, const btVector3 &rayTo) const
Function for retrieve triangles.
btGImpactMeshShapePart * getMeshPart(int index)
virtual int calculateSerializeBufferSize() const
virtual bool needsRetrieveTetrahedrons() const
Determines if this shape has tetrahedrons.
virtual eGIMPACT_SHAPE_TYPE getGImpactShapeType() const
Base method for determinig which kind of GIMPACT shape we get.
btStridingMeshInterface * getMeshInterface()
btAlignedObjectArray< btGImpactMeshShapePart * > m_mesh_parts
virtual btCollisionShape * getChildShape(int index)
Gets the children.
virtual void setLocalScaling(const btVector3 &scaling)
virtual const char * serialize(void *dataBuffer, btSerializer *serializer) const
fills the dataBuffer and returns the struct name (and 0 on failure)
virtual bool needsRetrieveTriangles() const
Determines if this shape has triangles.
virtual void postUpdate()
Tells to this object that is needed to refit all the meshes.
virtual void unlockChildShapes() const
virtual const char * getName() const
Structure for containing Boxes.
void buildSet()
this rebuild the entire set
SIMD_FORCE_INLINE void update()
this attemps to refit the box set.
SIMD_FORCE_INLINE int getNodeCount() const
node count
SIMD_FORCE_INLINE void setPrimitiveManager(btPrimitiveManagerBase *primitive_manager)
SIMD_FORCE_INLINE btAABB getGlobalBox() const
Base class for gimpact shapes.
void getAabb(const btTransform &t, btVector3 &aabbMin, btVector3 &aabbMax) const
If the Bounding box is not updated, then this class attemps to calculate it.
virtual const btCollisionShape * getChildShape(int index) const =0
Gets the child.
SIMD_FORCE_INLINE void getPrimitiveTriangle(int index, btPrimitiveTriangle &triangle) const
if this trimesh
virtual void calcLocalAABB()
virtual void getChildAabb(int child_index, const btTransform &t, btVector3 &aabbMin, btVector3 &aabbMax) const
Retrieves the bound from a child.
virtual eGIMPACT_SHAPE_TYPE getGImpactShapeType() const =0
Base method for determinig which kind of GIMPACT shape we get.
virtual void setMargin(btScalar margin)
virtual const btPrimitiveManagerBase * getPrimitiveManager() const =0
Obtains the primitive manager.
SIMD_FORCE_INLINE const btGImpactBoxSet * getBoxSet() const
gets boxset
virtual void lockChildShapes() const
call when reading child shapes
btGImpactBoxSet m_box_set
virtual bool needsRetrieveTriangles() const =0
Determines if this shape has triangles.
virtual void getBulletTetrahedron(int prim_index, btTetrahedronShapeEx &tetrahedron) const =0
virtual void getBulletTriangle(int prim_index, btTriangleShapeEx &triangle) const =0
virtual const btVector3 & getLocalScaling() const
virtual void setChildTransform(int index, const btTransform &transform)=0
Sets the children transform.
virtual bool childrenHasTransform() const =0
if true, then its children must get transforms.
virtual btCollisionShape * getChildShape(int index)=0
Gets the children.
virtual int getNumChildShapes() const =0
Gets the number of children.
virtual btTransform getChildTransform(int index) const =0
Gets the children transform.
virtual int getShapeType() const
virtual void postUpdate()
Tells to this object that is needed to refit the box set.
SIMD_FORCE_INLINE void updateBound()
performs refit operation
virtual bool needsRetrieveTetrahedrons() const =0
Determines if this shape has tetrahedrons.
SIMD_FORCE_INLINE const btAABB & getLocalBox()
Obtains the local box, which is the global calculated box of the total of subshapes.
virtual void setLocalScaling(const btVector3 &scaling)
virtual void processAllTriangles(btTriangleCallback *callback, const btVector3 &aabbMin, const btVector3 &aabbMax) const
Function for retrieve triangles.
virtual void unlockChildShapes() const
virtual void processAllTrianglesRay(btTriangleCallback *, const btVector3 &, const btVector3 &) const
Function for retrieve triangles.
SIMD_FORCE_INLINE bool hasBoxSet() const
Determines if this class has a hierarchy structure for sorting its primitives.
virtual void rayTest(const btVector3 &rayFrom, const btVector3 &rayTo, btCollisionWorld::RayResultCallback &resultCallback) const
virtual method for ray collision
Prototype Base class for primitive classification.
Definition: btGImpactBvh.h:150
virtual void get_primitive_triangle(int prim_index, btPrimitiveTriangle &triangle) const =0
retrieves only the points of the triangle, and the collision margin
virtual void get_primitive_box(int prim_index, btAABB &primbox) const =0
Helper class for tetrahedrons.
SIMD_FORCE_INLINE void setVertices(const btVector3 &v0, const btVector3 &v1, const btVector3 &v2, const btVector3 &v3)
Helper class for colliding Bullet Triangle Shapes.
DEGForeachIDComponentCallback callback
SyclQueue void void size_t num_bytes void
ccl_gpu_kernel_postfix int ccl_global int * indices
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
RayResultCallback is used to report new raycast results.
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
btCollisionShapeData m_collisionShapeData
btStridingMeshInterfaceData m_meshInterface
btVector3FloatData m_localScaling
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64