fix assert condition

This commit is contained in:
Irlan Robson
2018-02-24 19:21:45 -03:00
parent c5eabe3b9c
commit 3da2a25bd7
2 changed files with 7 additions and 12 deletions

View File

@ -131,20 +131,20 @@ private :
inline const b3AABB3& b3DynamicTree::GetAABB(i32 proxyId) const
{
B3_ASSERT(proxyId < m_nodeCount);
B3_ASSERT(proxyId != NULL_NODE && proxyId < m_nodeCapacity);
return m_nodes[proxyId].aabb;
}
inline void* b3DynamicTree::GetUserData(i32 proxyId) const
{
B3_ASSERT(proxyId < m_nodeCount);
B3_ASSERT(proxyId != NULL_NODE && proxyId < m_nodeCapacity);
return m_nodes[proxyId].userData;
}
inline bool b3DynamicTree::TestOverlap(i32 proxy1, i32 proxy2) const
{
B3_ASSERT(proxy1 < m_nodeCount);
B3_ASSERT(proxy2 < m_nodeCount);
B3_ASSERT(proxy1 != NULL_NODE && proxy1 < m_nodeCapacity);
B3_ASSERT(proxy2 != NULL_NODE && proxy2 < m_nodeCapacity);
return b3TestOverlap(m_nodes[proxy1].aabb, m_nodes[proxy2].aabb);
}

View File

@ -76,7 +76,7 @@ i32 b3DynamicTree::AllocateNode()
void b3DynamicTree::FreeNode(i32 node)
{
B3_ASSERT(node >= 0 && node < m_nodeCapacity);
B3_ASSERT(node != NULL_NODE && node < m_nodeCapacity);
m_nodes[node].next = m_freeList;
m_nodes[node].height = -1;
m_freeList = node;
@ -364,11 +364,6 @@ void b3DynamicTree::Validate(i32 nodeID) const
void b3DynamicTree::Draw(b3Draw* draw) const
{
b3Color red = b3Color(1.0f, 0.0f, 0.0f);
b3Color green = b3Color(0.0f, 1.0f, 0.0f);
b3Color blue = b3Color(0.0f, 0.0f, 1.0f);
b3Color purple = b3Color(1.0f, 0.0f, 1.0f);
if (m_nodeCount == 0)
{
return;
@ -390,11 +385,11 @@ void b3DynamicTree::Draw(b3Draw* draw) const
const b3Node* node = m_nodes + nodeIndex;
if (node->IsLeaf())
{
draw->DrawAABB(node->aabb, purple);
draw->DrawAABB(node->aabb, b3Color_pink);
}
else
{
draw->DrawAABB(node->aabb, red);
draw->DrawAABB(node->aabb, b3Color_red);
stack.Push(node->child1);
stack.Push(node->child2);