Fixing the Anitialising breaking the transparent rendering

This commit is contained in:
samcake 2016-01-22 18:25:26 -08:00
parent 74c37104f6
commit 9f87089c05
2 changed files with 6 additions and 4 deletions

View file

@ -51,7 +51,7 @@ const gpu::PipelinePointer& Antialiasing::getAntialiasingPipeline() {
// Link the antialiasing FBO to texture
_antialiasingBuffer = gpu::FramebufferPointer(gpu::Framebuffer::create(gpu::Element::COLOR_RGBA_32,
DependencyManager::get<FramebufferCache>()->getFrameBufferSize().width(), DependencyManager::get<FramebufferCache>()->getFrameBufferSize().height()));
auto format = gpu::Element(gpu::VEC4, gpu::NUINT8, gpu::RGBA);
auto format = DependencyManager::get<FramebufferCache>()->getLightingTexture()->getTexelFormat();
auto width = _antialiasingBuffer->getWidth();
auto height = _antialiasingBuffer->getHeight();
auto defaultSampler = gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_POINT);
@ -102,7 +102,9 @@ void Antialiasing::run(const render::SceneContextPointer& sceneContext, const re
RenderArgs* args = renderContext->getArgs();
gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {
batch.enableStereo(false);
batch.setViewportTransform(args->_viewport);
// FIXME: NEED to simplify that code to avoid all the GeometryCahce call, this is purely pixel manipulation
auto framebufferCache = DependencyManager::get<FramebufferCache>();
QSize framebufferSize = framebufferCache->getFrameBufferSize();
float fbWidth = framebufferSize.width();
@ -122,7 +124,7 @@ void Antialiasing::run(const render::SceneContextPointer& sceneContext, const re
// FXAA step
getAntialiasingPipeline();
batch.setResourceTexture(0, framebufferCache->getDeferredColorTexture());
batch.setResourceTexture(0, framebufferCache->getLightingTexture());
_antialiasingBuffer->setRenderBuffer(0, _antialiasingTexture);
batch.setFramebuffer(_antialiasingBuffer);
batch.setPipeline(getAntialiasingPipeline());
@ -152,7 +154,7 @@ void Antialiasing::run(const render::SceneContextPointer& sceneContext, const re
// Blend step
getBlendPipeline();
batch.setResourceTexture(0, _antialiasingTexture);
batch.setFramebuffer(framebufferCache->getDeferredFramebuffer());
batch.setFramebuffer(framebufferCache->getLightingFramebuffer());
batch.setPipeline(getBlendPipeline());
DependencyManager::get<GeometryCache>()->renderQuad(batch, bottomLeft, topRight, texCoordTopLeft, texCoordBottomRight, color);

View file

@ -125,7 +125,7 @@ RenderDeferredTask::RenderDeferredTask(CullFunctor cullFunctor) : Task() {
// Render transparent objects forward in LigthingBuffer
addJob<DrawTransparentDeferred>("DrawTransparentDeferred", transparents, shapePlumber);
// Lighting Buffer ready for tone mapping
addJob<ToneMappingDeferred>("ToneMapping");
_toneMappingJobIndex = (int)_jobs.size() - 1;