Showing the changes to libraries/render-utils/src/FramebufferCache.cpp (1 of 24 files). Show all
Unified · Split
| @@ -47,6 +47,10 @@ void FramebufferCache::setFrameBufferSize(QSize frameBufferSize) { · 46 unmodified lines | ||
| 47 | 47 | _lightingFramebuffer.reset(); |
| 48 | 48 | _depthPyramidFramebuffer.reset(); |
| 49 | 49 | _depthPyramidTexture.reset(); |
| 50 | + _occlusionFramebuffer.reset(); | |
| 51 | + _occlusionTexture.reset(); | |
| 52 | + _occlusionBlurredFramebuffer.reset(); | |
| 53 | + _occlusionBlurredTexture.reset(); | |
| 50 | 54 | } |
| 51 | 55 | } |
| 52 | 56 | |
| @@ -105,6 +109,18 @@ void FramebufferCache::createPrimaryFramebuffer() { · 52 unmodified lines | ||
| 105 | 109 | _depthPyramidFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create()); |
| 106 | 110 | _depthPyramidFramebuffer->setRenderBuffer(0, _depthPyramidTexture); |
| 107 | 111 | _depthPyramidFramebuffer->setDepthStencilBuffer(_primaryDepthTexture, depthFormat); |
| 112 | + | |
| 113 | + | |
| 114 | + _occlusionTexture = gpu::TexturePointer(gpu::Texture::create2D(gpu::Element(gpu::VEC4, gpu::NUINT8, gpu::RGB), width, height, defaultSampler)); | |
| 115 | + _occlusionFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create()); | |
| 116 | + _occlusionFramebuffer->setRenderBuffer(0, _occlusionTexture); | |
| 117 | + _occlusionFramebuffer->setDepthStencilBuffer(_primaryDepthTexture, depthFormat); | |
| 118 | + | |
| 119 | + | |
| 120 | + _occlusionBlurredTexture = gpu::TexturePointer(gpu::Texture::create2D(gpu::Element(gpu::VEC4, gpu::NUINT8, gpu::RGB), width, height, defaultSampler)); | |
| 121 | + _occlusionBlurredFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create()); | |
| 122 | + _occlusionBlurredFramebuffer->setRenderBuffer(0, _occlusionBlurredTexture); | |
| 123 | + _occlusionBlurredFramebuffer->setDepthStencilBuffer(_primaryDepthTexture, depthFormat); | |
| 108 | 124 | |
| 109 | 125 | } |
| 110 | 126 | |
| @@ -220,4 +236,32 @@ gpu::TexturePointer FramebufferCache::getDepthPyramidTexture() { · 109 unmodified lines | ||
| 220 | 236 | createPrimaryFramebuffer(); |
| 221 | 237 | } |
| 222 | 238 | return _depthPyramidTexture; |
| 239 | +} | |
| 240 | + | |
| 241 | +gpu::FramebufferPointer FramebufferCache::getOcclusionFramebuffer() { | |
| 242 | + if (!_occlusionFramebuffer) { | |
| 243 | + createPrimaryFramebuffer(); | |
| 244 | + } | |
| 245 | + return _occlusionFramebuffer; | |
| 246 | +} | |
| 247 | + | |
| 248 | +gpu::TexturePointer FramebufferCache::getOcclusionTexture() { | |
| 249 | + if (!_occlusionTexture) { | |
| 250 | + createPrimaryFramebuffer(); | |
| 251 | + } | |
| 252 | + return _occlusionTexture; | |
| 253 | +} | |
| 254 | + | |
| 255 | +gpu::FramebufferPointer FramebufferCache::getOcclusionBlurredFramebuffer() { | |
| 256 | + if (!_occlusionBlurredFramebuffer) { | |
| 257 | + createPrimaryFramebuffer(); | |
| 258 | + } | |
| 259 | + return _occlusionBlurredFramebuffer; | |
| 260 | +} | |
| 261 | + | |
| 262 | +gpu::TexturePointer FramebufferCache::getOcclusionBlurredTexture() { | |
| 263 | + if (!_occlusionBlurredTexture) { | |
| 264 | + createPrimaryFramebuffer(); | |
| 265 | + } | |
| 266 | + return _occlusionBlurredTexture; | |
| 223 | 267 | } |