Mitsuba Renderer  0.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mitsuba::Shader Class Referenceabstract

Shader base class for use with a VPL-style renderer. More...

#include <mitsuba/render/shader.h>

+ Inheritance diagram for mitsuba::Shader:

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 > &parameterIDs) 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 > &parameterIDs, 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 ClassgetClass () 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 Classm_theClass
 
- Static Public Attributes inherited from Object
static Classm_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...
 

Detailed Description

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.

Member Enumeration Documentation

Enumerator
ETransparent 
Enumerator
EBSDFShader 
ETextureShader 
EEmitterShader 

Constructor & Destructor Documentation

mitsuba::Shader::Shader ( Renderer renderer,
EShaderType  type 
)
protected
virtual mitsuba::Shader::~Shader ( )
protectedvirtual

Virtual destructor.

Member Function Documentation

virtual void mitsuba::Shader::bind ( GPUProgram program,
const std::vector< int > &  parameterIDs,
int &  textureUnitOffset 
) const
virtual

Configure the the associated GPU program.

This function is typically used to bind textures and to set program pararameters.

virtual void mitsuba::Shader::cleanup ( Renderer renderer)
virtual

Release all resources.

virtual void mitsuba::Shader::generateCode ( std::ostringstream &  oss,
const std::string &  evalName,
const std::vector< std::string > &  depNames 
) const
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 Float mitsuba::Shader::getAlpha ( ) const
virtual

For transparent objects, this function returns the alpha blending weight.

virtual const Class* mitsuba::Shader::getClass ( ) const
virtual

Retrieve this object's class.

Reimplemented from Object.

uint32_t mitsuba::Shader::getFlags ( ) const
inline

Return a list of flags.

EShaderType mitsuba::Shader::getType ( ) const
inline
virtual bool mitsuba::Shader::isComplete ( ) const
virtual

Is this shader complete?

This is mainly useful to check whether all dependencies could be constructed successfully. The default implementation returns true.

virtual void mitsuba::Shader::putDependencies ( std::vector< Shader * > &  deps)
virtual
virtual void mitsuba::Shader::resolve ( const GPUProgram program,
const std::string &  evalName,
std::vector< int > &  parameterIDs 
) const
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 void mitsuba::Shader::unbind ( ) const
virtual

Release any bound resources.

Member Data Documentation

uint32_t mitsuba::Shader::m_flags
protected
Class* mitsuba::Shader::m_theClass
static
EShaderType mitsuba::Shader::m_type
protected

The documentation for this class was generated from the following file: