00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00017
00018 #ifndef BVH_TRIANGLE_MATERIAL_MESH_SHAPE_H
00019 #define BVH_TRIANGLE_MATERIAL_MESH_SHAPE_H
00020
00021 #include "btBvhTriangleMeshShape.h"
00022 #include "btMaterial.h"
00023
00025 ATTRIBUTE_ALIGNED16(class) btMultimaterialTriangleMeshShape : public btBvhTriangleMeshShape
00026 {
00027 btAlignedObjectArray <btMaterial*> m_materialList;
00028 int ** m_triangleMaterials;
00029
00030 public:
00031
00032 BT_DECLARE_ALIGNED_ALLOCATOR();
00033
00034 btMultimaterialTriangleMeshShape(): btBvhTriangleMeshShape() {m_shapeType = MULTIMATERIAL_TRIANGLE_MESH_PROXYTYPE;}
00035 btMultimaterialTriangleMeshShape(btStridingMeshInterface* meshInterface, bool useQuantizedAabbCompression, bool buildBvh = true):
00036 btBvhTriangleMeshShape(meshInterface, useQuantizedAabbCompression, buildBvh)
00037 {
00038 m_shapeType = MULTIMATERIAL_TRIANGLE_MESH_PROXYTYPE;
00039
00040 const unsigned char *vertexbase;
00041 int numverts;
00042 PHY_ScalarType type;
00043 int stride;
00044 const unsigned char *indexbase;
00045 int indexstride;
00046 int numfaces;
00047 PHY_ScalarType indicestype;
00048
00049
00050
00051 for(int i = 0; i < meshInterface->getNumSubParts(); i++)
00052 {
00053 m_meshInterface->getLockedReadOnlyVertexIndexBase(
00054 &vertexbase,
00055 numverts,
00056 type,
00057 stride,
00058 &indexbase,
00059 indexstride,
00060 numfaces,
00061 indicestype,
00062 i);
00063
00064 }
00065 }
00066
00068 btMultimaterialTriangleMeshShape(btStridingMeshInterface* meshInterface, bool useQuantizedAabbCompression,const btVector3& bvhAabbMin,const btVector3& bvhAabbMax, bool buildBvh = true):
00069 btBvhTriangleMeshShape(meshInterface, useQuantizedAabbCompression, bvhAabbMin, bvhAabbMax, buildBvh)
00070 {
00071 m_shapeType = MULTIMATERIAL_TRIANGLE_MESH_PROXYTYPE;
00072
00073 const unsigned char *vertexbase;
00074 int numverts;
00075 PHY_ScalarType type;
00076 int stride;
00077 const unsigned char *indexbase;
00078 int indexstride;
00079 int numfaces;
00080 PHY_ScalarType indicestype;
00081
00082
00083
00084 for(int i = 0; i < meshInterface->getNumSubParts(); i++)
00085 {
00086 m_meshInterface->getLockedReadOnlyVertexIndexBase(
00087 &vertexbase,
00088 numverts,
00089 type,
00090 stride,
00091 &indexbase,
00092 indexstride,
00093 numfaces,
00094 indicestype,
00095 i);
00096
00097 }
00098 }
00099
00100 virtual ~btMultimaterialTriangleMeshShape()
00101 {
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111 }
00112
00113 virtual const char* getName()const {return "MULTIMATERIALTRIANGLEMESH";}
00114
00116 const btMaterial * getMaterialProperties(int partID, int triIndex);
00117
00118 }
00119 ;
00120
00121 #endif //BVH_TRIANGLE_MATERIAL_MESH_SHAPE_H