History

Putting together the stencil buffer for opaque vs background and using it for the backgroud render items

samcake committed 11 years ago

Commit 75e858c1 parent e78f15210 files · +44 −39Browse files

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

Unified · Split

libraries/render-utils/src/FramebufferCache.cpp+7−7
@@ -35,7 +35,7 @@ void FramebufferCache::setFrameBufferSize(QSize frameBufferSize) { · 34 unmodified lines
35 _frameBufferSize = frameBufferSize;35 _frameBufferSize = frameBufferSize;
36 _primaryFramebufferFull.reset();36 _primaryFramebufferFull.reset();
37 _primaryFramebufferDepthColor.reset();37 _primaryFramebufferDepthColor.reset();
38 _primaryFramebufferDepthStencilColor.reset();38 _primaryFramebufferStencilColor.reset();
39 _primaryDepthTexture.reset();39 _primaryDepthTexture.reset();
40 _primaryStencilTexture.reset();40 _primaryStencilTexture.reset();
41 _primaryColorTexture.reset();41 _primaryColorTexture.reset();
@@ -49,7 +49,7 @@ void FramebufferCache::setFrameBufferSize(QSize frameBufferSize) { · 7 unmodified lines
49void FramebufferCache::createPrimaryFramebuffer() {49void FramebufferCache::createPrimaryFramebuffer() {
50 _primaryFramebufferFull = gpu::FramebufferPointer(gpu::Framebuffer::create());50 _primaryFramebufferFull = gpu::FramebufferPointer(gpu::Framebuffer::create());
51 _primaryFramebufferDepthColor = gpu::FramebufferPointer(gpu::Framebuffer::create());51 _primaryFramebufferDepthColor = gpu::FramebufferPointer(gpu::Framebuffer::create());
52 _primaryFramebufferDepthStencilColor = gpu::FramebufferPointer(gpu::Framebuffer::create());52 _primaryFramebufferStencilColor = gpu::FramebufferPointer(gpu::Framebuffer::create());
53 53
54 auto colorFormat = gpu::Element(gpu::VEC4, gpu::NUINT8, gpu::RGBA);54 auto colorFormat = gpu::Element(gpu::VEC4, gpu::NUINT8, gpu::RGBA);
55 auto width = _frameBufferSize.width();55 auto width = _frameBufferSize.width();
@@ -66,7 +66,7 @@ void FramebufferCache::createPrimaryFramebuffer() { · 10 unmodified lines
66 66
67 _primaryFramebufferDepthColor->setRenderBuffer(0, _primaryColorTexture);67 _primaryFramebufferDepthColor->setRenderBuffer(0, _primaryColorTexture);
68 68
69 _primaryFramebufferDepthStencilColor->setRenderBuffer(0, _primaryColorTexture);69 _primaryFramebufferStencilColor->setRenderBuffer(0, _primaryColorTexture);
70 70
71 auto depthFormat = gpu::Element(gpu::SCALAR, gpu::FLOAT, gpu::DEPTH);71 auto depthFormat = gpu::Element(gpu::SCALAR, gpu::FLOAT, gpu::DEPTH);
72 _primaryDepthTexture = gpu::TexturePointer(gpu::Texture::create2D(depthFormat, width, height, defaultSampler));72 _primaryDepthTexture = gpu::TexturePointer(gpu::Texture::create2D(depthFormat, width, height, defaultSampler));
@@ -78,7 +78,7 @@ void FramebufferCache::createPrimaryFramebuffer() { · 5 unmodified lines
78 78
79 _primaryFramebufferDepthColor->setDepthStencilBuffer(_primaryDepthTexture, depthFormat);79 _primaryFramebufferDepthColor->setDepthStencilBuffer(_primaryDepthTexture, depthFormat);
80 80
81 _primaryFramebufferDepthStencilColor->setDepthStencilBuffer(_primaryStencilTexture, stencilFormat);81 _primaryFramebufferStencilColor->setDepthStencilBuffer(_primaryStencilTexture, stencilFormat);
82 82
83 _selfieFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create());83 _selfieFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create());
84 auto tex = gpu::TexturePointer(gpu::Texture::create2D(colorFormat, width * 0.5, height * 0.5, defaultSampler));84 auto tex = gpu::TexturePointer(gpu::Texture::create2D(colorFormat, width * 0.5, height * 0.5, defaultSampler));
@@ -99,11 +99,11 @@ gpu::FramebufferPointer FramebufferCache::getPrimaryFramebufferDepthColor() { · 14 unmodified lines
99 return _primaryFramebufferDepthColor;99 return _primaryFramebufferDepthColor;
100}100}
101 101
102gpu::FramebufferPointer FramebufferCache::getPrimaryFramebufferDepthStencilColor() {102gpu::FramebufferPointer FramebufferCache::getPrimaryFramebufferStencilColor() {
103 if (!_primaryFramebufferDepthStencilColor) {103 if (!_primaryFramebufferStencilColor) {
104 createPrimaryFramebuffer();104 createPrimaryFramebuffer();
105 }105 }
106 return _primaryFramebufferDepthStencilColor;106 return _primaryFramebufferStencilColor;
107}107}
108 108
109gpu::TexturePointer FramebufferCache::getPrimaryDepthTexture() {109gpu::TexturePointer FramebufferCache::getPrimaryDepthTexture() {