Showing the changes to libraries/render-utils/src/DebugDeferredBuffer.cpp (1 of 2 files). Show all
Unified · Split
| @@ -20,6 +20,7 @@ · 19 unmodified lines | |||
| 20 | 20 | ||
| 21 | #include "GeometryCache.h" | 21 | #include "GeometryCache.h" |
| 22 | #include "FramebufferCache.h" | 22 | #include "FramebufferCache.h" |
| 23 | #include "TextureCache.h" | ||
| 23 | #include "DeferredLightingEffect.h" | 24 | #include "DeferredLightingEffect.h" |
| 24 | 25 | ||
| 25 | #include "debug_deferred_buffer_vert.h" | 26 | #include "debug_deferred_buffer_vert.h" |
| @@ -138,7 +139,7 @@ static const std::string DEFAULT_PYRAMID_DEPTH_SHADER { · 112 unmodified lines | |||
| 138 | 139 | ||
| 139 | static const std::string DEFAULT_AMBIENT_OCCLUSION_SHADER{ | 140 | static const std::string DEFAULT_AMBIENT_OCCLUSION_SHADER{ |
| 140 | "vec4 getFragmentColor() {" | 141 | "vec4 getFragmentColor() {" |
| 141 | " return vec4(vec3(texture(occlusionMap, uv).x), 1.0);" | 142 | " return vec4(vec3(texture(obscuranceMap, uv).x), 1.0);" |
| 142 | // When drawing color " return vec4(vec3(texture(occlusionMap, uv).xyz), 1.0);" | 143 | // When drawing color " return vec4(vec3(texture(occlusionMap, uv).xyz), 1.0);" |
| 143 | // when drawing normal " return vec4(normalize(texture(occlusionMap, uv).xyz * 2.0 - vec3(1.0)), 1.0);" | 144 | // when drawing normal " return vec4(normalize(texture(occlusionMap, uv).xyz * 2.0 - vec3(1.0)), 1.0);" |
| 144 | " }" | 145 | " }" |
| @@ -251,10 +252,10 @@ const gpu::PipelinePointer& DebugDeferredBuffer::getPipeline(Mode mode, std::str · 106 unmodified lines | |||
| 251 | slotBindings.insert(gpu::Shader::Binding("normalMap", Normal)); | 252 | slotBindings.insert(gpu::Shader::Binding("normalMap", Normal)); |
| 252 | slotBindings.insert(gpu::Shader::Binding("specularMap", Specular)); | 253 | slotBindings.insert(gpu::Shader::Binding("specularMap", Specular)); |
| 253 | slotBindings.insert(gpu::Shader::Binding("depthMap", Depth)); | 254 | slotBindings.insert(gpu::Shader::Binding("depthMap", Depth)); |
| 255 | slotBindings.insert(gpu::Shader::Binding("obscuranceMap", AmbientOcclusion)); | ||
| 254 | slotBindings.insert(gpu::Shader::Binding("lightingMap", Lighting)); | 256 | slotBindings.insert(gpu::Shader::Binding("lightingMap", Lighting)); |
| 255 | slotBindings.insert(gpu::Shader::Binding("shadowMap", Shadow)); | 257 | slotBindings.insert(gpu::Shader::Binding("shadowMap", Shadow)); |
| 256 | slotBindings.insert(gpu::Shader::Binding("pyramidMap", Pyramid)); | 258 | slotBindings.insert(gpu::Shader::Binding("pyramidMap", Pyramid)); |
| 257 | slotBindings.insert(gpu::Shader::Binding("occlusionMap", AmbientOcclusion)); | ||
| 258 | slotBindings.insert(gpu::Shader::Binding("occlusionBlurredMap", AmbientOcclusionBlurred)); | 259 | slotBindings.insert(gpu::Shader::Binding("occlusionBlurredMap", AmbientOcclusionBlurred)); |
| 259 | gpu::Shader::makeProgram(*program, slotBindings); | 260 | gpu::Shader::makeProgram(*program, slotBindings); |
| 260 | 261 | ||
| @@ -288,6 +289,7 @@ void DebugDeferredBuffer::run(const SceneContextPointer& sceneContext, const Ren · 27 unmodified lines | |||
| 288 | gpu::doInBatch(args->_context, [&](gpu::Batch& batch) { | 289 | gpu::doInBatch(args->_context, [&](gpu::Batch& batch) { |
| 289 | const auto geometryBuffer = DependencyManager::get<GeometryCache>(); | 290 | const auto geometryBuffer = DependencyManager::get<GeometryCache>(); |
| 290 | const auto framebufferCache = DependencyManager::get<FramebufferCache>(); | 291 | const auto framebufferCache = DependencyManager::get<FramebufferCache>(); |
| 292 | const auto textureCache = DependencyManager::get<TextureCache>(); | ||
| 291 | const auto& lightStage = DependencyManager::get<DeferredLightingEffect>()->getLightStage(); | 293 | const auto& lightStage = DependencyManager::get<DeferredLightingEffect>()->getLightStage(); |
| 292 | 294 | ||
| 293 | glm::mat4 projMat; | 295 | glm::mat4 projMat; |
| @@ -310,7 +312,12 @@ void DebugDeferredBuffer::run(const SceneContextPointer& sceneContext, const Ren · 16 unmodified lines | |||
| 310 | batch.setResourceTexture(Lighting, framebufferCache->getLightingTexture()); | 312 | batch.setResourceTexture(Lighting, framebufferCache->getLightingTexture()); |
| 311 | batch.setResourceTexture(Shadow, lightStage.lights[0]->shadow.framebuffer->getDepthStencilBuffer()); | 313 | batch.setResourceTexture(Shadow, lightStage.lights[0]->shadow.framebuffer->getDepthStencilBuffer()); |
| 312 | batch.setResourceTexture(Pyramid, framebufferCache->getDepthPyramidTexture()); | 314 | batch.setResourceTexture(Pyramid, framebufferCache->getDepthPyramidTexture()); |
| 313 | batch.setResourceTexture(AmbientOcclusion, framebufferCache->getOcclusionTexture()); | 315 | if (DependencyManager::get<DeferredLightingEffect>()->isAmbientOcclusionEnabled()) { |
| 316 | batch.setResourceTexture(AmbientOcclusion, framebufferCache->getOcclusionTexture()); | ||
| 317 | } else { | ||
| 318 | // need to assign the white texture if ao is off | ||
| 319 | batch.setResourceTexture(AmbientOcclusion, textureCache->getWhiteTexture()); | ||
| 320 | } | ||
| 314 | batch.setResourceTexture(AmbientOcclusionBlurred, framebufferCache->getOcclusionBlurredTexture()); | 321 | batch.setResourceTexture(AmbientOcclusionBlurred, framebufferCache->getOcclusionBlurredTexture()); |
| 315 | 322 | ||
| 316 | const glm::vec4 color(1.0f, 1.0f, 1.0f, 1.0f); | 323 | const glm::vec4 color(1.0f, 1.0f, 1.0f, 1.0f); |