From b6cb1fcfe723a5f84ca4854665c1d2eeb8231f6a Mon Sep 17 00:00:00 2001 From: HifiExperiments Date: Wed, 22 Apr 2020 16:36:51 -0700 Subject: [PATCH 1/3] fix procedural applying to other things --- .../src/RenderableModelEntityItem.cpp | 29 +++++++++++++++++++ .../src/RenderableModelEntityItem.h | 1 + .../src/RenderableShapeEntityItem.cpp | 6 ++-- .../render-utils/src/MeshPartPayload.cpp | 3 +- 4 files changed, 34 insertions(+), 5 deletions(-) diff --git a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp index 5fbbdfa0b8..c70220506e 100644 --- a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp @@ -1442,6 +1442,31 @@ void ModelEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& sce emit requestRenderUpdate(); } + if (!_allProceduralMaterialsLoaded) { + std::lock_guard lock(_materialsLock); + bool allProceduralMaterialsLoaded = true; + for (auto& shapeMaterialPair : _materials) { + auto material = shapeMaterialPair.second; + while (!material.empty()) { + auto mat = material.top(); + if (mat.material && mat.material->isProcedural() && !mat.material->isReady()) { + allProceduralMaterialsLoaded = false; + break; + } + material.pop(); + } + if (!allProceduralMaterialsLoaded) { + break; + } + } + if (!allProceduralMaterialsLoaded) { + emit requestRenderUpdate(); + } else { + _allProceduralMaterialsLoaded = true; + model->setRenderItemsNeedUpdate(); + } + } + // When the individual mesh parts of a model finish fading, they will mark their Model as needing updating // we will watch for that and ask the model to update it's render items if (model->getRenderItemsNeedUpdate()) { @@ -1559,6 +1584,10 @@ void ModelEntityRenderer::addMaterial(graphics::MaterialLayer material, const st if (_model && _model->fetchRenderItemIDs().size() > 0) { _model->addMaterial(material, parentMaterialName); } + if (material.material && material.material->isProcedural()) { + _allProceduralMaterialsLoaded = false; + emit requestRenderUpdate(); + } } void ModelEntityRenderer::removeMaterial(graphics::MaterialPointer material, const std::string& parentMaterialName) { diff --git a/libraries/entities-renderer/src/RenderableModelEntityItem.h b/libraries/entities-renderer/src/RenderableModelEntityItem.h index 0119c7bc26..7c219422a6 100644 --- a/libraries/entities-renderer/src/RenderableModelEntityItem.h +++ b/libraries/entities-renderer/src/RenderableModelEntityItem.h @@ -198,6 +198,7 @@ private: bool _prevModelLoaded { false }; void processMaterials(); + bool _allProceduralMaterialsLoaded { false }; }; } } // namespace diff --git a/libraries/entities-renderer/src/RenderableShapeEntityItem.cpp b/libraries/entities-renderer/src/RenderableShapeEntityItem.cpp index 222b833be2..38dd3b2160 100644 --- a/libraries/entities-renderer/src/RenderableShapeEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableShapeEntityItem.cpp @@ -32,7 +32,7 @@ bool ShapeEntityRenderer::needsRenderUpdate() const { if (resultWithReadLock([&] { auto mat = _materials.find("0"); if (mat != _materials.end() && mat->second.top().material && mat->second.top().material->isProcedural() && - mat->second.top().material->isEnabled()) { + mat->second.top().material->isReady()) { auto procedural = std::static_pointer_cast(mat->second.top().material); if (procedural->isFading()) { return true; @@ -88,7 +88,7 @@ void ShapeEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& sce void ShapeEntityRenderer::doRenderUpdateAsynchronousTyped(const TypedEntityPointer& entity) { withReadLock([&] { auto mat = _materials.find("0"); - if (mat != _materials.end() && mat->second.top().material && mat->second.top().material->isProcedural() && mat->second.top().material->isEnabled()) { + if (mat != _materials.end() && mat->second.top().material && mat->second.top().material->isProcedural() && mat->second.top().material->isReady()) { auto procedural = std::static_pointer_cast(mat->second.top().material); if (procedural->isFading()) { procedural->setIsFading(Interpolate::calculateFadeRatio(procedural->getFadeStartTime()) < 1.0f); @@ -136,7 +136,7 @@ bool ShapeEntityRenderer::isTransparent() const { auto mat = _materials.find("0"); if (mat != _materials.end() && mat->second.top().material) { - if (mat->second.top().material->isProcedural() && mat->second.top().material->isEnabled()) { + if (mat->second.top().material->isProcedural() && mat->second.top().material->isReady()) { auto procedural = std::static_pointer_cast(mat->second.top().material); if (procedural->isFading()) { return true; diff --git a/libraries/render-utils/src/MeshPartPayload.cpp b/libraries/render-utils/src/MeshPartPayload.cpp index e82af5395f..544947ab59 100644 --- a/libraries/render-utils/src/MeshPartPayload.cpp +++ b/libraries/render-utils/src/MeshPartPayload.cpp @@ -493,8 +493,7 @@ void ModelMeshPartPayload::render(RenderArgs* args) { batch.setDrawcallUniform(drawcallInfo); } - if (!_drawMaterials.empty() && _drawMaterials.top().material && _drawMaterials.top().material->isProcedural() && - _drawMaterials.top().material->isReady()) { + if (_shapeKey.hasOwnPipeline()) { if (!(enableMaterialProceduralShaders)) { return; } From 75fa55baf7ade93939ef2de1ce87b8e9143c5a93 Mon Sep 17 00:00:00 2001 From: HifiExperiments Date: Tue, 1 Sep 2020 09:34:11 -0700 Subject: [PATCH 2/3] tabs.css issue? --- scripts/system/html/css/tabs.css | 154 +++++++++++++++---------------- 1 file changed, 77 insertions(+), 77 deletions(-) diff --git a/scripts/system/html/css/tabs.css b/scripts/system/html/css/tabs.css index 87e1c11ee8..349bd363de 100644 --- a/scripts/system/html/css/tabs.css +++ b/scripts/system/html/css/tabs.css @@ -1,77 +1,77 @@ -/* -// tabs.css -// -// Created by Alezia Kurdis on 27 Feb 2020 -// Copyright 2020 Project Athena contributors. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -*/ - -div.tabsContainer { - float: left; - width: 32px; - padding: 0px; -} - -.tabsContainer button { - padding: 4px; - text-align: center; - cursor: pointer; - transition: 0.4s; - font-size: 14px; - background-color: #404040; - border-color: #404040; - border-width: 1px 0px 1px 1px; - border-radius: 5px 0px 0px 5px; - outline: none; -} - -.tabsContainer button:hover { - background-color: #575757; -} - -.tabsContainer button.active { - background-color: #2E2E2E; -} - -div.labelTabHeader { - font-size: 20px; - font-weight: 700; - height: 40px; - color: #ffffff; -} - -div.tab-section-header { - width: 100%; - padding: 5px; -} - -table.tabsTableFrame { - width: 100%; - min-height: 352px; - display: block; -} - -tr.tabsTrFrame { - width: 100%; -} - -td.tabsFrame { - width: 32px; - vertical-align: top; - background-color: #575757; - padding: 0px; - border: 0px; -} - -td.tabsPropertiesFrame { - width: 100%; - vertical-align: top; - border:0px; -} - -div.tabsPropertiesPage { - min-height: 352px; - display: block; -} +/* +// tabs.css +// +// Created by Alezia Kurdis on 27 Feb 2020 +// Copyright 2020 Project Athena contributors. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +*/ + +div.tabsContainer { + float: left; + width: 32px; + padding: 0px; +} + +.tabsContainer button { + padding: 4px; + text-align: center; + cursor: pointer; + transition: 0.4s; + font-size: 14px; + background-color: #404040; + border-color: #404040; + border-width: 1px 0px 1px 1px; + border-radius: 5px 0px 0px 5px; + outline: none; +} + +.tabsContainer button:hover { + background-color: #575757; +} + +.tabsContainer button.active { + background-color: #2E2E2E; +} + +div.labelTabHeader { + font-size: 20px; + font-weight: 700; + height: 40px; + color: #ffffff; +} + +div.tab-section-header { + width: 100%; + padding: 5px; +} + +table.tabsTableFrame { + width: 100%; + min-height: 352px; + display: block; +} + +tr.tabsTrFrame { + width: 100%; +} + +td.tabsFrame { + width: 32px; + vertical-align: top; + background-color: #575757; + padding: 0px; + border: 0px; +} + +td.tabsPropertiesFrame { + width: 100%; + vertical-align: top; + border:0px; +} + +div.tabsPropertiesPage { + min-height: 352px; + display: block; +} From 9b47d924b33f526da28c36a8536722e13a623f1e Mon Sep 17 00:00:00 2001 From: HifiExperiments Date: Tue, 1 Sep 2020 09:37:59 -0700 Subject: [PATCH 3/3] fix merge conflict --- scripts/system/html/css/tabs.css | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/scripts/system/html/css/tabs.css b/scripts/system/html/css/tabs.css index 9806651953..6abd910300 100644 --- a/scripts/system/html/css/tabs.css +++ b/scripts/system/html/css/tabs.css @@ -2,11 +2,7 @@ // tabs.css // // Created by Alezia Kurdis on 27 Feb 2020 -<<<<<<< HEAD -// Copyright 2020 Project Athena contributors. -======= // Copyright 2020 Vircadia contributors. ->>>>>>> upstream/master // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html @@ -35,15 +31,9 @@ div.tabsContainer { background-color: #575757; } -<<<<<<< HEAD -.tabsContainer button.active { - background-color: #2E2E2E; -} -======= .tabsContainer button.active { background-color: #2E2E2E; } ->>>>>>> upstream/master div.labelTabHeader { font-size: 20px; @@ -59,11 +49,7 @@ div.tab-section-header { table.tabsTableFrame { width: 100%; -<<<<<<< HEAD - min-height: 352px; -======= min-height: 352px; ->>>>>>> upstream/master display: block; } @@ -82,11 +68,7 @@ td.tabsFrame { td.tabsPropertiesFrame { width: 100%; vertical-align: top; -<<<<<<< HEAD - border:0px; -======= border: 0px; ->>>>>>> upstream/master } div.tabsPropertiesPage {