Bug fix for btOptimizedBvh

ole.k
Posts: 17
Joined: Thu Jun 12, 2008 1:32 pm

Bug fix for btOptimizedBvh

Post by ole.k »

btOptimizedBvh::updateBvhNodes uses the variable curNodeSubPart to remember which part of a mesh is currently locked. If the part of the current node differs from curNodeSubPart, the old part has to be unlocked and the new one has to be locked. But the assignment of the new part index to curNodeSubPart is missing. The assignment

curNodeSubPart = nodeSubPart;

has to be added within

if (nodeSubPart != curNodeSubPart)
{
...
}
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Bug fix for btOptimizedBvh

Post by Erwin Coumans »

We changed it into:

Code: Select all

 if (nodeSubPart != curNodeSubPart)
{
	if (curNodeSubPart >= 0)
	meshInterface->unLockReadOnlyVertexBase(curNodeSubPart);
	meshInterface->getLockedReadOnlyVertexIndexBase(&vertexbase,numverts, type,stride,&indexbase,indexstride,numfaces,indicestype,nodeSubPart);

	curNodeSubPart = nodeSubPart;
	btAssert(indicestype==PHY_INTEGER||indicestype==PHY_SHORT);
}
Can you double check this is correct?
Thanks,
Erwin
ole.k
Posts: 17
Joined: Thu Jun 12, 2008 1:32 pm

Re: Bug fix for btOptimizedBvh

Post by ole.k »

Erwin Coumans wrote:Can you double check this is correct?
Thanks,
Erwin
Yes, it looks correct.