Blender V2.61 - r43446

btTriangleIndexVertexMaterialArray.h

Go to the documentation of this file.
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 
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