C++ API Reference
MDrawContext Class Reference

Class to allow access to hardware draw context information. More...

#include <MDrawContext.h>

+ Inheritance diagram for MDrawContext:

Public Types

enum  LightFilter { kFilteredToLightLimit, kFilteredIgnoreLightLimit }
 Options on which lights to return information for from light query methods. More...
 
enum  InternalTexture {
  kDepthPeelingTranspDepthTexture, kDepthPeelingOpaqueDepthTexture, kIrradianceEnvironment, kSpecularEnvironment,
  kNumberOfInternalTextures
}
 Options on which internal texture to get. More...
 
- Public Types inherited from MFrameContext
enum  MatrixType {
  kWorldMtx, kWorldTransposeMtx, kWorldInverseMtx, kWorldTranspInverseMtx,
  kViewMtx, kViewTransposeMtx, kViewInverseMtx, kViewTranspInverseMtx,
  kProjectionMtx, kProjectionTranposeMtx, kProjectionInverseMtx, kProjectionTranspInverseMtx,
  kViewProjMtx, kViewProjTranposeMtx, kViewProjInverseMtx, kViewProjTranspInverseMtx,
  kWorldViewMtx, kWorldViewTransposeMtx, kWorldViewInverseMtx, kWorldViewTranspInverseMtx,
  kWorldViewProjMtx, kWorldViewProjTransposeMtx, kWorldViewProjInverseMtx, kWorldViewProjTranspInverseMtx
}
 Matrices that can be accessed. More...
 
enum  TupleType {
  kViewPosition, kViewDirection, kViewUp, kViewRight,
  kViewportPixelSize, kViewNearClipValue, kViewFarClipValue, kViewUnnormlizedNearClipValue,
  kViewUnnormalizedFarClipValue
}
 Tuples that can be accessed. May be one or more values returned depending on the tuple requested. More...
 
enum  DisplayStyle {
  kGouraudShaded = (0x1), kWireFrame = (0x1 << 1), kBoundingBox = (0x1 << 2), kTextured = (0x1 << 3),
  kDefaultMaterial = (0x1 << 4), kXrayJoint = (0x1 << 5), kXray = (0x1 << 6), kTwoSidedLighting = (0x1 << 7),
  kFlatShaded = (0x1 << 8), kShadeActiveOnly = (0x1 << 9), kXrayActiveComponents = (0x1 << 10), kBackfaceCulling = (0x1 << 11),
  kSmoothWireframe = (0x1 << 12)
}
 Display styles. More...
 
enum  LightingMode {
  kNoLighting, kAmbientLight, kLightDefault, kSelectedLights,
  kSceneLights, kCustomLights
}
 Lighting modes. More...
 
enum  PostEffectType {
  kAmbientOcclusion, kMotionBlur, kGammaCorrection, kViewColorTransformEnabled = kGammaCorrection,
  kDepthOfField, kAntiAliasing
}
 Types of post effects which may be enabled during rendering. More...
 
enum  FogMode { kFogLinear, kFogExp, kFogExp2 }
 Types of the fog mode. More...
 
enum  TransparencyAlgorithm { kUnsorted, kObjectSorting, kWeightedAverage, kDepthPeeling }
 Options for transparency algorithm. More...
 
enum  WireOnShadedMode { kWireframeOnShadedFull, kWireFrameOnShadedReduced, kWireFrameOnShadedNone }
 Wireframe on shaded modes. More...
 
enum  RenderingDestination { k3dViewport, k2dViewport, kImage }
 Rendering destinations. More...
 

Public Member Functions

MMatrix getMatrix (MFrameContext::MatrixType mtype, MStatus *ReturnStatus=NULL) const override
 Get a matrix value of a certain type. More...
 
MDoubleArray getTuple (MFrameContext::TupleType ttype, MStatus *ReturnStatus=NULL) const override
 Get a tuple (vector, position, or single) value of a certain type. More...
 
