Shader base class for use with a VPL-style renderer. More...
#include <mitsuba/render/shader.h>
Public Types | |
enum | EShaderType { EBSDFShader = 0, ETextureShader, EEmitterShader } |
enum | EFlags { ETransparent = 0x01 } |
Public Member Functions | |
EShaderType | getType () const |
uint32_t | getFlags () const |
Return a list of flags. More... | |
virtual Float | getAlpha () const |
For transparent objects, this function returns the alpha blending weight. More... | |
virtual void | putDependencies (std::vector< Shader * > &deps) |
virtual bool | isComplete () const |
Is this shader complete? More... | |
virtual void | generateCode (std::ostringstream &oss, const std::string &evalName, const std::vector< std::string > &depNames) const =0 |
Generate a string version of this shader's evaluation routine. More... | |
virtual void | resolve (const GPUProgram *program, const std::string &evalName, std::vector< int > ¶meterIDs) const |
This function can optionally be implemented to resolve named program parameters to numerical IDs for increased performance. More... | |
virtual void | bind (GPUProgram *program, const std::vector< int > ¶meterIDs, int &textureUnitOffset) const |
Configure the the associated GPU program. More... | |
virtual void | unbind () const |
Release any bound resources. More... | |
virtual void | cleanup (Renderer *renderer) |
Release all resources. More... | |
virtual const Class * | getClass () const |
Retrieve this object's class. More... | |
Public Member Functions inherited from Object | |
Object () | |
Construct a new object. More... | |
int | getRefCount () const |
Return the current reference count. More... | |
void | incRef () const |
Increase the reference count of the object by one. More... | |
void | decRef (bool autoDeallocate=true) const |
Decrease the reference count of the object and possibly deallocate it. More... | |
virtual std::string | toString () const |
Return a human-readable string representation of the object's contents. More... | |
Static Public Attributes | |
static Class * | m_theClass |
Static Public Attributes inherited from Object | |
static Class * | m_theClass |
Pointer to the object's class descriptor. More... | |
Protected Member Functions | |
Shader (Renderer *renderer, EShaderType type) | |
virtual | ~Shader () |
Virtual destructor. More... | |
Protected Member Functions inherited from Object | |
virtual | ~Object () |
Virtual private deconstructor. (Will only be called by ref) More... | |
Protected Attributes | |
EShaderType | m_type |
uint32_t | m_flags |
Additional Inherited Members | |
Static Public Member Functions inherited from Object | |
static void | staticInitialization () |
Initializes the built-in reference count debugger (if enabled) More... | |
static void | staticShutdown () |
Free the memory taken by staticInitialization() More... | |
Shader base class for use with a VPL-style renderer.
Subclasses can implement one of various things, such as a BSDF, a light source, or a texture.
|
protected |
|
protectedvirtual |
Virtual destructor.
|
virtual |
Configure the the associated GPU program.
This function is typically used to bind textures and to set program pararameters.
|
virtual |
Release all resources.
|
pure virtual |
Generate a string version of this shader's evaluation routine.
The appended string should assign the name evalName
to this function. The function names of depedencies (as specified by putDependencies), are supplied in the parameter depNames
in identical order.
|
virtual |
For transparent objects, this function returns the alpha blending weight.
|
virtual |
Retrieve this object's class.
Reimplemented from Object.
|
inline |
Return a list of flags.
|
inline |
|
virtual |
Is this shader complete?
This is mainly useful to check whether all dependencies could be constructed successfully. The default implementation returns true
.
|
virtual |
|
virtual |
This function can optionally be implemented to resolve named program parameters to numerical IDs for increased performance.
The int array returned here will later be passed to bind(). The default implementation does nothing.
|
virtual |
Release any bound resources.
|
protected |
|
static |
|
protected |