Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00017
00018 #ifndef BT_BVH_TRIANGLE_MATERIAL_MESH_SHAPE_H
00019 #define BT_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(btStridingMeshInterface* meshInterface, bool useQuantizedAabbCompression, bool buildBvh = true):
00035 btBvhTriangleMeshShape(meshInterface, useQuantizedAabbCompression, buildBvh)
00036 {
00037 m_shapeType = MULTIMATERIAL_TRIANGLE_MESH_PROXYTYPE;
00038
00039 const unsigned char *vertexbase;
00040 int numverts;
00041 PHY_ScalarType type;
00042 int stride;
00043 const unsigned char *indexbase;
00044 int indexstride;
00045 int numfaces;
00046 PHY_ScalarType indicestype;
00047
00048
00049
00050 for(int i = 0; i < meshInterface->getNumSubParts(); i++)
00051 {
00052 m_meshInterface->getLockedReadOnlyVertexIndexBase(
00053 &vertexbase,
00054 numverts,
00055 type,
00056 stride,
00057 &indexbase,
00058 indexstride,
00059 numfaces,
00060 indicestype,
00061 i);
00062
00063 }
00064 }
00065
00067 btMultimaterialTriangleMeshShape(btStridingMeshInterface* meshInterface, bool useQuantizedAabbCompression,const btVector3& bvhAabbMin,const btVector3& bvhAabbMax, bool buildBvh = true):
00068 btBvhTriangleMeshShape(meshInterface, useQuantizedAabbCompression, bvhAabbMin, bvhAabbMax, buildBvh)
00069 {
00070 m_shapeType = MULTIMATERIAL_TRIANGLE_MESH_PROXYTYPE;
00071
00072 const unsigned char *vertexbase;
00073 int numverts;
00074 PHY_ScalarType type;
00075 int stride;
00076 const unsigned char *indexbase;
00077 int indexstride;
00078 int numfaces;
00079 PHY_ScalarType indicestype;
00080
00081
00082
00083 for(int i = 0; i < meshInterface->getNumSubParts(); i++)
00084 {
00085 m_meshInterface->getLockedReadOnlyVertexIndexBase(
00086 &vertexbase,
00087 numverts,
00088 type,
00089 stride,
00090 &indexbase,
00091 indexstride,
00092 numfaces,
00093 indicestype,
00094 i);
00095
00096 }
00097 }
00098
00099 virtual ~btMultimaterialTriangleMeshShape()
00100 {
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110 }
00111
00112 virtual const char* getName()const {return "MULTIMATERIALTRIANGLEMESH";}
00113
00115 const btMaterial * getMaterialProperties(int partID, int triIndex);
00116
00117 }
00118 ;
00119
00120 #endif //BT_BVH_TRIANGLE_MATERIAL_MESH_SHAPE_H