Showing the changes to libraries/render-utils/src/FramebufferCache.cpp (1 of 8 files). Show all
Unified · Split
| @@ -34,7 +34,8 @@ void FramebufferCache::setFrameBufferSize(QSize frameBufferSize) { · 33 unmodified lines | ||
| 34 | 34 | //If the size changed, we need to delete our FBOs |
| 35 | 35 | if (_frameBufferSize != frameBufferSize) { |
| 36 | 36 | _frameBufferSize = frameBufferSize; |
| 37 | − _primaryFramebuffer.reset(); | |
| 37 | + _primaryFramebufferFull.reset(); | |
| 38 | + _primaryFramebufferDepthColor.reset(); | |
| 38 | 39 | _primaryDepthTexture.reset(); |
| 39 | 40 | _primaryColorTexture.reset(); |
| 40 | 41 | _primaryNormalTexture.reset(); |
| @@ -45,7 +46,8 @@ void FramebufferCache::setFrameBufferSize(QSize frameBufferSize) { · 4 unmodified lines | ||
| 45 | 46 | } |
| 46 | 47 | |
| 47 | 48 | void FramebufferCache::createPrimaryFramebuffer() { |
| 48 | − _primaryFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create()); | |
| 49 | + _primaryFramebufferFull = gpu::FramebufferPointer(gpu::Framebuffer::create()); | |
| 50 | + _primaryFramebufferDepthColor = gpu::FramebufferPointer(gpu::Framebuffer::create()); | |
| 49 | 51 | |
| 50 | 52 | auto colorFormat = gpu::Element(gpu::VEC4, gpu::NUINT8, gpu::RGBA); |
| 51 | 53 | auto width = _frameBufferSize.width(); |
| @@ -56,24 +58,33 @@ void FramebufferCache::createPrimaryFramebuffer() { · 4 unmodified lines | ||
| 56 | 58 | _primaryNormalTexture = gpu::TexturePointer(gpu::Texture::create2D(colorFormat, width, height, defaultSampler)); |
| 57 | 59 | _primarySpecularTexture = gpu::TexturePointer(gpu::Texture::create2D(colorFormat, width, height, defaultSampler)); |
| 58 | 60 | |
| 59 | − _primaryFramebuffer->setRenderBuffer(0, _primaryColorTexture); | |
| 60 | − _primaryFramebuffer->setRenderBuffer(1, _primaryNormalTexture); | |
| 61 | − _primaryFramebuffer->setRenderBuffer(2, _primarySpecularTexture); | |
| 61 | + _primaryFramebufferFull->setRenderBuffer(0, _primaryColorTexture); | |
| 62 | + _primaryFramebufferFull->setRenderBuffer(1, _primaryNormalTexture); | |
| 63 | + _primaryFramebufferFull->setRenderBuffer(2, _primarySpecularTexture); | |
| 62 | 64 | |
| 65 | + _primaryFramebufferDepthColor->setRenderBuffer(0, _primaryColorTexture); | |
| 63 | 66 | |
| 64 | 67 | auto depthFormat = gpu::Element(gpu::SCALAR, gpu::FLOAT, gpu::DEPTH); |
| 65 | 68 | _primaryDepthTexture = gpu::TexturePointer(gpu::Texture::create2D(depthFormat, width, height, defaultSampler)); |
| 66 | 69 | |
| 67 | − _primaryFramebuffer->setDepthStencilBuffer(_primaryDepthTexture, depthFormat); | |
| 70 | + _primaryFramebufferFull->setDepthStencilBuffer(_primaryDepthTexture, depthFormat); | |
| 71 | + | |
| 72 | + _primaryFramebufferDepthColor->setDepthStencilBuffer(_primaryDepthTexture, depthFormat); | |
| 68 | 73 | } |
| 69 | 74 | |
| 70 | 75 | gpu::FramebufferPointer FramebufferCache::getPrimaryFramebuffer() { |
| 71 | − if (!_primaryFramebuffer) { | |
| 76 | + if (!_primaryFramebufferFull) { | |
| 72 | 77 | createPrimaryFramebuffer(); |
| 73 | 78 | } |
| 74 | − return _primaryFramebuffer; | |
| 79 | + return _primaryFramebufferFull; | |
| 75 | 80 | } |
| 76 | 81 | |
| 82 | +gpu::FramebufferPointer FramebufferCache::getPrimaryFramebufferDepthColor() { | |
| 83 | + if (!_primaryFramebufferDepthColor) { | |
| 84 | + createPrimaryFramebuffer(); | |
| 85 | + } | |
| 86 | + return _primaryFramebufferDepthColor; | |
| 87 | +} | |
| 77 | 88 | |
| 78 | 89 | |
| 79 | 90 | gpu::TexturePointer FramebufferCache::getPrimaryDepthTexture() { |