12 Texture* sceneTexture,
Texture* sceneTextureHalf,
const bool highQualityValue,
const bool nearBlurValue)
13 :
RenderPass(
device), _cameraComponent(cameraComponent), _sceneTexture(sceneTexture), _sceneTextureHalf(sceneTextureHalf),
17 Texture* halfSource = sceneTextureHalf ? sceneTextureHalf : sceneTexture;
20 _cocTarget = createRenderTarget(
"CoCTexture", cocFormat, _cocTexture);
22 Texture* sourceTexture = sceneTexture;
23 if (_cocTarget && sourceTexture) {
24 _cocPass = std::make_shared<RenderPassCoC>(
device, cameraComponent,
nearBlur);
25 auto options = std::make_shared<RenderPassOptions>();
26 options->resizeSource = std::shared_ptr<Texture>(sourceTexture, [](
Texture*) {});
27 _cocPass->init(_cocTarget, options);
28 const Color clearBlack(0.0f, 0.0f, 0.0f, 1.0f);
29 _cocPass->setClearColor(&clearBlack);
35 _farTarget = createRenderTarget(
"FarDofTexture", farSource->
format(), _farTexture);
41 _farPass = std::make_shared<RenderPassDownsample>(
device, farSource, downsampleOptions);
42 auto options = std::make_shared<RenderPassOptions>();
43 options->resizeSource = std::shared_ptr<Texture>(farSource, [](
Texture*) {});
44 options->scaleX = 0.5f;
45 options->scaleY = 0.5f;
46 _farPass->init(_farTarget, options);
47 const Color clearBlack(0.0f, 0.0f, 0.0f, 1.0f);
48 _farPass->setClearColor(&clearBlack);
54 _blurTarget = createRenderTarget(
"DofBlurTexture", sourceFormat, _blurTexture);
55 if (_blurTarget && _farTarget) {
56 Texture* farTexture = _farTarget->colorBuffer();
57 _blurPass = std::make_shared<RenderPassDofBlur>(
device,
nearBlur ? halfSource :
nullptr, farTexture, _cocTexture.get());
58 auto options = std::make_shared<RenderPassOptions>();
59 options->resizeSource = std::shared_ptr<Texture>(halfSource, [](
Texture*) {});
62 _blurPass->init(_blurTarget, options);
63 const Color clearBlack(0.0f, 0.0f, 0.0f, 1.0f);
64 _blurPass->setClearColor(&clearBlack);
RenderPassDof(const std::shared_ptr< GraphicsDevice > &device, CameraComponent *cameraComponent, Texture *sceneTexture, Texture *sceneTextureHalf, bool highQuality, bool nearBlur)
GPU texture resource supporting 2D, cubemap, volume, and array formats with mipmap management.
PixelFormat format() const