MSceneRender Class Reference

#include <MViewport2Renderer.h>

Class Description

+ Inheritance diagram for MSceneRender:

Public Types

enum  MObjectTypeExclusions {
  kExcludeNone = 0, kExcludeNurbsCurves = 1<<(0), kExcludeNurbsSurfaces = 1<<(1), kExcludeMeshes = 1<<(2),
  kExcludePlanes = 1<<(3), kExcludeLights = 1<<(4), kExcludeCameras = 1<<(5), kExcludeJoints = 1<<(6),
  kExcludeIkHandles = 1<<(7), kExcludeDeformers = 1<<(8), kExcludeDynamics = 1<<(9), kExcludeParticleInstancers = 1<<(10),
  kExcludeLocators = 1<<(11), kExcludeDimensions = 1<<(12), kExcludeSelectHandles = 1<<(13), kExcludePivots = 1<<(14),
  kExcludeTextures = 1<<(15), kExcludeGrid = 1<<(16), kExcludeCVs = 1<<(17), kExcludeHulls = 1<<(18),
  kExcludeStrokes = 1<<(19), kExcludeSubdivSurfaces = 1<<(20), kExcludeFluids = 1<<(21), kExcludeFollicles = 1<<(22),
  kExcludeHairSystems = 1<<(23), kExcludeImagePlane = 1<<(24), kExcludeNCloths = 1<<(25), kExcludeNRigids = 1<<(26),
  kExcludeDynamicConstraints = 1<<(27), kExcludeManipulators = 1<<(28), kExcludeNParticles = 1<<(29), kExcludeMotionTrails = 1<<(30),
  kExcludeHoldOuts = 1<<(31), kExcludeAll = ~0
}
 Object type exclusions This enumeration is marked to be deprecated. More...
 
enum  MSceneFilterOption { ,
  kRenderPreSceneUIItems = 1 << (0), kRenderOpaqueShadedItems = 1 << (1), kRenderTransparentShadedItems = 1 << (2), kRenderShadedItems = (kRenderOpaqueShadedItems | kRenderTransparentShadedItems),
  kRenderPostSceneUIItems = 1 << (3) , kRenderAllItems = ~0
}
 Render filter options. More...
 
enum  MDisplayMode {
  kNoDisplayModeOverride = 0, kWireFrame = 1<<(0), kShaded = 1<<(1), kFlatShaded = 1<<(2),
  kShadeActiveOnly = 1<<(3), kBoundingBox = 1<<(4), kDefaultMaterial = 1<<(5), kTextured = 1<<(6)
}
 Display modes. More...
 
enum  MLightingMode {
  kNoLightingModeOverride = 0, kNoLight, kAmbientLight, kLightDefault,
  kSelectedLights, kSceneLights
}
 Lighting mode. More...
 
enum  MPostEffectsOverride {
  kPostEffectDisableNone = 0, kPostEffectDisableSSAO = 1 << (0), kPostEffectDisableMotionBlur = 1 << (1), kPostEffectDisableDOF = 1 << (2),
  kPostEffectDisableAll = ~0
}
 Post effect override. More...
 
enum  MCullingOption { kNoCullingOverride = 0, kCullNone, kCullBackFaces, kCullFrontFaces }
 Culling option. More...
 
- Public Types inherited from MRenderOperation
enum  MRenderOperationType {
  kClear, kSceneRender, kQuadRender, kUserDefined,
  kHUDRender, kPresentTarget
}
 Supported render operation types. More...
 

Public Member Functions

 MSceneRender (const MString &name)
 Constructor for a named scene render. More...
 
 MSceneRender (const MString &name, const MString &fragmentName)
 Constructor for a named scene render that uses a custom fragment to render with. More...
 
virtual ~MSceneRender ()
 Default destructor for a scene render.
 
virtual void preRender ()
 Method to allow for the operation to update itself before being executed. More...
 
virtual void postRender ()
 Method to allow for the operation to clean up itself after being executed. More...
 
virtual void preSceneRender (const MDrawContext &context)
 Method to allow for the operation to update itself before a scene rendering begins. More...
 
virtual void postSceneRender (const MDrawContext &context)
 Method to allow for the operation to update itself after a scene rendering ends. More...
 
virtual MSceneFilterOption renderFilterOverride ()
 This method allows for the programmer to provide feedback on determining which elements of a scene render will be drawn based on semantic meaning. More...
 
virtual const MCameraOverridecameraOverride ()
 Query for a camera override. More...
 
