MRenderOperation Class Reference

#include <MViewport2Renderer.h>

Class Description

+ Inheritance diagram for MRenderOperation:

Public Types

enum  MRenderOperationType {
  kClear, kSceneRender, kQuadRender, kUserDefined,
  kHUDRender, kPresentTarget
}
 Supported render operation types. More...
 

Public Member Functions

virtual bool enableSRGBWrite ()
 Return whether to enable GPU based gamma correction during pixel writes. More...
 
virtual const MFloatPointviewportRectangleOverride ()
 Query for a viewport rectangle override. More...
 
virtual const MStringname () const
 Query the name of a render operator. More...
 
virtual bool getInputTargetDescription (const MString &name, MRenderTargetDescription &description)
 Return the description to use when creating the target for the named input. More...
 
virtual int writableTargets (unsigned int &count)
 Return the index of the first writable target in the inputTargets list. More...
 
virtual MRenderTarget *const * targetOverrideList (unsigned int &listSize)
 Return a list of pointers to render target which will be used as the target overrides for the operation. More...
 
const MStringArrayinputTargets ()
 An array of input target names that semantically declares the type of targets the operation requires as input. More...
 
const MStringArrayoutputTargets ()
 An array of output target names that semantically declares the type of targets the operation can produce. More...
 
void renameOutputTarget (const MString &name, const MString &newName)
 Renames an output target of an operation. More...
 
MRenderOperationType operationType () const
 Query the type (MRenderOperationType) of a render operator. More...
 

Protected Member Functions

 MRenderOperation (const MString &name)
 Protected constructor. More...
 
MRenderTargetgetInputTarget (const MString &name)
 Gets the target associated with this input. More...
 

Protected Attributes

MRenderOperationType mOperationType
 Operation type.
 
MString mName
 Identifier for a sub render.
 

Member Enumeration Documentation

Supported render operation types.

Enumerator
kClear 

Clear background operation.

kSceneRender 

Render a 3d scene.

kQuadRender 

Render a 2d quad.

kUserDefined 

User defined operation.

kHUDRender 

2D HUD draw operation

kPresentTarget 

Present target for viewing.

Constructor & Destructor Documentation

MRenderOperation ( const MString name)
protected

Protected constructor.

Only to be called from derived classes.

By default kColorTargetName and kDepthTargetName are set in both the input target name array (mInputTargetNames) and the output target name array (mOutputTargetNames). These inputs and outputs are all that are required for operations that simply write to an existing target. If an operation requires additional targets or different targets it should clear these lists after calling the base class constructor.

Parameters
[in]nameThe name of the operation.

Member Function Documentation

bool enableSRGBWrite ( )
virtual

Return whether to enable GPU based gamma correction during pixel writes.

Hardware support assumes a gamma value of 2.2 which is equivalent to converting to sRGB space. This method thus indicates whether to enable the ability of a render target to perform an "sRGB write".

All render targets returned from the MRenderOperation::targetOverrideList() method which support this capability will have the appropriate gamma correction performed.

Gamma correction is never performed for the MPresentTarget render operation.

The method MRenderTargetManager::formatSupportsSRGBWrite() can be used to query whether a a given format for a render target can support this capability.

The default implementation of this method will return false.

Returns
Whether to enable "sRGB write" for the targets on an operation.

Reimplemented in MPresentTarget.

+ Examples:
const MFloatPoint * viewportRectangleOverride ( )
virtual

Query for a viewport rectangle override.

An override is specified using 4 float values. All values are are represented as relative percentages of the output target dimensions.

  • The two values are the x and y values of the origin of the rectangle with respect to the origin of the render target. The origin of the render target is the lower left corner.
  • The next two values represent the width and height respectively.

Examples :

  • 0,0,1,1 would be mean 0 percentage from the origin and 100 percent of the target size.
  • 0.2, 0.3, 0.35, 0.4 would mean 20 percent to the left and 30 % up from the target origin, with a size which is 35 percent of the width and 40 percent of the height of the target.
Returns
Reference to the viewport rectangle. NULL if there is no override.
+ Examples:
const MString & name ( ) const
virtual

Query the name of a render operator.

Returns
Name of render operator

Reimplemented in MHUDRender.

+ Examples:
bool getInputTargetDescription ( const MString name,
MRenderTargetDescription description 
)
virtual

Return the description to use when creating the target for the named input.

Most standard operations do not care about the format of the target they use and expect the target to be passed in. Supply a custom description in cases where the operation expects a new target to be created.

Parameters
[in]nameThe name of the input to get the description for.
[out]descriptionThe target description to use when creating a target for this input.
Returns
true if a description is provide. False means the input should be written to the standard color or depth target.
+ Examples:
int writableTargets ( unsigned int &  count)
virtual

Return the index of the first writable target in the inputTargets list.

Parameters
[out]countThe number of writable targets returned. By default a value of 2 is returned for the standard color and depth targets.
Returns
The index of the first writable target. By default 0 is returned which is the index of the standard color target for most operations.
+ Examples:
MRenderTarget *const * targetOverrideList ( unsigned int &  listSize)
virtual

Return a list of pointers to render target which will be used as the target overrides for the operation.

Parameters
[out]listSizeNumber of targets returned. By default the writableTargets method is used to get the target count.
Returns
Pointer to an array of render targets. By default the writableTargets method is used to identify the overrides.
+ Examples:
const MStringArray & inputTargets ( )

An array of input target names that semantically declares the type of targets the operation requires as input.

This may include the standard color and depth targets and/or any other custom GBuffers, scene passes, etc used as input.

Returns
The array of required inputs as declared by the operation.
const MStringArray & outputTargets ( )

An array of output target names that semantically declares the type of targets the operation can produce.

This may include the standard color and depth targets and/or any other custom GBuffers, scene passes, etc produced by the operation.

Returns
The array of output names corresponding to the target types the operation can produce.
void renameOutputTarget ( const MString name,
const MString newName 
)

Renames an output target of an operation.

Renaming an output allows you to connect the produced output of this operation to a custom named input on another MRenderOperation. Similarly named inputs and outputs will share render targets.

Parameters
[in]nameThe name of the input to rename.
[in]newNameThe new name to assign to the output.
MRenderOperation::MRenderOperationType operationType ( ) const

Query the type (MRenderOperationType) of a render operator.

Returns
The type
MHWRender::MRenderTarget * getInputTarget ( const MString name)
protected

Gets the target associated with this input.

The target returned has either been set through and output by the caller who is indicating the target to draw to, or it is internally generated using the target descriptor provided for this input.

Parameters
[in]nameThe name of the input to get the target for.
Returns
The render target for this named input.

The documentation for this class was generated from the following files:
  • MViewport2Renderer.h
  • MViewport2Renderer.cpp