MStatus getViewportDimensions (int &originX, int &originY, int &width, int &height) const override
 Get the viewport dimensions. More...
 
MUint64 getFrameStamp () const
 Returns the current frame stamp. More...
 
MBoundingBox getSceneBox (MStatus *ReturnStatus=NULL) const
 Get a bounding box of the scene in world space. More...
 
MBoundingBox getFrustumBox (MStatus *ReturnStatus) const
 Get the bounding box of the current view frustum in world space. More...
 
MStatus getRenderTargetSize (int &width, int &height) const
 Get the size of the render target (output buffer) being rendered into. More...
 
MStatus getDepthRange (float &nearVal, float &farVal) const
 Get the depth range which specifies the mapping of depth values from normalized device coordinates to window coordinates. More...
 
bool viewDirectionAlongNegZ (MStatus *ReturnStatus) const
 Return whether the view direction is pointing down the -Z axis. More...
 
unsigned int numberOfActiveLights (LightFilter lightFilter=kFilteredToLightLimit, MStatus *ReturnStatus=NULL) const
 Return the number of available lights to render the scene. More...
 
MStatus getLightInformation (unsigned int lightNumber, MFloatPointArray &positions, MFloatVector &direction, float &intensity, MColor &color, bool &hasDirection, bool &hasPosition, LightFilter lightFilter=kFilteredToLightLimit) const
 Return common lighting information for a given active light. More...
 
MLightParameterInformationgetLightParameterInformation (unsigned int lightNumber, LightFilter lightFilter=kFilteredToLightLimit) const
 Return parameter information for a given active light. More...
 
MHWRender::MStateManagergetStateManager () const
 Access the GPU state manager for the current draw context. More...
 
const MHWRender::MPassContextgetPassContext () const
 Access the current pass context. More...
 
const MRenderTargetcopyCurrentColorRenderTarget (const MString &name) const
 Get a copy of the current color render target. More...
 
const MRenderTargetcopyCurrentDepthRenderTarget (const MString &name) const
 Get a copy of the current depth render target. More...
 
MTexturecopyCurrentColorRenderTargetToTexture () const
 Get a copy of the current color render target as a texture. More...
 
MTexturecopyCurrentDepthRenderTargetToTexture () const
 Get a copy of the current depth render target as a texture. More...
 
const MTexturegetInternalTexture (InternalTexture internalTexture) const
 Returns the internal texture as specified. More...
 
bool isMultiDraw () const
 Returns true if the context is rendering in MultiDraw mode. More...
 
unsigned int numberOfActiveLights (MStatus *ReturnStatus) const
 This method is obsolete. More...
 
- Public Member Functions inherited from MFrameContext
virtual float getGlobalLineWidth () const
 Get global line width. More...
 
MDagPath getCurrentCameraPath (MStatus *ReturnStatus=NULL) const
 Get the path to the camera being used to render the current frame. More...
 
const MRenderTargetgetCurrentColorRenderTarget () const
 Get current color render target. More...
 
const MRenderTargetgetCurrentDepthRenderTarget () const
 Get current depth render target. More...
 
unsigned int getDisplayStyle () const
 Get the current display style as a bit field. More...
 
LightingMode getLightingMode () const
 Get the current light mode. More...
 
unsigned int getLightLimit () const
 Get the current light limit. More...
 
EnvironmentParams getEnvironmentParameters () const
 Get parameters for currently used environment. More...
 
bool getPostEffectEnabled (PostEffectType postEffectType) const
 Returns if a given post effect is currently enabled. More...
 
HwFogParams getHwFogParameters () const
 Get all the hardware fog parameters. More...
 
TransparencyAlgorithm getTransparencyAlgorithm () const
 Get the current transparency algoritm. More...
 
RenderingDestination renderingDestination (MString &destinationName) const
 Return value indicates the destination that the renderer is drawing to. More...
 
MUint64 objectTypeExclusions () const
 Get the object type exclusions as a bitfield. More...
 
