fix depth buffer issue that was messing with drawInFront, plus some small fixes to line3ds

This commit is contained in:
SamGondelman 2017-08-14 15:03:14 -07:00
parent 0f163a6a7c
commit 8163430282
3 changed files with 12 additions and 8 deletions

View file

@ -32,6 +32,8 @@ Line3DOverlay::Line3DOverlay(const Line3DOverlay* line3DOverlay) :
_length = line3DOverlay->getLength();
_endParentID = line3DOverlay->getEndParentID();
_endParentJointIndex = line3DOverlay->getEndJointIndex();
_glow = line3DOverlay->getGlow();
_glowWidth = line3DOverlay->getGlowWidth();
}
Line3DOverlay::~Line3DOverlay() {
@ -138,11 +140,9 @@ void Line3DOverlay::render(RenderArgs* args) {
// TODO: add support for color to renderDashedLine()
geometryCache->bindSimpleProgram(*batch, false, false, false, true, true);
geometryCache->renderDashedLine(*batch, start, end, colorv4, _geometryCacheID);
} else if (_glow > 0.0f) {
geometryCache->renderGlowLine(*batch, start, end, colorv4, _glow, _glowWidth, _geometryCacheID);
} else {
geometryCache->bindSimpleProgram(*batch, false, false, false, true, true);
geometryCache->renderLine(*batch, start, end, colorv4, _geometryCacheID);
// renderGlowLine handles both glow = 0 and glow > 0 cases
geometryCache->renderGlowLine(*batch, start, end, colorv4, _glow, _glowWidth, _geometryCacheID);
}
}
}
@ -228,9 +228,9 @@ void Line3DOverlay::setProperties(const QVariantMap& originalProperties) {
}
}
auto glowWidth = properties["glow"];
auto glowWidth = properties["glowWidth"];
if (glowWidth.isValid()) {
setGlow(glowWidth.toFloat());
setGlowWidth(glowWidth.toFloat());
}
}

View file

@ -1640,7 +1640,11 @@ void GeometryCache::renderGlowLine(gpu::Batch& batch, const glm::vec3& p1, const
#endif
if (glowIntensity <= 0) {
bindSimpleProgram(batch, false, false, false, true, false);
if (color.a >= 1.0) {
bindSimpleProgram(batch, false, false, false, true, true);
} else {
bindSimpleProgram(batch, false, true, false, true, true);
}
renderLine(batch, p1, p2, color, id);
return;
}

View file

@ -357,7 +357,7 @@ void DrawOverlay3D::run(const RenderContextPointer& renderContext, const Inputs&
if (_opaquePass) {
gpu::doInBatch(args->_context, [&](gpu::Batch& batch){
batch.enableStereo(false);
batch.clearFramebuffer(gpu::Framebuffer::BUFFER_DEPTH, glm::vec4(), 1.f, 0, true);
batch.clearFramebuffer(gpu::Framebuffer::BUFFER_DEPTH, glm::vec4(), 1.f, 0, false);
});
}