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;
}
auto textures = parseTexturesToMap(getTextures());
auto textures = getTextures();
if (textures == _lastTextures) {
return;
}
if (textures != _currentTextures) {
geometry->setTextures(textures);
_currentTextures = textures;
_lastTextures = textures;
auto newTextures = parseTexturesToMap(textures);
if (newTextures != _currentTextures) {
geometry->setTextures(newTextures);
_currentTextures = newTextures;
}
}

View file

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