12 #ifndef hifi_VelocityBufferPass_h
13 #define hifi_VelocityBufferPass_h
15 #include "SurfaceGeometryPass.h"
20 class VelocityFramebuffer {
22 VelocityFramebuffer();
24 gpu::FramebufferPointer getVelocityFramebuffer();
25 gpu::TexturePointer getVelocityTexture();
28 void updatePrimaryDepth(
const gpu::TexturePointer& depthBuffer);
30 gpu::TexturePointer getPrimaryDepthTexture();
31 const glm::ivec2& getDepthFrameSize()
const {
return _frameSize; }
33 void setResolutionLevel(
int level);
34 int getResolutionLevel()
const {
return _resolutionLevel; }
40 gpu::TexturePointer _primaryDepthTexture;
42 gpu::FramebufferPointer _velocityFramebuffer;
43 gpu::TexturePointer _velocityTexture;
45 glm::ivec2 _frameSize;
46 glm::ivec2 _halfFrameSize;
47 int _resolutionLevel{ 0 };
50 using VelocityFramebufferPointer = std::shared_ptr<VelocityFramebuffer>;
52 class VelocityBufferPassConfig :
public render::GPUJobConfig {
54 Q_PROPERTY(
float depthThreshold MEMBER depthThreshold NOTIFY dirty)
57 VelocityBufferPassConfig() : render::GPUJobConfig(true) {}
59 float depthThreshold{ 5.0f };
65 class VelocityBufferPass {
67 using Inputs = render::VaryingSet2<DeferredFrameTransformPointer, DeferredFramebufferPointer>;
68 using Outputs = render::VaryingSet3<VelocityFramebufferPointer, gpu::FramebufferPointer, gpu::TexturePointer>;
69 using Config = VelocityBufferPassConfig;
70 using JobModel = render::Job::ModelIO<VelocityBufferPass, Inputs, Outputs, Config>;
74 void configure(
const Config& config);
75 void run(
const render::RenderContextPointer& renderContext,
const Inputs& inputs, Outputs& outputs);
78 typedef gpu::BufferView UniformBufferView;
80 VelocityFramebufferPointer _velocityFramebuffer;
82 const gpu::PipelinePointer& getCameraMotionPipeline(
const render::RenderContextPointer& renderContext);
83 gpu::PipelinePointer _cameraMotionPipeline;
85 gpu::RangeTimerPointer _gpuTimer;