VTK  9.5.20250623
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
38private:
39 static vtkGLSLModifierFactory& GetInstance();
40
41 struct ModCreator
42 {
44 void* UserData;
45 };
46 std::map<std::string, ModCreator> ModTable;
47};
48
49VTK_ABI_NAMESPACE_END
50#endif
51// 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 easily in VTK.
std::function< vtkGLSLModifierBase *(void *userData)> NewModFunction
static void RegisterAMod(const std::string &modName, NewModFunction createFunction, void *userData=nullptr)
Developers should register runtime GLSL mods by invoking this function.
static vtkGLSLModifierBase * CreateAMod(const std::string &modName)
Used by VTK to create a mod for rendering.