MTextureManager Class Reference


Detailed Description

Class which manages texture.

Examples:

hwPhongShader.cpp.

#include <MTextureManager.h>

List of all members.

Public Member Functions

MStatus  addImagePath (const MString &path)
  This method adds an additional search path for looking up images on disk.
MStatus  imagePaths (MStringArray &paths) const
  The current set of image search paths can be retrieved using this method.
MTexture acquireTexture (const MString &filePath)
  Ask the renderer to acquire a hardware texture.
MTexture acquireTexture (const MString &textureName, const MPlug &plug, int width, int height)
  Ask the renderer to acquire a hardware texture.
MTexture acquireTexture (const MString &textureName, const MHWRender::MTextureDescription &textureDesc, const void *pixelData)
  Ask the renderer to acquire a hardware texture by providing a texture description and a block of system memory data which matches the texture description.

Static Public Member Functions

static const char *  className ()
  Returns the name of this class.

Member Function Documentation

MStatus addImagePath ( const MString path )

This method adds an additional search path for looking up images on disk.

Parameters:
[in] path Image search path.
Returns:
Status code
Status Codes:
MStatus imagePaths ( MStringArray paths ) const

The current set of image search paths can be retrieved using this method.

Parameters:
[out] paths A string array to be filled in with image path strings. Each array element will contain one image path string.
Returns:
Status code
Status Codes:
MTexture * acquireTexture ( const MString textureName )

Ask the renderer to acquire a hardware texture.

The input data is read from an image file.

The renderer will add 1 reference to this texture on creation. If the texture has already been acquired then no new texture will be created, and a new reference will be added.

Parameters:
[in] textureName Image file name
Returns:
MTexture pointer
Examples:
hwPhongShader.cpp.
MTexture * acquireTexture ( const MString textureName,
const MPlug plug,
int  width,
int  height 
)

Ask the renderer to acquire a hardware texture.

The input data is a plug

The renderer will add 1 reference to this texture on creation. If the texture has already been acquired then no new texture will be created, and a new reference will be added.

Parameters:
[in] textureName Name of the texture to create
[in] plug Plug which is attached with a texture
[in] width Width of the texture
[in] height Height of the texture
Returns:
MTexture pointer
MTexture * acquireTexture ( const MString textureName,
const MHWRender::MTextureDescription textureDesc,
const void *  pixelData 
)

Ask the renderer to acquire a hardware texture by providing a texture description and a block of system memory data which matches the texture description.

The renderer will add 1 reference to this texture on creation. If the texture has already been acquired then no new texture will be created, and a new reference will be added.

The creation of a new texture involves copying the block of system memory data to a hardware texture. The caller is free to deallocate the system memory as the renderer itself does not keep any references to it.

Parameters:
[in] textureName Name of the texture to create
[in] textureDesc Description of the texture
[in] pixelData Block of system memory data which matches the texture description
Returns:
MTexture pointer
const char * className ( ) [static]

Returns the name of this class.

Returns:
Name of this class.

MTextureManager MTextureManager MTextureManager MTextureManager MTextureManager MTextureManager MTextureManager MTextureManager MTextureManager MTextureManager
MTextureManager MTextureManager MTextureManager MTextureManager MTextureManager MTextureManager MTextureManager MTextureManager MTextureManager MTextureManager