Showing the changes to libraries/render-utils/src/DebugDeferredBuffer.cpp (1 of 24 files). Show all
Unified · Split
| @@ -32,7 +32,9 @@ enum Slots { · 31 unmodified lines | ||
| 32 | 32 | Specular, |
| 33 | 33 | Depth, |
| 34 | 34 | Lighting, |
| 35 | − Pyramid | |
| 35 | + Pyramid, | |
| 36 | + OcclusionRaw, | |
| 37 | + OcclusionBlurred | |
| 36 | 38 | }; |
| 37 | 39 | |
| 38 | 40 | static const std::string DEEFAULT_DIFFUSE_SHADER { |
| @@ -40,7 +42,7 @@ static const std::string DEEFAULT_DIFFUSE_SHADER { · 1 unmodified line | ||
| 40 | 42 | " return vec4(pow(texture(diffuseMap, uv).xyz, vec3(1.0 / 2.2)), 1.0);" |
| 41 | 43 | " }" |
| 42 | 44 | }; |
| 43 | −static const std::string DEEFAULT_ALPHA_SHADER { | |
| 45 | +static const std::string DEFAULT_AMBIENT_OCCLUSION_SHADER { | |
| 44 | 46 | "vec4 getFragmentColor() {" |
| 45 | 47 | " return vec4(vec3(texture(diffuseMap, uv).a), 1.0);" |
| 46 | 48 | " }" |
| @@ -70,12 +72,23 @@ static const std::string DEEFAULT_LIGHTING_SHADER { · 23 unmodified lines | ||
| 70 | 72 | " return vec4(pow(texture(lightingMap, uv).xyz, vec3(1.0 / 2.2)), 1.0);" |
| 71 | 73 | " }" |
| 72 | 74 | }; |
| 73 | −static const std::string DEFAULT_AMBIENT_OCCLUSION_SHADER { | |
| 75 | +static const std::string DEFAULT_PYRAMID_DEPTH_SHADER { | |
| 74 | 76 | "vec4 getFragmentColor() {" |
| 75 | 77 | " return vec4(vec3(1.0 - texture(pyramidMap, uv).x * 0.01), 1.0);" |
| 76 | 78 | //" return vec4(vec3(1.0 - textureLod(pyramidMap, uv, 3).x * 0.01), 1.0);" |
| 77 | 79 | " }" |
| 78 | 80 | }; |
| 81 | +static const std::string DEFAULT_OCCLUSION_RAW_SHADER { | |
| 82 | + "vec4 getFragmentColor() {" | |
| 83 | + " return vec4(vec3(texture(occlusionRawMap, uv).x), 1.0);" | |
| 84 | + " }" | |
| 85 | +}; | |
| 86 | +static const std::string DEFAULT_OCCLUSION_BLURRED_SHADER { | |
| 87 | + "vec4 getFragmentColor() {" | |
| 88 | + " return vec4(vec3(texture(occlusionBlurredMap, uv).x), 1.0);" | |
| 89 | + " }" | |
| 90 | +}; | |
| 91 | + | |
| 79 | 92 | static const std::string DEEFAULT_CUSTOM_SHADER { |
| 80 | 93 | "vec4 getFragmentColor() {" |
| 81 | 94 | " return vec4(1.0, 0.0, 0.0, 1.0);" |
| @@ -106,8 +119,8 @@ std::string DebugDeferredBuffer::getShaderSourceCode(Modes mode, std::string cus · 24 unmodified lines | ||
| 106 | 119 | switch (mode) { |
| 107 | 120 | case DiffuseMode: |
| 108 | 121 | return DEEFAULT_DIFFUSE_SHADER; |
| 109 | − case AlphaMode: | |
| 110 | − return DEEFAULT_ALPHA_SHADER; | |
| 122 | + case AmbientOcclusionMode: | |
| 123 | + return DEFAULT_AMBIENT_OCCLUSION_SHADER; | |
| 111 | 124 | case SpecularMode: |
| 112 | 125 | return DEEFAULT_SPECULAR_SHADER; |
| 113 | 126 | case RoughnessMode: |
| @@ -118,8 +131,12 @@ std::string DebugDeferredBuffer::getShaderSourceCode(Modes mode, std::string cus · 4 unmodified lines | ||
| 118 | 131 | return DEEFAULT_DEPTH_SHADER; |
| 119 | 132 | case LightingMode: |
| 120 | 133 | return DEEFAULT_LIGHTING_SHADER; |
| 121 | − case AmbientOcclusionMode: | |
| 122 | − return DEFAULT_AMBIENT_OCCLUSION_SHADER; | |
| 134 | + case PyramidDepthMode: | |
| 135 | + return DEFAULT_PYRAMID_DEPTH_SHADER; | |
| 136 | + case OcclusionRawMode: | |
| 137 | + return DEFAULT_OCCLUSION_RAW_SHADER; | |
| 138 | + case OcclusionBlurredMode: | |
| 139 | + return DEFAULT_OCCLUSION_BLURRED_SHADER; | |
| 123 | 140 | case CustomMode: |
| 124 | 141 | return getFileContent(customFile, DEEFAULT_CUSTOM_SHADER); |
| 125 | 142 | } |
| @@ -168,6 +185,8 @@ const gpu::PipelinePointer& DebugDeferredBuffer::getPipeline(Modes mode, std::st · 42 unmodified lines | ||
| 168 | 185 | slotBindings.insert(gpu::Shader::Binding("depthMap", Depth)); |
| 169 | 186 | slotBindings.insert(gpu::Shader::Binding("lightingMap", Lighting)); |
| 170 | 187 | slotBindings.insert(gpu::Shader::Binding("pyramidMap", Pyramid)); |
| 188 | + slotBindings.insert(gpu::Shader::Binding("occlusionRawMap", OcclusionRaw)); | |
| 189 | + slotBindings.insert(gpu::Shader::Binding("occlusionBlurredMap", OcclusionBlurred)); | |
| 171 | 190 | gpu::Shader::makeProgram(*program, slotBindings); |
| 172 | 191 | |
| 173 | 192 | auto pipeline = gpu::Pipeline::create(program, std::make_shared<gpu::State>()); |
| @@ -216,6 +235,8 @@ void DebugDeferredBuffer::run(const SceneContextPointer& sceneContext, const Ren · 42 unmodified lines | ||
| 216 | 235 | batch.setResourceTexture(Depth, framebufferCache->getPrimaryDepthTexture()); |
| 217 | 236 | batch.setResourceTexture(Lighting, framebufferCache->getLightingTexture()); |
| 218 | 237 | batch.setResourceTexture(Pyramid, framebufferCache->getDepthPyramidTexture()); |
| 238 | + batch.setResourceTexture(OcclusionRaw, framebufferCache->getOcclusionTexture()); | |
| 239 | + batch.setResourceTexture(OcclusionBlurred, framebufferCache->getOcclusionBlurredTexture()); | |
| 219 | 240 | |
| 220 | 241 | const glm::vec4 color(1.0f, 1.0f, 1.0f, 1.0f); |
| 221 | 242 | const glm::vec2 bottomLeft(renderContext->_deferredDebugSize.x, renderContext->_deferredDebugSize.y); |