5
5
This software is provided 'as-is', without any express or implied warranty.
6
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,
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
9
subject to the following restrictions:
11
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.
16
16
#include "btTriangleIndexVertexArray.h"
18
18
btTriangleIndexVertexArray::btTriangleIndexVertexArray(int numTriangles,int* triangleIndexBase,int triangleIndexStride,int numVertices,btScalar* vertexBase,int vertexStride)
20
21
btIndexedMesh mesh;
22
23
mesh.m_numTriangles = numTriangles;
23
24
mesh.m_triangleIndexBase = (const unsigned char *)triangleIndexBase;
24
25
mesh.m_triangleIndexStride = triangleIndexStride;
25
26
mesh.m_numVertices = numVertices;
26
27
mesh.m_vertexBase = (const unsigned char *)vertexBase;
27
28
mesh.m_vertexStride = vertexStride;
29
30
addIndexedMesh(mesh);
34
btTriangleIndexVertexArray::~btTriangleIndexVertexArray()
33
39
void btTriangleIndexVertexArray::getLockedVertexIndexBase(unsigned char **vertexbase, int& numverts,PHY_ScalarType& type, int& vertexStride,unsigned char **indexbase,int & indexstride,int& numfaces,PHY_ScalarType& indicestype,int subpart)
35
41
btAssert(subpart< getNumSubParts() );
37
43
btIndexedMesh& mesh = m_indexedMeshes[subpart];
39
45
numverts = mesh.m_numVertices;
40
46
(*vertexbase) = (unsigned char *) mesh.m_vertexBase;
47
#ifdef BT_USE_DOUBLE_PRECISION
42
52
vertexStride = mesh.m_vertexStride;
44
54
numfaces = mesh.m_numTriangles;
46
56
(*indexbase) = (unsigned char *)mesh.m_triangleIndexBase;
47
57
indexstride = mesh.m_triangleIndexStride;
48
indicestype = PHY_INTEGER;
58
indicestype = mesh.m_indexType;
51
61
void btTriangleIndexVertexArray::getLockedReadOnlyVertexIndexBase(const unsigned char **vertexbase, int& numverts,PHY_ScalarType& type, int& vertexStride,const unsigned char **indexbase,int & indexstride,int& numfaces,PHY_ScalarType& indicestype,int subpart) const
55
65
numverts = mesh.m_numVertices;
56
66
(*vertexbase) = (const unsigned char *)mesh.m_vertexBase;
67
#ifdef BT_USE_DOUBLE_PRECISION
58
72
vertexStride = mesh.m_vertexStride;
60
74
numfaces = mesh.m_numTriangles;
61
75
(*indexbase) = (const unsigned char *)mesh.m_triangleIndexBase;
62
76
indexstride = mesh.m_triangleIndexStride;
63
indicestype = PHY_INTEGER;
77
indicestype = mesh.m_indexType;
80
bool btTriangleIndexVertexArray::hasPremadeAabb() const
82
return (m_hasAabb == 1);
85
void btTriangleIndexVertexArray::setPremadeAabb(const btVector3& aabbMin, const btVector3& aabbMax )
89
m_hasAabb = 1; // this is intentionally an int see notes in header
92
void btTriangleIndexVertexArray::getPremadeAabb(btVector3* aabbMin, btVector3* aabbMax ) const