fix file caching issue

This commit is contained in:
Erwin Coumans
2019-04-25 07:04:22 -07:00
parent 0d4392af58
commit 72c6ed9abe
2 changed files with 28 additions and 26 deletions

View File

@@ -112,7 +112,7 @@ struct b3PluginManagerInternalData
b3BulletDefaultFileIO m_defaultFileIO;
b3PluginManagerInternalData()
: m_rpcCommandProcessorInterface(0), m_activeNotificationsBufferIndex(0), m_activeRendererPluginUid(-1), m_activeCollisionPluginUid(-1), m_numNotificationPlugins(0), m_activeFileIOPluginUid(-1)
: m_physicsDirect(0), m_rpcCommandProcessorInterface(0), m_activeNotificationsBufferIndex(0), m_activeRendererPluginUid(-1), m_activeCollisionPluginUid(-1), m_numNotificationPlugins(0), m_activeFileIOPluginUid(-1)
{
}
};

View File

@@ -387,6 +387,8 @@ struct WrapperFileIO : public CommonFileIOInterface
{
int childHandle = childFileIO->fileOpen(fileName, mode);
if (childHandle>=0)
{
if (m_enableFileCaching)
{
int fileSize = childFileIO->getFileSize(childHandle);
char* buffer = 0;
@@ -413,10 +415,10 @@ struct WrapperFileIO : public CommonFileIOInterface
}
//potentially register a zero byte file, or files that only can be read partially
if (m_enableFileCaching)
{
m_cachedFiles.registerFile(fileName, buffer, fileSize);
}
childFileIO->fileClose(childHandle);
break;
}