mirror of
https://github.com/bulletphysics/bullet3.git
synced 2026-08-19 09:39:50 +00:00
fixes in cached textures (pointer re-use)
This commit is contained in:
@@ -684,7 +684,7 @@ public:
|
||||
|
||||
GUIHelperInterface* m_childGuiHelper;
|
||||
|
||||
|
||||
btHashMap<btHashPtr, int> m_cachedTextureIds;
|
||||
int m_uidGenerator;
|
||||
const unsigned char* m_texels;
|
||||
int m_textureWidth;
|
||||
@@ -910,7 +910,11 @@ public:
|
||||
}
|
||||
virtual int registerTexture(const unsigned char* texels, int width, int height)
|
||||
{
|
||||
|
||||
int* cachedTexture = m_cachedTextureIds[texels];
|
||||
if (cachedTexture)
|
||||
{
|
||||
return *cachedTexture;
|
||||
}
|
||||
m_texels = texels;
|
||||
m_textureWidth = width;
|
||||
m_textureHeight = height;
|
||||
@@ -919,7 +923,7 @@ public:
|
||||
m_cs->setSharedParam(1, eGUIHelperRegisterTexture);
|
||||
|
||||
workerThreadWait();
|
||||
|
||||
m_cachedTextureIds.insert(texels, m_textureId);
|
||||
return m_textureId;
|
||||
}
|
||||
virtual int registerGraphicsShape(const float* vertices, int numvertices, const int* indices, int numIndices, int primitiveType, int textureId)
|
||||
@@ -973,6 +977,7 @@ public:
|
||||
|
||||
virtual void removeAllGraphicsInstances()
|
||||
{
|
||||
m_cachedTextureIds.clear();
|
||||
m_cs->lock();
|
||||
m_cs->setSharedParam(1, eGUIHelperRemoveAllGraphicsInstances);
|
||||
workerThreadWait();
|
||||
|
||||
Reference in New Issue
Block a user