- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Directories
- Examples

- Class List
- Class Hierarchy
- Class Members

Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes

# TexturePool Class Reference

This reference page is linked to from the following overview topics: Textures, Sampling Texture Values, Layer Containers.

Search for all occurrences

## Detailed Description

This is a container class for simple textures.

In Mudbox, textures are confined to a 0 to 1 UV space. If an object has texture coordinates that go outside this 0-1 space, then multiple texture tiles are used to represent the texture, one tile per unit region in texture space. This class is a container for all the tiles that comprise a texture.

Mudbox also uses paint layers (where each layer would have the same number of tiles). An instance of the TexturePool class can therefore also be a LayerContainer. In this case it is possible to cast a TexturePool pointer into a pointer to a LayerContainer instance, and use the LayerContainer pointer to determine the number of layers and get them. Each pointer to a layer object can then be cast into a TexturePool object again, which then will be the physical paint layer. See the Material class documentation for more details.

Examples:

  FixedFunctionMaterial/FixedFunctionMaterial.h, and PtexExtractor/PtexPaintExporter.h.

Definition at line 459 of file material.h.

`#include <material.h>`

Inheritance diagram for TexturePool:
[legend]

List of all members.

## Classes
struct | TileDescriptor
| This structure describes the default texture parameters used when creating texture tiles for this TexturePool. More...
## Public Types
enum | RenderMode { renderModeConstantColor, renderModeTexture, renderModeVertexColor }
enum | Location { locationUnknown, locationGPU, locationCPU, locationDisk }
enum | Usage { usagePaintLayer, usageLayerMask, usageAdjustmentLayer, usageUnknown }
## Public Member Functions
virtual const TileDescriptor & | DefaultTileDescriptor (void) const
| Returns the default parameters that are used to construct new texture tiles.
virtual void | SetDefaultTileDescriptor (const TileDescriptor &pDesc)
| Sets the default parameters that are used to construct new texture tiles.
virtual enum Usage | Usage () const
| A texture pool can have different usages.
virtual void | SetUsage (enum Usage eUsage)
| Sets the desired usage type for this texture pool. See TexturePool::Usage().
virtual QString | Name (void) const
| Returns the name of the texturepool.
virtual void | SetName (const QString &sName)
| Sets the name of the texture pool.
virtual unsigned int | RenderMode (void) const
| Returns the render mode of the texture pool. 0=constant color, 1=texture, 2=vertex color.
virtual void | SetRenderMode (unsigned int iMode)
| Sets the render mode for the texture pool.
virtual void | SetLocation (unsigned int iLocation)
| Sets the location for the texture pool.
virtual unsigned int | Location (void) const
| Gets the location for the texture pool.
virtual TexturePool & | operator= (TexturePool &cT)
virtual int | Width (void) const
| Returns the number of tiles in a row.
virtual void | SetWidth (int iWidth)
| Sets the number of tiles in a row.
virtual void | SetFileName (const QString &sFileName)
| Set the file name mask for the texture pool.
virtual const QString & | FileName (void) const
| Returns the file name mask for the texture pool.
virtual void | Save (const QString &sFileName="", const QString &sFormat="", Material *m=NULL, bool bForced=false)
| Saves the textures into files on the disk.
virtual void | Export (const QString &sFileName, const QString &sFormat="", Material *m=NULL)
| Exports the textures into files on the disk.
virtual void | SetDirty (bool bDirty)
| Sets the dirty status of the texture.
virtual bool | IsDirty (void) const
| Gets the dirty status of the texture.
virtual void | AddToDirtyArea (const Vector &cPoint)
| Adds a point to the dirty region of this texture pool.
virtual void | SetTilesDirty (void)
| Sets all tiles dirty in the texture pool.
virtual void | Reload (void)
| Reload the pool from the files based on the current file name mask.
virtual void | SetContentChanged (void)
| Sets a flag to say that the texturepool has been modified.
virtual bool | IsContentChanged (void)
| Returns true if the texturepool has been modified since the last file save.
virtual unsigned int | TileCount (void) const
| Returns the number of created tiles so far. These tiles can overlap.
virtual class Texture * | Tile (unsigned int iTileIndex)
| Returns a pointer to a specified tile. Do not delete this pointer.
virtual class Texture * | Tile (const AxisAlignedBoundingBox &cTCArea, bool bAlloc=true)
| Returns a texture tile for a coordinate range.
virtual class Texture * | Tile (float U, float V, bool bAlloc=true)
| Returns a texture tile for a coordinate.
virtual AxisAlignedBoundingBox | TileArea (unsigned int iTileIndex) const
| Returns the UV area associated with a tile.
TextureTileArray * | getTextureTileArray ()
virtual TextureMixer * | Mixer (void) const
| Returns a mixer object for the pool.
virtual int | BlendMode (void) const
| Returns the blending mode of the pool.
virtual void | SetBlendMode (int iMode)
| Sets the blending mode.
virtual void | SetMaterial (Material *pMaterial)
virtual Material * | GetMaterial () const
virtual TexturePool * | Buffer (void) const
| return the material associated with this texture pool.
virtual qint64 | TileVideoMemoryUsage (const AxisAlignedBoundingBox &cArea, float fTCGrad=-1)
| Returns the estimated video memory usage for the specific tile, for the specific texture coordinate gradient.
## Protected Member Functions
| TexturePool (void)
| Constructor.
## Protected Attributes
TextureTileArray | m_TextureTileArray

