more clean up

This commit is contained in:
samcake 2016-01-21 17:36:53 -08:00
parent 846c5a7b9a
commit b5aa5fcb46
3 changed files with 6 additions and 12 deletions

View file

@ -115,7 +115,7 @@ const gpu::PipelinePointer& AmbientOcclusionEffect::getPyramidPipeline() {
gpu::StatePointer state = gpu::StatePointer(new gpu::State());
// Stencil test all the ao passes for objects pixels only, not the background
// Stencil test the pyramid passe for objects pixels only, not the background
state->setStencilTest(true, 0xFF, gpu::State::StencilTest(0, 0xFF, gpu::NOT_EQUAL, gpu::State::STENCIL_OP_KEEP, gpu::State::STENCIL_OP_KEEP, gpu::State::STENCIL_OP_KEEP));
state->setColorWriteMask(true, false, false, false);
@ -140,9 +140,6 @@ const gpu::PipelinePointer& AmbientOcclusionEffect::getOcclusionPipeline() {
gpu::StatePointer state = gpu::StatePointer(new gpu::State());
// Stencil test the ao passes for objects pixels only, not the background
state->setStencilTest(true, 0xFF, gpu::State::StencilTest(0, 0xFF, gpu::NOT_EQUAL, gpu::State::STENCIL_OP_KEEP, gpu::State::STENCIL_OP_KEEP, gpu::State::STENCIL_OP_KEEP));
state->setColorWriteMask(true, true, true, false);
// Good to go add the brand new pipeline
@ -165,10 +162,7 @@ const gpu::PipelinePointer& AmbientOcclusionEffect::getHBlurPipeline() {
gpu::Shader::makeProgram(*program, slotBindings);
gpu::StatePointer state = gpu::StatePointer(new gpu::State());
// Stencil test all the ao passes for objects pixels only, not the background
//state->setStencilTest(true, 0xFF, gpu::State::StencilTest(0, 0xFF, gpu::NOT_EQUAL, gpu::State::STENCIL_OP_KEEP, gpu::State::STENCIL_OP_KEEP, gpu::State::STENCIL_OP_KEEP));
state->setColorWriteMask(true, true, true, false);
// Good to go add the brand new pipeline
@ -192,9 +186,6 @@ const gpu::PipelinePointer& AmbientOcclusionEffect::getVBlurPipeline() {
gpu::StatePointer state = gpu::StatePointer(new gpu::State());
// Stencil test all the ao passes for objects pixels only, not the background
//state->setStencilTest(true, 0xFF, gpu::State::StencilTest(0, 0xFF, gpu::NOT_EQUAL, gpu::State::STENCIL_OP_KEEP, gpu::State::STENCIL_OP_KEEP, gpu::State::STENCIL_OP_KEEP));
// Vertical blur write just the final result Occlusion value in the alpha channel
state->setColorWriteMask(true, true, true, false);

View file

@ -247,7 +247,8 @@ gpu::TexturePointer FramebufferCache::getDepthPyramidTexture() {
}
void FramebufferCache::setAmbientOcclusionResolutionLevel(int level) {
level = std::max(0, std::min(level, 4));
const int MAX_AO_RESOLUTION_LEVEL = 4;
level = std::max(0, std::min(level, MAX_AO_RESOLUTION_LEVEL));
if (level != _AOResolutionLevel) {
_AOResolutionLevel = level;
resizeAmbientOcclusionBuffers();

View file

@ -133,6 +133,7 @@ void main(void) {
float A = max(0.0, 1.0 - sum * getObscuranceScaling() * 5.0 * getInvNumSamples());
<! // KEEP IT for Debugging
// Bilateral box-filter over a quad for free, respecting depth edges
// (the difference that this makes is subtle)
if (abs(dFdx(Cp.z)) < 0.02) {
@ -141,6 +142,7 @@ void main(void) {
if (abs(dFdy(Cp.z)) < 0.02) {
A -= dFdy(A) * ((ssC.y & 1) - 0.5);
}
!>
outFragColor = vec4(packOcclusionDepth(A, CSZToDephtKey(Cp.z)), 1.0);