void classificationExclusions (MStringArray &classification) const
 Get a list of drawdb strings for object which are excluded from display. More...
 
void getBackgroundParameters (MFrameContext::BackgroundParams &params) const
 Get parameters related to how the background is cleared. More...
 
void getDOFParameters (MFrameContext::DOFParams &params) const
 Get the parameters generated by Maya for the circle-of-confusion depth shader used for a pass used when computing depth of field. More...
 
void getRenderOverrideInformation (RenderOverrideInformation &info) const
 Get information about any render override. More...
 
const MSelectionInfogetSelectionInfo () const
 Get the selection state information if the method is called in selection pass; nullptr will be returned otherwise. More...
 
void worldToViewport (const MPoint &inPoint, double &xPos, double &yPos) const
 Convert coordinate in world space to coordinate in viewport. More...
 
void viewportToWorld (double xPos, double yPos, MPoint &worldNearPt, MPoint &worldFarPt) const
 Convert coordinate in viewport to near cliping plane coordinate in world space. More...
 

Static Public Member Functions

static const char * className ()
 Returns the name of this class. More...
 
- Static Public Member Functions inherited from MFrameContext
static MFrameContext::MatrixType semanticToMatrixType (const MString &value, MStatus *ReturnStatus=NULL)
 It is assumed that these flags match between MFrameContext and TexcludeObjectDisplay, but that is not enforced elsewhere. More...
 
static MFrameContext::TupleType semanticToTupleType (const MString &value, MStatus *ReturnStatus=NULL)
 Given a semantic name return the corresponding tuple enumeration that can be used to retrieve a value via the getTuple() method. More...
 
static bool inUserInteraction ()
 Returns true during any interactive refresh, as when user is interacting with the scene in any way including camera changes, object or component TRS changes, etc. More...
 
static bool userChangingViewContext ()
 Returns true during any interactive refresh, as when user is changing the view using view context tools such as tumble, dolly or track. More...
 
static WireOnShadedMode wireOnShadedMode ()
 Returns the global user display preference which indicates how wireframe should be drawn on top of objects while in shaded mode. More...
 
static bool shadeTemplates ()
 Returns the display preference indicating whether templated objects should be drawn shaded. More...
 
static const char * className ()
 Returns the name of this class. More...
 

Additional Inherited Members

- Static Public Attributes inherited from MFrameContext
static constexpr MUint64 kExcludeNone = MUint64(0)
 Bit flags specifying types of objects excluded from displaying in the viewport. More...
 
static constexpr MUint64 kExcludeNurbsCurves = MUint64(1) << (0)
 Exclude NURBS curves.
 
static constexpr MUint64 kExcludeNurbsSurfaces = MUint64(1) << (1)
 Exclude NURBS surface.
 
static constexpr MUint64 kExcludeMeshes = MUint64(1) << (2)
 Exclude polygonal meshes.
 
static constexpr MUint64 kExcludePlanes = MUint64(1) << (3)
 Exclude planes.
 
static constexpr MUint64 kExcludeLights = MUint64(1) << (4)
 Exclude lights.
 
static constexpr MUint64 kExcludeCameras = MUint64(1) << (5)
 Exclude camera.
 
static constexpr MUint64 kExcludeJoints = MUint64(1) << (6)
 Exclude joints.
 
static constexpr MUint64 kExcludeIkHandles = MUint64(1) << (7)
 Exclude IK handles.
 
static constexpr MUint64 kExcludeDeformers = MUint64(1) << (8)
 Exclude all deformations.
 
static constexpr MUint64 kExcludeDynamics = MUint64(1) << (9)
 Exclude all dynamics objects (emiiters, cloth)
 
static constexpr MUint64 kExcludeParticleInstancers = MUint64(1) << (10)
 Exclude all Particle Instancers.
 
static constexpr MUint64 kExcludeLocators = MUint64(1) << (11)
 Exclude locators.
 
static constexpr MUint64 kExcludeDimensions = MUint64(1) << (12)
 Exclude all measurement objects.
 
