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 | Specular, | 32 | Specular, |
| 33 | Depth, | 33 | Depth, |
| 34 | Lighting, | 34 | Lighting, |
| 35 | Pyramid | 35 | Pyramid, |
| 36 | OcclusionRaw, | ||
| 37 | OcclusionBlurred | ||
| 36 | }; | 38 | }; |
| 37 | 39 | ||
| 38 | static const std::string DEEFAULT_DIFFUSE_SHADER { | 40 | static const std::string DEEFAULT_DIFFUSE_SHADER { |
| @@ -40,7 +42,7 @@ static const std::string DEEFAULT_DIFFUSE_SHADER { · 1 unmodified line | |||
| 40 | " return vec4(pow(texture(diffuseMap, uv).xyz, vec3(1.0 / 2.2)), 1.0);" | 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 | "vec4 getFragmentColor() {" | 46 | "vec4 getFragmentColor() {" |
| 45 | " return vec4(vec3(texture(diffuseMap, uv).a), 1.0);" | 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 | " return vec4(pow(texture(lightingMap, uv).xyz, vec3(1.0 / 2.2)), 1.0);" | 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 | "vec4 getFragmentColor() {" | 76 | "vec4 getFragmentColor() {" |
| 75 | " return vec4(vec3(1.0 - texture(pyramidMap, uv).x * 0.01), 1.0);" | 77 | " return vec4(vec3(1.0 - texture(pyramidMap, uv).x * 0.01), 1.0);" |
| 76 | //" return vec4(vec3(1.0 - textureLod(pyramidMap, uv, 3).x * 0.01), 1.0);" | 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 | static const std::string DEEFAULT_CUSTOM_SHADER { | 92 | static const std::string DEEFAULT_CUSTOM_SHADER { |
| 80 | "vec4 getFragmentColor() {" | 93 | "vec4 getFragmentColor() {" |
| 81 | " return vec4(1.0, 0.0, 0.0, 1.0);" | 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 | switch (mode) { | 119 | switch (mode) { |
| 107 | case DiffuseMode: | 120 | case DiffuseMode: |
| 108 | return DEEFAULT_DIFFUSE_SHADER; | 121 | return DEEFAULT_DIFFUSE_SHADER; |
| 109 | case AlphaMode: | 122 | case AmbientOcclusionMode: |
| 110 | return DEEFAULT_ALPHA_SHADER; | 123 | return DEFAULT_AMBIENT_OCCLUSION_SHADER; |
| 111 | case SpecularMode: | 124 | case SpecularMode: |
| 112 | return DEEFAULT_SPECULAR_SHADER; | 125 | return DEEFAULT_SPECULAR_SHADER; |
| 113 | case RoughnessMode: | 126 | case RoughnessMode: |
| @@ -118,8 +131,12 @@ std::string DebugDeferredBuffer::getShaderSourceCode(Modes mode, std::string cus · 4 unmodified lines | |||
| 118 | return DEEFAULT_DEPTH_SHADER; | 131 | return DEEFAULT_DEPTH_SHADER; |
| 119 | case LightingMode: | 132 | case LightingMode: |
| 120 | return DEEFAULT_LIGHTING_SHADER; | 133 | return DEEFAULT_LIGHTING_SHADER; |
| 121 | case AmbientOcclusionMode: | 134 | case PyramidDepthMode: |
| 122 | return DEFAULT_AMBIENT_OCCLUSION_SHADER; | 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 | case CustomMode: | 140 | case CustomMode: |
| 124 | return getFileContent(customFile, DEEFAULT_CUSTOM_SHADER); | 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 | slotBindings.insert(gpu::Shader::Binding("depthMap", Depth)); | 185 | slotBindings.insert(gpu::Shader::Binding("depthMap", Depth)); |
| 169 | slotBindings.insert(gpu::Shader::Binding("lightingMap", Lighting)); | 186 | slotBindings.insert(gpu::Shader::Binding("lightingMap", Lighting)); |
| 170 | slotBindings.insert(gpu::Shader::Binding("pyramidMap", Pyramid)); | 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 | gpu::Shader::makeProgram(*program, slotBindings); | 190 | gpu::Shader::makeProgram(*program, slotBindings); |
| 172 | 191 | ||
| 173 | auto pipeline = gpu::Pipeline::create(program, std::make_shared<gpu::State>()); | 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 | batch.setResourceTexture(Depth, framebufferCache->getPrimaryDepthTexture()); | 235 | batch.setResourceTexture(Depth, framebufferCache->getPrimaryDepthTexture()); |
| 217 | batch.setResourceTexture(Lighting, framebufferCache->getLightingTexture()); | 236 | batch.setResourceTexture(Lighting, framebufferCache->getLightingTexture()); |
| 218 | batch.setResourceTexture(Pyramid, framebufferCache->getDepthPyramidTexture()); | 237 | batch.setResourceTexture(Pyramid, framebufferCache->getDepthPyramidTexture()); |
| 238 | batch.setResourceTexture(OcclusionRaw, framebufferCache->getOcclusionTexture()); | ||
| 239 | batch.setResourceTexture(OcclusionBlurred, framebufferCache->getOcclusionBlurredTexture()); | ||
| 219 | 240 | ||
| 220 | const glm::vec4 color(1.0f, 1.0f, 1.0f, 1.0f); | 241 | const glm::vec4 color(1.0f, 1.0f, 1.0f, 1.0f); |
| 221 | const glm::vec2 bottomLeft(renderContext->_deferredDebugSize.x, renderContext->_deferredDebugSize.y); | 242 | const glm::vec2 bottomLeft(renderContext->_deferredDebugSize.x, renderContext->_deferredDebugSize.y); |