Framework Classes

The framework classes give plugins access to Maya’s internal rendering framework objects, including state and resource management, rendering context and override management.

MDrawRegistry

This is where implementations of proxy override classes must be registered against a specific node type in Maya. The same proxy may be registered against multiple node types, but each node type may only have one associated proxy class. Additional registrations override existing registrations.

MDrawContext

MDrawContext stores all draw context information for use by classes that override the actual draw (MPxDrawOverride and MPxShaderOverride). This class can be used to get and set draw state.

MStateManager

The state manager can be retrieved from the draw context instance in order to access and/or modify GPU state in an efficient and controlled manner. Although it is, of course, possible for users to modify state directly, it is recommended that all state management go through this interface. Not only does Maya attempt to optimize access to device state in order to avoid expensive read-backs and redundant state changes, using this interface also helps Maya keep track of the current state to avoid corruption.

MRenderer

This is the main interface for the Viewport 2.0 renderer. It presents interfaces for resource management as well render logic control. The renderer is a singleton object which may be accessed through MRenderer::theRenderer().

Texture Management

Textures are resources that can be acquired and released from the renderer. The main interfaces allow for acquiring a file texture from disk or creating a texture from a block of system memory. All textures are managed by the renderer. A texture is described by MTextureDescription and the list of available raster formats is described by MRasterFormat. The supported texture types are described by MTextureType and the environment mapping types by MEnvironmentMapType. It is also possible to access the device level handle of a texture to allow users to directly use the resource.

Shader Management

Some simple stock shaders, as well as CgFX shaders loaded stored in files on disk, can be acquired from the renderer through the shader manager. Access the MShaderManager class from the renderer to get access to MShaderInstance objects which can be used by MPxGeometryOverride or as a complete shader override on a render.

MFragmentManager

MFragmentManager provides functionality for dealing with Viewport 2.0 shading fragments and fragment graphs and is intended for use by implementations of MPxShadingNodeOverride and MPxSurfaceShadingNodeOverride. Both fragments and graphs are defined using a custom XML format. This format describes the input and output parameters for the fragment, as well as default values for parameters. It allows the specification of multiple implementations of the fragment (for example, a Cg implementation and an HLSL implementation), so that fragments can be created that work in both the OpenGL and DirectX versions of Viewport 2.0. The format can also be used to define how several fragments should be connected together into a single fragment graph.

MFragmentManager may also be used to store the XML data for many of the fragments and fragment graphs used by Maya for rendering internal shading nodes in Viewport 2.0. This information can be used by developers to write their own fragments that integrate with other Maya shading nodes and the whole shading system.

Target Management

MRenderTargetManager can be used to acquire render targets from the renderer for use as overrides on render operations.