Blender V4.3
btMultimaterialTriangleMeshShape.h
Go to the documentation of this file.
1/*
2Bullet Continuous Collision Detection and Physics Library
3Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
4
5This software is provided 'as-is', without any express or implied warranty.
6In no event will the authors be held liable for any damages arising from the use of this software.
7Permission is granted to anyone to use this software for any purpose,
8including commercial applications, and to alter it and redistribute it freely,
9subject to the following restrictions:
10
111. 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.
122. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
133. This notice may not be removed or altered from any source distribution.
14*/
15
17
18#ifndef BT_BVH_TRIANGLE_MATERIAL_MESH_SHAPE_H
19#define BT_BVH_TRIANGLE_MATERIAL_MESH_SHAPE_H
20
22#include "btMaterial.h"
23
27{
29
30public:
32
33 btMultimaterialTriangleMeshShape(btStridingMeshInterface * meshInterface, bool useQuantizedAabbCompression, bool buildBvh = true) : btBvhTriangleMeshShape(meshInterface, useQuantizedAabbCompression, buildBvh)
34 {
36
37 const unsigned char *vertexbase;
38 int numverts;
39 PHY_ScalarType type;
40 int stride;
41 const unsigned char *indexbase;
42 int indexstride;
43 int numfaces;
44 PHY_ScalarType indicestype;
45
46 //m_materialLookup = (int**)(btAlignedAlloc(sizeof(int*) * meshInterface->getNumSubParts(), 16));
47
48 for (int i = 0; i < meshInterface->getNumSubParts(); i++)
49 {
50 m_meshInterface->getLockedReadOnlyVertexIndexBase(
51 &vertexbase,
52 numverts,
53 type,
54 stride,
55 &indexbase,
56 indexstride,
57 numfaces,
58 indicestype,
59 i);
60 //m_materialLookup[i] = (int*)(btAlignedAlloc(sizeof(int) * numfaces, 16));
61 }
62 }
63
65 btMultimaterialTriangleMeshShape(btStridingMeshInterface * meshInterface, bool useQuantizedAabbCompression, const btVector3 &bvhAabbMin, const btVector3 &bvhAabbMax, bool buildBvh = true) : btBvhTriangleMeshShape(meshInterface, useQuantizedAabbCompression, bvhAabbMin, bvhAabbMax, buildBvh)
66 {
68
69 const unsigned char *vertexbase;
70 int numverts;
71 PHY_ScalarType type;
72 int stride;
73 const unsigned char *indexbase;
74 int indexstride;
75 int numfaces;
76 PHY_ScalarType indicestype;
77
78 //m_materialLookup = (int**)(btAlignedAlloc(sizeof(int*) * meshInterface->getNumSubParts(), 16));
79
80 for (int i = 0; i < meshInterface->getNumSubParts(); i++)
81 {
82 m_meshInterface->getLockedReadOnlyVertexIndexBase(
83 &vertexbase,
84 numverts,
85 type,
86 stride,
87 &indexbase,
88 indexstride,
89 numfaces,
90 indicestype,
91 i);
92 //m_materialLookup[i] = (int*)(btAlignedAlloc(sizeof(int) * numfaces * 2, 16));
93 }
94 }
95
97 {
98 /*
99 for(int i = 0; i < m_meshInterface->getNumSubParts(); i++)
100 {
101 btAlignedFree(m_materialValues[i]);
102 m_materialLookup[i] = NULL;
103 }
104 btAlignedFree(m_materialValues);
105 m_materialLookup = NULL;
106*/
107 }
108 //debugging
109 virtual const char *getName() const { return "MULTIMATERIALTRIANGLEMESH"; }
110
112 const btMaterial *getMaterialProperties(int partID, int triIndex);
113};
114
115#endif //BT_BVH_TRIANGLE_MATERIAL_MESH_SHAPE_H
@ MULTIMATERIAL_TRIANGLE_MESH_PROXYTYPE
Multimaterial mesh.
btBvhTriangleMeshShape(btStridingMeshInterface *meshInterface, bool useQuantizedAabbCompression, bool buildBvh=true)
PHY_ScalarType
BT_DECLARE_ALIGNED_ALLOCATOR()
virtual const char * getName() const
virtual ~btMultimaterialTriangleMeshShape()
const btMaterial * getMaterialProperties(int partID, int triIndex)
Obtains the material for a specific triangle.
btMultimaterialTriangleMeshShape(btStridingMeshInterface *meshInterface, bool useQuantizedAabbCompression, bool buildBvh=true)
#define ATTRIBUTE_ALIGNED16(a)
Definition btScalar.h:285
btStridingMeshInterface
btStridingMeshInterface * m_meshInterface
This file was created by Alex Silverman.
Definition btMaterial.h:23