25#ifndef vtkOSPRayMaterialLibrary_h
26#define vtkOSPRayMaterialLibrary_h
29#include "vtkRenderingRayTracingModule.h"
31#include <initializer_list>
37class vtkOSPRayMaterialLibraryInternals;
74 void WriteFile(
const std::string& filename,
bool writeImageInline =
false);
102 const std::string& nickname,
const std::string& varname);
118 const TextureInfo*
GetTextureInfo(
const std::string& nickname,
const std::string& varname);
124 std::string
GetTextureName(
const std::string& nickname,
const std::string& varname);
136 void AddMaterial(
const std::string& nickname,
const std::string& implname);
156 const std::string& texturename =
"unnamedTexture",
const std::string& filename =
"");
163 void RemoveTexture(
const std::string& nickname,
const std::string& varname);
176 const std::string& nickname,
const std::string& variablename,
int numVars,
const double* x);
178 const std::initializer_list<double>& data)
180 this->AddShaderVariable(nickname, variablename,
static_cast<int>(data.size()), data.begin());
227 const std::string& parentDir,
vtkTexture* textr, std::string& textureName,
228 std::string& textureFilename);
234 vtkOSPRayMaterialLibraryInternals* Internal;
a simple class to control print indentation
a collection of materials for vtk apps to draw from
void RemoveMaterial(const std::string &nickname)
Remove Material Removes a material nickname from the set of known materials.
void AddShaderVariable(const std::string &nickname, const std::string &variablename, const std::initializer_list< double > &data)
Add control variable Adds a new control variable.
std::vector< double > GetDoubleShaderVariable(const std::string &nickname, const std::string &varname)
Returns a uniform variable.
const TextureInfo * GetTextureInfo(const std::string &nickname, const std::string &varname)
Returns the texture information (name, texture and filename) of this varname.
bool ReadBuffer(const char *Buffer)
DeSerialize contents from an in memory buffer as ReadFile does from a file or set of files.
std::string GetTextureFilename(const std::string &nickname, const std::string &varname)
Returns the filename associated ti a texture (if any).
std::vector< std::string > GetDoubleShaderVariableList(const std::string &nickname)
Returns list of variable names set for a specific material.
bool InternalParseJSON(const char *name, bool IsFile, std::istream *doc)
vtkOSPRayMaterialLibrary()
std::string LookupImplName(const std::string &nickname)
Return an implementation name for the given material nickname.
void RemoveTexture(const std::string &nickname, const std::string &varname)
Remove Texture Removes a texture for a specific materal nickname and shader variable varname.
void WriteFile(const std::string &filename, bool writeImageInline=false)
Serialize contents to a file specified by filename.
std::string GetTextureName(const std::string &nickname, const std::string &varname)
Returns the name (and not the shader variable name) associated to a texture.
std::set< std::string > GetMaterialNames()
Returns the set of material nicknames.
bool InternalParseMTL(const char *name, bool IsFile, std::istream *doc)
const char * WriteBuffer(bool writeImageInline=true)
Serialize contents to an in memory buffer.
void RemoveAllTextures(const std::string &nickname)
Remove all textures of a specific material.
std::vector< std::string > GetTextureList(const std::string &nickname)
Returns list of texture names set for a specific material.
vtkTexture * GetTexture(const std::string &nickname, const std::string &varname)
Returns a texture.
void RemoveShaderVariable(const std::string &nickname, const std::string &variablename)
Remove control variable Removes a new control variable.
bool InternalParse(const char *name, bool IsFile)
void AddMaterial(const std::string &nickname, const std::string &implname)
Add Material Adds a new material nickname to the set of known materials.
std::map< std::string, ParameterType > ParametersMap
void AddShaderVariable(const std::string &nickname, const std::string &variablename, int numVars, const double *x)
Add control variable Adds a new control variable.
static vtkOSPRayMaterialLibrary * New()
void AddTexture(const std::string &nickname, const std::string &varname, vtkTexture *tex, const std::string &texturename="unnamedTexture", const std::string &filename="")
Add Texture Given a material nickname and a shader variable varname, set its data to a specific textu...
bool ReadTextureFileOrData(const std::string &texFilenameOrData, bool fromfile, const std::string &parentDir, vtkTexture *textr, std::string &textureName, std::string &textureFilename)
void RemoveAllShaderVariables(const std::string &nickname)
Remove all control variables of a specific material.
static const std::map< std::string, ParametersMap > & GetParametersDictionary()
Get the dictionary of all possible materials based on OSPRay documentation.
ParameterType
Lists all different parameter types.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
bool ReadFile(const char *FileName)
Reads the given file of materials and creates the in memory data structures needed to display objects...
void Fire()
Called to kick off events in all followers.
~vtkOSPRayMaterialLibrary() override
abstract base class for most VTK objects
handles properties associated with a texture map