diff options
author | Erwin Coumans <blender@erwincoumans.com> | 2008-09-03 06:27:16 +0400 |
---|---|---|
committer | Erwin Coumans <blender@erwincoumans.com> | 2008-09-03 06:27:16 +0400 |
commit | 1926e846500212d11061c23cacdbd08d88e375da (patch) | |
tree | ad72fe64632cfc22a4878e065578b66d52de218d /extern/bullet2/src/BulletCollision/CollisionShapes/btTriangleIndexVertexArray.h | |
parent | 33ac84e888ee3e3217f15f955e1b389a9c4bb230 (diff) |
Finally upgraded to latest Bullet subversion, about to release 2.71. Some recent changes in extern/bullet2 need to be re-applied, will check with Benoit. Ray tests in 0_FPS_Template.blend is broken, didn't figure out why yet.
HELP BUILD SYSTEM MAINTAINERS: Please help with updating all build systems: the newly added files need to be added. Note that the src/SoftBody has been added for future extension of real-time soft bodies.
Diffstat (limited to 'extern/bullet2/src/BulletCollision/CollisionShapes/btTriangleIndexVertexArray.h')
-rw-r--r-- | extern/bullet2/src/BulletCollision/CollisionShapes/btTriangleIndexVertexArray.h | 40 |
1 files changed, 29 insertions, 11 deletions
diff --git a/extern/bullet2/src/BulletCollision/CollisionShapes/btTriangleIndexVertexArray.h b/extern/bullet2/src/BulletCollision/CollisionShapes/btTriangleIndexVertexArray.h index 6ab6a762b39..e546675f802 100644 --- a/extern/bullet2/src/BulletCollision/CollisionShapes/btTriangleIndexVertexArray.h +++ b/extern/bullet2/src/BulletCollision/CollisionShapes/btTriangleIndexVertexArray.h @@ -17,48 +17,62 @@ subject to the following restrictions: #define BT_TRIANGLE_INDEX_VERTEX_ARRAY_H #include "btStridingMeshInterface.h" -#include "../../LinearMath/btAlignedObjectArray.h" +#include "LinearMath/btAlignedObjectArray.h" +#include "LinearMath/btScalar.h" -///IndexedMesh indexes into existing vertex and index arrays, in a similar way OpenGL glDrawElements -///instead of the number of indices, we pass the number of triangles -///todo: explain with pictures + +///The btIndexedMesh indexes a single vertex and index array. Multiple btIndexedMesh objects can be passed into a btTriangleIndexVertexArray using addIndexedMesh. +///Instead of the number of indices, we pass the number of triangles. ATTRIBUTE_ALIGNED16( struct) btIndexedMesh { + BT_DECLARE_ALIGNED_ALLOCATOR(); + int m_numTriangles; const unsigned char * m_triangleIndexBase; int m_triangleIndexStride; int m_numVertices; const unsigned char * m_vertexBase; int m_vertexStride; - int pad[2]; + // The index type is set when adding an indexed mesh to the + // btTriangleIndexVertexArray, do not set it manually + PHY_ScalarType m_indexType; + int pad; } ; typedef btAlignedObjectArray<btIndexedMesh> IndexedMeshArray; -///TriangleIndexVertexArray allows to use multiple meshes, by indexing into existing triangle/index arrays. +///The btTriangleIndexVertexArray allows to access multiple triangle meshes, by indexing into existing triangle/index arrays. ///Additional meshes can be added using addIndexedMesh ///No duplcate is made of the vertex/index data, it only indexes into external vertex/index arrays. ///So keep those arrays around during the lifetime of this btTriangleIndexVertexArray. ATTRIBUTE_ALIGNED16( class) btTriangleIndexVertexArray : public btStridingMeshInterface { +protected: IndexedMeshArray m_indexedMeshes; - int m_pad[3]; + int m_pad[2]; + int m_hasAabb; // using int instead of bool to maintain alignment + btVector3 m_aabbMin; + btVector3 m_aabbMax; - public: - btTriangleIndexVertexArray() + BT_DECLARE_ALIGNED_ALLOCATOR(); + + btTriangleIndexVertexArray() : m_hasAabb(0) { } + virtual ~btTriangleIndexVertexArray(); + //just to be backwards compatible - btTriangleIndexVertexArray(int numTriangleIndices,int* triangleIndexBase,int triangleIndexStride,int numVertices,btScalar* vertexBase,int vertexStride); + btTriangleIndexVertexArray(int numTriangles,int* triangleIndexBase,int triangleIndexStride,int numVertices,btScalar* vertexBase,int vertexStride); - void addIndexedMesh(const btIndexedMesh& mesh) + void addIndexedMesh(const btIndexedMesh& mesh, PHY_ScalarType indexType = PHY_INTEGER) { m_indexedMeshes.push_back(mesh); + m_indexedMeshes[m_indexedMeshes.size()-1].m_indexType = indexType; } @@ -91,6 +105,10 @@ public: virtual void preallocateVertices(int numverts){(void) numverts;} virtual void preallocateIndices(int numindices){(void) numindices;} + virtual bool hasPremadeAabb() const; + virtual void setPremadeAabb(const btVector3& aabbMin, const btVector3& aabbMax ); + virtual void getPremadeAabb(btVector3* aabbMin, btVector3* aabbMax ) const; + } ; |