Blender V2.61 - r43446
|
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 m_value; 00110 char m_pad[2]; 00111 }; 00112 00113 struct btShortIntIndexTripletData 00114 { 00115 short m_values[3]; 00116 char m_pad[2]; 00117 }; 00118 00119 struct btCharIndexTripletData 00120 { 00121 unsigned char m_values[3]; 00122 char m_pad; 00123 }; 00124 00125 00127 struct btMeshPartData 00128 { 00129 btVector3FloatData *m_vertices3f; 00130 btVector3DoubleData *m_vertices3d; 00131 00132 btIntIndexData *m_indices32; 00133 btShortIntIndexTripletData *m_3indices16; 00134 btCharIndexTripletData *m_3indices8; 00135 00136 btShortIntIndexData *m_indices16;//backwards compatibility 00137 00138 int m_numTriangles;//length of m_indices = m_numTriangles 00139 int m_numVertices; 00140 }; 00141 00142 00144 struct btStridingMeshInterfaceData 00145 { 00146 btMeshPartData *m_meshPartsPtr; 00147 btVector3FloatData m_scaling; 00148 int m_numMeshParts; 00149 char m_padding[4]; 00150 }; 00151 00152 00153 00154 00155 SIMD_FORCE_INLINE int btStridingMeshInterface::calculateSerializeBufferSize() const 00156 { 00157 return sizeof(btStridingMeshInterfaceData); 00158 } 00159 00160 00161 00162 #endif //STRIDING_MESHINTERFACE_H