C++ API Reference
MHWShaderSwatchGenerator Class Reference

Hardware shader swatch generator utility class. More...

#include <MHWShaderSwatchGenerator.h>

+ Inheritance diagram for MHWShaderSwatchGenerator:

Public Member Functions

 MHWShaderSwatchGenerator (MObject obj, MObject renderObj, int res)
 Class constructor. More...
 
bool doIteration () override
 This method will be called from the MSwatchRenderRegister for generating a swatch image. More...
 
- Public Member Functions inherited from MSwatchRenderBase
 MSwatchRenderBase (MObject obj, MObject renderObj, int res)
 Class constructor. More...
 
virtual ~MSwatchRenderBase ()
 Class destructor.
 
virtual bool renderParallel ()
 Method indicates if the swatch is rendered parallel. More...
 
virtual void cancelParallelRendering ()
 Method to cancel the parallel rendering. More...
 
MObject swatchNode () const
 This method returns the node for which the swatch is required to be generated.
 
MObject node () const
 This method returns the node that is used to compute the swatch.
 
int resolution () const
 This method returns the expected resolution of the swatch.
 
MImageimage ()
 This method returns the the render swatch as an image.
 
void setRenderQuality (int)
 Method to set the render quality in which the swatch will be rendered. More...
 
int renderQuality () const
 Returns the quality in which the swatch will be rendered. More...
 

Static Public Member Functions

static MSwatchRenderBasecreateObj (MObject obj, MObject renderObj, int res)
 Class constructor. More...
 
static const MStringinitialize ()
 This method sets a swatch name, and registers a new swatch generator creation function for the swatch name. More...
 
static void getSwatchBackgroundColor (float &r, float &g, float &b, float &a)
 This method returns the default background color for the hardware rendered swatch. More...
 
- Static Public Member Functions inherited from MSwatchRenderBase
static void cancelCurrentSwatchRender ()
 The method cancels the swatch which is being rendered in parallel, and push the swatch render item back to the render queue after. More...
 
static void enableSwatchRender (bool enable)
 Enable/disable swatch rendering. More...
 

Additional Inherited Members

- Protected Member Functions inherited from MSwatchRenderBase
void finishParallelRender ()
 Method to update the swatch image when the parallel rendering is finished. More...
 

Detailed Description

Hardware shader swatch generator utility class.

Derived from the MSwatchRenderBase class as a utility for generating a swatch for a plugin hardware shader class. This class supports hardware shaders derived from both MPxHardwareShader and the older MPxHwShaderNode base classes.

Constructor & Destructor Documentation

OPENMAYA_MAJOR_NAMESPACE_OPEN MHWShaderSwatchGenerator ( MObject  obj,
MObject  renderObj,
int  res 
)

Class constructor.

Initializes base class

Parameters
[in]objThe node object for which the swatch needs to be generated.
[in]renderObjThe node used to actually compute the swatch. In most situations, this can be the same as obj. This parameter can be used to request the computation of the swatch on another node, and display the swatch on the obj node.
[in]resThe expected resolution of the swatch image.

Member Function Documentation

MSwatchRenderBase * createObj ( MObject  obj,
MObject  renderObj,
int  resolution 
)
static

Class constructor.

Saves the Node object and image resolution as data members for future use.

Parameters
[in]objThe node object for which the swatch needs to be generated.
[in]renderObjThe node used to actually compute the swatch. In most situations, this can be the same as obj. This parameter can be used to request the computation of the swatch on another node, and display the swatch on the obj node.
[in]resolutionThe expected resolution of the swatch image.
Examples:
dx11Shader/dx11ShaderPluginMain.cpp, and hlslShader/hlslPluginMain.cpp.
const MString & initialize ( )
static

This method sets a swatch name, and registers a new swatch generator creation function for the swatch name.

The string returned from this method can be used for node classification purpose.

Examples:
cgFx/pluginMain.cpp, glslShader/GLSLShaderMainMaya.cpp, hwPhongShader/hwPhongShader.cpp, and vp2BlinnShader/vp2BlinnShader.cpp.
void getSwatchBackgroundColor ( float &  r,
float &  g,
float &  b,
float &  a 
)
static

This method returns the default background color for the hardware rendered swatch.

Parameters
[out]rStorage variable for red component.
[out]gStorage variable for green component.
[out]bStorage variable for blue component.
[out]aStorage variable for alpha component.
Examples:
cgFx/cgfxShaderNode.cpp, and hlslShader/hlslShader.cpp.
bool doIteration ( )
overridevirtual

This method will be called from the MSwatchRenderRegister for generating a swatch image.

This doIteration function is called repeatedly (during idle events) till it returns true.

Reimplemented from MSwatchRenderBase.


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