Showing the changes to libraries/render-utils/src/DebugDeferredBuffer.cpp (1 of 13 files). Show all
Unified · Split
| @@ -52,7 +52,8 @@ enum Slot { · 51 unmodified lines | |||
| 52 | DiffusedCurvature, | 52 | DiffusedCurvature, |
| 53 | Scattering, | 53 | Scattering, |
| 54 | AmbientOcclusion, | 54 | AmbientOcclusion, |
| 55 | AmbientOcclusionBlurred | 55 | AmbientOcclusionBlurred, |
| 56 | Velocity, | ||
| 56 | }; | 57 | }; |
| 57 | 58 | ||
| 58 | 59 | ||
| @@ -226,6 +227,12 @@ static const std::string DEFAULT_AMBIENT_OCCLUSION_BLURRED_SHADER{ · 167 unmodified lines | |||
| 226 | " }" | 227 | " }" |
| 227 | }; | 228 | }; |
| 228 | 229 | ||
| 230 | static const std::string DEFAULT_VELOCITY_SHADER{ | ||
| 231 | "vec4 getFragmentColor() {" | ||
| 232 | " return vec4(vec2(texture(velocityMap, uv).xy), 0.0, 1.0);" | ||
| 233 | " }" | ||
| 234 | }; | ||
| 235 | |||
| 229 | static const std::string DEFAULT_CUSTOM_SHADER { | 236 | static const std::string DEFAULT_CUSTOM_SHADER { |
| 230 | "vec4 getFragmentColor() {" | 237 | "vec4 getFragmentColor() {" |
| 231 | " return vec4(1.0, 0.0, 0.0, 1.0);" | 238 | " return vec4(1.0, 0.0, 0.0, 1.0);" |
| @@ -308,6 +315,8 @@ std::string DebugDeferredBuffer::getShaderSourceCode(Mode mode, std::string cust · 76 unmodified lines | |||
| 308 | return DEFAULT_AMBIENT_OCCLUSION_SHADER; | 315 | return DEFAULT_AMBIENT_OCCLUSION_SHADER; |
| 309 | case AmbientOcclusionBlurredMode: | 316 | case AmbientOcclusionBlurredMode: |
| 310 | return DEFAULT_AMBIENT_OCCLUSION_BLURRED_SHADER; | 317 | return DEFAULT_AMBIENT_OCCLUSION_BLURRED_SHADER; |
| 318 | case VelocityMode: | ||
| 319 | return DEFAULT_VELOCITY_SHADER; | ||
| 311 | case CustomMode: | 320 | case CustomMode: |
| 312 | return getFileContent(customFile, DEFAULT_CUSTOM_SHADER); | 321 | return getFileContent(customFile, DEFAULT_CUSTOM_SHADER); |
| 313 | default: | 322 | default: |
| @@ -366,6 +375,7 @@ const gpu::PipelinePointer& DebugDeferredBuffer::getPipeline(Mode mode, std::str · 52 unmodified lines | |||
| 366 | slotBindings.insert(gpu::Shader::Binding("diffusedCurvatureMap", DiffusedCurvature)); | 375 | slotBindings.insert(gpu::Shader::Binding("diffusedCurvatureMap", DiffusedCurvature)); |
| 367 | slotBindings.insert(gpu::Shader::Binding("scatteringMap", Scattering)); | 376 | slotBindings.insert(gpu::Shader::Binding("scatteringMap", Scattering)); |
| 368 | slotBindings.insert(gpu::Shader::Binding("occlusionBlurredMap", AmbientOcclusionBlurred)); | 377 | slotBindings.insert(gpu::Shader::Binding("occlusionBlurredMap", AmbientOcclusionBlurred)); |
| 378 | slotBindings.insert(gpu::Shader::Binding("velocityMap", Velocity)); | ||
| 369 | gpu::Shader::makeProgram(*program, slotBindings); | 379 | gpu::Shader::makeProgram(*program, slotBindings); |
| 370 | 380 | ||
| 371 | auto pipeline = gpu::Pipeline::create(program, std::make_shared<gpu::State>()); | 381 | auto pipeline = gpu::Pipeline::create(program, std::make_shared<gpu::State>()); |
| @@ -403,6 +413,7 @@ void DebugDeferredBuffer::run(const RenderContextPointer& renderContext, const I · 31 unmodified lines | |||
| 403 | auto& linearDepthTarget = inputs.get1(); | 413 | auto& linearDepthTarget = inputs.get1(); |
| 404 | auto& surfaceGeometryFramebuffer = inputs.get2(); | 414 | auto& surfaceGeometryFramebuffer = inputs.get2(); |
| 405 | auto& ambientOcclusionFramebuffer = inputs.get3(); | 415 | auto& ambientOcclusionFramebuffer = inputs.get3(); |
| 416 | auto& velocityFramebuffer = inputs.get4(); | ||
| 406 | 417 | ||
| 407 | gpu::doInBatch(args->_context, [&](gpu::Batch& batch) { | 418 | gpu::doInBatch(args->_context, [&](gpu::Batch& batch) { |
| 408 | batch.enableStereo(false); | 419 | batch.enableStereo(false); |
| @@ -431,6 +442,9 @@ void DebugDeferredBuffer::run(const RenderContextPointer& renderContext, const I · 22 unmodified lines | |||
| 431 | batch.setResourceTexture(Depth, deferredFramebuffer->getPrimaryDepthTexture()); | 442 | batch.setResourceTexture(Depth, deferredFramebuffer->getPrimaryDepthTexture()); |
| 432 | batch.setResourceTexture(Lighting, deferredFramebuffer->getLightingTexture()); | 443 | batch.setResourceTexture(Lighting, deferredFramebuffer->getLightingTexture()); |
| 433 | } | 444 | } |
| 445 | if (velocityFramebuffer) { | ||
| 446 | batch.setResourceTexture(Velocity, velocityFramebuffer->getVelocityTexture()); | ||
| 447 | } | ||
| 434 | 448 | ||
| 435 | auto lightStage = renderContext->_scene->getStage<LightStage>(); | 449 | auto lightStage = renderContext->_scene->getStage<LightStage>(); |
| 436 | assert(lightStage); | 450 | assert(lightStage); |
| @@ -476,5 +490,7 @@ void DebugDeferredBuffer::run(const RenderContextPointer& renderContext, const I · 39 unmodified lines | |||
| 476 | batch.setResourceTexture(AmbientOcclusion, nullptr); | 490 | batch.setResourceTexture(AmbientOcclusion, nullptr); |
| 477 | batch.setResourceTexture(AmbientOcclusionBlurred, nullptr); | 491 | batch.setResourceTexture(AmbientOcclusionBlurred, nullptr); |
| 478 | 492 | ||
| 493 | batch.setResourceTexture(Velocity, nullptr); | ||
| 494 | |||
| 479 | }); | 495 | }); |
| 480 | } | 496 | } |