![]() |
PURE API 0.5
PR00F's Ultimate Rendering Engine full documentation
|
Texture manager class. More...
Texture manager class.
Definition at line 192 of file PureTextureManager.h.
#include <PureTextureManager.h>
Classes | |
class | PureTextureManagerImpl |
Public Member Functions | |
PureTextureManager () | |
Sets default values. | |
virtual | ~PureTextureManager () |
CConsole & | getConsole () const |
Returns access to console preset with logger module name as this class. | |
TPureBool | isInitialized () const |
Tells whether the object is correctly initialized or not. | |
TPureUInt | getUsedTextureMemory () const |
Gets the total amount of allocated VRAM by all of the textures. | |
TPureBool | isHardwareMipMapGenerationEnabled () const |
Gets whether HW MIP map generation is enabled or not. | |
void | SetHardwareMipMapGenerationEnabled (TPureBool state) |
Sets whether HW MIP map generation is enabled or not. | |
TPureBool | isNativeDIBFormatSupportEnabled () const |
Gets whether direct upload of BGRA-format images is enabled or not. | |
void | SetNativeDIBFormatSupportEnabled (TPureBool state) |
Sets whether direct upload of BGRA-format images is enabled or not. | |
TPureBool | isLazyInstancingEnabled () const |
Gets whether always creating new texture instances from the same file is enabled or not. | |
void | SetLazyInstancingEnabled (TPureBool state) |
Sets whether always create new texture instances from the same file or not. | |
TPureBool | isPixelPreservingEnabled () const |
Gets whether keeping pixels of loaded textures in system memory is enabled or not. | |
void | SetPixelPreservingEnabled (TPureBool state) |
Sets whether to keep pixels of loaded textures in system memory or delete them after texture uploading. | |
PureTexture * | createTextureFromImage (const PureImage &img) |
Creates texture from the given image. | |
virtual PureTexture * | createFromFile (const char *filename) |
Creates texture from the given file. | |
TPURE_ISO_TEX_FILTERING | getDefaultMinFilteringMode () const |
Gets the default isotropic filtering mode when zooming out. | |
TPURE_ISO_TEX_FILTERING | getDefaultMagFilteringMode () const |
Gets the default isotropic filtering mode when zooming in. | |
TPureBool | setDefaultMinFilteringMode (TPURE_ISO_TEX_FILTERING filtering) |
Sets the default isotropic filtering mode when zooming out (when 1 texel < 1 pixel). | |
TPureBool | setDefaultMagFilteringMode (TPURE_ISO_TEX_FILTERING filtering) |
Sets the default isotropic filtering mode when zooming in (when 1 texel > 1 pixel). | |
TPureBool | setDefaultIsoFilteringMode (TPURE_ISO_TEX_FILTERING minfilter, TPURE_ISO_TEX_FILTERING magfilter) |
Sets the default isotropic filtering modes. | |
TPURE_ANISO_TEX_FILTERING | getDefaultAnisoFilteringMode () const |
Gets the default anisotropic filtering level. | |
TPureBool | setDefaultAnisoFilteringMode (TPURE_ANISO_TEX_FILTERING filtering) |
Sets the default anisotropic filtering level. | |
TPURE_ANISO_TEX_FILTERING | getMaximumAnisoFiltering () const |
Gets the maximum level of anisotropic filtering. | |
TPURE_TEX_WRAPPING | getDefaultTextureWrappingModeS () const |
Gets the default texture wrapping mode for S coordinates. | |
TPURE_TEX_WRAPPING | getDefaultTextureWrappingModeT () const |
Gets the default texture wrapping mode for T coordinates. | |
TPureBool | setDefaultTextureWrappingMode (TPURE_TEX_WRAPPING tw_s, TPURE_TEX_WRAPPING tw_t) |
Sets the default texture wrapping mode. | |
TPURE_TEX_COMPRESSION_MODE | getDefaultCompressionMode () const |
Gets the default texture compression mode. | |
TPureBool | setDefaultCompressionMode (TPURE_TEX_COMPRESSION_MODE mode) |
Sets the default texture compression mode. | |
TPureBool | getDefaultBorder () const |
Gets the default border state. | |
TPureBool | setDefaultBorder (TPureBool state) |
Sets the default border state. | |
PureColor & | getDefaultBorderColor () |
Gets default color of the border. | |
const PureColor & | getDefaultBorderColor () const |
Gets default color of the border. | |
virtual void | WriteList () const |
From PureImageManager, adding total texture memory usage counting. | |
![]() | |
PureImageManager () | |
virtual | ~PureImageManager () |
CConsole & | getConsole () const |
Returns access to console preset with logger module name as this class. | |
PureImage * | createBlank (TPureUInt width, TPureUInt height, TPureUInt bpp) |
Creates a blank Image object as specified. | |
![]() | |
PureFiledManager () | |
virtual | ~PureFiledManager () |
CConsole & | getConsole () const |
Returns access to console preset with logger module name as this class. | |
PureFiledManaged * | getByFilename (const char *filename) const |
Gets the FiledManaged by the specified filename. | |
![]() | |
PureManager () | |
virtual | ~PureManager () |
CConsole & | getConsole () const |
Returns access to console preset with logger module name as this class. | |
TPureInt | getCount () const |
Gets the number of managed objects. | |
TPureBool | isEmpty () const |
Is the number of manageds 0? | |
TPureInt | getSize () const |
Gets the number of allocated slots for managed objects; getSize() >= getCount(). | |
PureManaged * | getAttachedAt (TPureInt ind) const |
Gets the pointer to the managed at the given index. | |
TPureInt | getAttachedIndex (const PureManaged &m) const |
Gets the index of the given managed. | |
void | PreAlloc (TPureInt count) |
Allocates count free slots for manageds. | |
TPureBool | hasAttached (const PureManaged &m) const |
Gets whether the given managed is managed by this manager. | |
virtual void | Attach (PureManaged &m) |
Adds the given managed to the manager, if the managed has no manager yet. | |
virtual void | Detach (PureManaged &m) |
Removes the given managed from the manager, so the managed will have no manager. | |
void | DeleteAttachedInstance (PureManaged &m) |
Removes the given managed from the manager and destructs it. | |
void | DeleteAll () |
Removes and destructs every managed element in the manager. | |
virtual void | HandleManagedPropertyChanged (PureManaged &m) |
Should be invoked when a managed's property got changed from a different kind of manager or managed. | |
virtual TPureUInt | getUsedSystemMemory () const |
Gets the amount of allocated system memory for all manageds owner by this manager. | |
Static Public Member Functions | |
static TPureUInt | getMIPmapCount (TPureUInt width, TPureUInt height) |
Calculates the number of MIP maps from the given texture size. | |
static TPureUInt | getWidthAtLevel (TPureUInt level, TPureUInt width, TPureUInt height) |
Calculates the texture width at the given MIP map level. | |
static TPureUInt | getHeightAtLevel (TPureUInt level, TPureUInt width, TPureUInt height) |
Calculates the texture height at the given MIP map level. | |
static TPureUInt | getMIPmappedTexSize (TPureUInt basesize, TPureUInt width, TPureUInt height) |
Calculates the total size of the MIP mapped texture in memory based on its basesize and size. | |
static TPURE_ANISO_TEX_FILTERING | getPureanisoTexFilteringNameFromFloat (TPureFloat value) |
Gets the Pure aniso texture filtering value that corresponds to the given floating point value. | |
static TPURE_ANISO_TEX_FILTERING | getPureanisoTexFilteringNameFromUInt (TPureUInt value) |
Gets the Pure aniso texture filtering value that corresponds to the given integer value. | |
static TPureFloat | getFloatFromPureanisoTexFilteringName (TPURE_ANISO_TEX_FILTERING value) |
Gets the value that corresponds to the given Pure aniso texture filtering value. | |
static TPureUInt | getUIntFromPureanisoTexFilteringName (TPURE_ANISO_TEX_FILTERING value) |
Gets the value that corresponds to the given Pure aniso texture filtering value. | |
static const char * | getLoggerModuleName () |
Returns the logger module name of this class. | |
![]() | |
static TPureUInt | getColorConversionSwapCount (TPIXCOMPORD from, TPIXCOMPORD to) |
Calculates the number of swaps needed from the given color component order to the other. | |
static TPIXCOMPORD | getMirroredPixelComponentOrder (TPIXCOMPORD corder) |
Transforms the given color component order to its mirrored form. | |
static const char * | getLoggerModuleName () |
Returns the logger module name of this class. | |
![]() | |
static const char * | getLoggerModuleName () |
Returns the logger module name of this class. | |
![]() | |
static const char * | getLoggerModuleName () |
Returns the logger module name of this class. | |
Protected Member Functions | |
PureTextureManager (const PureTextureManager &) | |
PureTextureManager & | operator= (const PureTextureManager &) |
virtual void | WriteListCallback (const PureManaged &mngd) const |
From PureImageManager, texture memory and internal number. | |
![]() | |
PureImageManager (const PureImageManager &) | |
PureImageManager & | operator= (const PureImageManager &) |
![]() | |
PureFiledManager (const PureFiledManager &) | |
PureFiledManager & | operator= (const PureFiledManager &) |
![]() | |
PureManager (const PureManager &other) | |
PureManager & | operator= (const PureManager &) |
Private Attributes | |
PureTextureManagerImpl * | pImpl |
PureTextureManager::PureTextureManager | ( | ) |
Sets default values.
Requires a valid initialized PureHwInfo instance to be functional.
std::bad_alloc | - This class or its ancestor dynamically allocates memory with operator new, in case of failure the exception is not handled but propagated to caller. |
Definition at line 623 of file PureTextureManager.cpp.
|
virtual |
Definition at line 630 of file PureTextureManager.cpp.
|
protected |
Definition at line 1173 of file PureTextureManager.cpp.
|
virtual |
Creates texture from the given file.
Only the file formats accepted in ImageManager can be used here. Based on lazy instancing setting, this function may return an already existing Texture instance if such exists with same image data. Lazy instancing is controlled by SetLazyInstancingEnabled().
The texture may appear misaligned on surfaces under certain circumstances, check the documentation of PureImageManager::createFromFile() for details and workarounds.
For maximum compatibility with older systems, it is highly recommended to use images having width and height divisible by 2, and equal (width = height).
Reimplemented from PureImageManager.
Definition at line 859 of file PureTextureManager.cpp.
PureTexture * PureTextureManager::createTextureFromImage | ( | const PureImage & | img | ) |
Creates texture from the given image.
This method may change the color component order of the given image temporarily but restores it after creating the texture. Based on lazy instancing setting, this function may return an already existing Texture instance if such exists with same file name. Lazy instancing is controlled by SetLazyInstancingEnabled().
The texture may appear misaligned on surfaces under certain circumstances, check the documentation of PureImageManager::createFromFile() for details and workarounds.
For maximum compatibility with older systems, it is highly recommended to use images having width and height divisible by 2, and equal (width = height).
Definition at line 789 of file PureTextureManager.cpp.
CConsole & PureTextureManager::getConsole | ( | ) | const |
Returns access to console preset with logger module name as this class.
Intentionally not virtual, so the getConsole() in derived class should hide this instead of overriding.
Definition at line 643 of file PureTextureManager.cpp.
TPURE_ANISO_TEX_FILTERING PureTextureManager::getDefaultAnisoFilteringMode | ( | ) | const |
Gets the default anisotropic filtering level.
The default mode is the mode that will be set at every texture creation. The default anisotropic filtering mode is PURE_ANISO_1X.
Definition at line 1007 of file PureTextureManager.cpp.
TPureBool PureTextureManager::getDefaultBorder | ( | ) | const |
Gets the default border state.
The default mode is the mode that will be set at every texture creation. Please note that texture borders are not supported with compressed textures.
Definition at line 1110 of file PureTextureManager.cpp.
PureColor & PureTextureManager::getDefaultBorderColor | ( | ) |
Gets default color of the border.
The default mode is the mode that will be set at every texture creation. Texture default border color is by default black. Please note that texture borders are not supported with compressed textures.
Definition at line 1134 of file PureTextureManager.cpp.
const PureColor & PureTextureManager::getDefaultBorderColor | ( | ) | const |
Gets default color of the border.
The default mode is the mode that will be set at every texture creation. Texture default border color is by default black. Please note that texture borders are not supported with compressed textures.
Definition at line 1146 of file PureTextureManager.cpp.
TPURE_TEX_COMPRESSION_MODE PureTextureManager::getDefaultCompressionMode | ( | ) | const |
Gets the default texture compression mode.
The default mode is the mode that will be set at every texture creation. The default texture compression mode is PURE_TC_NONE. Not every system supports texture compression.
Definition at line 1080 of file PureTextureManager.cpp.
TPURE_ISO_TEX_FILTERING PureTextureManager::getDefaultMagFilteringMode | ( | ) | const |
Gets the default isotropic filtering mode when zooming in.
Gets the default isotropic filtering mode when zooming in (when 1 texel > 1 pixel).
The default mode is the mode that will be set at every texture creation. The default isotropic filtering mode when zooming in is PURE_ISO_LINEAR.
Definition at line 958 of file PureTextureManager.cpp.
TPURE_ISO_TEX_FILTERING PureTextureManager::getDefaultMinFilteringMode | ( | ) | const |
Gets the default isotropic filtering mode when zooming out.
Gets the default isotropic filtering mode when zooming out (when 1 texel < 1 pixel).
The default mode is the mode that will be set at every texture creation. The default isotropic filtering mode when zooming out is PURE_ISO_LINEAR.
Definition at line 945 of file PureTextureManager.cpp.
TPURE_TEX_WRAPPING PureTextureManager::getDefaultTextureWrappingModeS | ( | ) | const |
Gets the default texture wrapping mode for S coordinates.
The default mode is the mode that will be set at every texture creation. The default texture wrapping mode is PURE_TW_REPEAT.
Definition at line 1043 of file PureTextureManager.cpp.
TPURE_TEX_WRAPPING PureTextureManager::getDefaultTextureWrappingModeT | ( | ) | const |
Gets the default texture wrapping mode for T coordinates.
The default mode is the mode that will be set at every texture creation. The default texture wrapping mode is PURE_TW_REPEAT.
Definition at line 1054 of file PureTextureManager.cpp.
|
static |
Gets the value that corresponds to the given Pure aniso texture filtering value.
Definition at line 584 of file PureTextureManager.cpp.
|
static |
Calculates the texture height at the given MIP map level.
Definition at line 498 of file PureTextureManager.cpp.
|
static |
Returns the logger module name of this class.
Intentionally not virtual, so derived class should hide this instead of overriding. Not even private, so user can also access this from outside, for any reason like controlling log filtering per logger module name.
Definition at line 656 of file PureTextureManager.cpp.
TPURE_ANISO_TEX_FILTERING PureTextureManager::getMaximumAnisoFiltering | ( | ) | const |
Gets the maximum level of anisotropic filtering.
Not every system supports anisotropic filtering.
Definition at line 1032 of file PureTextureManager.cpp.
Calculates the number of MIP maps from the given texture size.
Definition at line 457 of file PureTextureManager.cpp.
|
static |
Calculates the total size of the MIP mapped texture in memory based on its basesize and size.
Definition at line 519 of file PureTextureManager.cpp.
|
static |
Gets the Pure aniso texture filtering value that corresponds to the given floating point value.
Definition at line 544 of file PureTextureManager.cpp.
|
static |
Gets the Pure aniso texture filtering value that corresponds to the given integer value.
Definition at line 564 of file PureTextureManager.cpp.
|
static |
Gets the value that corresponds to the given Pure aniso texture filtering value.
Definition at line 603 of file PureTextureManager.cpp.
TPureUInt PureTextureManager::getUsedTextureMemory | ( | ) | const |
Gets the total amount of allocated VRAM by all of the textures.
Definition at line 676 of file PureTextureManager.cpp.
|
static |
Calculates the texture width at the given MIP map level.
Definition at line 477 of file PureTextureManager.cpp.
TPureBool PureTextureManager::isHardwareMipMapGenerationEnabled | ( | ) | const |
Gets whether HW MIP map generation is enabled or not.
Enabled by default.
Definition at line 688 of file PureTextureManager.cpp.
TPureBool PureTextureManager::isInitialized | ( | ) | const |
Tells whether the object is correctly initialized or not.
Definition at line 666 of file PureTextureManager.cpp.
TPureBool PureTextureManager::isLazyInstancingEnabled | ( | ) | const |
Gets whether always creating new texture instances from the same file is enabled or not.
Lazy instancing means we don't create new texture instance for the same file that has been already loaded as a texture.
On by default.
Definition at line 732 of file PureTextureManager.cpp.
TPureBool PureTextureManager::isNativeDIBFormatSupportEnabled | ( | ) | const |
Gets whether direct upload of BGRA-format images is enabled or not.
Enabled by default, if supported.
Definition at line 711 of file PureTextureManager.cpp.
TPureBool PureTextureManager::isPixelPreservingEnabled | ( | ) | const |
Gets whether keeping pixels of loaded textures in system memory is enabled or not.
Off by default. Keeping pixels in system memory means that after successfully creating the texture in video memory, the Image part of the Texture should still keep the pixels in system memory. This is useful when you want to update pixels after creating the texture but takes more memory.
Definition at line 756 of file PureTextureManager.cpp.
|
protected |
Definition at line 1179 of file PureTextureManager.cpp.
TPureBool PureTextureManager::setDefaultAnisoFilteringMode | ( | TPURE_ANISO_TEX_FILTERING | filtering | ) |
Sets the default anisotropic filtering level.
The default mode is the mode that will be set at every texture creation. The default anisotropic filtering mode is PURE_ANISO_1X, meaning it is off. Not every system supports anisotropic filtering.
Definition at line 1020 of file PureTextureManager.cpp.
Sets the default border state.
The default mode is the mode that will be set at every texture creation. Please note that texture borders are not supported with compressed textures.
Definition at line 1122 of file PureTextureManager.cpp.
TPureBool PureTextureManager::setDefaultCompressionMode | ( | TPURE_TEX_COMPRESSION_MODE | mode | ) |
Sets the default texture compression mode.
The default mode is the mode that will be used at every texture creation. The default texture compression mode is PURE_TC_NONE. Not every system supports texture compression.
You can select RGBA compression modes even if source image is in RGB. In that case, alpha values will be automatically set to 1. You can also select RGB compression mode even if source image is in RGBA. In that case, alpha values will be ignored. Please note that texture borders are not supported with compressed textures.
Definition at line 1099 of file PureTextureManager.cpp.
TPureBool PureTextureManager::setDefaultIsoFilteringMode | ( | TPURE_ISO_TEX_FILTERING | minfilter, |
TPURE_ISO_TEX_FILTERING | magfilter ) |
Sets the default isotropic filtering modes.
Equivalent to calling setDefaultMinFilteringMode(minfilter) && setDefaultMagFilteringMode(magfilter).
Definition at line 994 of file PureTextureManager.cpp.
TPureBool PureTextureManager::setDefaultMagFilteringMode | ( | TPURE_ISO_TEX_FILTERING | filtering | ) |
Sets the default isotropic filtering mode when zooming in (when 1 texel > 1 pixel).
The default mode is the mode that will be set at every texture creation. The default isotropic filtering mode when zooming in is PURE_ISO_LINEAR. Only the following 2 values are accepted: PURE_ISO_NEAREST and PURE_ISO_LINEAR.
Definition at line 983 of file PureTextureManager.cpp.
TPureBool PureTextureManager::setDefaultMinFilteringMode | ( | TPURE_ISO_TEX_FILTERING | filtering | ) |
Sets the default isotropic filtering mode when zooming out (when 1 texel < 1 pixel).
The default mode is the mode that will be set at every texture creation. The default isotropic filtering mode when zooming out is PURE_ISO_LINEAR.
Definition at line 970 of file PureTextureManager.cpp.
TPureBool PureTextureManager::setDefaultTextureWrappingMode | ( | TPURE_TEX_WRAPPING | tw_s, |
TPURE_TEX_WRAPPING | tw_t ) |
Sets the default texture wrapping mode.
The default mode is the mode that will be set at every texture creation. The default texture wrapping mode is PURE_TW_REPEAT for S- and T- texture coordinates.
Definition at line 1066 of file PureTextureManager.cpp.
void PureTextureManager::SetHardwareMipMapGenerationEnabled | ( | TPureBool | state | ) |
Sets whether HW MIP map generation is enabled or not.
Can be enabled only if the system supports it. Enabled by default, if supported.
Definition at line 699 of file PureTextureManager.cpp.
void PureTextureManager::SetLazyInstancingEnabled | ( | TPureBool | state | ) |
Sets whether always create new texture instances from the same file or not.
Lazy instancing means we don't create new texture instance for the same file that has been already loaded as a texture.
If enabled, creating texture multiple times from the same image will result in creating only 1 PureTexture and keep referring to the same later. On by default.
Definition at line 743 of file PureTextureManager.cpp.
void PureTextureManager::SetNativeDIBFormatSupportEnabled | ( | TPureBool | state | ) |
Sets whether direct upload of BGRA-format images is enabled or not.
Can be enabled only if supported. Enabled by default, if supported.
Definition at line 722 of file PureTextureManager.cpp.
void PureTextureManager::SetPixelPreservingEnabled | ( | TPureBool | state | ) |
Sets whether to keep pixels of loaded textures in system memory or delete them after texture uploading.
Off by default. Keeping pixels in system memory means that after successfully creating the texture in video memory, the Image part of the Texture should still keep the pixels in system memory. This is useful when you want to update pixels after creating the texture but takes more memory.
Definition at line 769 of file PureTextureManager.cpp.
|
virtual |
From PureImageManager, adding total texture memory usage counting.
Reimplemented from PureImageManager.
Definition at line 1155 of file PureTextureManager.cpp.
|
protectedvirtual |
From PureImageManager, texture memory and internal number.
Reimplemented from PureImageManager.
Definition at line 1188 of file PureTextureManager.cpp.
|
private |
Definition at line 295 of file PureTextureManager.h.