16#if defined(_WIN32) || defined(__i386__)
17#define BT_USE_SSE_IN_API
31 m_unscaledPoints.resize(numPoints);
33 unsigned char* pointsAddress = (
unsigned char*)points;
35 for (
int i = 0; i < numPoints; i++)
38 m_unscaledPoints[i] =
btVector3(point[0], point[1], point[2]);
39 pointsAddress += stride;
45void btConvexHullShape::setLocalScaling(
const btVector3& scaling)
53 m_unscaledPoints.push_back(point);
58btVector3 btConvexHullShape::localGetSupportingVertexWithoutMargin(
const btVector3& vec)
const
64 if (0 < m_unscaledPoints.size())
67 int index = (
int)
scaled.maxDot(&m_unscaledPoints[0], m_unscaledPoints.size(),
maxDot);
74void btConvexHullShape::batchedUnitVectorGetSupportingVertexWithoutMargin(
const btVector3* vectors, btVector3* supportVerticesOut,
int numVectors)
const
79 for (
int i = 0; i < numVectors; i++)
85 for (
int j = 0; j < numVectors; j++)
88 if (0 < m_unscaledPoints.size())
90 int i = (
int)vec.maxDot(&m_unscaledPoints[0], m_unscaledPoints.size(), newDot);
92 supportVerticesOut[j][3] = newDot;
99btVector3 btConvexHullShape::localGetSupportingVertex(
const btVector3& vec)
const
105 btVector3 vecnorm = vec;
116void btConvexHullShape::optimizeConvexHull()
119 conv.compute(&m_unscaledPoints[0].
getX(),
sizeof(btVector3), m_unscaledPoints.size(), 0.f, 0.f);
121 m_unscaledPoints.resize(0);
122 for (
int i = 0; i < numVerts; i++)
124 m_unscaledPoints.push_back(conv.
vertices[i]);
130int btConvexHullShape::getNumVertices()
const
132 return m_unscaledPoints.size();
135int btConvexHullShape::getNumEdges()
const
137 return m_unscaledPoints.size();
140void btConvexHullShape::getEdge(
int i, btVector3& pa, btVector3& pb)
const
142 int index0 = i % m_unscaledPoints.size();
143 int index1 = (i + 1) % m_unscaledPoints.size();
148void btConvexHullShape::getVertex(
int i, btVector3& vtx)
const
153int btConvexHullShape::getNumPlanes()
const
158void btConvexHullShape::getPlane(btVector3&, btVector3&,
int)
const
164bool btConvexHullShape::isInside(
const btVector3&,
btScalar)
const
171const char* btConvexHullShape::serialize(
void* dataBuffer,
btSerializer* serializer)
const
177 int numElem = m_unscaledPoints.size();
179#ifdef BT_USE_DOUBLE_PRECISION
194 for (
int i = 0; i < numElem; i++, memPtr++)
196 m_unscaledPoints[i].serialize(*memPtr);
204 return "btConvexHullShapeData";
207void btConvexHullShape::project(
const btTransform& trans,
const btVector3& dir,
btScalar& minProj,
btScalar& maxProj, btVector3& witnesPtMin, btVector3& witnesPtMax)
const
213 int numVerts = m_unscaledPoints.size();
214 for (
int i = 0; i < numVerts; i++)
217 btVector3 pt = trans * vtx;
231 btVector3 localAxis = dir * trans.getBasis();
235 minProj = witnesPtMin.dot(dir);
236 maxProj = witnesPtMax.dot(dir);
239 if (minProj > maxProj)
242 btSwap(witnesPtMin, witnesPtMax);
SIMD_FORCE_INLINE btVector3 localGetSupportingVertexWithoutMargin(const btVector3 &vec) const
btConvexShape Interface
virtual btVector3 localGetSupportingVertex(const btVector3 &vec) const
@ CONVEX_HULL_SHAPE_PROXYTYPE
virtual btScalar getMargin() const =0
virtual void recalculateLocalAabb()
SIMD_FORCE_INLINE btVector3 getScaledPoint(int i) const
btMatrix3x3 scaled(const btVector3 &s) const
Create a scaled copy of the matrix.
SIMD_FORCE_INLINE const btScalar & getX() const
Return the x value.
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
SIMD_FORCE_INLINE void btSwap(T &a, T &b)
#define btVector3DataName
btVector3
btVector3 can be used to represent 3D points and vectors. It has an un-used w component to suit 16-by...
SIMD_FORCE_INLINE long maxDot(const btVector3 *array, long array_count, btScalar &dotOut) const
returns index of maximum dot product between this and vectors in array[]
SIMD_FORCE_INLINE int size() const
return the number of elements in the array
btAlignedObjectArray< btVector3 > vertices
The btPolyhedralConvexAabbCachingShape adds aabb caching to the btPolyhedralConvexShape.
virtual btChunk * allocate(size_t size, int numElements)=0
virtual void * getUniquePointer(void *oldPtr)=0
virtual void finalizeChunk(btChunk *chunk, const char *structType, int chunkCode, void *oldPtr)=0
draw_view push_constant(Type::INT, "radiance_src") .push_constant(Type capture_info_buf storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .push_constant(Type draw_view int
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
btVector3DoubleData * m_unscaledPointsDoublePtr
btVector3FloatData * m_unscaledPointsFloatPtr
btConvexInternalShapeData m_convexInternalShapeData