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:
@@ -37,7 +37,8 @@ struct GUIHelperInterface
|
||||
virtual int registerGraphicsShape(const float* vertices, int numvertices, const int* indices, int numIndices,int primitiveType, int textureId) = 0;
|
||||
virtual int registerGraphicsInstance(int shapeIndex, const float* position, const float* quaternion, const float* color, const float* scaling) =0;
|
||||
virtual void removeAllGraphicsInstances()=0;
|
||||
|
||||
virtual void removeGraphicsInstance(int graphicsUid)=0;
|
||||
|
||||
virtual Common2dCanvasInterface* get2dCanvasInterface()=0;
|
||||
|
||||
virtual CommonParameterInterface* getParameterInterface()=0;
|
||||
@@ -123,7 +124,8 @@ struct DummyGUIHelper : public GUIHelperInterface
|
||||
virtual int registerGraphicsShape(const float* vertices, int numvertices, const int* indices, int numIndices,int primitiveType, int textureId){return -1;}
|
||||
virtual int registerGraphicsInstance(int shapeIndex, const float* position, const float* quaternion, const float* color, const float* scaling) {return -1;}
|
||||
virtual void removeAllGraphicsInstances(){}
|
||||
|
||||
virtual void removeGraphicsInstance(int graphicsUid){}
|
||||
|
||||
virtual Common2dCanvasInterface* get2dCanvasInterface()
|
||||
{
|
||||
return 0;
|
||||
|
||||
@@ -23,7 +23,8 @@ struct CommonRenderInterface
|
||||
virtual void init()=0;
|
||||
virtual void updateCamera(int upAxis)=0;
|
||||
virtual void removeAllInstances() = 0;
|
||||
|
||||
virtual void removeGraphicsInstance(int instanceUid) = 0;
|
||||
|
||||
virtual const CommonCameraInterface* getActiveCamera() const =0;
|
||||
virtual CommonCameraInterface* getActiveCamera()=0;
|
||||
virtual void setActiveCamera(CommonCameraInterface* cam)=0;
|
||||
|
||||
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user