## Member Enumeration Documentation

enum RenderMode

Search for all occurrences

Enumerator:

  renderModeConstantColor | Search for all occurrences
  renderModeTexture | Search for all occurrences
  renderModeVertexColor | Search for all occurrences

Definition at line 496 of file material.h.

        {
            renderModeConstantColor,
            renderModeTexture,
            renderModeVertexColor
        };

enum Location

Search for all occurrences

Enumerator:

  locationUnknown | Search for all occurrences
  locationGPU | Search for all occurrences
  locationCPU | Search for all occurrences
  locationDisk | Search for all occurrences

Definition at line 503 of file material.h.

        {
            locationUnknown,
            locationGPU,
            locationCPU,
            locationDisk
        };

enum Usage

Search for all occurrences

Enumerator:

  usagePaintLayer | Search for all occurrences
  usageLayerMask | Search for all occurrences
  usageAdjustmentLayer | Search for all occurrences
  usageUnknown | Search for all occurrences

Definition at line 511 of file material.h.

        {
            usagePaintLayer,
            usageLayerMask,
            usageAdjustmentLayer,
            usageUnknown
        };

## Constructor & Destructor Documentation

TexturePool | ( | void |  | ) | `[protected]`

Constructor.

Do not use it directly; Use CreateInstance() instead.

            TexturePool *myTexturePool = CreateInstance<TexturePool>();

## Member Function Documentation

virtual const TileDescriptor& DefaultTileDescriptor | ( | void |  | ) | const `[virtual]`

Search for all occurrences

Returns the default parameters that are used to construct new texture tiles.

virtual void SetDefaultTileDescriptor | ( | const TileDescriptor & | pDesc | ) | `[virtual]`

Search for all occurrences

Sets the default parameters that are used to construct new texture tiles.

virtual enum Usage Usage | ( |  | ) | const `[virtual]`

Search for all occurrences

A texture pool can have different usages.

This flag indicates how this pool should be used.

Texture pools can be used for paint layers, paint layer masks, or adjustment layers. All pools are the same regardless of usage. However its useful to differentiate them for layer compositing operations and for UI display. For example, if the layer is being used as a mask (i.e. its usage type is TexturePool::usageLayerMask), the layer's parent is the layer that is affected by the mask.

virtual void SetUsage | ( | enum Usage | eUsage | ) | `[virtual]`

Search for all occurrences

Sets the desired usage type for this texture pool. See TexturePool::Usage().

virtual QString Name | ( | void |  | ) | const `[virtual]`

Search for all occurrences

Returns the name of the texturepool.

virtual void SetName | ( | const QString & | sName | ) | `[virtual]`

Search for all occurrences

Sets the name of the texture pool.

Parameters:

  [in] | sName | New texture pool name. If the texture pool is a layer, this is the name of the layer seen in the UI.

