MaterialX 1.39.1
|
Base class for renderers that generate shader code to produce images. More...
#include <ShaderRenderer.h>
Public Types | |
enum class | MatrixConvention { OpenGL = 0 , Metal = 1 } |
Viewing API matrix conventions designation (default to OpenGL). | |
using | StageMap = StringMap |
A map with name and source code for each shader stage. | |
Public Member Functions | |
Setup | |
virtual void | initialize (RenderContextHandle=nullptr) |
Initialize the renderer. More... | |
void | setCamera (CameraPtr camera) |
Set the camera. | |
CameraPtr | getCamera () const |
Return the camera. | |
void | setImageHandler (ImageHandlerPtr imageHandler) |
Set the image handler used by this renderer for image I/O. | |
ImageHandlerPtr | getImageHandler () const |
Return the image handler. | |
void | setLightHandler (LightHandlerPtr lightHandler) |
Set the light handler used by this renderer for light bindings. | |
LightHandlerPtr | getLightHandler () const |
Return the light handler. | |
void | setGeometryHandler (GeometryHandlerPtr geometryHandler) |
Set the geometry handler. | |
GeometryHandlerPtr | getGeometryHandler () const |
Return the geometry handler. | |
Rendering | |
virtual void | createProgram (ShaderPtr shader) |
Create program based on an input shader. More... | |
virtual void | createProgram (const StageMap &stages) |
Create program based on shader stage source code. More... | |
virtual void | validateInputs () |
Validate inputs for the program. More... | |
virtual void | updateUniform (const string &name, ConstValuePtr value) |
Update the program with value of the uniform. More... | |
virtual void | setSize (unsigned int width, unsigned int height) |
Set the size of the rendered image. More... | |
virtual void | render () |
Render the current program to produce an image. More... | |
Utilities | |
virtual ImagePtr | captureImage (ImagePtr image=nullptr) |
Capture the current rendered output as an image. More... | |
Protected Member Functions | |
ShaderRenderer (unsigned int width, unsigned int height, Image::BaseType baseType, MatrixConvention matrixConvention=MatrixConvention::OpenGL) | |
Protected Attributes | |
unsigned int | _width |
unsigned int | _height |
Image::BaseType | _baseType |
MatrixConvention | _matrixConvention |
CameraPtr | _camera |
ImageHandlerPtr | _imageHandler |
GeometryHandlerPtr | _geometryHandler |
LightHandlerPtr | _lightHandler |
Base class for renderers that generate shader code to produce images.
Capture the current rendered output as an image.
Reimplemented in GlslRenderer, and OslRenderer.
|
virtual |
Create program based on shader stage source code.
stages | Map of name and source code for the shader stages. |
Reimplemented in GlslRenderer, and OslRenderer.
|
virtual |
Create program based on an input shader.
Reimplemented in GlslRenderer, and OslRenderer.
|
inlinevirtual |
Initialize the renderer.
Reimplemented in GlslRenderer, and OslRenderer.
|
inlinevirtual |
Render the current program to produce an image.
Reimplemented in GlslRenderer, and OslRenderer.
|
virtual |
Set the size of the rendered image.
Reimplemented in GlslRenderer, and OslRenderer.
|
virtual |
Update the program with value of the uniform.
Reimplemented in GlslRenderer.
|
inlinevirtual |
Validate inputs for the program.
Reimplemented in GlslRenderer, and OslRenderer.