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