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
25#include "TextureCache.h"25#include "TextureCache.h"
26#include "RenderUtilsLogging.h"26#include "RenderUtilsLogging.h"
27#include "StencilMaskPass.h"27#include "StencilMaskPass.h"
28#include "FadeEffect.h"
28 29
29#include "gpu/StandardShaderLib.h"30#include "gpu/StandardShaderLib.h"
30 31
@@ -543,15 +544,16 @@ void GeometryCache::initializeShapePipelines() { · 512 unmodified lines
543 if (!_simpleOpaquePipeline) {544 if (!_simpleOpaquePipeline) {
544 _simpleOpaquePipeline = getShapePipeline(false, false, true, false);545 _simpleOpaquePipeline = getShapePipeline(false, false, true, false);
545 _simpleTransparentPipeline = getShapePipeline(false, true, true, false);546 _simpleTransparentPipeline = getShapePipeline(false, true, true, false);
546 _simpleOpaqueFadePipeline = getShapePipeline(false, false, true, false, false, true);547 _simpleOpaqueFadePipeline = getFadingShapePipeline(false, false, true, false, false);
547 _simpleTransparentFadePipeline = getShapePipeline(false, true, true, false, false, true);548 _simpleTransparentFadePipeline = getFadingShapePipeline(false, true, true, false, false);
548 _simpleWirePipeline = getShapePipeline(false, false, true, true);549 _simpleWirePipeline = getShapePipeline(false, false, true, true);
549 }550 }
550}551}
551 552
552render::ShapePipelinePointer GeometryCache::getShapePipeline(bool textured, bool transparent, bool culled,553render::ShapePipelinePointer GeometryCache::getShapePipeline(bool textured, bool transparent, bool culled,
553 bool unlit, bool depthBias, bool fading) {554 bool unlit, bool depthBias) {
554 return std::make_shared<render::ShapePipeline>(getSimplePipeline(textured, transparent, culled, unlit, depthBias, fading), nullptr,555
556 return std::make_shared<render::ShapePipeline>(getSimplePipeline(textured, transparent, culled, unlit, depthBias, false), nullptr,
555 [](const render::ShapePipeline&, gpu::Batch& batch, render::Args*) {557 [](const render::ShapePipeline&, gpu::Batch& batch, render::Args*) {
556 // Set the defaults needed for a simple program558 // Set the defaults needed for a simple program
557 batch.setResourceTexture(render::ShapePipeline::Slot::MAP::ALBEDO,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
565render::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
563render::ShapePipelinePointer GeometryCache::getOpaqueShapePipeline(bool isFading) {581render::ShapePipelinePointer GeometryCache::getOpaqueShapePipeline(bool isFading) {
564 return isFading ? _simpleOpaqueFadePipeline : _simpleOpaquePipeline;582 return isFading ? _simpleOpaqueFadePipeline : _simpleOpaquePipeline;
565}583}