btStridingMeshInterface.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 STRIDING_MESHINTERFACE_H
00017 #define STRIDING_MESHINTERFACE_H
00018 
00019 #include "LinearMath/btVector3.h"
00020 #include "btTriangleCallback.h"
00021 #include "btConcaveShape.h"
00022 
00023 
00024 
00025 
00026 
00030 class  btStridingMeshInterface
00031 {
00032         protected:
00033         
00034                 btVector3 m_scaling;
00035 
00036         public:
00037                 btStridingMeshInterface() :m_scaling(btScalar(1.),btScalar(1.),btScalar(1.))
00038                 {
00039 
00040                 }
00041 
00042                 virtual ~btStridingMeshInterface();
00043 
00044 
00045 
00046                 virtual void    InternalProcessAllTriangles(btInternalTriangleIndexCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const;
00047 
00049                 void    calculateAabbBruteForce(btVector3& aabbMin,btVector3& aabbMax);
00050 
00056                 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)=0;
00057                 
00058                 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;
00059         
00062                 virtual void    unLockVertexBase(int subpart)=0;
00063 
00064                 virtual void    unLockReadOnlyVertexBase(int subpart) const=0;
00065 
00066 
00069                 virtual int             getNumSubParts() const=0;
00070 
00071                 virtual void    preallocateVertices(int numverts)=0;
00072                 virtual void    preallocateIndices(int numindices)=0;
00073 
00074                 virtual bool    hasPremadeAabb() const { return false; }
00075                 virtual void    setPremadeAabb(const btVector3& aabbMin, const btVector3& aabbMax ) const
00076                 {
00077                         (void) aabbMin;
00078                         (void) aabbMax;
00079                 }
00080                 virtual void    getPremadeAabb(btVector3* aabbMin, btVector3* aabbMax ) const
00081         {
00082             (void) aabbMin;
00083             (void) aabbMax;
00084         }
00085 
00086                 const btVector3&        getScaling() const {
00087                         return m_scaling;
00088                 }
00089                 void    setScaling(const btVector3& scaling)
00090                 {
00091                         m_scaling = scaling;
00092                 }
00093 
00094                 virtual int     calculateSerializeBufferSize() const;
00095 
00097                 virtual const char*     serialize(void* dataBuffer, btSerializer* serializer) const;
00098 
00099 
00100 };
00101 
00102 struct  btIntIndexData
00103 {
00104         int     m_value;
00105 };
00106 
00107 struct  btShortIntIndexData
00108 {
00109         short int       m_value;
00110 };
00111 
00113 struct  btMeshPartData
00114 {
00115         btVector3FloatData                      *m_vertices3f;
00116         btVector3DoubleData                     *m_vertices3d;
00117 
00118         btIntIndexData                  *m_indices32;
00119         btShortIntIndexData             *m_indices16;
00120         int                     m_numTriangles;//length of m_indices = 3*m_numTriangles
00121         int                     m_numVertices;
00122 };
00123 
00124 
00126 struct  btStridingMeshInterfaceData
00127 {
00128         btMeshPartData  *m_meshPartsPtr;
00129         btVector3FloatData      m_scaling;
00130         int     m_numMeshParts;
00131         char m_padding[4];
00132 };
00133 
00134 
00135 
00136 
00137 SIMD_FORCE_INLINE       int     btStridingMeshInterface::calculateSerializeBufferSize() const
00138 {
00139         return sizeof(btStridingMeshInterfaceData);
00140 }
00141 
00142 
00143 
00144 #endif //STRIDING_MESHINTERFACE_H

Generated on Mon Feb 15 22:17:07 2010 for Bullet Collision Detection & Physics Library by  doxygen 1.6.1