mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
Merge pull request #15273 from SamGondelman/transparency
Case 21949: Fix transparent shape flickering
This commit is contained in:
commit
8ff47659d3
3 changed files with 18 additions and 7 deletions
|
@ -281,9 +281,9 @@ void ShapeEntityRenderer::doRender(RenderArgs* args) {
|
|||
outColor.a *= _isFading ? Interpolate::calculateFadeRatio(_fadeStartTime) : 1.0f;
|
||||
render::ShapePipelinePointer pipeline;
|
||||
if (renderLayer == RenderLayer::WORLD) {
|
||||
pipeline = GeometryCache::getShapePipeline(false, outColor.a < 1.0f, true, false);
|
||||
pipeline = outColor.a < 1.0f ? geometryCache->getTransparentShapePipeline() : geometryCache->getOpaqueShapePipeline();
|
||||
} else {
|
||||
pipeline = GeometryCache::getShapePipeline(false, outColor.a < 1.0f, true, false, false, true);
|
||||
pipeline = outColor.a < 1.0f ? geometryCache->getForwardTransparentShapePipeline() : geometryCache->getForwardOpaqueShapePipeline();
|
||||
}
|
||||
if (render::ShapeKey(args->_globalShapeKey).isWireframe() || primitiveMode == PrimitiveMode::LINES) {
|
||||
geometryCache->renderWireShapeInstance(args, batch, geometryShape, outColor, pipeline);
|
||||
|
|
|
@ -722,6 +722,8 @@ gpu::ShaderPointer GeometryCache::_unlitFadeShader;
|
|||
|
||||
render::ShapePipelinePointer GeometryCache::_simpleOpaquePipeline;
|
||||
render::ShapePipelinePointer GeometryCache::_simpleTransparentPipeline;
|
||||
render::ShapePipelinePointer GeometryCache::_forwardSimpleOpaquePipeline;
|
||||
render::ShapePipelinePointer GeometryCache::_forwardSimpleTransparentPipeline;
|
||||
render::ShapePipelinePointer GeometryCache::_simpleOpaqueFadePipeline;
|
||||
render::ShapePipelinePointer GeometryCache::_simpleTransparentFadePipeline;
|
||||
render::ShapePipelinePointer GeometryCache::_simpleWirePipeline;
|
||||
|
@ -801,6 +803,8 @@ void GeometryCache::initializeShapePipelines() {
|
|||
if (!_simpleOpaquePipeline) {
|
||||
_simpleOpaquePipeline = getShapePipeline(false, false, true, false);
|
||||
_simpleTransparentPipeline = getShapePipeline(false, true, true, false);
|
||||
_forwardSimpleOpaquePipeline = getShapePipeline(false, false, true, false, false, true);
|
||||
_forwardSimpleTransparentPipeline = getShapePipeline(false, true, true, false, false, true);
|
||||
_simpleOpaqueFadePipeline = getFadingShapePipeline(false, false, false, false, false);
|
||||
_simpleTransparentFadePipeline = getFadingShapePipeline(false, true, false, false, false);
|
||||
_simpleWirePipeline = getShapePipeline(false, false, true, true);
|
||||
|
|
|
@ -181,6 +181,11 @@ public:
|
|||
|
||||
static void initializeShapePipelines();
|
||||
|
||||
render::ShapePipelinePointer getOpaqueShapePipeline() { assert(_simpleOpaquePipeline != nullptr); return _simpleOpaquePipeline; }
|
||||
render::ShapePipelinePointer getTransparentShapePipeline() { assert(_simpleTransparentPipeline != nullptr); return _simpleTransparentPipeline; }
|
||||
render::ShapePipelinePointer getForwardOpaqueShapePipeline() { assert(_forwardSimpleOpaquePipeline != nullptr); return _forwardSimpleOpaquePipeline; }
|
||||
render::ShapePipelinePointer getForwardTransparentShapePipeline() { assert(_forwardSimpleTransparentPipeline != nullptr); return _forwardSimpleTransparentPipeline; }
|
||||
|
||||
// Static (instanced) geometry
|
||||
void renderShapeInstances(gpu::Batch& batch, Shape shape, size_t count, gpu::BufferPointer& colorBuffer);
|
||||
void renderWireShapeInstances(gpu::Batch& batch, Shape shape, size_t count, gpu::BufferPointer& colorBuffer);
|
||||
|
@ -369,11 +374,6 @@ public:
|
|||
|
||||
graphics::MeshPointer meshFromShape(Shape geometryShape, glm::vec3 color);
|
||||
|
||||
static render::ShapePipelinePointer getShapePipeline(bool textured = false, bool transparent = false, bool culled = true,
|
||||
bool unlit = false, bool depthBias = false, bool forward = false);
|
||||
static render::ShapePipelinePointer getFadingShapePipeline(bool textured = false, bool transparent = false, bool culled = true,
|
||||
bool unlit = false, bool depthBias = false);
|
||||
|
||||
private:
|
||||
|
||||
GeometryCache();
|
||||
|
@ -467,6 +467,8 @@ private:
|
|||
static gpu::ShaderPointer _unlitFadeShader;
|
||||
static render::ShapePipelinePointer _simpleOpaquePipeline;
|
||||
static render::ShapePipelinePointer _simpleTransparentPipeline;
|
||||
static render::ShapePipelinePointer _forwardSimpleOpaquePipeline;
|
||||
static render::ShapePipelinePointer _forwardSimpleTransparentPipeline;
|
||||
static render::ShapePipelinePointer _simpleOpaqueFadePipeline;
|
||||
static render::ShapePipelinePointer _simpleTransparentFadePipeline;
|
||||
static render::ShapePipelinePointer _simpleWirePipeline;
|
||||
|
@ -477,6 +479,11 @@ private:
|
|||
gpu::PipelinePointer _simpleOpaqueWebBrowserPipeline;
|
||||
gpu::ShaderPointer _simpleTransparentWebBrowserShader;
|
||||
gpu::PipelinePointer _simpleTransparentWebBrowserPipeline;
|
||||
|
||||
static render::ShapePipelinePointer getShapePipeline(bool textured = false, bool transparent = false, bool culled = true,
|
||||
bool unlit = false, bool depthBias = false, bool forward = false);
|
||||
static render::ShapePipelinePointer getFadingShapePipeline(bool textured = false, bool transparent = false, bool culled = true,
|
||||
bool unlit = false, bool depthBias = false);
|
||||
};
|
||||
|
||||
#endif // hifi_GeometryCache_h
|
||||
|
|
Loading…
Reference in a new issue