Differential D8762 Diff 28333 extern/bullet2/src/BulletCollision/CollisionShapes/btTriangleIndexVertexMaterialArray.h
Changeset View
Changeset View
Standalone View
Standalone View
extern/bullet2/src/BulletCollision/CollisionShapes/btTriangleIndexVertexMaterialArray.h
| Show All 14 Lines | |||||
| ///This file was created by Alex Silverman | ///This file was created by Alex Silverman | ||||
| #ifndef BT_MULTIMATERIAL_TRIANGLE_INDEX_VERTEX_ARRAY_H | #ifndef BT_MULTIMATERIAL_TRIANGLE_INDEX_VERTEX_ARRAY_H | ||||
| #define BT_MULTIMATERIAL_TRIANGLE_INDEX_VERTEX_ARRAY_H | #define BT_MULTIMATERIAL_TRIANGLE_INDEX_VERTEX_ARRAY_H | ||||
| #include "btTriangleIndexVertexArray.h" | #include "btTriangleIndexVertexArray.h" | ||||
| ATTRIBUTE_ALIGNED16(struct) | |||||
| ATTRIBUTE_ALIGNED16( struct) btMaterialProperties | btMaterialProperties | ||||
| { | { | ||||
| ///m_materialBase ==========> 2 btScalar values make up one material, friction then restitution | ///m_materialBase ==========> 2 btScalar values make up one material, friction then restitution | ||||
| int m_numMaterials; | int m_numMaterials; | ||||
| const unsigned char * m_materialBase; | const unsigned char* m_materialBase; | ||||
| int m_materialStride; | int m_materialStride; | ||||
| PHY_ScalarType m_materialType; | PHY_ScalarType m_materialType; | ||||
| ///m_numTriangles <=========== This exists in the btIndexedMesh object for the same subpart, but since we're | ///m_numTriangles <=========== This exists in the btIndexedMesh object for the same subpart, but since we're | ||||
| /// padding the structure, it can be reproduced at no real cost | /// padding the structure, it can be reproduced at no real cost | ||||
| ///m_triangleMaterials =====> 1 integer value makes up one entry | ///m_triangleMaterials =====> 1 integer value makes up one entry | ||||
| /// eg: m_triangleMaterials[1] = 5; // This will set triangle 2 to use material 5 | /// eg: m_triangleMaterials[1] = 5; // This will set triangle 2 to use material 5 | ||||
| int m_numTriangles; | int m_numTriangles; | ||||
| const unsigned char * m_triangleMaterialsBase; | const unsigned char* m_triangleMaterialsBase; | ||||
| int m_triangleMaterialStride; | int m_triangleMaterialStride; | ||||
| ///m_triangleType <========== Automatically set in addMaterialProperties | ///m_triangleType <========== Automatically set in addMaterialProperties | ||||
| PHY_ScalarType m_triangleType; | PHY_ScalarType m_triangleType; | ||||
| }; | }; | ||||
| typedef btAlignedObjectArray<btMaterialProperties> MaterialArray; | typedef btAlignedObjectArray<btMaterialProperties> MaterialArray; | ||||
| ///Teh btTriangleIndexVertexMaterialArray is built on TriangleIndexVertexArray | ///Teh btTriangleIndexVertexMaterialArray is built on TriangleIndexVertexArray | ||||
| ///The addition of a material array allows for the utilization of the partID and | ///The addition of a material array allows for the utilization of the partID and | ||||
| ///triangleIndex that are returned in the ContactAddedCallback. As with | ///triangleIndex that are returned in the ContactAddedCallback. As with | ||||
| ///TriangleIndexVertexArray, no duplicate is made of the material data, so it | ///TriangleIndexVertexArray, no duplicate is made of the material data, so it | ||||
| ///is the users responsibility to maintain the array during the lifetime of the | ///is the users responsibility to maintain the array during the lifetime of the | ||||
| ///TriangleIndexVertexMaterialArray. | ///TriangleIndexVertexMaterialArray. | ||||
| ATTRIBUTE_ALIGNED16(class) btTriangleIndexVertexMaterialArray : public btTriangleIndexVertexArray | ATTRIBUTE_ALIGNED16(class) | ||||
| btTriangleIndexVertexMaterialArray : public btTriangleIndexVertexArray | |||||
| { | { | ||||
| protected: | protected: | ||||
| MaterialArray m_materials; | MaterialArray m_materials; | ||||
| public: | public: | ||||
| BT_DECLARE_ALIGNED_ALLOCATOR(); | BT_DECLARE_ALIGNED_ALLOCATOR(); | ||||
| btTriangleIndexVertexMaterialArray() | btTriangleIndexVertexMaterialArray() | ||||
| { | { | ||||
| } | } | ||||
| btTriangleIndexVertexMaterialArray(int numTriangles,int* triangleIndexBase,int triangleIndexStride, | btTriangleIndexVertexMaterialArray(int numTriangles, int* triangleIndexBase, int triangleIndexStride, | ||||
| int numVertices,btScalar* vertexBase,int vertexStride, | int numVertices, btScalar* vertexBase, int vertexStride, | ||||
| int numMaterials, unsigned char* materialBase, int materialStride, | int numMaterials, unsigned char* materialBase, int materialStride, | ||||
| int* triangleMaterialsBase, int materialIndexStride); | int* triangleMaterialsBase, int materialIndexStride); | ||||
| virtual ~btTriangleIndexVertexMaterialArray() {} | virtual ~btTriangleIndexVertexMaterialArray() {} | ||||
| void addMaterialProperties(const btMaterialProperties& mat, PHY_ScalarType triangleType = PHY_INTEGER) | void addMaterialProperties(const btMaterialProperties& mat, PHY_ScalarType triangleType = PHY_INTEGER) | ||||
| { | { | ||||
| m_materials.push_back(mat); | m_materials.push_back(mat); | ||||
| m_materials[m_materials.size()-1].m_triangleType = triangleType; | m_materials[m_materials.size() - 1].m_triangleType = triangleType; | ||||
| } | } | ||||
| virtual void getLockedMaterialBase(unsigned char **materialBase, int& numMaterials, PHY_ScalarType& materialType, int& materialStride, | virtual void getLockedMaterialBase(unsigned char** materialBase, int& numMaterials, PHY_ScalarType& materialType, int& materialStride, | ||||
| unsigned char ** triangleMaterialBase, int& numTriangles, int& triangleMaterialStride, PHY_ScalarType& triangleType ,int subpart = 0); | unsigned char** triangleMaterialBase, int& numTriangles, int& triangleMaterialStride, PHY_ScalarType& triangleType, int subpart = 0); | ||||
| virtual void getLockedReadOnlyMaterialBase(const unsigned char **materialBase, int& numMaterials, PHY_ScalarType& materialType, int& materialStride, | virtual void getLockedReadOnlyMaterialBase(const unsigned char** materialBase, int& numMaterials, PHY_ScalarType& materialType, int& materialStride, | ||||
| const unsigned char ** triangleMaterialBase, int& numTriangles, int& triangleMaterialStride, PHY_ScalarType& triangleType, int subpart = 0); | const unsigned char** triangleMaterialBase, int& numTriangles, int& triangleMaterialStride, PHY_ScalarType& triangleType, int subpart = 0); | ||||
| }; | |||||
| } | |||||
| ; | |||||
| #endif //BT_MULTIMATERIAL_TRIANGLE_INDEX_VERTEX_ARRAY_H | #endif //BT_MULTIMATERIAL_TRIANGLE_INDEX_VERTEX_ARRAY_H | ||||