static constexpr MUint64 kExcludeSelectHandles = MUint64(1) << (13)
 Exclude selection handles.
 
static constexpr MUint64 kExcludePivots = MUint64(1) << (14)
 Exclude pivots.
 
static constexpr MUint64 kExcludeTextures = MUint64(1) << (15)
 Exclude texure placement objects.
 
static constexpr MUint64 kExcludeGrid = MUint64(1) << (16)
 Exclude grid drawing.
 
static constexpr MUint64 kExcludeCVs = MUint64(1) << (17)
 Exclude NURBS control vertices.
 
static constexpr MUint64 kExcludeHulls = MUint64(1) << (18)
 Exclude NURBS hulls.
 
static constexpr MUint64 kExcludeStrokes = MUint64(1) << (19)
 Exclude PaintFX strokes.
 
static constexpr MUint64 kExcludeSubdivSurfaces = MUint64(1) << (20)
 Exclude subdivision surfaces.
 
static constexpr MUint64 kExcludeFluids = MUint64(1) << (21)
 Exclude fluid objects.
 
static constexpr MUint64 kExcludeFollicles = MUint64(1) << (22)
 Exclude hair follicles.
 
static constexpr MUint64 kExcludeHairSystems = MUint64(1) << (23)
 Exclude hair system.
 
static constexpr MUint64 kExcludeImagePlane = MUint64(1) << (24)
 Exclude image planes.
 
static constexpr MUint64 kExcludeNCloths = MUint64(1) << (25)
 Exclude N-cloth objects.
 
static constexpr MUint64 kExcludeNRigids = MUint64(1) << (26)
 Exclude rigid-body objects.
 
static constexpr MUint64 kExcludeDynamicConstraints = MUint64(1) << (27)
 Exclude rigid-body constraints.
 
static constexpr MUint64 kExcludeManipulators = MUint64(1) << (28)
 Exclude manipulators.
 
static constexpr MUint64 kExcludeNParticles = MUint64(1) << (29)
 Exclude N-particle objects.
 
static constexpr MUint64 kExcludeMotionTrails = MUint64(1) << (30)
 Exclude motion trails.
 
static constexpr MUint64 kExcludeHoldOuts = MUint64(1) << (31)
 Exclude Hold-Outs.
 
static constexpr MUint64 kExcludePluginShapes = MUint64(1) << (32)
 Exclude plug-in shapes.
 
static constexpr MUint64 kExcludeHUD = MUint64(1) << (33)
 Exclude HUD.
 
static constexpr MUint64 kExcludeClipGhosts = MUint64(1) << (34)
 Exclude animation clip ghosts.
 
static constexpr MUint64 kExcludeGreasePencils = MUint64(1) << (35)
 Exclude grease-pencil draw.
 
static constexpr MUint64 kExcludeControllers = MUint64(1) << (36)
 Exclude Controllers.
 
static constexpr MUint64 kExcludeAll = ~MUint64(0)
 Exclude all listed object types.
 

Detailed Description

Class to allow access to hardware draw context information.

MDrawContext provides access to current hardware draw context information. It is read-only and cannot be instantiated by the plugin writer.

The information provided includes various transformation matrices, camera information, and render target information such as output buffer size. It is also possible to access and alter GPU state through this class.

There are a few main advantages for using this class:

1. The data is computed and cached as required. This can avoid work for the plugin writer to extract this information themselves. 2. The plugin writer should not need to directly access the device to extract this information. Any data extraction from the device has a performance penalty which can be avoided. 3. The information is device aware, meaning that it will return the correct results based on the current active device. For example it will return the appropriate values for DirectX versus an OpenGL device.

MDrawContext is derived from MFrameContext and provides its own implementation for all virtual methods. The values returned from these methods may differ slightly between MFrameContext and MDrawContext as MFrameContext retrieves the values from Maya and MDrawContext retrieves the values from the GPU device state.

Some information will vary from one draw to the next draw such as the object-to-world matrix which will change as different objects are being drawn.

