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;
202 _raysPerPixelLit = rays;
208 _raysPerPixelUnlit = rays;
224 void shadeOSL(
const FilePath& dirPath,
const string& shaderName,
const string& outputName);
234 OslRenderer(
unsigned int width,
unsigned int height, Image::BaseType baseType);
244 FilePath _oslTestRenderSceneTemplateFile;
245 string _oslShaderName;
247 StringVec _envOslShaderParameterOverrides;
248 string _oslShaderOutputName;
249 string _oslShaderOutputType;
252 int _raysPerPixelLit;
253 int _raysPerPixelUnlit;
256MATERIALX_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:60
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.
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:219
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 setRaysPerPixelUnlit(int rays)
Set the number of rays per pixel to be used for unlit surfaces.
Definition OslRenderer.h:206
void createProgram(ShaderPtr shader) override
Create OSL program based on an input shader.
void setRaysPerPixelLit(int rays)
Set the number of rays per pixel to be used for lit surfaces.
Definition OslRenderer.h:200
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 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 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 useTestRender(bool useTestRender)
Used to toggle to either use testrender or testshade during render validation By default testshade is...
Definition OslRenderer.h:194
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