Reimplemented from Node.

virtual unsigned int RenderMode | ( | void |  | ) | const `[virtual]`

Search for all occurrences

Returns the render mode of the texture pool. 0=constant color, 1=texture, 2=vertex color.

virtual void SetRenderMode | ( | unsigned int | iMode | ) | `[virtual]`

Search for all occurrences

Sets the render mode for the texture pool.

virtual void SetLocation | ( | unsigned int | iLocation | ) | `[virtual]`

Search for all occurrences

Sets the location for the texture pool.

virtual unsigned int Location | ( | void |  | ) | const `[virtual]`

Search for all occurrences

Gets the location for the texture pool.

virtual TexturePool& operator= | ( | TexturePool & | cT | ) | `[virtual]`

virtual int Width | ( | void |  | ) | const `[virtual]`

Search for all occurrences

Returns the number of tiles in a row.

The number of tiles in a TexturePool depends on the texture coordinates of the meshes which are using the pool. If the mesh has texture coordinates only within the 0-1 range, then only a single tile will be used, so this function will return 1. But for example when the U texture coordinate is in the range of 0-3 and V is in the range of 0-2, then six tiles will be used, this function will return 3 (since there are 3 tiles horizontally)

virtual void SetWidth | ( | int | iWidth | ) | `[virtual]`

Search for all occurrences

Sets the number of tiles in a row.

virtual void SetFileName | ( | const QString & | sFileName | ) | `[virtual]`

Search for all occurrences

Set the file name mask for the texture pool.

If there is more than a single tile used in the pool, then the file name will be extended with a string indicating which tile it belongs to. The attached string has the format _uX_vY, where X is the horizontal, and Y is the vertical coordinate of the tile. For example if the given filename is texture.jpg, then the name for the third tile in the first row will be texutre_u3_v1.jpg

Parameters:

  [in] | sFileName | The base file name for the texture files in this pool

virtual const QString& FileName | ( | void |  | ) | const `[virtual]`

Search for all occurrences

Returns the file name mask for the texture pool.

The name may contain tile wildcards (i, x, y).

virtual void Save | ( | const QString & | sFileName = `""`,
|  | const QString & | sFormat = `""`,
|  | Material * | m = `NULL`,
|  | bool | bForced = `false`
| ) |  | `[virtual]`

Search for all occurrences

Saves the textures into files on the disk.

If the file format is PSD and the material is not null, the uv mesh is drawn in a layer above the image layer saved by this function.

Parameters:

  [in] | sFileName | The file name to save
  [in] | sFormat | The file format in the form "bitDepth,dataType", i.e. "8,i" for 8bit/channel integer. 8, 16, 32 are valid for bitdepth and i and fp are valid for dataType.
  [in] | m | The material assciated with this texture pool.
  [in] | bForced | If the save should happen regardless if the texture is dirty

virtual void Export | ( | const QString & | sFileName,
|  | const QString & | sFormat = `""`,
|  | Material * | m = `NULL`
| ) |  | `[virtual]`

Search for all occurrences

Exports the textures into files on the disk.

Unlike Save(), this method does not modify the state of the texture pool.

Parameters:

  [in] | sFileName | The file name to save
  [in] | sFormat | The file format in the form "bitDepth,dataType",
  | m | i.e. "8,i" for 8bit/channel integer. 8, 16, 32 are valid for bitdepth and i and fp are valid for dataType. [in] The material assciated with this texture pool.

virtual void SetDirty | ( | bool | bDirty | ) | `[virtual]`

Search for all occurrences

Sets the dirty status of the texture.

This function must be called after the texture content is changed

Parameters:

  [in] | bDirty | Set to true to mark the texture dirty.

virtual bool IsDirty | ( | void |  | ) | const `[virtual]`

Search for all occurrences

Gets the dirty status of the texture.

virtual void AddToDirtyArea | ( | const Vector & | cPoint | ) | `[virtual]`

Search for all occurrences

Adds a point to the dirty region of this texture pool.

Parameters:

  [in] | cPoint | the area of the texture pool to mark as dirty

virtual void SetTilesDirty | ( | void |  | ) | `[virtual]`

