00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00017
00018 #ifndef BT_MULTIMATERIAL_TRIANGLE_INDEX_VERTEX_ARRAY_H
00019 #define BT_MULTIMATERIAL_TRIANGLE_INDEX_VERTEX_ARRAY_H
00020
00021 #include "btTriangleIndexVertexArray.h"
00022
00023
00024 ATTRIBUTE_ALIGNED16( struct) btMaterialProperties
00025 {
00027 int m_numMaterials;
00028 const unsigned char * m_materialBase;
00029 int m_materialStride;
00030 PHY_ScalarType m_materialType;
00035 int m_numTriangles;
00036 const unsigned char * m_triangleMaterialsBase;
00037 int m_triangleMaterialStride;
00039 PHY_ScalarType m_triangleType;
00040 };
00041
00042 typedef btAlignedObjectArray<btMaterialProperties> MaterialArray;
00043
00050 ATTRIBUTE_ALIGNED16(class) btTriangleIndexVertexMaterialArray : public btTriangleIndexVertexArray
00051 {
00052 protected:
00053 MaterialArray m_materials;
00054
00055 public:
00056 BT_DECLARE_ALIGNED_ALLOCATOR();
00057
00058 btTriangleIndexVertexMaterialArray()
00059 {
00060 }
00061
00062 btTriangleIndexVertexMaterialArray(int numTriangles,int* triangleIndexBase,int triangleIndexStride,
00063 int numVertices,btScalar* vertexBase,int vertexStride,
00064 int numMaterials, unsigned char* materialBase, int materialStride,
00065 int* triangleMaterialsBase, int materialIndexStride);
00066
00067 virtual ~btTriangleIndexVertexMaterialArray() {}
00068
00069 void addMaterialProperties(const btMaterialProperties& mat, PHY_ScalarType triangleType = PHY_INTEGER)
00070 {
00071 m_materials.push_back(mat);
00072 m_materials[m_materials.size()-1].m_triangleType = triangleType;
00073 }
00074
00075 virtual void getLockedMaterialBase(unsigned char **materialBase, int& numMaterials, PHY_ScalarType& materialType, int& materialStride,
00076 unsigned char ** triangleMaterialBase, int& numTriangles, int& triangleMaterialStride, PHY_ScalarType& triangleType ,int subpart = 0);
00077
00078 virtual void getLockedReadOnlyMaterialBase(const unsigned char **materialBase, int& numMaterials, PHY_ScalarType& materialType, int& materialStride,
00079 const unsigned char ** triangleMaterialBase, int& numTriangles, int& triangleMaterialStride, PHY_ScalarType& triangleType, int subpart = 0);
00080
00081 }
00082 ;
00083
00084 #endif //BT_MULTIMATERIAL_TRIANGLE_INDEX_VERTEX_ARRAY_H