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;
196 _useTestRender = useTestRender;
202 _raysPerPixelLit = rays;
208 _raysPerPixelUnlit = rays;
214 void compileOSL(
const FilePath& oslFilePath);
224 void shadeOSL(
const FilePath& dirPath,
const string& shaderName,
const string& outputName);
231 void renderOSL(
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:57
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
Helper class for rendering generated OSL code to produce images.
Definition: OslRenderer.h:33
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
void setRaysPerPixelUnlit(int rays)
Set the number of rays per pixel to be used for unlit surfaces.
Definition: OslRenderer.h:206
void setRaysPerPixelLit(int rays)
Set the number of rays per pixel to be used for lit surfaces.
Definition: OslRenderer.h:200
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 setOslShaderName(const string &shaderName)
Set the name of the shader to be used for the input XML scene file.
Definition: OslRenderer.h:178
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
void setOslTestShadeExecutable(const FilePath &executableFilePath)
Set the path to the OSL shading tester.
Definition: OslRenderer.h:152
Base class for renderers that generate shader code to produce images.
Definition: ShaderRenderer.h:31
virtual ImagePtr captureImage(ImagePtr image=nullptr)
Capture the current rendered output as an image.
Definition: ShaderRenderer.h:127
virtual void render()
Render the current program to produce an image.
Definition: ShaderRenderer.h:120
virtual void validateInputs()
Validate inputs for the program.
Definition: ShaderRenderer.h:111
virtual void createProgram(ShaderPtr shader)
Create program based on an input shader.
Definition: ShaderRenderer.cpp:50
virtual void setSize(unsigned int width, unsigned int height)
Set the size of the rendered image.
Definition: ShaderRenderer.cpp:58
StringMap StageMap
A map with name and source code for each shader stage.
Definition: ShaderRenderer.h:40
virtual void initialize(RenderContextHandle=nullptr)
Initialize the renderer.
Definition: ShaderRenderer.h:49