History

Working on AO

samcake committed 10 years ago

Commit dbc45061 parent ee6d72011 files · +393 −343Browse files

Showing the changes to libraries/render-utils/src/FramebufferCache.cpp (1 of 11 files). Show all

Unified · Split

libraries/render-utils/src/FramebufferCache.cpp+24−0
@@ -45,6 +45,8 @@ void FramebufferCache::setFrameBufferSize(QSize frameBufferSize) { · 44 unmodified lines
4545 _cachedFramebuffers.clear();
4646 _lightingTexture.reset();
4747 _lightingFramebuffer.reset();
48+ _depthPyramidFramebuffer.reset();
49+ _depthPyramidTexture.reset();
4850 }
4951 }
5052
@@ -96,6 +98,14 @@ void FramebufferCache::createPrimaryFramebuffer() { · 45 unmodified lines
9698 _lightingFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create());
9799 _lightingFramebuffer->setRenderBuffer(0, _lightingTexture);
98100 _lightingFramebuffer->setDepthStencilBuffer(_primaryDepthTexture, depthFormat);
101+
102+
103+ // For AO:
104+ _depthPyramidTexture = gpu::TexturePointer(gpu::Texture::create2D(gpu::Element(gpu::SCALAR, gpu::HALF, gpu::RGB), width, height, smoothSampler));
105+ _depthPyramidFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create());
106+ _depthPyramidFramebuffer->setRenderBuffer(0, _depthPyramidTexture);
107+ _depthPyramidFramebuffer->setDepthStencilBuffer(_primaryDepthTexture, depthFormat);
108+
99109 }
100110
101111 gpu::FramebufferPointer FramebufferCache::getPrimaryFramebuffer() {
@@ -197,3 +207,17 @@ gpu::FramebufferPointer FramebufferCache::getSelfieFramebuffer() { · 95 unmodified lines
197207 }
198208 return _selfieFramebuffer;
199209 }
210+
211+gpu::FramebufferPointer FramebufferCache::getDepthPyramidFramebuffer() {
212+ if (!_depthPyramidFramebuffer) {
213+ createPrimaryFramebuffer();
214+ }
215+ return _depthPyramidFramebuffer;
216+}
217+
218+gpu::TexturePointer FramebufferCache::getDepthPyramidTexture() {
219+ if (!_depthPyramidTexture) {
220+ createPrimaryFramebuffer();
221+ }
222+ return _depthPyramidTexture;
223+}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t