History

Require model fixup if tex is transparent

Zach Pomerantz committed 10 years ago

Commit a89a76d1 parent 3b62e202 files · +24 −5Browse files

Showing the changes to libraries/render-utils/src/Model.cpp (1 of 2 files). Show all

Unified · Split

libraries/render-utils/src/Model.cpp+17−0
@@ -74,6 +74,21 @@ Model::~Model() { · 73 unmodified lines
7474
7575 AbstractViewStateInterface* Model::_viewState = NULL;
7676
77+bool Model::needsFixupInScene() {
78+ if (readyToAddToScene()) {
79+ // Once textures are loaded, fixup if they are now transparent
80+ if (!_needsReload && _needsUpdateTransparentTextures && _geometry->isLoadedWithTextures()) {
81+ _needsUpdateTransparentTextures = false;
82+ if (_hasTransparentTextures != _geometry->hasTransparentTextures()) {
83+ return true;
84+ }
85+ }
86+ if (!_readyWhenAdded) {
87+ return true;
88+ }
89+ }
90+ return false;
91+}
7792
7893 void Model::setTranslation(const glm::vec3& translation) {
7994 _translation = translation;
@@ -728,6 +743,8 @@ void Model::setURL(const QUrl& url) { · 648 unmodified lines
728743 }
729744
730745 _needsReload = true;
746+ _needsUpdateTransparentTextures = true;
747+ _hasTransparentTextures = false;
731748 _meshGroupsKnown = false;
732749 invalidCalculatedMeshBoxes();
733750 deleteGeometry();