Fix z-write enabled for transparent draws.

Fix z-write being enabled for transparencies in GeometryCache::getSimplePipeline and Procedural::Procedural (fixes https://github.com/vircadia/vircadia/issues/224).
Z-write is controlled by the 'writeMask' parameter of gpu::State::setDepthTest.
This commit is contained in:
Phil Palmer 2021-01-03 16:31:51 -05:00
parent f1576aba78
commit 90799e10da
2 changed files with 2 additions and 2 deletions

View file

@ -125,7 +125,7 @@ Procedural::Procedural() {
opaqueStencil(_opaqueState);
_transparentState->setCullMode(gpu::State::CULL_NONE);
_transparentState->setDepthTest(true, true, gpu::LESS_EQUAL);
_transparentState->setDepthTest(true, false, gpu::LESS_EQUAL);
_transparentState->setBlendFunction(true,
gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA,
gpu::State::FACTOR_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::ONE);

View file

@ -2207,7 +2207,7 @@ gpu::PipelinePointer GeometryCache::getSimplePipeline(bool textured, bool transp
} else {
state->setCullMode(gpu::State::CULL_BACK);
}
state->setDepthTest(true, true, gpu::LESS_EQUAL);
state->setDepthTest(true, !config.isTransparent(), gpu::LESS_EQUAL);
if (config.hasDepthBias()) {
state->setDepthBias(1.0f);
state->setDepthBiasSlopeScale(1.0f);