VTK  9.7.20260926
vtkAnariPass.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
23
24#ifndef vtkAnariPass_h
25#define vtkAnariPass_h
26
27#include "vtkNew.h" // For vtkNew
28#include "vtkRenderPass.h"
29#include "vtkRenderingAnariOpenGLModule.h" // For export macro
30
31#include "vtkAnariDevice.h" // For vtkAnariDevice
32#include "vtkAnariRenderer.h" // For vtkAnariRenderer
33#include "vtkAnariSceneGraph.h" // For vtkAnariSceneGraph
34
35VTK_ABI_NAMESPACE_BEGIN
36
37// Forward declarations
39class vtkCameraPass;
45
46class VTKRENDERINGANARIOPENGL_EXPORT vtkAnariPass : public vtkRenderPass
47{
48public:
49 static vtkAnariPass* New();
50 vtkTypeMacro(vtkAnariPass, vtkRenderPass);
51 void PrintSelf(ostream& os, vtkIndent indent) override;
52
56 void Render(const vtkRenderState* s) override;
57
59
62 vtkGetObjectMacro(SceneGraph, vtkAnariSceneGraph);
64
69
76
82
83private:
84 struct vtkFrameInformation
85 {
86 vtkFrameInformation() = default;
87
88 int ViewportX = 0;
89 int ViewportY = 0;
90 int ViewportWidth = 0;
91 int ViewportHeight = 0;
92
93 double TileViewport[4] = { 0.0, 0.0, 1.0, 1.0 };
94 int TileScale[2] = { 1, 1 };
95 };
96
97 vtkAnariPass(const vtkAnariPass&) = delete;
98 void operator=(const vtkAnariPass&) = delete;
99
100 vtkAnariPass();
101 ~vtkAnariPass() override = default;
102
106 void SetSceneGraph(vtkAnariSceneGraph*);
107
108 void RenderAnariFrame(vtkRenderer* renderer, const vtkFrameInformation& frameInfo);
109
110 void BlitAnariFrameToOpenGLFrame(vtkRenderer* renderer, const vtkFrameInformation& frameInfo);
111 void SetupFrame(vtkOpenGLRenderWindow* openGLRenderWindow, vtkRenderer* renderer,
112 const anari::Extensions& extensions);
113
114 vtkSmartPointer<vtkAnariSceneGraph> SceneGraph;
115 vtkNew<vtkAnariDevice> Device;
116 vtkNew<vtkAnariRenderer> Renderer;
117 vtkNew<vtkAnariViewNodeFactory> Factory;
118
119 // ANARI frame blit to OpenGL
120 std::unique_ptr<vtkOpenGLQuadHelper> OpenGLQuadHelper;
121 vtkNew<vtkTextureObject> ColorTexture;
122 vtkNew<vtkTextureObject> DepthTexture;
123 vtkNew<vtkTextureObject> SharedColorTexture;
124 vtkNew<vtkTextureObject> SharedDepthTexture;
125};
126
127VTK_ABI_NAMESPACE_END
128#endif
base class to objects which create + manage a ANARI library + device
virtual vtkViewNodeFactory * GetViewNodeFactory()
Make the factory available to apps that need to replace object(s) in VTK with their own at runtime (e...
vtkAnariDevice * GetAnariDevice()
Get the managing class of the ANARI device for queries or make changes.
static vtkAnariPass * New()
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkAnariRenderer * GetAnariRenderer()
Get the managing class of the ANARI renderer to query or make changes.
void Render(const vtkRenderState *s) override
Perform rendering according to a render state.
base class to objects which create + manage an ANARI library, device, and renderer
links vtkRenderers to ANARI
matches vtk rendering classes to specific ANARI ViewNode classes
Implement the camera render pass.
a simple class to control print indentation
Definition vtkIndent.h:108
Internal class which encapsulates OpenGL FramebufferObject.
Class to make rendering a full screen quad easier.
OpenGL rendering window.
vtkRenderPass()
Default constructor.
Context in which a vtkRenderPass will render.
abstracts an OpenGL texture object.
factory that chooses vtkViewNodes to create