Examples:
apiMeshShape/apiMeshGeometryOverride.cpp, blast2Cmd/blast2Cmd.cpp, blindDataShader/blindDataShaderOverride.cpp, blindDataShader/blindDataShaderOverride.h, cgFx/cgfxShaderNode.cpp, cgFx/cgfxShaderNode.h, customSpriteShader/customSpriteShader.cpp, customTextureShader/customTextureShaderOverride.cpp, customTextureShader/customTextureShaderOverride.h, dx11Shader/dx11Shader.cpp, dx11Shader/dx11Shader.h, dx11Shader/dx11ShaderOverride.cpp, dx11Shader/dx11ShaderOverride.h, footPrintNode_AnimatedMaterial/footPrintNode_GeometryOverride_AnimatedMaterial.cpp, glslShader/GLSLShader.cpp, glslShader/GLSLShader.h, glslShader/GLSLShaderOverride.cpp, glslShader/GLSLShaderOverride.h, gpuCache/gpuCacheDrawOverride.cpp, gpuCache/gpuCacheDrawOverride.h, gpuCache/gpuCacheSubSceneOverride.cpp, hlslShader/hlslShader.cpp, hwPhongShader/hwPhongShader.cpp, rawfootPrintNode/rawfootPrintNode.cpp, swissArmyManip/swissArmyManip.cpp, viewDX11DeviceAccess/viewDX11DeviceAccess.cpp, viewMRenderOverride/viewMRenderOverride.cpp, viewRenderOverride/viewRenderOverride.h, viewRenderOverride/viewRenderOverrideOperations.cpp, viewRenderOverride/viewRenderOverrideUserOperation.cpp, viewRenderOverrideFrameCache/viewRenderOverrideFrameCache.cpp, viewRenderOverrideFrameCache/viewRenderOverrideFrameCache.h, viewRenderOverrideMRT/viewRenderOverrideMRT.cpp, viewRenderOverrideMRT/viewRenderOverrideMRT.h, viewRenderOverridePointLightShadows/viewRenderOverridePointLightShadows.cpp, viewRenderOverridePointLightShadows/viewRenderOverridePointLightShadows.h, viewRenderOverrideShadows/viewRenderOverrideShadows.cpp, viewRenderOverrideShadows/viewRenderOverrideShadows.h, viewRenderOverrideTargets/viewRenderOverrideTargets.cpp, viewRenderOverrideTargets/viewRenderOverrideTargets.h, and vp2BlinnShader/vp2BlinnShader.cpp.

Member Enumeration Documentation

Options on which lights to return information for from light query methods.

Enumerator
kFilteredToLightLimit 

Return light information for lights which pass the VP2.0 filter options.

The number of lights accessible is clamped to the VP2.0 light limit option.

kFilteredIgnoreLightLimit 

Return light information for lights which pass the VP2.0 filter options.

The number of lights accessible ignores the VP2.0 light limit option.

Options on which internal texture to get.

Enumerator
kDepthPeelingTranspDepthTexture 

Depth texture of current transparent layer in depth-peeling transparency.

kDepthPeelingOpaqueDepthTexture 

Depth texture of all opaque objects in depth-peeling transparency.

kIrradianceEnvironment 

Irradiance environment map.

kSpecularEnvironment 

Specular environment map.

kNumberOfInternalTextures 

Number of internal textures, not to be used to describe an internal texture.

Member Function Documentation

MMatrix getMatrix ( MFrameContext::MatrixType  mtype,
MStatus ReturnStatus = NULL 
) const
overridevirtual

Get a matrix value of a certain type.

Parameters
[in]mtypeType of matrix to return
[out]ReturnStatusReturn status
Returns
The requested matrix
Status Codes:
  • MS::kSuccess Method succeeded
  • MS::kUnknownParameter Unknown matrix type
  • MS::kFailure Object error

Reimplemented from MFrameContext.

