Implementation of virtual void CommonRenderInterface::removeGraphicsInstance(int instanceUid)

for GLInstancingRenderer (OpenGL3+) and SimpleOpenGL2Renderer (OpenGL2)
Refactored the add/remove object pool in Bullet3Common/b3ResizablePool.h
Added CommonRigidBodyBase::deleteRigidBody, also removing its graphics instance.
This commit is contained in:
Erwin Coumans
2017-05-03 17:05:05 -07:00
parent 6f7601966d
commit 152e3da3e4
12 changed files with 316 additions and 62 deletions

View File

@@ -410,6 +410,18 @@ struct CommonRigidBodyBase : public CommonExampleInterface
return box;
}
void deleteRigidBody(btRigidBody* body)
{
int graphicsUid = body->getUserIndex();
m_guiHelper->removeGraphicsInstance(graphicsUid);
m_dynamicsWorld->removeRigidBody(body);
btMotionState* ms = body->getMotionState();
delete body;
delete ms;
}
btRigidBody* createRigidBody(float mass, const btTransform& startTransform, btCollisionShape* shape, const btVector4& color = btVector4(1, 0, 0, 1))
{
btAssert((!shape || shape->getShapeType() != INVALID_SHAPE_PROXYTYPE));