6#ifndef MATERIALX_OSLRENDERER_H
7#define MATERIALX_OSLRENDERER_H
21using OslRendererPtr = std::shared_ptr<class OslRenderer>;
37 static OslRendererPtr create(
unsigned int width = 512,
unsigned int height = 512, Image::BaseType baseType = Image::BaseType::UINT8);
51 void initialize()
override;
68 void createProgram(
ShaderPtr shader)
override;
72 void createProgram(
const StageMap& stages)
override;
76 void validateInputs()
override;
79 void setSize(
unsigned int width,
unsigned int height)
override;
88 void render()
override;
106 _oslCompilerExecutable = executableFilePath;
114 _oslIncludePath = dirPath;
121 _oslOutputFilePath = dirPath;
128 _oslShaderParameterOverrides = parameterOverrides;
135 _envOslShaderParameterOverrides = parameterOverrides;
146 _oslShaderOutputName = outputName;
147 _oslShaderOutputType = outputType;
155 _oslTestShadeExecutable = executableFilePath;
163 _oslTestRenderExecutable = executableFilePath;
173 _oslTestRenderSceneTemplateFile = templateFilePath;
181 _oslShaderName = shaderName;
189 _oslUtilityOSOPath = dirPath;
197 _useTestRender = useTestRender;
203 void compileOSL(
const FilePath& oslFilePath);
213 void shadeOSL(
const FilePath& dirPath,
const string& shaderName,
const string& outputName);
220 void renderOSL(
const FilePath& dirPath,
const string& shaderName,
const string& outputName);
223 OslRenderer(
unsigned int width,
unsigned int height, Image::BaseType baseType);
240 FilePath _oslTestRenderSceneTemplateFile;
242 string _oslShaderName;
246 StringVec _envOslShaderParameterOverrides;
248 string _oslShaderOutputName;
250 string _oslShaderOutputType;
shared_ptr< Image > ImagePtr
A shared pointer to an image.
Definition: Image.h:24
Image handler interfaces.
vector< string > StringVec
A vector of strings.
Definition: Library.h:56
shared_ptr< Shader > ShaderPtr
Shared pointer to a Shader.
Definition: Library.h:34
Macros for declaring imported and exported symbols.
Base class for shader rendering.
A generic file path, supporting both syntactic and file system operations.
Definition: File.h:28
Helper class for rendering generated OSL code to produce images.
Definition: OslRenderer.h:34
void setOslTestRenderSceneTemplateFile(const FilePath &templateFilePath)
Set the XML scene file to use for testrender.
Definition: OslRenderer.h:171
void setOslUtilityOSOPath(const FilePath &dirPath)
Set the search path for dependent shaders (.oso files) which are used when rendering with testrender.
Definition: OslRenderer.h:187
void setOslCompilerExecutable(const FilePath &executableFilePath)
Set the path to the OSL executable.
Definition: OslRenderer.h:104
void setOslTestRenderExecutable(const FilePath &executableFilePath)
Set the path to the OSL rendering tester.
Definition: OslRenderer.h:161
void setOslShaderOutput(const string &outputName, const string &outputType)
Set the OSL shader output.
Definition: OslRenderer.h:144
static string OSL_CLOSURE_COLOR_STRING
Color closure OSL string.
Definition: OslRenderer.h:43
void setShaderParameterOverrides(const StringVec ¶meterOverrides)
Set shader parameter strings to be added to the scene XML file.
Definition: OslRenderer.h:126
void setOslIncludePath(const FilePath &dirPath)
Set the search locations for OSL include files.
Definition: OslRenderer.h:112
void setOslShaderName(const string &shaderName)
Set the name of the shader to be used for the input XML scene file.
Definition: OslRenderer.h:179
void setEnvShaderParameterOverrides(const StringVec ¶meterOverrides)
Set shader parameter strings to be added to the scene XML file.
Definition: OslRenderer.h:133
void useTestRender(bool useTestRender)
Used to toggle to either use testrender or testshade during render validation By default testshade is...
Definition: OslRenderer.h:195
void setOslOutputFilePath(const FilePath &dirPath)
Set the location where compiled OSL files will reside.
Definition: OslRenderer.h:119
void setOslTestShadeExecutable(const FilePath &executableFilePath)
Set the path to the OSL shading tester.
Definition: OslRenderer.h:153
Base class for renderers that generate shader code to produce images.
Definition: ShaderRenderer.h:29
StringMap StageMap
A map with name and source code for each shader stage.
Definition: ShaderRenderer.h:32