PyBullet: free cached textures
PyBullet: bool PhysicsServerCommandProcessor::pickBody, disable collision filtering to allow picking of all objects
This commit is contained in:
@@ -30,6 +30,27 @@ struct CachedTextureResult
|
||||
};
|
||||
|
||||
static b3HashMap<b3HashString, CachedTextureResult> gCachedTextureResults;
|
||||
struct CachedTextureManager
|
||||
{
|
||||
CachedTextureManager()
|
||||
{
|
||||
}
|
||||
virtual ~CachedTextureManager()
|
||||
{
|
||||
for (int i=0;i<gCachedTextureResults.size();i++)
|
||||
{
|
||||
CachedTextureResult* res = gCachedTextureResults.getAtIndex(i);
|
||||
if (res)
|
||||
{
|
||||
free(res->m_pixels);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
static CachedTextureManager sTexCacheMgr;
|
||||
|
||||
|
||||
|
||||
|
||||
bool b3ImportMeshUtility::loadAndRegisterMeshFromFileInternal(const std::string& fileName, b3ImportMeshData& meshData)
|
||||
{
|
||||
|
||||
@@ -9186,6 +9186,22 @@ void PhysicsServerCommandProcessor::physicsDebugDraw(int debugDrawFlags)
|
||||
}
|
||||
|
||||
|
||||
struct MyResultCallback : public btCollisionWorld::ClosestRayResultCallback
|
||||
{
|
||||
MyResultCallback(const btVector3& rayFromWorld,const btVector3& rayToWorld)
|
||||
:btCollisionWorld::ClosestRayResultCallback(rayFromWorld, rayToWorld)
|
||||
{
|
||||
}
|
||||
|
||||
virtual bool needsCollision(btBroadphaseProxy* proxy0) const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
bool PhysicsServerCommandProcessor::pickBody(const btVector3& rayFromWorld, const btVector3& rayToWorld)
|
||||
{
|
||||
@@ -9193,8 +9209,8 @@ bool PhysicsServerCommandProcessor::pickBody(const btVector3& rayFromWorld, cons
|
||||
if (m_data->m_dynamicsWorld==0)
|
||||
return false;
|
||||
|
||||
btCollisionWorld::ClosestRayResultCallback rayCallback(rayFromWorld, rayToWorld);
|
||||
|
||||
//btCollisionWorld::ClosestRayResultCallback rayCallback(rayFromWorld, rayToWorld);
|
||||
MyResultCallback rayCallback(rayFromWorld, rayToWorld);
|
||||
m_data->m_dynamicsWorld->rayTest(rayFromWorld, rayToWorld, rayCallback);
|
||||
if (rayCallback.hasHit())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user