8#ifndef vtkRenderMaterialLibrary_h
9#define vtkRenderMaterialLibrary_h
12#include "vtkRenderingCoreModule.h"
15#include <initializer_list>
22VTK_ABI_NAMESPACE_BEGIN
23class vtkRenderMaterialLibraryInternals;
94 const std::string& nickname,
const std::string& varname)
const;
118 const std::string& nickname,
const std::string& varname)
const;
126 std::string
GetTextureName(
const std::string& nickname,
const std::string& varname)
const;
142 virtual void AddMaterial(
const std::string& nickname,
const std::string& implname);
161 const std::string& texturename =
"unnamedTexture",
const std::string& filename =
"");
172 const std::string& nickname,
const std::string& variablename,
int numVars,
const double* x);
182 const std::initializer_list<double>& data)
184 this->
AddShaderVariable(nickname, variablename,
static_cast<int>(data.size()), data.begin());
205 void RemoveTexture(
const std::string& nickname,
const std::string& varname);
227 void WriteFile(
const std::string& filename,
bool writeImageInline =
false);
241 const std::string& parentDir,
vtkTexture* textr, std::string& textureName,
242 std::string& textureFilename);
262 std::string
Trim(
const std::string& s);
275 vtkRenderMaterialLibraryInternals* Internal;
a simple class to control print indentation
virtual bool ReadTextureFileOrData(const std::string &texFilenameOrData, bool fromfile, const std::string &parentDir, vtkTexture *textr, std::string &textureName, std::string &textureFilename)
Load texture from file or inline data.
bool ReadBuffer(const char *Buffer)
Parse material data from a buffer in memory.
std::vector< std::string > GetTextureList(const std::string &nickname) const
Get the list of texture variables for a material.
void RemoveTexture(const std::string &nickname, const std::string &varname)
Remove a texture from a material.
virtual bool InternalParseJSON(const char *filename, bool fromfile, std::istream *doc)
virtual const std::map< std::string, ParametersMap > & GetParametersDictionary() const
std::string GetTextureName(const std::string &nickname, const std::string &varname) const
Get the registered name of a texture variable.
static vtkRenderMaterialLibrary * New()
std::vector< std::string > GetDoubleShaderVariableList(const std::string &nickname) const
Get the list of double-valued shader variables for a material.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
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.
virtual void AddMaterial(const std::string &nickname, const std::string &implname)
Add a new material to the library or replace an existing one.
vtkRenderMaterialLibrary()
void WriteFile(const std::string &filename, bool writeImageInline=false)
Write the material library to a file on disk.
void AddShaderVariable(const std::string &nickname, const std::string &variablename, const std::initializer_list< double > &data)
Add a shader variable from an initializer list of doubles.
void RemoveAllTextures(const std::string &nickname)
Remove all textures from a material.
std::string LookupImplName(const std::string &nickname) const
Look up the implementation name for a material nickname.
vtkTexture * GetTexture(const std::string &nickname, const std::string &varname) const
Get a texture object for a material variable.
std::string GetTextureFilename(const std::string &nickname, const std::string &varname) const
Get the filename path of a texture variable.
virtual const char * GetFamilyName() const
std::map< std::string, ParameterType > ParametersMap
std::string Trim(const std::string &s)
Remove leading and trailing whitespace from a string.
bool ReadFile(const char *FileName)
Read a material file from disk.
~vtkRenderMaterialLibrary() override
bool InternalParse(const char *filename, bool fromfile)
const char * WriteBuffer(bool writeImageInline=true)
Write the material library to a string buffer.
void RemoveMaterial(const std::string &nickname)
Remove a material from the library.
std::string FilePathToTextureName(const std::string &path)
Convert a file path to a texture name by extracting the filename without extension.
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.
virtual const TextureInfo * GetTextureInfo(const std::string &nickname, const std::string &varname) const
Get texture information for a material variable.
void RemoveShaderVariable(const std::string &nickname, const std::string &variablename)
Remove a shader variable from a material.
virtual void AddShaderVariable(const std::string &nickname, const std::string &variablename, int numVars, const double *x)
Add a shader variable to a material.
std::string InternalGetImplName(const std::string &nickname) const
const std::set< std::string > & GetMaterialNames() const
Get the set of all material nicknames currently in the library.
void RemoveAllShaderVariables(const std::string &nickname)
Remove all shader variables from a material.
virtual const char * GetAcceptedFamilyName() const
bool InternalParseMTL(const char *filename, bool fromfile, std::istream *doc)
handles properties associated with a texture map