Corrects loading of texture and default visibility.

This commit is contained in:
NissimHadar 2018-07-25 13:28:23 -07:00
parent 89e7e3b938
commit 630df7c233
2 changed files with 7 additions and 4 deletions

View file

@ -27,10 +27,6 @@ ModelOverlay::ModelOverlay()
{
_model->setLoadingPriority(_loadPriority);
_isLoaded = false;
// Don't show overlay until textures have loaded
_visible = false;
render::ScenePointer scene = qApp->getMain3DScene();
_model->setVisibleInScene(false, scene);
}
@ -136,6 +132,11 @@ void ModelOverlay::update(float deltatime) {
}
scene->enqueueTransaction(transaction);
if (_texturesDirty && !_modelTextures.isEmpty()) {
_texturesDirty = false;
_model->setTextures(_modelTextures);
}
if (!_texturesLoaded && _model->getGeometry() && _model->getGeometry()->areTexturesLoaded()) {
_texturesLoaded = true;
if (!_modelTextures.isEmpty()) {
@ -242,6 +243,7 @@ void ModelOverlay::setProperties(const QVariantMap& properties) {
_texturesLoaded = false;
QVariantMap textureMap = texturesValue.toMap();
_modelTextures = textureMap;
_texturesDirty = true;
}
auto groupCulledValue = properties["isGroupCulled"];

View file

@ -94,6 +94,7 @@ private:
ModelPointer _model;
QVariantMap _modelTextures;
bool _texturesLoaded { false };
bool _texturesDirty{ false };
render::ItemIDs _subRenderItemIDs;