diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-11-13 00:16:53 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-11-13 00:16:53 +0300 |
commit | bdfe7d89e2f1292644577972c716931b4ce3c6c3 (patch) | |
tree | d00eb50b749cb001e2b08272c91791e66740b05d /extern/bullet2/src/BulletCollision/CollisionShapes/btTriangleMesh.h | |
parent | 78a1c27c4a6abe0ed31ca93ad21910f3df04da56 (diff) | |
parent | 7e4db234cee71ead34ee81a12e27da4bd548eb4b (diff) |
Merge of trunk into blender 2.5:
svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r12987:17416
Issues:
* GHOST/X11 had conflicting changes. Some code was added in 2.5, which was
later added in trunk also, but reverted partially, specifically revision
16683. I have left out this reversion in the 2.5 branch since I think it is
needed there.
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16683
* Scons had various conflicting changes, I decided to go with trunk version
for everything except priorities and some library renaming.
* In creator.c, there were various fixes and fixes for fixes related to the -w
-W and -p options. In 2.5 -w and -W is not coded yet, and -p is done
differently. Since this is changed so much, and I don't think those fixes
would be needed in 2.5, I've left them out.
* Also in creator.c: there was code for a python bugfix where the screen was not
initialized when running with -P. The code that initializes the screen there
I had to disable, that can't work in 2.5 anymore but left it commented as a
reminder.
Further I had to disable some new function calls. using src/ and python/, as
was done already in this branch, disabled function calls:
* bpath.c: error reporting
* BME_conversions.c: editmesh conversion functions.
* SHD_dynamic: disabled almost completely, there is no python/.
* KX_PythonInit.cpp and Ketsji/ build files: Mathutils is not there, disabled.
* text.c: clipboard copy call.
* object.c: OB_SUPPORT_MATERIAL.
* DerivedMesh.c and subsurf_ccg, stipple_quarttone.
Still to be done:
* Go over files and functions that were moved to a different location but could
still use changes that were done in trunk.
Diffstat (limited to 'extern/bullet2/src/BulletCollision/CollisionShapes/btTriangleMesh.h')
-rw-r--r-- | extern/bullet2/src/BulletCollision/CollisionShapes/btTriangleMesh.h | 68 |
1 files changed, 31 insertions, 37 deletions
diff --git a/extern/bullet2/src/BulletCollision/CollisionShapes/btTriangleMesh.h b/extern/bullet2/src/BulletCollision/CollisionShapes/btTriangleMesh.h index 525f5336b48..1f51b2f2c87 100644 --- a/extern/bullet2/src/BulletCollision/CollisionShapes/btTriangleMesh.h +++ b/extern/bullet2/src/BulletCollision/CollisionShapes/btTriangleMesh.h @@ -17,54 +17,48 @@ subject to the following restrictions: #ifndef TRIANGLE_MESH_H #define TRIANGLE_MESH_H -#include "btStridingMeshInterface.h" -#include "../../LinearMath/btVector3.h" -#include "../../LinearMath/btAlignedObjectArray.h" - -///TriangleMesh provides storage for a concave triangle mesh. It can be used as data for the btTriangleMeshShape. -class btTriangleMesh : public btStridingMeshInterface +#include "btTriangleIndexVertexArray.h" +#include "LinearMath/btVector3.h" +#include "LinearMath/btAlignedObjectArray.h" + +///The btTriangleMesh class is a convenience class derived from btTriangleIndexVertexArray, that provides storage for a concave triangle mesh. It can be used as data for the btBvhTriangleMeshShape. +///It allows either 32bit or 16bit indices, and 4 (x-y-z-w) or 3 (x-y-z) component vertices. +///If you want to share triangle/index data between graphics mesh and collision mesh (btBvhTriangleMeshShape), you can directly use btTriangleIndexVertexArray or derive your own class from btStridingMeshInterface. +///Performance of btTriangleMesh and btTriangleIndexVertexArray used in a btBvhTriangleMeshShape is the same. +///It has a brute-force option to weld together closeby vertices. +class btTriangleMesh : public btTriangleIndexVertexArray { - btAlignedObjectArray<btVector3> m_vertices; - btAlignedObjectArray<int> m_indices; + btAlignedObjectArray<btVector3> m_4componentVertices; + btAlignedObjectArray<float> m_3componentVertices; + + btAlignedObjectArray<unsigned int> m_32bitIndices; + btAlignedObjectArray<unsigned short int> m_16bitIndices; + bool m_use32bitIndices; + bool m_use4componentVertices; + public: - btTriangleMesh (); + btScalar m_weldingThreshold; + + btTriangleMesh (bool use32bitIndices=true,bool use4componentVertices=true); - void addTriangle(const btVector3& vertex0,const btVector3& vertex1,const btVector3& vertex2) + int findOrAddVertex(const btVector3& vertex); + void addIndex(int index); + + bool getUse32bitIndices() const { - int curIndex = m_indices.size(); - m_vertices.push_back(vertex0); - m_vertices.push_back(vertex1); - m_vertices.push_back(vertex2); - - m_indices.push_back(curIndex++); - m_indices.push_back(curIndex++); - m_indices.push_back(curIndex++); + return m_use32bitIndices; } - int getNumTriangles() const + bool getUse4componentVertices() const { - return m_indices.size() / 3; + return m_use4componentVertices; } - - -//StridingMeshInterface interface implementation - - virtual void getLockedVertexIndexBase(unsigned char **vertexbase, int& numverts,PHY_ScalarType& type, int& stride,unsigned char **indexbase,int & indexstride,int& numfaces,PHY_ScalarType& indicestype,int subpart=0); - - 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; - - /// unLockVertexBase finishes the access to a subpart of the triangle mesh - /// make a call to unLockVertexBase when the read and write access (using getLockedVertexIndexBase) is finished - virtual void unLockVertexBase(int subpart) {(void) subpart;} - - virtual void unLockReadOnlyVertexBase(int subpart) const { (void) subpart;} - - /// getNumSubParts returns the number of seperate subparts - /// each subpart has a continuous array of vertices and indices - virtual int getNumSubParts() const; + void addTriangle(const btVector3& vertex0,const btVector3& vertex1,const btVector3& vertex2); + int getNumTriangles() const; + virtual void preallocateVertices(int numverts){(void) numverts;} virtual void preallocateIndices(int numindices){(void) numindices;} |