virtual const MSelectionListobjectSetOverride ()
 Query for override for the set of objects to view. More...
 
virtual const MShaderInstanceshaderOverride ()
 Query for a scene level shader override. More...
 
virtual MUint64 getObjectTypeExclusions ()
 Query for any object type exclusions. More...
 
virtual MDisplayMode displayModeOverride ()
 Query for any display mode override. More...
 
virtual MLightingMode lightModeOverride ()
 Query for any lighting mode override. More...
 
virtual const bool * shadowEnableOverride ()
 Query for shadow display override. More...
 
virtual MPostEffectsOverride postEffectsOverride ()
 Query for post effects override. More...
 
virtual MCullingOption cullingOverride ()
 Query for a face culling override. More...
 
virtual MClearOperationclearOperation ()
 Get the scene clear operation. More...
 
virtual bool hasUIDrawables () const
 If you've overridden addPreUIDrawables() or addPostUIDrawables() then you must override this method to return true in order for them to have any effect. More...
 
virtual void addPreUIDrawables (MUIDrawManager &drawManager, const MFrameContext &frameContext)
 Provides access to the MUIDrawManager, which can be used to queue up operations to draw simple UI shapes like lines, circles, text, etc. More...
 
virtual void addPostUIDrawables (MUIDrawManager &drawManager, const MFrameContext &frameContext)
 Provides access to the MUIDrawManager, which can be used to queue up operations to draw simple UI shapes like lines, circles, text, etc. More...
 
MRenderParametersgetParameters ()
 Get the block of input parameters used to control the renderer. More...
 
MString fragmentName ()
 Get the name of the fragment to use when rendering the scene. More...
 
virtual MObjectTypeExclusions objectTypeExclusions ()
 This method is obsolete. More...
 
- Public Member Functions inherited from MRenderOperation
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 Attributes

MClearOperation mClearOperation
 Clear operation.
 
- Protected Attributes inherited from MRenderOperation
MRenderOperationType mOperationType
 Operation type.
 
MString mName
 Identifier for a sub render.
 

Additional Inherited Members

- Protected Member Functions inherited from MRenderOperation
 MRenderOperation (const MString &name)
 Protected constructor. More...
 
MRenderTargetgetInputTarget (const MString &name)
 Gets the target associated with this input. More...
 

Member Enumeration Documentation

Object type exclusions This enumeration is marked to be deprecated.

Use the MFramentContext static member equivalents instead which is a superset of this enumeration.

Enumerator
kExcludeNone 

Exclude no object types.

kExcludeNurbsCurves 

Exclude NURBS curves.

kExcludeNurbsSurfaces 

Exclude NURBS surface.

kExcludeMeshes 

Exclude polygonal meshes.

kExcludePlanes 

Exclude planes.

kExcludeLights 

Exclude lights.

kExcludeCameras 

Exclude camera.

kExcludeJoints 

Exclude joints.

kExcludeIkHandles 

Exclude IK handles.

kExcludeDeformers 

Exclude all deformations.

kExcludeDynamics 

Exclude all dynamics objects (emitters, cloth)

kExcludeParticleInstancers 

Exclude all Particle Instancers.

kExcludeLocators 

Exclude locators.

kExcludeDimensions 

Exclude all measurement objects.

kExcludeSelectHandles 

Exclude selection handles.

kExcludePivots 

Exclude pivots.

kExcludeTextures 

Exclude texture placement objects.

kExcludeGrid 

Exclude grid drawing.

kExcludeCVs 

Exclude NURBS control vertices.

kExcludeHulls 

Exclude NURBS hulls.

kExcludeStrokes 

Exclude PaintFX strokes.

kExcludeSubdivSurfaces 

Exclude subdivision surfaces.

kExcludeFluids 

Exclude fluid objects.

kExcludeFollicles 

Exclude hair follicles.

kExcludeHairSystems 

Exclude hair system.

kExcludeImagePlane 

Exclude image planes.

kExcludeNCloths 

Exclude N-cloth objects.

kExcludeNRigids 

Exclude rigid-body objects.

kExcludeDynamicConstraints 

Exclude rigid-body constraints.

kExcludeManipulators 

Exclude manipulators.

kExcludeNParticles 

Exclude N-particle objects.

kExcludeMotionTrails 

Exclude motion trails.

kExcludeHoldOuts 

Exclude Hold-Outs.

kExcludeAll 

Exclude all listed object types.

Render filter options.

Refer to the renderFilterOverride() method for details on usage.

