Blender V2.61 - r43446

btTriangleMesh.h

Go to the documentation of this file.
00001 /*
00002 Bullet Continuous Collision Detection and Physics Library
00003 Copyright (c) 2003-2009 Erwin Coumans  http://bulletphysics.org
00004 
00005 This software is provided 'as-is', without any express or implied warranty.
00006 In no event will the authors be held liable for any damages arising from the use of this software.
00007 Permission is granted to anyone to use this software for any purpose, 
00008 including commercial applications, and to alter it and redistribute it freely, 
00009 subject to the following restrictions:
00010 
00011 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.
00012 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
00013 3. This notice may not be removed or altered from any source distribution.
00014 */
00015 
00016 #ifndef TRIANGLE_MESH_H
00017 #define TRIANGLE_MESH_H
00018 
00019 #include "btTriangleIndexVertexArray.h"
00020 #include "LinearMath/btVector3.h"
00021 #include "LinearMath/btAlignedObjectArray.h"
00022 
00027 class btTriangleMesh : public btTriangleIndexVertexArray
00028 {
00029     btAlignedObjectArray<btVector3> m_4componentVertices;
00030     btAlignedObjectArray<float>     m_3componentVertices;
00031 
00032     btAlignedObjectArray<unsigned int>      m_32bitIndices;
00033     btAlignedObjectArray<unsigned short int>        m_16bitIndices;
00034     bool    m_use32bitIndices;
00035     bool    m_use4componentVertices;
00036     
00037 
00038     public:
00039         btScalar    m_weldingThreshold;
00040 
00041         btTriangleMesh (bool use32bitIndices=true,bool use4componentVertices=true);
00042 
00043         bool    getUse32bitIndices() const
00044         {
00045             return m_use32bitIndices;
00046         }
00047 
00048         bool    getUse4componentVertices() const
00049         {
00050             return m_use4componentVertices;
00051         }
00054         void    addTriangle(const btVector3& vertex0,const btVector3& vertex1,const btVector3& vertex2, bool removeDuplicateVertices=false);
00055         
00056         int getNumTriangles() const;
00057 
00058         virtual void    preallocateVertices(int numverts){(void) numverts;}
00059         virtual void    preallocateIndices(int numindices){(void) numindices;}
00060 
00062         int     findOrAddVertex(const btVector3& vertex, bool removeDuplicateVertices);
00064         void    addIndex(int index);
00065         
00066 };
00067 
00068 #endif //TRIANGLE_MESH_H
00069