Search for all occurrences

Sets all tiles dirty in the texture pool.

virtual void Reload | ( | void |  | ) | `[virtual]`

Search for all occurrences

Reload the pool from the files based on the current file name mask.

virtual void SetContentChanged | ( | void |  | ) | `[virtual]`

Search for all occurrences

Sets a flag to say that the texturepool has been modified.

virtual bool IsContentChanged | ( | void |  | ) | `[virtual]`

Search for all occurrences

Returns true if the texturepool has been modified since the last file save.

virtual unsigned int TileCount | ( | void |  | ) | const `[virtual]`

Search for all occurrences

Returns the number of created tiles so far. These tiles can overlap.

virtual class Texture* Tile | ( | unsigned int | iTileIndex | ) | `[virtual]`

Search for all occurrences

Returns a pointer to a specified tile. Do not delete this pointer.

Parameters:

  [in] | iTileIndex | Index of the tile to be returned

virtual class Texture* Tile | ( | const AxisAlignedBoundingBox & | cTCArea,
|  | bool | bAlloc = `true`
| ) |  | `[virtual]`

Search for all occurrences

Returns a texture tile for a coordinate range.

Attempts to create the texture if it does not yet exist.

Parameters:

  [in] | cTCArea | The UV area that corresponds to the desired texture.
  [in] | bAlloc | Set this to true to guarantee the returned Texture is loaded onto the GPU.

virtual class Texture* Tile | ( | float | U,
|  | float | V,
|  | bool | bAlloc = `true`
| ) |  | `[virtual]`

Search for all occurrences

Returns a texture tile for a coordinate.

Attempts to create the texture if it does not yet exist. Use this instead of the one taking a AABB. This one is faster.

virtual AxisAlignedBoundingBox TileArea | ( | unsigned int | iTileIndex | ) | const `[virtual]`

Search for all occurrences

Returns the UV area associated with a tile.

Parameters:

  [in] | iTileIndex | Index of the tile

TextureTileArray* getTextureTileArray | ( |  | ) | `[inline]`

Search for all occurrences

Definition at line 667 of file material.h.

    { return &m_TextureTileArray; }

virtual TextureMixer* Mixer | ( | void |  | ) | const `[virtual]`

Search for all occurrences

Returns a mixer object for the pool.

virtual int BlendMode | ( | void |  | ) | const `[virtual]`

Search for all occurrences

Returns the blending mode of the pool.

virtual void SetBlendMode | ( | int | iMode | ) | `[virtual]`

Search for all occurrences

Sets the blending mode.

Parameters:

  [in] | iMode | The index of the desired blending mode (see TextureMixer::BlendModeCount() and TextureMixer::BlendModeName() )

virtual void SetMaterial | ( | Material * | pMaterial | ) | `[virtual]`

Search for all occurrences

Parameters:

  [in] | pMaterial | Set the material associated with this TexturePool.

virtual Material* GetMaterial | ( |  | ) | const `[virtual]`

Search for all occurrences

virtual TexturePool* Buffer | ( | void |  | ) | const `[virtual]`

Search for all occurrences

return the material associated with this texture pool.

virtual qint64 TileVideoMemoryUsage | ( | const AxisAlignedBoundingBox & | cArea,
|  | float | fTCGrad = `-1`
| ) |  | `[virtual]`

Search for all occurrences

Returns the estimated video memory usage for the specific tile, for the specific texture coordinate gradient.

If no gradient is specified, the actual video memory usage is returned. See Texture::ProxyLevel for a description of the gradient parameter, and how it is used to compute a proxy level.

Parameters:

  [in] | cArea | The UV tile to query
  [in] | fTCGrad | The texture coordinate gradient, if none specified, the current LOD level is used.

## Member Data Documentation

TextureTileArray m_TextureTileArray `[protected]`

Search for all occurrences

Definition at line 471 of file material.h.

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

- Mudbox/material.h

TexturePool TexturePool TexturePool TexturePool TexturePool TexturePool TexturePool TexturePool TexturePool TexturePool
TexturePool TexturePool TexturePool TexturePool TexturePool TexturePool TexturePool TexturePool TexturePool TexturePool