Showing the changes to libraries/render-utils/src/GeometryCache.cpp (1 of 3 files). Show all
Unified · Split
| @@ -25,6 +25,7 @@ · 24 unmodified lines | ||
| 25 | 25 | #include "TextureCache.h" |
| 26 | 26 | #include "RenderUtilsLogging.h" |
| 27 | 27 | #include "StencilMaskPass.h" |
| 28 | +#include "FadeEffect.h" | |
| 28 | 29 | |
| 29 | 30 | #include "gpu/StandardShaderLib.h" |
| 30 | 31 | |
| @@ -543,15 +544,16 @@ void GeometryCache::initializeShapePipelines() { · 512 unmodified lines | ||
| 543 | 544 | if (!_simpleOpaquePipeline) { |
| 544 | 545 | _simpleOpaquePipeline = getShapePipeline(false, false, true, false); |
| 545 | 546 | _simpleTransparentPipeline = getShapePipeline(false, true, true, false); |
| 546 | − _simpleOpaqueFadePipeline = getShapePipeline(false, false, true, false, false, true); | |
| 547 | − _simpleTransparentFadePipeline = getShapePipeline(false, true, true, false, false, true); | |
| 547 | + _simpleOpaqueFadePipeline = getFadingShapePipeline(false, false, true, false, false); | |
| 548 | + _simpleTransparentFadePipeline = getFadingShapePipeline(false, true, true, false, false); | |
| 548 | 549 | _simpleWirePipeline = getShapePipeline(false, false, true, true); |
| 549 | 550 | } |
| 550 | 551 | } |
| 551 | 552 | |
| 552 | 553 | render::ShapePipelinePointer GeometryCache::getShapePipeline(bool textured, bool transparent, bool culled, |
| 553 | − bool unlit, bool depthBias, bool fading) { | |
| 554 | − return std::make_shared<render::ShapePipeline>(getSimplePipeline(textured, transparent, culled, unlit, depthBias, fading), nullptr, | |
| 554 | + bool unlit, bool depthBias) { | |
| 555 | + | |
| 556 | + return std::make_shared<render::ShapePipeline>(getSimplePipeline(textured, transparent, culled, unlit, depthBias, false), nullptr, | |
| 555 | 557 | [](const render::ShapePipeline&, gpu::Batch& batch, render::Args*) { |
| 556 | 558 | // Set the defaults needed for a simple program |
| 557 | 559 | batch.setResourceTexture(render::ShapePipeline::Slot::MAP::ALBEDO, |
| @@ -560,6 +562,22 @@ render::ShapePipelinePointer GeometryCache::getShapePipeline(bool textured, bool · 2 unmodified lines | ||
| 560 | 562 | ); |
| 561 | 563 | } |
| 562 | 564 | |
| 565 | +render::ShapePipelinePointer GeometryCache::getFadingShapePipeline(bool textured, bool transparent, bool culled, | |
| 566 | + bool unlit, bool depthBias) { | |
| 567 | + auto fadeEffect = DependencyManager::get<FadeEffect>(); | |
| 568 | + auto fadeBatchSetter = fadeEffect->getBatchSetter(); | |
| 569 | + auto fadeItemSetter = fadeEffect->getItemSetter(); | |
| 570 | + return std::make_shared<render::ShapePipeline>(getSimplePipeline(textured, transparent, culled, unlit, depthBias, true), nullptr, | |
| 571 | + [fadeBatchSetter, fadeItemSetter](const render::ShapePipeline& pipeline, gpu::Batch& batch, render::Args* args) { | |
| 572 | + // Set the defaults needed for a simple program | |
| 573 | + batch.setResourceTexture(render::ShapePipeline::Slot::MAP::ALBEDO, | |
| 574 | + DependencyManager::get<TextureCache>()->getWhiteTexture()); | |
| 575 | + fadeBatchSetter(pipeline, batch, args); | |
| 576 | + }, | |
| 577 | + fadeItemSetter | |
| 578 | + ); | |
| 579 | +} | |
| 580 | + | |
| 563 | 581 | render::ShapePipelinePointer GeometryCache::getOpaqueShapePipeline(bool isFading) { |
| 564 | 582 | return isFading ? _simpleOpaqueFadePipeline : _simpleOpaquePipeline; |
| 565 | 583 | } |