History

Removed transparency on fading shapes

Olivier Prat committed 9 years ago

Commit f8b2ffe1 parent db7871f3 files · +28 −16Browse files

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

Unified · Split

libraries/render-utils/src/GeometryCache.cpp+22−4
@@ -25,6 +25,7 @@ · 24 unmodified lines
2525 #include "TextureCache.h"
2626 #include "RenderUtilsLogging.h"
2727 #include "StencilMaskPass.h"
28+#include "FadeEffect.h"
2829
2930 #include "gpu/StandardShaderLib.h"
3031
@@ -543,15 +544,16 @@ void GeometryCache::initializeShapePipelines() { · 512 unmodified lines
543544 if (!_simpleOpaquePipeline) {
544545 _simpleOpaquePipeline = getShapePipeline(false, false, true, false);
545546 _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);
548549 _simpleWirePipeline = getShapePipeline(false, false, true, true);
549550 }
550551 }
551552
552553 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,
555557 [](const render::ShapePipeline&, gpu::Batch& batch, render::Args*) {
556558 // Set the defaults needed for a simple program
557559 batch.setResourceTexture(render::ShapePipeline::Slot::MAP::ALBEDO,
@@ -560,6 +562,22 @@ render::ShapePipelinePointer GeometryCache::getShapePipeline(bool textured, bool · 2 unmodified lines
560562 );
561563 }
562564
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+
563581 render::ShapePipelinePointer GeometryCache::getOpaqueShapePipeline(bool isFading) {
564582 return isFading ? _simpleOpaqueFadePipeline : _simpleOpaquePipeline;
565583 }