History

Merge branch 'master' of https://github.com/highfidelity/hifi into feat/add-primitive-shapes

Liv committed 9 years ago

Commit e4963e02 parents 9248715 77a6ecf47 files · +568 −750Browse files

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

Unified · Split

libraries/render-utils/src/GeometryCache.cpp+20−0
@@ -24,6 +24,7 @@ · 23 unmodified lines
2424
2525 #include "TextureCache.h"
2626 #include "RenderUtilsLogging.h"
27+#include "StencilMaskPass.h"
2728
2829 #include "gpu/StandardShaderLib.h"
2930
@@ -1654,6 +1655,9 @@ void GeometryCache::renderGlowLine(gpu::Batch& batch, const glm::vec3& p1, const · 1624 unmodified lines
16541655 state->setBlendFunction(true,
16551656 gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA,
16561657 gpu::State::FACTOR_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::ONE);
1658+
1659+ PrepareStencil::testMask(*state);
1660+
16571661 gpu::Shader::BindingSet slotBindings;
16581662 slotBindings.insert(gpu::Shader::Binding(std::string("lineData"), LINE_DATA_SLOT));
16591663 gpu::Shader::makeProgram(*program, slotBindings);
@@ -1707,11 +1711,14 @@ void GeometryCache::useSimpleDrawPipeline(gpu::Batch& batch, bool noBlend) { · 47 unmodified lines
17071711
17081712 // enable decal blend
17091713 state->setBlendFunction(true, gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA);
1714+ PrepareStencil::testMask(*state);
17101715
17111716 _standardDrawPipeline = gpu::Pipeline::create(program, state);
17121717
17131718
17141719 auto stateNoBlend = std::make_shared<gpu::State>();
1720+ PrepareStencil::testMaskDrawShape(*state);
1721+
17151722 auto noBlendPS = gpu::StandardShaderLib::getDrawTextureOpaquePS();
17161723 auto programNoBlend = gpu::Shader::createProgram(vs, noBlendPS);
17171724 gpu::Shader::makeProgram((*programNoBlend));
@@ -1734,12 +1741,14 @@ void GeometryCache::useGridPipeline(gpu::Batch& batch, GridBuffer gridBuffer, bo · 16 unmodified lines
17341741
17351742 auto stateLayered = std::make_shared<gpu::State>();
17361743 stateLayered->setBlendFunction(true, gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA);
1744+ PrepareStencil::testMask(*stateLayered);
17371745 _gridPipelineLayered = gpu::Pipeline::create(program, stateLayered);
17381746
17391747 auto state = std::make_shared<gpu::State>(stateLayered->getValues());
17401748 const float DEPTH_BIAS = 0.001f;
17411749 state->setDepthBias(DEPTH_BIAS);
17421750 state->setDepthTest(true, false, gpu::LESS_EQUAL);
1751+ PrepareStencil::testMaskDrawShape(*state);
17431752 _gridPipeline = gpu::Pipeline::create(program, state);
17441753 }
17451754
@@ -1817,6 +1826,11 @@ static void buildWebShader(const std::string& vertShaderText, const std::string& · 71 unmodified lines
18171826 state->setBlendFunction(blendEnable,
18181827 gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA,
18191828 gpu::State::FACTOR_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::ONE);
1829+ if (blendEnable) {
1830+ PrepareStencil::testMask(*state);
1831+ } else {
1832+ PrepareStencil::testMaskDrawShape(*state);
1833+ }
18201834
18211835 pipelinePointerOut = gpu::Pipeline::create(shaderPointerOut, state);
18221836 }
@@ -1902,6 +1916,12 @@ gpu::PipelinePointer GeometryCache::getSimplePipeline(bool textured, bool transp · 79 unmodified lines
19021916 gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA,
19031917 gpu::State::FACTOR_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::ONE);
19041918
1919+ if (config.isTransparent()) {
1920+ PrepareStencil::testMask(*state);
1921+ } else {
1922+ PrepareStencil::testMaskDrawShape(*state);
1923+ }
1924+
19051925 gpu::ShaderPointer program = (config.isUnlit()) ? _unlitShader : _simpleShader;
19061926 gpu::PipelinePointer pipeline = gpu::Pipeline::create(program, state);
19071927 _simplePrograms.insert(config, pipeline);