Avoid JSON parsing texs every render cycle

This commit is contained in:
Zach Pomerantz 2016-03-30 14:48:57 -07:00
parent 54b8a9278d
commit 01db2be6b8
2 changed files with 11 additions and 4 deletions

View file

@ -143,11 +143,17 @@ void RenderableModelEntityItem::remapTextures() {
_currentTextures = _originalTextures; _currentTextures = _originalTextures;
} }
auto textures = parseTexturesToMap(getTextures()); auto textures = getTextures();
if (textures == _lastTextures) {
return;
}
if (textures != _currentTextures) { _lastTextures = textures;
geometry->setTextures(textures); auto newTextures = parseTexturesToMap(textures);
_currentTextures = textures;
if (newTextures != _currentTextures) {
geometry->setTextures(newTextures);
_currentTextures = newTextures;
} }
} }

View file

@ -90,6 +90,7 @@ private:
bool _needsInitialSimulation = true; bool _needsInitialSimulation = true;
bool _needsModelReload = true; bool _needsModelReload = true;
EntityTreeRenderer* _myRenderer = nullptr; EntityTreeRenderer* _myRenderer = nullptr;
QString _lastTextures;
QVariantMap _currentTextures; QVariantMap _currentTextures;
QVariantMap _originalTextures; QVariantMap _originalTextures;
bool _originalTexturesRead = false; bool _originalTexturesRead = false;