VTK  9.4.20250321
vtkAnariDevice.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
13#ifndef vtkAnariDevice_h
14#define vtkAnariDevice_h
15
16#include "vtkObject.h"
17#include "vtkRenderingAnariModule.h" // For export macro
18
19#include <anari/anari_cpp.hpp> // for ANARI handles
20
21#include <functional> // for std::function
22
23VTK_ABI_NAMESPACE_BEGIN
24
25class vtkAnariDeviceInternals;
26
27class VTKRENDERINGANARI_EXPORT vtkAnariDevice : public vtkObject
28{
29public:
30 using OnNewDeviceCallback = std::function<void(anari::Device)>;
31
33 vtkTypeMacro(vtkAnariDevice, vtkObject);
34 void PrintSelf(ostream& os, vtkIndent indent) override;
35
41 void SetAnariDebugConfig(const char* traceDir, const char* traceMode);
42
50 const char* libraryName, const char* deviceName, bool enableDebugLayer = false);
51
55 bool AnariInitialized() const;
56
60 anari::Device GetHandle() const;
61
65 const anari::Extensions& GetAnariDeviceExtensions() const;
66
70 const char* const* GetAnariDeviceExtensionStrings() const;
71
76
78
85 void SetParameterc(const char* param, char*);
86 void SetParameterb(const char* param, bool);
87 void SetParameteri(const char* param, int);
88 void SetParameter2i(const char* param, int, int);
89 void SetParameter3i(const char* param, int, int, int);
90 void SetParameter4i(const char* param, int, int, int, int);
91 void SetParameterf(const char* param, float);
92 void SetParameter2f(const char* param, float, float);
93 void SetParameter3f(const char* param, float, float, float);
94 void SetParameter4f(const char* param, float, float, float, float);
95 void SetParameterd(const char* param, double);
98
99protected:
104
109
110private:
111 vtkAnariDevice(const vtkAnariDevice&) = delete;
112 void operator=(const vtkAnariDevice&) = delete;
113
114 vtkAnariDeviceInternals* Internal{ nullptr };
115};
116
117VTK_ABI_NAMESPACE_END
118#endif
base class to objects which create + manage a ANARI library + device
anari::Device GetHandle() const
Get the current ANARI device, which will be NULL if not yet setup.
void SetParameterb(const char *param, bool)
void CommitParameters()
bool SetupAnariDeviceFromLibrary(const char *libraryName, const char *deviceName, bool enableDebugLayer=false)
Initialize this vtkAnariDevice from the name of an anari::Library and anari::Device to be loaded.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static vtkAnariDevice * New()
vtkAnariDevice()
Default constructor.
void SetParameter4f(const char *param, float, float, float, float)
bool AnariInitialized() const
Check if ANARI has been initialized with SetupAnariDeviceFromLibrary.
void SetParameter3f(const char *param, float, float, float)
void SetParameterf(const char *param, float)
void SetParameter2f(const char *param, float, float)
void SetParameterd(const char *param, double)
void SetParameter4i(const char *param, int, int, int, int)
void SetAnariDebugConfig(const char *traceDir, const char *traceMode)
Setup the trace directory and trace mode strings for the debug device for when SetupAnariDeviceFromLi...
void SetParameter3i(const char *param, int, int, int)
std::function< void(anari::Device)> OnNewDeviceCallback
virtual ~vtkAnariDevice()
Destructor.
const anari::Extensions & GetAnariDeviceExtensions() const
Get the current ANARI device extensions, which will be empty if not yet setup.
const char *const * GetAnariDeviceExtensionStrings() const
Get the current ANARI device extensions as list of strings.
void SetOnNewDeviceCallback(OnNewDeviceCallback &&cb)
Set a callback that gets called whenever a new device has been created.
void SetParameterc(const char *param, char *)
Methods to set/commit generic parameteters on the underlying anari::Renderer object.
void SetParameteri(const char *param, int)
void SetParameter2i(const char *param, int, int)
a simple class to control print indentation
Definition vtkIndent.h:108
abstract base class for most VTK objects
Definition vtkObject.h:162