Examples:
cgFx/cgfxShaderNode.cpp, gpuCache/gpuCacheDrawOverride.cpp, hwPhongShader/hwPhongShader.cpp, rawfootPrintNode/rawfootPrintNode.cpp, swissArmyManip/swissArmyManip.cpp, viewDX11DeviceAccess/viewDX11DeviceAccess.cpp, and viewRenderOverride/viewRenderOverrideUserOperation.cpp.
MDoubleArray getTuple ( MFrameContext::TupleType  ttype,
MStatus ReturnStatus = NULL 
) const
overridevirtual

Get a tuple (vector, position, or single) value of a certain type.

Parameters
[in]ttypeType of information to return
[out]ReturnStatusReturn status
Returns
The requested tuple
Status Codes:
  • MS::kSuccess Method succeeded
  • MS::kUnknownParameter Unknown tuple type
  • MS::kFailure Object error

Reimplemented from MFrameContext.

Examples:
dx11Shader/dx11Shader.cpp, glslShader/GLSLShader.cpp, hwPhongShader/hwPhongShader.cpp, rawfootPrintNode/rawfootPrintNode.cpp, and viewRenderOverride/viewRenderOverrideUserOperation.cpp.
MStatus getViewportDimensions ( int &  originX,
int &  originY,
int &  width,
int &  height 
) const
overridevirtual

Get the viewport dimensions.

The origin is the upper left corner of the viewport.

Parameters
[out]originXX coordinate of the viewport origin
[out]originYY coordinate of the viewport origin
[out]widthWidth of the viewport
[out]heightHeight of the viewport
Returns
Status code
Status Codes:
  • MS::kSuccess method succeeded
  • MS::kFailure method does not have a valid object

Reimplemented from MFrameContext.

Examples:
cgFx/cgfxShaderNode.cpp, gpuCache/gpuCacheDrawOverride.cpp, hwPhongShader/hwPhongShader.cpp, rawfootPrintNode/rawfootPrintNode.cpp, and viewRenderOverride/viewRenderOverrideUserOperation.cpp.
MUint64 getFrameStamp ( ) const

Returns the current frame stamp.

Returns
Unique render ID
Examples:
dx11Shader/dx11Shader.cpp, glslShader/GLSLShader.cpp, and rawfootPrintNode/rawfootPrintNode.cpp.
MBoundingBox getSceneBox ( MStatus ReturnStatus = NULL) const

Get a bounding box of the scene in world space.

Parameters
[out]ReturnStatusreturn status
Returns
The world space scene bounding box.
Status Codes:
  • MS::kSuccess method succeeded
  • MS::kFailure method does not have a valid object
Examples:
hwPhongShader/hwPhongShader.cpp, and viewRenderOverride/viewRenderOverrideUserOperation.cpp.
MBoundingBox getFrustumBox ( MStatus ReturnStatus) const

Get the bounding box of the current view frustum in world space.

Parameters
[out]ReturnStatusreturn status
Returns
The world space bounding box for the view frustum
Status Codes:
  • MS::kSuccess Method succeeded
  • MS::kFailure Object error
Examples:
rawfootPrintNode/rawfootPrintNode.cpp.
MStatus getRenderTargetSize ( int &  width,
int &  height 
) const

Get the size of the render target (output buffer) being rendered into.

The dimensions of the target are in pixels.

Parameters
[out]widthWidth of the render target
[out]heightHeight of the render target
Returns
Status code
Status Codes:
  • MS::kSuccess method succeeded
  • MS::kFailure method does not have a valid object
Examples:
dx11Shader/dx11Shader.cpp, glslShader/GLSLShader.cpp, hwPhongShader/hwPhongShader.cpp, viewDX11DeviceAccess/viewDX11DeviceAccess.cpp, and viewRenderOverride/viewRenderOverrideUserOperation.cpp.
MStatus getDepthRange ( float &  nearVal,
float &  farVal 
) const

Get the depth range which specifies the mapping of depth values from normalized device coordinates to window coordinates.

