VTK  9.4.20241103
vtkGLSLModifierFactory.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
10#ifndef vtkGLSLModifierFactory_h
11#define vtkGLSLModifierFactory_h
12
13#include "vtkRenderingOpenGL2Module.h"
14
15#include <functional>
16#include <map>
17#include <string>
18
19VTK_ABI_NAMESPACE_BEGIN
21
22class VTKRENDERINGOPENGL2_EXPORT vtkGLSLModifierFactory
23{
24public:
25 using NewModFunction = std::function<vtkGLSLModifierBase*(void* userData)>;
26
28 static vtkGLSLModifierBase* CreateAMod(const std::string& modName);
29
35 static void RegisterAMod(
36 const std::string& modName, NewModFunction createFunction, void* userData = nullptr);
37
38protected:
41
42private:
44 vtkGLSLModifierFactory& operator=(const vtkGLSLModifierFactory&) = delete;
45
46 static vtkGLSLModifierFactory& GetInstance();
47
48 struct ModCreator
49 {
51 void* UserData;
52 };
53 std::map<std::string, ModCreator> ModTable;
54};
55
56VTK_ABI_NAMESPACE_END
57#endif
58// VTK-HeaderTest-Exclude: vtkGLSLModifierFactory.h
Abstract class that helps you develop modifier for VTK GLSL shaders.
This class empowers developers to write and use GLSL mods eaisly in VTK.
std::function< vtkGLSLModifierBase *(void *userData)> NewModFunction
~vtkGLSLModifierFactory()=default
static void RegisterAMod(const std::string &modName, NewModFunction createFunction, void *userData=nullptr)
Developers should register runtime GLSL mods by invoking this function.
vtkGLSLModifierFactory()=default
static vtkGLSLModifierBase * CreateAMod(const std::string &modName)
Used by VTK to create a mod for rendering.