This reference page is linked to from the following overview topics: Textures, Sampling Texture Values, Layer Containers.
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.
FixedFunctionMaterial/FixedFunctionMaterial.h, PtexExtractor/PtexPaintExporter.h, and PtexImporter/PtexImporter.h.
Definition at line 419 of file material.h.
#include <material.h>
Public Types |
|
enum | RenderMode { renderModeConstantColor, renderModeTexture, renderModeVertexColor } |
enum | Location { locationUnknown, locationGPU, locationCPU, locationDisk } |
enum | Usage { usagePaintLayer, usageLayerMask, usageAdjustmentLayer, usageUnknown } |
Public Member Functions |
|
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 | 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 | GPUMemoryUsageInBytes (void) const |
Returns the video memory usage in byte.
|
|
Protected Member Functions |
|
TexturePool (void) | |
Constructor. |
|
Protected Attributes |
|
TextureTileArray | m_TextureTileArray |
enum RenderMode |
Definition at line 435 of file material.h.
enum Location |
Definition at line 442 of file material.h.
enum Usage |
Definition at line 450 of file material.h.
TexturePool | ( | void | ) | [protected] |
Constructor.
Do not use it directly; Use CreateInstance() instead.
TexturePool *myTexturePool = CreateInstance<TexturePool>();
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] |
Sets the desired usage type for this texture pool. See TexturePool::Usage().
virtual QString Name | ( | void | ) | const [virtual] |
Returns the name of the texturepool.
virtual void SetName | ( | const QString & | sName | ) | [virtual] |
Sets the name of the texture pool.
[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] |
Returns the render mode of the texture pool. 0=constant color, 1=texture, 2=vertex color.
virtual void SetRenderMode | ( | unsigned int | iMode | ) | [virtual] |
Sets the render mode for the texture pool.
virtual void SetLocation | ( | unsigned int | iLocation | ) | [virtual] |
Sets the location for the texture pool.
virtual unsigned int Location | ( | void | ) | const [virtual] |
Gets the location for the texture pool.
virtual TexturePool& operator= | ( | TexturePool & | cT | ) | [virtual] |
virtual int Width | ( | void | ) | const [virtual] |
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] |
Sets the number of tiles in a row.
virtual void SetFileName | ( | const QString & | sFileName | ) | [virtual] |
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
[in] | sFileName | The base file name for the texture files in this pool |
virtual const QString& FileName | ( | void | ) | const [virtual] |
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] |
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.
[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] |
Exports the textures into files on the disk.
Unlike Save(), this method does not modify the state of the texture pool.
[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] |
Sets the dirty status of the texture.
This function must be called after the texture content is changed
[in] | bDirty | Set to true to mark the texture dirty. |
virtual bool IsDirty | ( | void | ) | const [virtual] |
Gets the dirty status of the texture.
virtual void AddToDirtyArea | ( | const Vector & | cPoint | ) | [virtual] |
Adds a point to the dirty region of this texture pool.
[in] | cPoint | the area of the texture pool to mark as dirty |
virtual void Reload | ( | void | ) | [virtual] |
Reload the pool from the files based on the current file name mask.
virtual void SetContentChanged | ( | void | ) | [virtual] |
Sets a flag to say that the texturepool has been modified.
virtual bool IsContentChanged | ( | void | ) | [virtual] |
Returns true if the texturepool has been modified since the last file save.
virtual unsigned int TileCount | ( | void | ) | const [virtual] |
Returns the number of created tiles so far. These tiles can overlap.
virtual class Texture* Tile | ( | unsigned int | iTileIndex | ) | [virtual] |
Returns a pointer to a specified tile. Do not delete this pointer.
[in] | iTileIndex | Index of the tile to be returned |
virtual class Texture* Tile | ( | const AxisAlignedBoundingBox & | cTCArea, |
bool | bAlloc =
true |
||
) | [virtual] |
Returns a texture tile for a coordinate range.
Attempts to create the texture if it does not yet exist.
[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] |
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] |
Returns the UV area associated with a tile.
[in] | iTileIndex | Index of the tile |
TextureTileArray* getTextureTileArray | ( | ) | [inline] |
Definition at line 597 of file material.h.
{ return &m_TextureTileArray; }
virtual TextureMixer* Mixer | ( | void | ) | const [virtual] |
Returns a mixer object for the pool.
virtual int BlendMode | ( | void | ) | const [virtual] |
Returns the blending mode of the pool.
virtual void SetBlendMode | ( | int | iMode | ) | [virtual] |
Sets the blending mode.
[in] | iMode | The index of the desired blending mode (see TextureMixer::BlendModeCount() and TextureMixer::BlendModeName() ) |
virtual void SetMaterial | ( | Material * | pMaterial | ) | [virtual] |
[in] | pMaterial | Set the material associated with this TexturePool. |
virtual Material* GetMaterial | ( | ) | const [virtual] |
virtual TexturePool* Buffer | ( | void | ) | const [virtual] |
return the material associated with this texture pool.
virtual qint64 GPUMemoryUsageInBytes | ( | void | ) | const [virtual] |
Returns the video memory usage in byte.
TextureTileArray
m_TextureTileArray [protected] |
Definition at line 431 of file material.h.