The depth range values are normally 0.0 and 1.0.

Parameters
[out]nearValSpecifies the near clipping plane
[out]farValSpecifies the far clipping plane
Returns
Status code
Status Codes:
  • MS::kSuccess method succeeded
  • MS::kFailure method does not have a valid object
Examples:
cgFx/cgfxShaderNode.cpp, and rawfootPrintNode/rawfootPrintNode.cpp.
bool viewDirectionAlongNegZ ( MStatus ReturnStatus) const

Return whether the view direction is pointing down the -Z axis.

Different devices will have difference conventions. For OpenGL the conventions is -Z. For DirectX the convention is +Z.

Parameters
[out]ReturnStatusreturn status
Returns
True if the view direction is pointing down the -Z axis.
Status Codes:
  • MS::kSuccess method succeeded
  • MS::kFailure method does not have a valid object
Examples:
hwPhongShader/hwPhongShader.cpp, and rawfootPrintNode/rawfootPrintNode.cpp.
unsigned int numberOfActiveLights ( LightFilter  lightFilter = kFilteredToLightLimit,
MStatus ReturnStatus = NULL 
) const

Return the number of available lights to render the scene.

This method takes into consideration the VP2.0 lighting mode options, whether lights are visible, and whether the light is a member of the default light set (illuminates by default).

When the light mode is set to use all lights, if the lightFilter argument is set to be 'kFilteredIgnoreLightLimit', then the light limit value in the VP2.0 settings will be ignored. Otherwise the value returned is clamped to the light limit.

Parameters
[in]lightFilterOnly consider lights which pass this filter option. The default value is kFilteredToLightLimit.
[out]ReturnStatusreturn status
Returns
The number of active lights.
Status Codes:
  • MS::kSuccess method succeeded
  • MS::kFailure method does not have a valid object
Examples:
dx11Shader/dx11Shader.cpp, glslShader/GLSLShader.cpp, gpuCache/gpuCacheDrawOverride.cpp, hwPhongShader/hwPhongShader.cpp, viewRenderOverride/viewRenderOverrideOperations.cpp, viewRenderOverridePointLightShadows/viewRenderOverridePointLightShadows.cpp, and viewRenderOverrideShadows/viewRenderOverrideShadows.cpp.
MStatus getLightInformation ( unsigned int  lightNumber,
MFloatPointArray positions,
MFloatVector direction,
float &  intensity,
MColor color,
bool &  hasDirection,
bool &  hasPosition,
LightFilter  lightFilter = kFilteredToLightLimit 
) const

Return common lighting information for a given active light.

Note that any ambient lighting information is returned as the last light.

Parameters
[in]lightNumberLight index number starting from 0 to the number of lights returned from numberOfActiveLights() minus one. Index 0 indicates the first light. There is no correspondance to fixed-function OpenGL light indices.
[out]positionsThe world space positions on a light. If a light is purely directional or represents ambient lighting then the position value has no meaning and the return value will be an empty array. In all other cases except for area lights a single position entry will be returned. Multiple positions are returned to represent different sample points on area lights.
[out]directionThe world space direction of the light. If a light is purely positional or represents ambient lighting then the direction value has no meaning and will be set to a value of (0,0,0,1).
[out]intensityThe intensity of the light.
[out]colorThe color value of the light.
[out]hasDirectionThis will indicate if the light has any directional properties.
[out]hasPositionThis will indicate if the light has any positional properties.
[in]lightFilterOnly consider lights which pass this filter option. The default value is kFilteredToLightLimit.
Returns
Status code
Status Codes:
  • MS::kSuccess method succeeded
  • MS::kFailure method does not have a valid object
  • MS::kInvalidParameter an invalid lightNumber was specified
Examples:
gpuCache/gpuCacheDrawOverride.cpp, and hwPhongShader/hwPhongShader.cpp.
MLightParameterInformation * getLightParameterInformation ( unsigned int  lightNumber,
LightFilter  lightFilter = kFilteredToLightLimit 
) const

