Bullet Collision Detection & Physics Library: btTriangleIndexVertexMaterialArray.h Source File

Bullet Collision Detection & Physics Library

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

btTriangleIndexVertexMaterialArray.h
Go to the documentation of this file.
1 /*
2 Bullet Continuous Collision Detection and Physics Library
3 Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
4
5 This software is provided 'as-is', without any express or implied warranty.
6 In no event will the authors be held liable for any damages arising from the use of this software.
7 Permission is granted to anyone to use this software for any purpose,
8 including commercial applications, and to alter it and redistribute it freely,
9 subject to the following restrictions:
10
11 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.
12 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
13 3. This notice may not be removed or altered from any source distribution.
14 */
15
17
18 #ifndef BT_MULTIMATERIAL_TRIANGLE_INDEX_VERTEX_ARRAY_H
19 #define BT_MULTIMATERIAL_TRIANGLE_INDEX_VERTEX_ARRAY_H
20
21 #include "btTriangleIndexVertexArray.h"
22
23
24 ATTRIBUTE_ALIGNED16( struct) btMaterialProperties
25 {
27 int m_numMaterials;
28 const unsigned char * m_materialBase;
29 int m_materialStride;
30 PHY_ScalarType m_materialType;
35 int m_numTriangles;
36 const unsigned char * m_triangleMaterialsBase;
37 int m_triangleMaterialStride;
39 PHY_ScalarType m_triangleType;
40 };
41
42 typedef btAlignedObjectArray<btMaterialProperties> MaterialArray;
43
50 ATTRIBUTE_ALIGNED16(class) btTriangleIndexVertexMaterialArray : public btTriangleIndexVertexArray
51 {
52 protected:
53 MaterialArray m_materials;
54
55 public:
56 BT_DECLARE_ALIGNED_ALLOCATOR();
57
58 btTriangleIndexVertexMaterialArray()
59 {
60 }
61
62 btTriangleIndexVertexMaterialArray(int numTriangles,int* triangleIndexBase,int triangleIndexStride,
63 int numVertices,btScalar* vertexBase,int vertexStride,
64 int numMaterials, unsigned char* materialBase, int materialStride,
65 int* triangleMaterialsBase, int materialIndexStride);
66
67 virtual ~btTriangleIndexVertexMaterialArray() {}
68
69 void addMaterialProperties(const btMaterialProperties& mat, PHY_ScalarType triangleType = PHY_INTEGER)
70 {
71 m_materials.push_back(mat);
72 m_materials[m_materials.size()-1].m_triangleType = triangleType;
73 }
74
75 virtual void getLockedMaterialBase(unsigned char **materialBase, int& numMaterials, PHY_ScalarType& materialType, int& materialStride,
76 unsigned char ** triangleMaterialBase, int& numTriangles, int& triangleMaterialStride, PHY_ScalarType& triangleType ,int subpart = 0);
77
78 virtual void getLockedReadOnlyMaterialBase(const unsigned char **materialBase, int& numMaterials, PHY_ScalarType& materialType, int& materialStride,
79 const unsigned char ** triangleMaterialBase, int& numTriangles, int& triangleMaterialStride, PHY_ScalarType& triangleType, int subpart = 0);
80
81 }
82 ;
83
84 #endif //BT_MULTIMATERIAL_TRIANGLE_INDEX_VERTEX_ARRAY_H
btMaterialProperties::m_numMaterials
int m_numMaterials
m_materialBase ==========> 2 btScalar values make up one material, friction then restitution ...
Definition: btTriangleIndexVertexMaterialArray.h:27
btMaterialProperties::m_numTriangles
int m_numTriangles
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 m_triangleMaterials =====> 1 integer value makes up one entry eg: m_triangleMaterials[1] = 5; // This will set triangle 2 to use material 5
Definition: btTriangleIndexVertexMaterialArray.h:35
btAlignedObjectArray::push_back
void push_back(const T &_Val)
Definition: btAlignedObjectArray.h:276
btAlignedObjectArray< btMaterialProperties >
btMaterialProperties::m_materialStride
int m_materialStride
Definition: btTriangleIndexVertexMaterialArray.h:29
btTriangleIndexVertexMaterialArray::btTriangleIndexVertexMaterialArray
btTriangleIndexVertexMaterialArray()
Definition: btTriangleIndexVertexMaterialArray.h:58
btMaterialProperties::m_triangleMaterialsBase
const unsigned char * m_triangleMaterialsBase
Definition: btTriangleIndexVertexMaterialArray.h:36
btTriangleIndexVertexArray.h
btTriangleIndexVertexMaterialArray::addMaterialProperties
void addMaterialProperties(const btMaterialProperties &mat, PHY_ScalarType triangleType=PHY_INTEGER)
Definition: btTriangleIndexVertexMaterialArray.h:69
btTriangleIndexVertexArray
The btTriangleIndexVertexArray allows to access multiple triangle meshes, by indexing into existing t...
Definition: btTriangleIndexVertexArray.h:68
btAlignedObjectArray::size
int size() const
return the number of elements in the array
Definition: btAlignedObjectArray.h:149
btMaterialProperties::m_materialType
PHY_ScalarType m_materialType
Definition: btTriangleIndexVertexMaterialArray.h:30
btTriangleIndexVertexMaterialArray
Teh btTriangleIndexVertexMaterialArray is built on TriangleIndexVertexArray The addition of a materia...
Definition: btTriangleIndexVertexMaterialArray.h:50
ATTRIBUTE_ALIGNED16
#define ATTRIBUTE_ALIGNED16(a)
Definition: btScalar.h:64
btTriangleIndexVertexMaterialArray::m_materials
MaterialArray m_materials
Definition: btTriangleIndexVertexMaterialArray.h:53
MaterialArray
btAlignedObjectArray< btMaterialProperties > MaterialArray
Definition: btTriangleIndexVertexMaterialArray.h:42
btMaterialProperties::m_triangleType
PHY_ScalarType m_triangleType
m_triangleType <========== Automatically set in addMaterialProperties
Definition: btTriangleIndexVertexMaterialArray.h:39
PHY_INTEGER
Definition: btConcaveShape.h:28
BT_DECLARE_ALIGNED_ALLOCATOR
#define BT_DECLARE_ALIGNED_ALLOCATOR()
Definition: btScalar.h:388
btMaterialProperties::m_triangleMaterialStride
int m_triangleMaterialStride
Definition: btTriangleIndexVertexMaterialArray.h:37
btMaterialProperties::m_materialBase
const unsigned char * m_materialBase
Definition: btTriangleIndexVertexMaterialArray.h:28
btTriangleIndexVertexMaterialArray::~btTriangleIndexVertexMaterialArray
virtual ~btTriangleIndexVertexMaterialArray()
Definition: btTriangleIndexVertexMaterialArray.h:67
btMaterialProperties
This file was created by Alex Silverman.
Definition: btTriangleIndexVertexMaterialArray.h:24
btScalar
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
Definition: btScalar.h:278
PHY_ScalarType
PHY_ScalarType
PHY_ScalarType enumerates possible scalar types.
Definition: btConcaveShape.h:25