Showing the changes to libraries/render-utils/src/GeometryCache.cpp (1 of 44 files). Show all
Unified · Split
| @@ -29,6 +29,8 @@ · 28 unmodified lines | ||
| 29 | 29 | #include "standardTransformPNTC_vert.h" |
| 30 | 30 | #include "standardDrawTexture_frag.h" |
| 31 | 31 | |
| 32 | +#include "gpu/StandardShaderLib.h" | |
| 33 | + | |
| 32 | 34 | //#define WANT_DEBUG |
| 33 | 35 | |
| 34 | 36 | const int GeometryCache::UNKNOWN_ID = -1; |
| @@ -1651,7 +1653,7 @@ QSharedPointer<Resource> GeometryCache::createResource(const QUrl& url, const QS · 1616 unmodified lines | ||
| 1651 | 1653 | return geometry.staticCast<Resource>(); |
| 1652 | 1654 | } |
| 1653 | 1655 | |
| 1654 | −void GeometryCache::useSimpleDrawPipeline(gpu::Batch& batch) { | |
| 1656 | +void GeometryCache::useSimpleDrawPipeline(gpu::Batch& batch, bool noBlend) { | |
| 1655 | 1657 | if (!_standardDrawPipeline) { |
| 1656 | 1658 | auto vs = gpu::ShaderPointer(gpu::Shader::createVertex(std::string(standardTransformPNTC_vert))); |
| 1657 | 1659 | auto ps = gpu::ShaderPointer(gpu::Shader::createPixel(std::string(standardDrawTexture_frag))); |
| @@ -1660,12 +1662,24 @@ void GeometryCache::useSimpleDrawPipeline(gpu::Batch& batch) { · 2 unmodified lines | ||
| 1660 | 1662 | |
| 1661 | 1663 | auto state = std::make_shared<gpu::State>(); |
| 1662 | 1664 | |
| 1665 | + | |
| 1663 | 1666 | // enable decal blend |
| 1664 | 1667 | state->setBlendFunction(true, gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA); |
| 1665 | 1668 | |
| 1666 | 1669 | _standardDrawPipeline.reset(gpu::Pipeline::create(program, state)); |
| 1670 | + | |
| 1671 | + | |
| 1672 | + auto stateNoBlend = std::make_shared<gpu::State>(); | |
| 1673 | + auto noBlendPS = gpu::StandardShaderLib::getDrawTextureOpaquePS(); | |
| 1674 | + auto programNoBlend = gpu::ShaderPointer(gpu::Shader::createProgram(vs, noBlendPS)); | |
| 1675 | + gpu::Shader::makeProgram((*programNoBlend)); | |
| 1676 | + _standardDrawPipelineNoBlend.reset(gpu::Pipeline::create(programNoBlend, stateNoBlend)); | |
| 1677 | + } | |
| 1678 | + if (noBlend) { | |
| 1679 | + batch.setPipeline(_standardDrawPipelineNoBlend); | |
| 1680 | + } else { | |
| 1681 | + batch.setPipeline(_standardDrawPipeline); | |
| 1667 | 1682 | } |
| 1668 | − batch.setPipeline(_standardDrawPipeline); | |
| 1669 | 1683 | } |
| 1670 | 1684 | |
| 1671 | 1685 | const float NetworkGeometry::NO_HYSTERESIS = -1.0f; |