explicitly remove textures during resetSimulation

move glViewport to Win32Window
This commit is contained in:
erwincoumans
2018-02-21 23:22:16 -08:00
parent 15c46a0237
commit 73a4334e30
16 changed files with 102 additions and 5 deletions

View File

@@ -48,6 +48,7 @@ ATTRIBUTE_ALIGNED16(struct) BulletURDFInternalData
int m_bodyId;
btHashMap<btHashInt,UrdfMaterialColor> m_linkColors;
btAlignedObjectArray<btCollisionShape*> m_allocatedCollisionShapes;
btAlignedObjectArray<int> m_allocatedTextures;
mutable btAlignedObjectArray<btTriangleMesh*> m_allocatedMeshInterfaces;
btHashMap<btHashPtr, UrdfCollision> m_bulletCollisionShape2UrdfCollision;
@@ -1163,6 +1164,10 @@ int BulletURDFImporter::convertLinkVisualShapes(int linkIndex, const char* pathP
{
textureIndex = m_data->m_guiHelper->registerTexture(textures[0].textureData1,textures[0].m_width,textures[0].m_height);
if (textureIndex >= 0)
{
m_data->m_allocatedTextures.push_back(textureIndex);
}
}
{
B3_PROFILE("registerGraphicsShape");
@@ -1270,11 +1275,22 @@ int BulletURDFImporter::getNumAllocatedMeshInterfaces() const
}
btStridingMeshInterface* BulletURDFImporter::getAllocatedMeshInterface(int index)
{
return m_data->m_allocatedMeshInterfaces[index];
}
int BulletURDFImporter::getNumAllocatedTextures() const
{
return m_data->m_allocatedTextures.size();
}
int BulletURDFImporter::getAllocatedTexture(int index) const
{
return m_data->m_allocatedTextures[index];
}
class btCompoundShape* BulletURDFImporter::convertLinkCollisionShapes(int linkIndex, const char* pathPrefix, const btTransform& localInertiaFrame) const

View File

@@ -84,6 +84,9 @@ public:
virtual int getNumAllocatedMeshInterfaces() const;
virtual class btStridingMeshInterface* getAllocatedMeshInterface(int index);
virtual int getNumAllocatedTextures() const;
virtual int getAllocatedTexture(int index) const;
virtual void setEnableTinyRenderer(bool enable);
void convertURDFToVisualShapeInternal(const struct UrdfVisual* visual, const char* urdfPathPrefix, const class btTransform& visualTransform, btAlignedObjectArray<struct GLInstanceVertex>& verticesOut, btAlignedObjectArray<int>& indicesOut, btAlignedObjectArray<struct BulletURDFTexture>& texturesOut) const;

View File

@@ -85,6 +85,10 @@ public:
virtual int getNumModels() const {return 0;}
virtual void activateModel(int /*modelIndex*/) { }
virtual int getNumAllocatedMeshInterfaces() const { return 0;}
virtual int getNumAllocatedTextures() const { return 0; }
virtual int getAllocatedTexture(int index) const { return 0; }
virtual class btStridingMeshInterface* getAllocatedMeshInterface(int index) {return 0;}
};