VTK
vtkOSPRayMaterialLibrary.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkOSPRayMaterialLibrary.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
28 #ifndef vtkOSPRayMaterialLibrary_h
29 #define vtkOSPRayMaterialLibrary_h
30 
31 #include "vtkRenderingOSPRayModule.h" // For export macro
32 #include "vtkObject.h"
33 
34 #include <initializer_list> //for initializer_list!
35 #include <set> //for set!
36 #include <vector> //for vector!
37 
38 class vtkOSPRayMaterialLibraryInternals;
39 class vtkTexture;
40 
41 class VTKRENDERINGOSPRAY_EXPORT vtkOSPRayMaterialLibrary : public vtkObject
42 {
43 public:
44  static vtkOSPRayMaterialLibrary *New();
46  void PrintSelf(ostream& os, vtkIndent indent) override;
47 
51  void Fire();
52 
58  bool ReadFile(const char*FileName);
59 
63  const char *WriteBuffer();
64 
70  bool ReadBuffer(const char*Buffer);
71 
75  std::set<std::string> GetMaterialNames();
76 
80  std::string LookupImplName(const std::string& nickname);
81 
85  std::vector<double> GetDoubleShaderVariable(const std::string& nickname, const std::string& varname);
86 
90  vtkTexture* GetTexture(const std::string& nickname, const std::string& varname);
91 
97  void AddMaterial(const std::string& nickname, const std::string& implname);
98 
103  void AddTexture(const std::string& nickname, const std::string& texturename, vtkTexture* tex);
104 
110  void AddShaderVariable(const std::string& nickname,
111  const std::string& variablename,
112  int numVars, const double *x);
113  void AddShaderVariable(const std::string& nickname,
114  const std::string& variablename,
115  const std::initializer_list<double>& data)
116  {
117  this->AddShaderVariable(nickname, variablename,
118  static_cast<int>(data.size()), data.begin());
119  }
123 protected:
125  virtual ~vtkOSPRayMaterialLibrary();
126 
127  bool InternalParse(const char *name, bool IsFile);
128  bool InternalParseJSON(const char *name, bool IsFile, std::istream *doc);
129  bool InternalParseMTL(const char *name, bool IsFile, std::istream *doc);
130 
131 private:
133  void operator=(const vtkOSPRayMaterialLibrary&) = delete;
134 
135  vtkOSPRayMaterialLibraryInternals *Internal;
136 };
137 
138 #endif
abstract base class for most VTK objects
Definition: vtkObject.h:59
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
a collection of materials for vtk apps to draw from
a simple class to control print indentation
Definition: vtkIndent.h:39
handles properties associated with a texture map
Definition: vtkTexture.h:71
void AddShaderVariable(const std::string &nickname, const std::string &variablename, const std::initializer_list< double > &data)
Add control variable Adds a new control variable.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...