Enumerator
kRenderPreSceneUIItems 

Render UI items before scene render like grid or user added pre-scene UI items.

kRenderOpaqueShadedItems 

Render only opaque shaded objects but not their wireframe or components.

kRenderTransparentShadedItems 

Render only transparent shaded objects but not their wireframe or components.

kRenderShadedItems 

Render only shaded (opaque and transparent) objects but not their wireframe or components.

kRenderPostSceneUIItems 

Render UI items after scene render like wireframe and components for surfaces as well as non-surface objects.

kRenderAllItems 

This flag has same meaning as kRenderUIItems and will be deprecated in the future.

Render all items.

Display modes.

Enumerator
kNoDisplayModeOverride 

No display mode override.

kWireFrame 

Display wireframe.

kShaded 

Display smooth shaded.

kFlatShaded 

Display flat shaded.

kShadeActiveOnly 

Shade active objects.

Only applicable if kShaded or kFlatShaded is enabled.

kBoundingBox 

Display bounding boxes.

kDefaultMaterial 

Use default material.

Only applicable if kShaded or kFlatShaded is enabled.

kTextured 

Display textured.

Only applicable if kShaded or kFlatShaded is enabled.

Lighting mode.

Enumerator
kNoLightingModeOverride 

No lighting mode override.

kNoLight 

Use no light.

kAmbientLight 

Use global ambient light.

kLightDefault 

Use default light.

kSelectedLights 

Use lights which are selected.

kSceneLights 

Use all lights in the scene.

Post effect override.

Enumerator
kPostEffectDisableNone 

Use current render settings options.

kPostEffectDisableSSAO 

Disable SSAO post effect.

kPostEffectDisableMotionBlur 

Disable motion blur post effect.

kPostEffectDisableDOF 

Disable depth-of-field post effect.

kPostEffectDisableAll 

Disable all post effects.

Culling option.

Enumerator
kNoCullingOverride 

No culling override.

kCullNone 

Don't perform culling.

kCullBackFaces 

Cull back faces.

kCullFrontFaces 

Cull front faces.

Constructor & Destructor Documentation

MSceneRender ( const MString name)

Constructor for a named scene render.

A default clear operation is created which will be used for scene rendering. This is a convenience such that separate clear operations do not need to be added before each scene render.

Parameters
[in]nameName of scene render
MSceneRender ( const MString name,
const MString fragmentName 
)

Constructor for a named scene render that uses a custom fragment to render with.

A default clear operation is created which will be used for scene rendering. This is a convenience such that separate clear operations do not need to be added before each scene render.

Parameters
[in]nameName of scene render
[in]fragmentNameName of fragment used to render with

Member Function Documentation

void preRender ( )
virtual

Method to allow for the operation to update itself before being executed.

In general this would be used to update any operation parameters.

No context information is available at this point.

By default this method performs no action.

+ Examples:
void postRender ( )
virtual

Method to allow for the operation to clean up itself after being executed.

By default this method performs no action.

+ Examples:
void preSceneRender ( const MDrawContext context)
virtual

Method to allow for the operation to update itself before a scene rendering begins.

This method will be called before computing shadow maps, and before a color pass.

Parameters
[in]contextDraw context before rendering begins

By default this method performs no action.

+ Examples:
void postSceneRender ( const MDrawContext context)
virtual

Method to allow for the operation to update itself after a scene rendering ends.

This method will be called after computing shadow maps, and after a color pass.

Parameters
[in]contextDraw context after rendering has completed

By default this method performs no action.

+ Examples:
MSceneRender::MSceneFilterOption renderFilterOverride ( )
virtual

This method allows for the programmer to provide feedback on determining which elements of a scene render will be drawn based on semantic meaning.

For now the only meanings are:

  1. To draw non-UI related scene elements
  2. To draw UI related scene elements

Non-UI related elements currenty includes rendering surfaces which are shaded. Surfaces are defined as polygonal meshes, subdivision surfaces, and nurbs surfaces.

UI related elements includes drawing the wireframe and component "UI" for the above surface types as well as non-surface items.

A general way to think of the two options is that "non-UI" can be related to drawing a "beauty" pass, and "UI" are decorations on of the "beauty" pass.

We will call these semantic meanings "scene filters" which are enumerated by MSceneRender::MSceneFilterOption.

The default return value is kNoSceneFilterOverride. This indicates that the a scene render will render all scene elements.

Returns
A scene filter.
+ Examples:
const MCameraOverride * cameraOverride ( )
virtual

