VTK  9.7.1
vtkHexagonalBokehBlurPass.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-FileCopyrightText: Copyright 2025 F3D-APP Foundation
3 // SPDX-License-Identifier: BSD-3-Clause
15 #ifndef vtkHexagonalBokehBlurPass_h
16 #define vtkHexagonalBokehBlurPass_h
17 
18 #include "vtkImageProcessingPass.h"
19 #include "vtkOpenGLQuadHelper.h"
20 #include "vtkSmartPointer.h"
21 
22 class vtkTextureObject;
23 class vtkOpenGLFrameBuffer;
24 
25 VTK_ABI_NAMESPACE_BEGIN
26 
27 class VTKRENDERINGOPENGL2_EXPORT VTK_MARSHALAUTO vtkHexagonalBokehBlurPass
28  : public vtkImageProcessingPass
29 {
30 public:
33  void PrintSelf(ostream& os, vtkIndent indent) override;
34 
38  void Render(const vtkRenderState* s) override;
39 
43  void ReleaseGraphicsResources(vtkWindow* w) override;
44 
46 
52  vtkGetMacro(CircleOfConfusionRadius, float);
53  vtkSetMacro(CircleOfConfusionRadius, float);
55 
56 protected:
57  vtkHexagonalBokehBlurPass() = default;
58  ~vtkHexagonalBokehBlurPass() override = default;
59 
60 private:
62  void operator=(const vtkHexagonalBokehBlurPass&) = delete;
63 
67  void InitializeGraphicsResources(vtkOpenGLRenderWindow* renderWindow, int width, int height);
68 
72  void RenderDelegate(const vtkRenderState* s, int width, int height);
73 
77  void RenderDirectionalBlur(vtkOpenGLRenderWindow* renWin, int width, int height, float coc);
78 
82  void RenderRhomboidBlur(vtkOpenGLRenderWindow* renWin, int width, int height, float coc);
83 
84  float CircleOfConfusionRadius = 20.0f;
85 
87  vtkSmartPointer<vtkTextureObject> VerticalBlurTexture;
88  vtkSmartPointer<vtkTextureObject> DiagonalBlurTexture;
89  vtkSmartPointer<vtkTextureObject> BackgroundTexture;
90 
91  std::unique_ptr<vtkOpenGLQuadHelper> BlurQuadHelper = nullptr;
92  std::unique_ptr<vtkOpenGLQuadHelper> RhomboidQuadHelper = nullptr;
93 };
94 
95 VTK_ABI_NAMESPACE_END
96 
97 #endif // vtkHexagonalBokehBlurPass_h
OpenGL rendering window.
void ReleaseGraphicsResources(vtkWindow *w) override
Release graphics resources and ask components to release their own resources.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
Convenient class for post-processing passes.
window superclass for vtkRenderWindow
Definition: vtkWindow.h:41
Context in which a vtkRenderPass will render.
void RenderDelegate(const vtkRenderState *s, int width, int height, int newWidth, int newHeight, vtkOpenGLFramebufferObject *fbo, vtkTextureObject *target)
Render delegate with a image of different dimensions than the original one.
a simple class to control print indentation
Definition: vtkIndent.h:28
Screen space render pass that blur a given image using the hexagonal bokeh method.
abstracts an OpenGL texture object.
virtual void Render(const vtkRenderState *s)=0
Perform rendering according to a render state s.
#define VTK_MARSHALAUTO
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...