mirror of
https://github.com/bulletphysics/bullet3
synced 2025-01-18 21:10:05 +00:00
Planar triangle meshes with zero extends (in any direction) could cause quantization failures (division by zero).
Added a positive value to quantization AABB (doesn't affect performance).
This commit is contained in:
parent
cf2337ed7b
commit
c1250cd26a
@ -326,10 +326,12 @@ void btOptimizedBvh::updateBvhNodes(btStridingMeshInterface* meshInterface,int f
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void btOptimizedBvh::setQuantizationValues(const btVector3& bvhAabbMin,const btVector3& bvhAabbMax)
|
void btOptimizedBvh::setQuantizationValues(const btVector3& bvhAabbMin,const btVector3& bvhAabbMax,btScalar quantizationMargin)
|
||||||
{
|
{
|
||||||
m_bvhAabbMin = bvhAabbMin;
|
//enlarge the AABB to avoid division by zero when initializing the quantization values
|
||||||
m_bvhAabbMax = bvhAabbMax;
|
btVector3 clampValue(quantizationMargin,quantizationMargin,quantizationMargin);
|
||||||
|
m_bvhAabbMin = bvhAabbMin - clampValue;
|
||||||
|
m_bvhAabbMax = bvhAabbMax + clampValue;
|
||||||
btVector3 aabbSize = m_bvhAabbMax - m_bvhAabbMin;
|
btVector3 aabbSize = m_bvhAabbMax - m_bvhAabbMin;
|
||||||
m_bvhQuantization = btVector3(btScalar(65535.0),btScalar(65535.0),btScalar(65535.0)) / aabbSize;
|
m_bvhQuantization = btVector3(btScalar(65535.0),btScalar(65535.0),btScalar(65535.0)) / aabbSize;
|
||||||
}
|
}
|
||||||
|
@ -205,7 +205,7 @@ ATTRIBUTE_ALIGNED16(class) btOptimizedBvh
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void setQuantizationValues(const btVector3& bvhAabbMin,const btVector3& bvhAabbMax);
|
void setQuantizationValues(const btVector3& bvhAabbMin,const btVector3& bvhAabbMax,btScalar quantizationMargin=btScalar(1.0));
|
||||||
|
|
||||||
void setInternalNodeEscapeIndex(int nodeIndex, int escapeIndex)
|
void setInternalNodeEscapeIndex(int nodeIndex, int escapeIndex)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user