Return parameter information for a given active light.

Parameters
[in]lightNumberLight index number starting from 0 to the number of lights returned from numberOfActiveLights() minus one. Index 0 indicates the first light. There is no correspondance to fixed-function OpenGL light indices.
[in]lightFilterOnly consider lights which pass this filter option. The default value is kFilteredToLightLimit.
Returns
Light information instance
Examples:
dx11Shader/dx11Shader.cpp, glslShader/GLSLShader.cpp, hwPhongShader/hwPhongShader.cpp, viewRenderOverride/viewRenderOverrideOperations.cpp, viewRenderOverridePointLightShadows/viewRenderOverridePointLightShadows.cpp, and viewRenderOverrideShadows/viewRenderOverrideShadows.cpp.
MHWRender::MStateManager * getStateManager ( ) const

Access the GPU state manager for the current draw context.

Returns
The GPU state manager for the current draw context
Examples:
cgFx/cgfxShaderNode.cpp, gpuCache/gpuCacheDrawOverride.cpp, hwPhongShader/hwPhongShader.cpp, rawfootPrintNode/rawfootPrintNode.cpp, swissArmyManip/swissArmyManip.cpp, and viewDX11DeviceAccess/viewDX11DeviceAccess.cpp.
const MRenderTarget * copyCurrentColorRenderTarget ( const MString name) const

Get a copy of the current color render target.

When the object is no longer needed, MRenderTargetManager::releaseRenderTarget() should be called to notify the target manager that the caller is done with the render target.

Parameters
[in]nameUnique name for copy. A non-empty string must be provided otherwise the method will fail.
Returns
Copy of the current color target
const MRenderTarget * copyCurrentDepthRenderTarget ( const MString name) const

Get a copy of the current depth render target.

When the object is no longer needed, MRenderTargetManager::releaseRenderTarget() should be called to notify the target manager that the caller is done with the render target.

Parameters
[in]nameUnique name for copy. A non-empty string must be provided otherwise the method will fail.
Returns
Copy of the current depth target
MTexture * copyCurrentColorRenderTargetToTexture ( ) const

Get a copy of the current color render target as a texture.

When the texture is no longer needed, MTextureManager::releaseTexture() should be called.

Returns
Copy of the current depth target
Examples:
blast2Cmd/blast2Cmd.cpp, viewRenderOverrideFrameCache/viewRenderOverrideFrameCache.cpp, and viewRenderOverrideTargets/viewRenderOverrideTargets.cpp.
MTexture * copyCurrentDepthRenderTargetToTexture ( ) const

Get a copy of the current depth render target as a texture.

When the texture is no longer needed, MTextureManager::releaseTexture() should be called.

Returns
Copy of the current depth target
Examples:
viewRenderOverrideTargets/viewRenderOverrideTargets.cpp.
const MTexture * getInternalTexture ( InternalTexture  internalTexture) const

Returns the internal texture as specified.

The internal texture is owned by MDrawContext and only valid during the lifetime of the MDrawContext object.

Parameters
[in]internalTextureSpecifies which internal texture to get.
Returns
Internal texture.
Examples:
dx11Shader/dx11Shader.cpp, and glslShader/GLSLShader.cpp.
bool isMultiDraw ( ) const

Returns true if the context is rendering in MultiDraw mode.

Returns
true if the context is rendering in MultiDraw mode.
Examples:
customTextureShader/customTextureShaderOverride.cpp.
const char * className ( )
static

Returns the name of this class.

Returns
Name of this class.
unsigned int numberOfActiveLights ( MStatus ReturnStatus) const

This method is obsolete.

[as of Maya 2019]

Deprecated:
Use numberOfActiveLights(LightFilter lightFilter, MStatus* ReturnStatus) instead.
Parameters
[out]ReturnStatusreturn status
Returns
The number of active lights.
Status Codes:
  • MS::kSuccess method succeeded
  • MS::kFailure method does not have a valid object

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