Query for a camera override.

The default implementation returns that there is no override.

Returns
Reference to the camera override. NULL if there is no override.
+ Examples:
const MSelectionList * objectSetOverride ( )
virtual

Query for override for the set of objects to view.

Visibility takes into account the current states of each object, any display filters, and camera frustum culling.

Note that the override only applies to rendering but not selection.

By default NULL is returned which indicates that no override is present.

Returns
Pointer to an MSelectionList
+ Examples:
const MShaderInstance * shaderOverride ( )
virtual
MUint64 getObjectTypeExclusions ( )
virtual

Query for any object type exclusions.

By default kExcludeNone is returned meaning to not exclude drawing of any types.

If there has already been an exclusion which is specified, for example via the viewport then those exclusions will still apply.

Returns
Object type exclusion bitfield
+ Examples:
MSceneRender::MDisplayMode displayModeOverride ( )
virtual

Query for any display mode override.

By default kNoDisplayModeOverride is returned indicating that no override is specified.

Returns
Display mode override.
+ Examples:
MSceneRender::MLightingMode lightModeOverride ( )
virtual

Query for any lighting mode override.

By default kNoLightingModeOverride is returned indicating that no override is specified.

Returns
Lighting mode override
+ Examples:
const bool * shadowEnableOverride ( )
virtual

Query for shadow display override.

By default a NULL value is returned indicating that no override is specified. To force shadowing off or on, return a pointer to a false or true boolean (respectively).

Returns
Pointer to bool indicating the override.
+ Examples:
MSceneRender::MPostEffectsOverride postEffectsOverride ( )
virtual

Query for post effects override.

By default MSceneRender::kPostEffectDisableNone is returned which indicates that there is no override.

Returns
Override value
MSceneRender::MCullingOption cullingOverride ( )
virtual

Query for a face culling override.

By default kNoCullingOverride is returned indicating that no override is specified.

Returns
Culling option override
+ Examples:
bool hasUIDrawables ( ) const
virtual

If you've overridden addPreUIDrawables() or addPostUIDrawables() then you must override this method to return true in order for them to have any effect.

You also need to have kRenderPreSceneUIItems or kRenderPostSceneUIItems set in the mask returned by renderFilterOverride().

Returns
Whether addPreUIDrawables() or addPostUIDrawables() will be called or not.
+ Examples:
void addPreUIDrawables ( MUIDrawManager drawManager,
const MFrameContext frameContext 
)
virtual

Provides access to the MUIDrawManager, which can be used to queue up operations to draw simple UI shapes like lines, circles, text, etc.

This method will only be called when hasUIDrawables() is overridden to return true and kRenderPreSceneUIItems is set in the MSceneFilterOption mask returned by renderFilterOverride().

UI drawables added in this method will be rendered before the scene render.

Parameters
[in]drawManagerThe UI draw manager, it can be used to draw some simple geometry including text.
[in]frameContextFrame level context information
+ Examples:
void addPostUIDrawables ( MUIDrawManager drawManager,
const MFrameContext frameContext 
)
virtual

Provides access to the MUIDrawManager, which can be used to queue up operations to draw simple UI shapes like lines, circles, text, etc.

This method will only be called when hasUIDrawables() is overridden to return true and kRenderPostSceneUIItems is set in the MSceneFilterOption mask returned by renderFilterOverride().

UI drawables added in this method will be rendered after the scene render.

Parameters
[in]drawManagerThe UI draw manager, it can be used to draw some simple geometry including text.
[in]frameContextFrame level context information
+ Examples:
MRenderParameters * getParameters ( )

Get the block of input parameters used to control the renderer.

Parameter input values can be acquired or set by name.

Returns
A pointer to a MRenderParameters class used to read or write render input values. The returned pointer is owned by the MSceneRender and should not be deleted by the caller.
MString fragmentName ( )

Get the name of the fragment to use when rendering the scene.

Must be the name of a valid script fragment or fragment graph added through the FragmentManager.

Returns
The name of the fragment in use. If an empty string is returned then the default fragment will be used.
MSceneRender::MObjectTypeExclusions objectTypeExclusions ( )
virtual

This method is obsolete.

Deprecated:
Please use getObjectTypeExclusions() instead.

Query for any object type exclusions. By default kExcludeNone is returned meaning to not exclude drawing of any types.

If there has already been an exclusion which is specified, for example via the viewport then those exclusions will still apply.

Returns
Object type exclusion bitfield

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