C++ API Reference
|
Utilities for Viewport 2.0. More...
#include <MRenderUtilities.h>
Public Types | |
enum | MaterialViewerCamera { kPerspectiveCamera = 0, kOrthogonalCameraWithMargin, kOrthogonalCameraCloseUp } |
Camera positions supported by the Material Viewer. More... | |
enum | MaterialViewerLights { kDefaultLights = 0, kSwatchLight, kAmbientLight } |
Light rigs supported by the Material Viewer. More... | |
Static Public Member Functions | |
static MDrawContext * | acquireSwatchDrawContext (const MRenderTarget *colorTarget=NULL, const MRenderTarget *depthTarget=NULL) |
Acquire a draw context fit for rendering a swatch into the provided render targets. More... | |
static MDrawContext * | acquireUVTextureDrawContext (const MRenderTarget *colorTarget=NULL, const MRenderTarget *depthTarget=NULL) |
Acquire a draw context fit for rendering a texture for the UV editor into the provided render targets. More... | |
static void | releaseDrawContext (MDrawContext *context, bool releaseTargets=true) |
Release a draw context. More... | |
static void | swatchBackgroundColor (float &r, float &g, float &b, float &a) |
This method returns the default background color for the hardware rendered swatch. More... | |
static MStatus | blitTargetToImage (const MRenderTarget *target, MImage &image) |
Copy the data from a target to an image. More... | |
static MStatus | blitTargetToGL (const MRenderTarget *target, const float region[2][2], bool unfiltered) |
Blit the data from a target to current GL context. More... | |
static MStatus | drawSimpleMesh (MDrawContext &context, const MVertexBuffer &vertexBuffer, const MIndexBuffer &indexBuffer, MGeometry::Primitive primitiveType, int start, int count) |
Render a simple mesh. More... | |
static MStatus | renderMaterialViewerGeometry (const MString &shape, MObject shaderNode, MImage &image, MaterialViewerCamera cameraMode=kPerspectiveCamera, MaterialViewerLights lightRig=kDefaultLights) |
Do an off-screen render replicating the results shown by the Material Viewer window of Hypershade. More... | |
static const char * | className () |
Returns the name of this class. More... | |
Utilities for Viewport 2.0.
This class is a utility class for rendering in Viewport 2.0
enum MaterialViewerCamera |
Camera positions supported by the Material Viewer.
enum MaterialViewerLights |
|
static |
Acquire a draw context fit for rendering a swatch into the provided render targets.
The caller is responsible for releasing the draw context when it is no longer needed, by calling MRenderUtilities::releaseDrawContext(). If no targets are specified, then the caller will also have to properly setup render targets before drawing. Specifying targets also insures that the proper GL context is made active when using GL devices.
[in] | colorTarget | The color target for swatch drawing. Can be NULL. |
[in] | depthTarget | The depth target for swatch drawing. Can be NULL. |
|
static |
Acquire a draw context fit for rendering a texture for the UV editor into the provided render targets.
The caller is responsible for releasing the draw context when it is no longer needed, by calling MRenderUtilities::releaseDrawContext(). If no targets are specified, then the caller will also have to properly setup render targets before drawing. Specifying targets also insures that the proper GL context is made active when using GL devices.
[in] | colorTarget | The color target for UV texture drawing. Can be NULL. |
[in] | depthTarget | The depth target for UV texture drawing. Can be NULL. |
|
static |
Release a draw context.
If releaseTargets is requested, the device will have NULL targets on function exit.
[in] | context | The draw context to delete |
[in] | releaseTargets | Removes the current draw targets from the device, defaults to true. |
|
static |
This method returns the default background color for the hardware rendered swatch.
[out] | r | The value for the red component. |
[out] | g | The value for the green component. |
[out] | b | The value for the blue component. |
[out] | a | The value for the alpha component. |
|
static |
Copy the data from a target to an image.
Only 2D targets and targets with the following formats are supported
[in] | target | The source target to get the data from. |
[in] | image | The destination image to copy the data to. |
|
static |
Blit the data from a target to current GL context.
Only 2D targets and targets with the following formats are supported
[in] | target | The source target to get the data from. |
[in] | region | Rectangular region to be rendered. |
[in] | unfiltered | Render with hardware filtering or sharply defined pixels. |
|
static |
Render a simple mesh.
[in] | context | The draw context to use for render. |
[in] | vertexBuffer | The vertex buffer for the mesh. |
[in] | indexBuffer | The index buffer for the mesh. |
[in] | primitiveType | The primitive type of the mesh. |
[in] | start | The location of the first index read from the index buffer. |
[in] | count | The number of indices to draw. |
|
static |
Do an off-screen render replicating the results shown by the Material Viewer window of Hypershade.
[in] | shape | Shape to render. Valid values include "meshSphere", "meshPlane", "meshShaderball", "meshTeapot", "meshCloth", and "meshHair". |
[in] | shaderNode | The shader node to use on the geometry. |
[in] | image | The image where the result should be stored. |
[in] | cameraMode | The camera to use for rendering. Defaults to MRenderUtilities::kPerspectiveCamera. |
[in] | lightRig | The light rig to use for rendering. Defaults to MRenderUtilities::kDefaultLights. |
|
static |
Returns the name of this class.