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 | 52 | DiffusedCurvature, |
| 53 | 53 | Scattering, |
| 54 | 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 | 236 | static const std::string DEFAULT_CUSTOM_SHADER { |
| 230 | 237 | "vec4 getFragmentColor() {" |
| 231 | 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 | 315 | return DEFAULT_AMBIENT_OCCLUSION_SHADER; |
| 309 | 316 | case AmbientOcclusionBlurredMode: |
| 310 | 317 | return DEFAULT_AMBIENT_OCCLUSION_BLURRED_SHADER; |
| 318 | + case VelocityMode: | |
| 319 | + return DEFAULT_VELOCITY_SHADER; | |
| 311 | 320 | case CustomMode: |
| 312 | 321 | return getFileContent(customFile, DEFAULT_CUSTOM_SHADER); |
| 313 | 322 | default: |
| @@ -366,6 +375,7 @@ const gpu::PipelinePointer& DebugDeferredBuffer::getPipeline(Mode mode, std::str · 52 unmodified lines | ||
| 366 | 375 | slotBindings.insert(gpu::Shader::Binding("diffusedCurvatureMap", DiffusedCurvature)); |
| 367 | 376 | slotBindings.insert(gpu::Shader::Binding("scatteringMap", Scattering)); |
| 368 | 377 | slotBindings.insert(gpu::Shader::Binding("occlusionBlurredMap", AmbientOcclusionBlurred)); |
| 378 | + slotBindings.insert(gpu::Shader::Binding("velocityMap", Velocity)); | |
| 369 | 379 | gpu::Shader::makeProgram(*program, slotBindings); |
| 370 | 380 | |
| 371 | 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 | 413 | auto& linearDepthTarget = inputs.get1(); |
| 404 | 414 | auto& surfaceGeometryFramebuffer = inputs.get2(); |
| 405 | 415 | auto& ambientOcclusionFramebuffer = inputs.get3(); |
| 416 | + auto& velocityFramebuffer = inputs.get4(); | |
| 406 | 417 | |
| 407 | 418 | gpu::doInBatch(args->_context, [&](gpu::Batch& batch) { |
| 408 | 419 | batch.enableStereo(false); |
| @@ -431,6 +442,9 @@ void DebugDeferredBuffer::run(const RenderContextPointer& renderContext, const I · 22 unmodified lines | ||
| 431 | 442 | batch.setResourceTexture(Depth, deferredFramebuffer->getPrimaryDepthTexture()); |
| 432 | 443 | batch.setResourceTexture(Lighting, deferredFramebuffer->getLightingTexture()); |
| 433 | 444 | } |
| 445 | + if (velocityFramebuffer) { | |
| 446 | + batch.setResourceTexture(Velocity, velocityFramebuffer->getVelocityTexture()); | |
| 447 | + } | |
| 434 | 448 | |
| 435 | 449 | auto lightStage = renderContext->_scene->getStage<LightStage>(); |
| 436 | 450 | assert(lightStage); |
| @@ -476,5 +490,7 @@ void DebugDeferredBuffer::run(const RenderContextPointer& renderContext, const I · 39 unmodified lines | ||
| 476 | 490 | batch.setResourceTexture(AmbientOcclusion, nullptr); |
| 477 | 491 | batch.setResourceTexture(AmbientOcclusionBlurred, nullptr); |
| 478 | 492 | |
| 493 | + batch.setResourceTexture(Velocity, nullptr); | |
| 494 | + | |
| 479 | 495 | }); |
| 480 | 496 | } |