6#ifndef MATERIALX_OSLRENDERER_H
7#define MATERIALX_OSLRENDERER_H
17MATERIALX_NAMESPACE_BEGIN
20using OslRendererPtr = std::shared_ptr<class OslRenderer>;
36 static OslRendererPtr
create(
unsigned int width = 512,
unsigned int height = 512, Image::BaseType baseType = Image::BaseType::UINT8);
78 void setSize(
unsigned int width,
unsigned int height)
override;
105 _oslCompilerExecutable = executableFilePath;
113 _oslIncludePath = dirPath;
120 _oslOutputFilePath = dirPath;
127 _oslShaderParameterOverrides = parameterOverrides;
134 _envOslShaderParameterOverrides = parameterOverrides;
145 _oslShaderOutputName = outputName;
146 _oslShaderOutputType = outputType;
154 _oslTestShadeExecutable = executableFilePath;
162 _oslTestRenderExecutable = executableFilePath;
172 _oslTestRenderSceneTemplateFile = templateFilePath;
180 _oslShaderName = shaderName;
188 _oslUtilityOSOPath = dirPath;
190 void setDataLibraryOSOPath(
const FilePath& dirPath)
192 _dataLibraryOSOPath = dirPath;
206 _useOSLCmdStr = useOslCmdstr;
242 void shadeOSL(
const FilePath& dirPath,
const string& shaderName,
const string& outputName);
257 OslRenderer(
unsigned int width,
unsigned int height, Image::BaseType baseType);
267 FilePath _oslTestRenderSceneTemplateFile;
268 string _oslShaderName;
270 StringVec _envOslShaderParameterOverrides;
271 string _oslShaderOutputName;
272 string _oslShaderOutputType;
282MATERIALX_NAMESPACE_END
shared_ptr< Image > ImagePtr
A shared pointer to an image.
Definition Image.h:23
Image handler interfaces.
vector< string > StringVec
A vector of strings.
Definition Library.h:61
shared_ptr< Shader > ShaderPtr
Shared pointer to a Shader.
Definition Library.h:33
Macros for declaring imported and exported symbols.
Base class for shader rendering.
void * RenderContextHandle
Render context handle Provides a provision for an application to share any renderer specific settings...
Definition ShaderRenderer.h:23
A generic file path, supporting both syntactic and file system operations.
Definition File.h:27
A sequence of file paths, which may be queried to find the first instance of a given filename on the ...
Definition File.h:221
void validateInputs() override
Validate inputs for the compiled OSL program.
void setOslTestRenderSceneTemplateFile(const FilePath &templateFilePath)
Set the XML scene file to use for testrender.
Definition OslRenderer.h:170
void setOslUtilityOSOPath(const FilePath &dirPath)
Set the search path for dependent shaders (.oso files) which are used when rendering with testrender.
Definition OslRenderer.h:186
void setOslCompilerExecutable(const FilePath &executableFilePath)
Set the path to the OSL executable.
Definition OslRenderer.h:103
static OslRendererPtr create(unsigned int width=512, unsigned int height=512, Image::BaseType baseType=Image::BaseType::UINT8)
Create an OSL renderer instance.
virtual ~OslRenderer()
Destructor.
void useOslCommandString(bool useOslCmdstr)
Used to switch between testing oso files and osl command strings.
Definition OslRenderer.h:204
void setOSLCmdStr(const string &oslCmd)
Set the osl command string that is to be tested.
Definition OslRenderer.h:225
void createProgram(ShaderPtr shader) override
Create OSL program based on an input shader.
OslRenderer(unsigned int width, unsigned int height, Image::BaseType baseType)
Constructor.
void compileOSL(const FilePath &oslFilePath)
Compile OSL code stored in a file.
void setOslTestRenderExecutable(const FilePath &executableFilePath)
Set the path to the OSL rendering tester.
Definition OslRenderer.h:160
void setOslShaderOutput(const string &outputName, const string &outputType)
Set the OSL shader output.
Definition OslRenderer.h:143
static string OSL_CLOSURE_COLOR_STRING
Color closure OSL string.
Definition OslRenderer.h:42
void setAaUnlit(int aa)
Set the testrender -aa N value used for unlit (non-closure) outputs.
Definition OslRenderer.h:219
void setShaderParameterOverrides(const StringVec ¶meterOverrides)
Set shader parameter strings to be added to the scene XML file.
Definition OslRenderer.h:125
void setOslIncludePath(const FileSearchPath &dirPath)
Set the search locations for OSL include files.
Definition OslRenderer.h:111
void render() override
Render OSL program to disk.
void renderOSLNetwork(const FilePath &dirPath, const string &shaderName)
Render using OSL command string.
void setOslShaderName(const string &shaderName)
Set the name of the shader to be used for the input XML scene file.
Definition OslRenderer.h:178
void renderOSL(const FilePath &dirPath, const string &shaderName, const string &outputName)
Render using OSO input file.
void setEnvShaderParameterOverrides(const StringVec ¶meterOverrides)
Set shader parameter strings to be added to the scene XML file.
Definition OslRenderer.h:132
void setAaLit(int aa)
Set the testrender -aa N value used for lit (closure-color) outputs.
Definition OslRenderer.h:212
void useTestRender(bool useTestRender)
Used to toggle to either use testrender or testshade during render validation By default testshade is...
Definition OslRenderer.h:198
void setOslOutputFilePath(const FilePath &dirPath)
Set the location where compiled OSL files will reside.
Definition OslRenderer.h:118
ImagePtr captureImage(ImagePtr image=nullptr) override
Capture the current rendered output as an image.
void setOslTestShadeExecutable(const FilePath &executableFilePath)
Set the path to the OSL shading tester.
Definition OslRenderer.h:152
void createProgram(const StageMap &stages) override
Create OSL program based on shader stage source code.
void initialize(RenderContextHandle renderContextHandle=nullptr) override
Internal initialization required for program validation and rendering.
void setSize(unsigned int width, unsigned int height) override
Set the size for rendered image.
void shadeOSL(const FilePath &dirPath, const string &shaderName, const string &outputName)
Shade using OSO input file.
StringMap StageMap
A map with name and source code for each shader stage.
Definition ShaderRenderer.h:40