History

Merged with samcake's 'black' branch

Olivier Prat committed 8 years ago

Commit 1ce1aca2 parents 2bd24ee ec9343381 files · +4373 −104Browse files

Showing the changes to libraries/render-utils/src/DebugDeferredBuffer.cpp (1 of 81 files). Show all

Unified · Split

libraries/render-utils/src/DebugDeferredBuffer.cpp+17−1
@@ -53,7 +53,8 @@ enum Slot { · 52 unmodified lines
5353 DiffusedCurvature,
5454 Scattering,
5555 AmbientOcclusion,
56− AmbientOcclusionBlurred
56+ AmbientOcclusionBlurred,
57+ Velocity,
5758 };
5859
5960
@@ -227,6 +228,12 @@ static const std::string DEFAULT_AMBIENT_OCCLUSION_BLURRED_SHADER{ · 167 unmodified lines
227228 " }"
228229 };
229230
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+
230237 static const std::string DEFAULT_CUSTOM_SHADER {
231238 "vec4 getFragmentColor() {"
232239 " 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
309316 return DEFAULT_AMBIENT_OCCLUSION_SHADER;
310317 case AmbientOcclusionBlurredMode:
311318 return DEFAULT_AMBIENT_OCCLUSION_BLURRED_SHADER;
319+ case VelocityMode:
320+ return DEFAULT_VELOCITY_SHADER;
312321 case CustomMode:
313322 return getFileContent(customFile, DEFAULT_CUSTOM_SHADER);
314323 default:
@@ -367,6 +376,7 @@ const gpu::PipelinePointer& DebugDeferredBuffer::getPipeline(Mode mode, std::str · 52 unmodified lines
367376 slotBindings.insert(gpu::Shader::Binding("diffusedCurvatureMap", DiffusedCurvature));
368377 slotBindings.insert(gpu::Shader::Binding("scatteringMap", Scattering));
369378 slotBindings.insert(gpu::Shader::Binding("occlusionBlurredMap", AmbientOcclusionBlurred));
379+ slotBindings.insert(gpu::Shader::Binding("velocityMap", Velocity));
370380 gpu::Shader::makeProgram(*program, slotBindings);
371381
372382 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
404414 auto& linearDepthTarget = inputs.get1();
405415 auto& surfaceGeometryFramebuffer = inputs.get2();
406416 auto& ambientOcclusionFramebuffer = inputs.get3();
417+ auto& velocityFramebuffer = inputs.get4();
407418
408419 gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {
409420 batch.enableStereo(false);
@@ -432,6 +443,9 @@ void DebugDeferredBuffer::run(const RenderContextPointer& renderContext, const I · 22 unmodified lines
432443 batch.setResourceTexture(Depth, deferredFramebuffer->getPrimaryDepthTexture());
433444 batch.setResourceTexture(Lighting, deferredFramebuffer->getLightingTexture());
434445 }
446+ if (velocityFramebuffer) {
447+ batch.setResourceTexture(Velocity, velocityFramebuffer->getVelocityTexture());
448+ }
435449
436450 auto lightStage = renderContext->_scene->getStage<LightStage>();
437451 assert(lightStage);
@@ -477,5 +491,7 @@ void DebugDeferredBuffer::run(const RenderContextPointer& renderContext, const I · 39 unmodified lines
477491 batch.setResourceTexture(AmbientOcclusion, nullptr);
478492 batch.setResourceTexture(AmbientOcclusionBlurred, nullptr);
479493
494+ batch.setResourceTexture(Velocity, nullptr);
495+
480496 });
481497 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t