#include <MMaterial.h>
This class is used in the draw functions of user defined shapes (see MPxSurfaceShapeUI) for setting up and querying materials used in shaded mode drawing.
Channels which can be queried. Only Lambert, Phong, PhongE, Blinn, and Anisotropic are supported
MMaterial::MMaterial | ( | ) |
Constructor.
MMaterial::MMaterial | ( | const MMaterial & | other | ) |
Copy constructor.
[in] | other |
MMaterial::~MMaterial | ( | ) |
Destructor.
Evaluate a material. Must be called before evaluating for getting any material properties.
[in] | view | the view |
[in] | path | path to the object |
MStatus MMaterial::evaluateShininess | ( | ) |
Perform necessary evaluation to be able to get shininess back.
MStatus MMaterial::evaluateDiffuse | ( | ) |
Perform necessary evaluation to be able to get diffuse back.
MStatus MMaterial::evaluateEmission | ( | ) |
Perform necessary evaluation to be able to get emission back.
MStatus MMaterial::evaluateSpecular | ( | ) |
Perform necessary evaluation to be able to get emission back.
Do texture evaluation and set a flag to tell if the texture is transparent.
This method should be called from MPxSurfaceShapeUI::getDrawRequests. The draw data argument is the MDrawData for the request that will carry the texture information to the MPxSurfaceShapeUI::draw method.
[in] | data | draw request data to carry the texture information |
MStatus MMaterial::evaluateTextureTransformation | ( | ) |
Perform necessary evaluation to be able to get the texture transformation information back.
bool MMaterial::materialIsTextured | ( | ) | const |
Do we have a texture (evaluated or not).
Set the current GL material.
[in] | path | path to the object |
[in] | hasTransparency | whether the material has transparency |
MStatus MMaterial::getShininess | ( | float & | value | ) |
Get the GL shininess.
[out] | value | storage for shininess |
Get the GL diffuse color.
[out] | color | storage for the diffuse color |
Get the GL emission color.
[out] | color | storage for the emission color |
Get the GL specular color.
[out] | color | storage for the specular color |
MStatus MMaterial::getHasTransparency | ( | bool & | value | ) |
Get flag to determine if material or texture has transparency.
[out] | value | flag to return |
MStatus MMaterial::getTextureTransformation | ( | float & | scaleU, | |
float & | scaleV, | |||
float & | translateU, | |||
float & | translateV, | |||
float & | rotate | |||
) |
Get the current textures transformation.
[out] | scaleU | storage for u scale value |
[out] | scaleV | storage for v scale value |
[out] | translateU | storage for u translation value |
[out] | translateV | storage for v translation value |
[out] | rotate | storage for rotate value |
For materials that have texture, this method must be used before the OpenGL drawing to apply the texture to the current view. This method should be called from within your MPxSurfaceShapeUI::draw method.
[in] | view | the view in which the textured drawing is to take place |
[in] | data | the draw data from the draw request |
MStatus MMaterial::textureImage | ( | MImage & | image, | |
MColor & | color, | |||
MtextureChannel | chan, | |||
bool & | mapped, | |||
MDagPath & | dagPath, | |||
int | xRes = -1 , |
|||
int | yRes = -1 | |||
) |
For materials that have texture, this method will attempt to retrieve the pixel map for a given mapped channel of that material. If the channel is not mapped than a status of failure will be returned.
The material types that can be queried include:
Currently only channels mapped to single file textures is supported.
[out] | image | The image retrieved. If no image could be retrieve, the value will not change. |
[in] | color | Either the mapped or unmapped color. If the channel is mapped than an RGBA value of (1,1,1,1) will be returned, otherwise the unmapped channel's current color value will be returned. |
[out] | mapped | Whether the channel is mapped or not (true or false) |
[in] | dagPath | Optional dag path to object. An object path is required to produce texture maps from non-2D procedural textures. |
[in] | xRes | Optional width of image to create. The minimal allowed value is 2. This parameter only applies to procedural textures. The dimension in X will be 128 by default, if a value less than 2 is specified. |
[in] | yRes | Optional height of image to create. The minimal allowed value is 2. This parameter only applies to procedural textures. The dimension in Y will be 128 by default, if a value less than 2 is specified. |
MPxHwShaderNode * MMaterial::getHwShaderNode | ( | MStatus * | ReturnStatus = NULL |
) |
Get the hardware shader node. If this material has a hardware shader, a pointer to it will be returned in hwShader. If there is no hardware shader, hwShader will be set to NULL.
Autodesk® Maya® 2009 © 1997-2008 Autodesk, Inc. All rights reserved. | Generated with 1.5.6 |