VTK  9.7.1
vtkOSPRayMaterialLibrary.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
21 #ifndef vtkOSPRayMaterialLibrary_h
22 #define vtkOSPRayMaterialLibrary_h
23 
25 
26 #include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_*
27 #include "vtkRenderingRayTracingModule.h" // For export macro
28 
29 VTK_ABI_NAMESPACE_BEGIN
30 
31 class VTKRENDERINGRAYTRACING_EXPORT vtkOSPRayMaterialLibrary : public vtkRenderMaterialLibrary
32 {
33 public:
34  static vtkOSPRayMaterialLibrary* New();
36  void PrintSelf(ostream& os, vtkIndent indent) override;
37 
44  void AddMaterial(const std::string& nickname, const std::string& implname) override;
45 
54  void AddTexture(const std::string& nickname, const std::string& varname, vtkTexture* tex,
55  const std::string& texturename = "unnamedTexture", const std::string& filename = "") override;
56 
62  void AddShaderVariable(const std::string& nickname, const std::string& variablename, int numVars,
63  const double* x) override;
64  using Superclass::AddShaderVariable;
65 
69  std::vector<double> GetDoubleShaderVariable(
70  const std::string& nickname, const std::string& varname) const override;
71 
75  const TextureInfo* GetTextureInfo(
76  const std::string& nickname, const std::string& varname) const override;
77 
84  VTK_DEPRECATED_IN_9_7_0("Use Modified() instead to notify observers of changes.")
85  void Fire();
86 
90  const std::map<std::string, ParametersMap>& GetParametersDictionary() const override;
91 
92 protected:
96  bool InternalParseJSON(const char* filename, bool fromfile, std::istream* doc) override;
97 
102  bool ReadTextureFileOrData(const std::string& texFilenameOrData, bool fromfile,
103  const std::string& parentDir, vtkTexture* textr, std::string& textureName,
104  std::string& textureFilename) override;
105  vtkOSPRayMaterialLibrary() = default;
106  ~vtkOSPRayMaterialLibrary() override = default;
107 
108  const char* GetFamilyName() const override { return "OSPRay"; }
109  const char* GetAcceptedFamilyName() const override { return "OSPRay"; }
110 
111 private:
113  void operator=(const vtkOSPRayMaterialLibrary&) = delete;
114 };
115 
116 VTK_ABI_NAMESPACE_END
117 #endif
virtual void AddMaterial(const std::string &nickname, const std::string &implname)
Add a new material to the library or replace an existing one.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual void AddShaderVariable(const std::string &nickname, const std::string &variablename, int numVars, const double *x)
Add a shader variable to a material.
a collection of materials for OSPRay-based rendering
const char * GetAcceptedFamilyName() const override
a renderer-agnostic collection of materials for VTK apps to draw from
a simple class to control print indentation
Definition: vtkIndent.h:28
virtual const TextureInfo * GetTextureInfo(const std::string &nickname, const std::string &varname) const
Get texture information for a material variable.
handles properties associated with a texture map
Definition: vtkTexture.h:58
static vtkRenderMaterialLibrary * New()
std::map< std::string, ParameterType > ParametersMap
virtual std::vector< double > GetDoubleShaderVariable(const std::string &nickname, const std::string &varname) const
Get the value of a double shader variable for a material.
#define VTK_DEPRECATED_IN_9_7_0(reason)
virtual void AddTexture(const std::string &nickname, const std::string &varname, vtkTexture *tex, const std::string &texturename="unnamedTexture", const std::string &filename="")
Add a texture to a material.