PURE API 0.5
PR00F's Ultimate Rendering Engine full documentation
Loading...
Searching...
No Matches
PureTexture Class Reference

Texture-representing class. More...

Detailed Description

Texture-representing class.

Definition at line 113 of file PureTextureManager.h.

#include <PureTextureManager.h>

+ Inheritance diagram for PureTexture:

Classes

class  PureTextureImpl
 

Public Member Functions

virtual ~PureTexture ()
 
CConsole & getManagedConsole () const
 Returns access to console preset with logger module name as this class.
 
TPURE_TEX_FORMAT getInternalFormat () const
 Gets the internal texture format, including compression mode.
 
TPureUInt getInternalNum () const
 Gets the internal texture ID.
 
TPURE_ISO_TEX_FILTERING getMinFilteringMode () const
 Gets the isotropic filtering mode when zooming out (1 texel < 1 pixel).
 
TPURE_ISO_TEX_FILTERING getMagFilteringMode () const
 Gets the isotropic filtering mode when zooming in (1 texel > 1 pixel).
 
TPureBool setMinFilteringMode (TPURE_ISO_TEX_FILTERING filtering)
 Sets the isotropic filtering mode when zooming out (1 texel < 1 pixel).
 
TPureBool setMagFilteringMode (TPURE_ISO_TEX_FILTERING filtering)
 Sets the isotropic filtering mode when zooming in (1 texel > 1 pixel).
 
TPureBool setIsoFilteringMode (TPURE_ISO_TEX_FILTERING minfilter, TPURE_ISO_TEX_FILTERING magfilter)
 Sets the isotropic filtering modes.
 
TPureUInt getMIPmapCount () const
 Gets the number of MIP maps.
 
TPURE_ANISO_TEX_FILTERING getAnisoFilteringMode () const
 Gets the anisotropic filtering mode.
 
TPureBool setAnisoFilteringMode (TPURE_ANISO_TEX_FILTERING filtering)
 Sets the anisotropic filtering mode.
 
TPURE_TEX_WRAPPING getTextureWrappingModeS () const
 Gets the texture wrapping mode for S coordinates.
 
TPURE_TEX_WRAPPING getTextureWrappingModeT () const
 Gets the texture wrapping mode for T coordinates.
 
TPureBool setTextureWrappingMode (TPURE_TEX_WRAPPING tw_s, TPURE_TEX_WRAPPING tw_t)
 Sets the texture wrapping mode.
 
TPureBool getBorder () const
 Gets the border state.
 
TPureBool setBorder (TPureBool state)
 Sets the border state.
 
const PureColorgetBorderColor () const
 Gets color of the border.
 
TPureBool setBorderColor (const PureColor &clr)
 Sets color of the border.
 
TPureBool uploadPixels ()
 Uploads pixels in system memory to video memory.
 
virtual TPureUInt getUsedSystemMemory () const
 Gets the amount of allocated system memory for the texture (VRAM not included).
 
TPureUInt getUsedTextureMemory () const
 Gets the amount of VRAM allocated (considering compression, MIP mapping, etc...).
 
- Public Member Functions inherited from PureImage
virtual ~PureImage ()
 
CConsole & getManagedConsole () const
 Returns access to console preset with logger module name as this class.
 
TPureUInt getWidth () const
 Gets the width of the image.
 
TPureUInt getHeight () const
 Gets the height of the image.
 
TPureUInt getBitsPerPixels () const
 Gets the bit depth of the image.
 
TPURE_PIXEL_COMPONENT_ORDER getPixelComponentOrder () const
 Gets the actual color component order.
 
TPURE_PIXEL_COMPONENT_ORDER getOriginalPixelComponentOrder () const
 Gets the original color component order.
 
TPureBool setPixelComponentOrder (TPURE_PIXEL_COMPONENT_ORDER corder)
 Transforms the color component order of the image to the given color component order.
 
PureColor getPixel (TPureUInt x, TPureUInt y)
 Gets the color of the pixel at the given (x,y) coordinate.
 
PureColor getPixel (TPureUInt x, TPureUInt y) const
 Gets the color of the pixel at the given (x,y) coordinate.
 
TPureBool setPixel (TPureUInt x, TPureUInt y, TPureUByte r, TPureUByte g, TPureUByte b, TPureUByte a=0)
 Sets the color of the pixel at the given (x,y) coordinate.
 
TPureBool setPixel (TPureUInt x, TPureUInt y, PureColor clr)
 Sets the color of the pixel at the given (x,y) coordinate.
 
TPureBool isChanged () const
 True if the pixel data has been changed since loading it from file.
 
const TPureUBytegetPixels () const
 Gets the pointer to the array of pixels, giving direct access to pixels.
 
TPureUBytegetPixels ()
 Gets the pointer to the array of pixels, giving direct access to pixels.
 
TPureUInt getPixelsSize () const
 Gets the size of the array of pixels.
 
virtual void FlushResources ()
 This can be used if you don't need the pixels of the image to be in the system memory anymore.
 
- Public Member Functions inherited from PureFiledManaged
 PureFiledManaged ()
 
virtual ~PureFiledManaged ()
 
CConsole & getManagedConsole () const
 Returns access to console preset with logger module name as this class.
 
const std::string & getFilename () const
 Gets the filename.
 
- Public Member Functions inherited from PureManaged
 PureManaged ()
 
virtual ~PureManaged ()
 
CConsole & getManagedConsole () const
 Returns access to console preset with logger module name as this class.
 
const PureManagedgetUtiliser () const
 Returns the managed that utilizes this managed.
 
PureManagedgetUtiliser ()
 Returns the managed that utilizes this managed.
 
void SetUtiliser (PureManaged *pUtiliser)
 Sets the managed that utilizes this managed.
 
void DetachFrom ()
 Removes the managed from its manager.
 
PureManagergetManager () const
 Gets the manager of the managed.
 
const std::string & getName () const
 Gets the name.
 
void SetName (const std::string &name)
 Sets the name.
 

Static Public Member Functions

static const char * getLoggerModuleName ()
 Returns the logger module name of this class.
 
- Static Public Member Functions inherited from PureImage
static const char * getLoggerModuleName ()
 Returns the logger module name of this class.
 
- Static Public Member Functions inherited from PureFiledManaged
static const char * getLoggerModuleName ()
 Returns the logger module name of this class.
 
- Static Public Member Functions inherited from PureManaged
static const char * getLoggerModuleName ()
 Returns the logger module name of this class.
 

Protected Member Functions

 PureTexture ()
 Only PureTextureManager creates it.
 
 PureTexture (const PureImage &img)
 Only PureTextureManager creates it this way.
 
 PureTexture (const PureTexture &)
 
PureTextureoperator= (const PureTexture &)
 
- Protected Member Functions inherited from PureImage
 PureImage ()
 Only ImageManager can create it.
 
 PureImage (const PureImage &)
 
PureImageoperator= (const PureImage &)
 
- Protected Member Functions inherited from PureFiledManaged
 PureFiledManaged (const PureFiledManaged &other)
 
PureFiledManagedoperator= (const PureFiledManaged &other)
 
void SetFilename (const std::string &filename)
 Sets the filename.
 
- Protected Member Functions inherited from PureManaged
 PureManaged (const PureManaged &other)
 
PureManagedoperator= (const PureManaged &other)
 

Private Attributes

PureTextureImplpImpl
 

Friends

class PureTextureManager
 

Constructor & Destructor Documentation

◆ ~PureTexture()

PureTexture::~PureTexture ( )
virtual

Definition at line 749 of file PureTexture.cpp.

◆ PureTexture() [1/3]

PureTexture::PureTexture ( )
protected

Only PureTextureManager creates it.

Exceptions
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 1016 of file PureTexture.cpp.

◆ PureTexture() [2/3]

PureTexture::PureTexture ( const PureImage & img)
explicitprotected

Only PureTextureManager creates it this way.

Exceptions
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 1029 of file PureTexture.cpp.

◆ PureTexture() [3/3]

PureTexture::PureTexture ( const PureTexture & )
protected

Definition at line 1038 of file PureTexture.cpp.

Member Function Documentation

◆ getAnisoFilteringMode()

TPURE_ANISO_TEX_FILTERING PureTexture::getAnisoFilteringMode ( ) const

Gets the anisotropic filtering mode.

Returns
The anisotropic filtering mode.

Definition at line 869 of file PureTexture.cpp.

◆ getBorder()

TPureBool PureTexture::getBorder ( ) const

Gets the border state.

Returns
Texture border state: true if has border, false otherwise.

Definition at line 923 of file PureTexture.cpp.

◆ getBorderColor()

const PureColor & PureTexture::getBorderColor ( ) const

Gets color of the border.

Texture border color is by default black.

Returns
Texture border color.

Definition at line 946 of file PureTexture.cpp.

◆ getInternalFormat()

TPURE_TEX_FORMAT PureTexture::getInternalFormat ( ) const

Gets the internal texture format, including compression mode.

Gets the internal texture format.


Returns
The internal texture format.

Definition at line 785 of file PureTexture.cpp.

◆ getInternalNum()

TPureUInt PureTexture::getInternalNum ( ) const

Gets the internal texture ID.

Returns
The texture ID.

Definition at line 795 of file PureTexture.cpp.

◆ getLoggerModuleName()

const char * PureTexture::getLoggerModuleName ( )
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.

Returns
The logger module name of this class.

Definition at line 775 of file PureTexture.cpp.

◆ getMagFilteringMode()

TPURE_ISO_TEX_FILTERING PureTexture::getMagFilteringMode ( ) const

Gets the isotropic filtering mode when zooming in (1 texel > 1 pixel).

Returns
The isotropic filtering mode when zooming in.

Definition at line 816 of file PureTexture.cpp.

◆ getManagedConsole()

CConsole & PureTexture::getManagedConsole ( ) 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.

Returns
Console instance used by this class.

Definition at line 762 of file PureTexture.cpp.

◆ getMinFilteringMode()

TPURE_ISO_TEX_FILTERING PureTexture::getMinFilteringMode ( ) const

Gets the isotropic filtering mode when zooming out (1 texel < 1 pixel).

Returns
The isotropic filtering mode when zooming out.

Definition at line 806 of file PureTexture.cpp.

◆ getMIPmapCount()

TPureUInt PureTexture::getMIPmapCount ( ) const

Gets the number of MIP maps.

Returns
Number of MIP maps.

Definition at line 859 of file PureTexture.cpp.

◆ getTextureWrappingModeS()

TPURE_TEX_WRAPPING PureTexture::getTextureWrappingModeS ( ) const

Gets the texture wrapping mode for S coordinates.

Returns
Texture wrapping mode for S coordinates.

Definition at line 891 of file PureTexture.cpp.

◆ getTextureWrappingModeT()

TPURE_TEX_WRAPPING PureTexture::getTextureWrappingModeT ( ) const

Gets the texture wrapping mode for T coordinates.

Returns
Texture wrapping mode for T coordinates.

Definition at line 901 of file PureTexture.cpp.

◆ getUsedSystemMemory()

TPureUInt PureTexture::getUsedSystemMemory ( ) const
virtual

Gets the amount of allocated system memory for the texture (VRAM not included).

VRAM usage can be retrieved by getUsedTextureMemory().

Returns
Amount of allocated system memory in Bytes.

Reimplemented from PureImage.

Definition at line 990 of file PureTexture.cpp.

◆ getUsedTextureMemory()

TPureUInt PureTexture::getUsedTextureMemory ( ) const

Gets the amount of VRAM allocated (considering compression, MIP mapping, etc...).

This does not include used system memory by the object itself, including possible cached pixel data. Used system memory can be retrieved by getUsedSystemMemory().

Returns
Amount of allocated video memory in Bytes.

Definition at line 1002 of file PureTexture.cpp.

◆ operator=()

PureTexture & PureTexture::operator= ( const PureTexture & )
protected

Definition at line 1044 of file PureTexture.cpp.

◆ setAnisoFilteringMode()

TPureBool PureTexture::setAnisoFilteringMode ( TPURE_ANISO_TEX_FILTERING filtering)

Sets the anisotropic filtering mode.

Note that if anisotropic filtering is supported but on a lower filtering mode, that will be set and considered as success. Obviously if anisotropic filtering is not supported, this function will fail.

Returns
True on success, false otherwise.

Definition at line 881 of file PureTexture.cpp.

◆ setBorder()

TPureBool PureTexture::setBorder ( TPureBool state)

Sets the border state.

No effect until uploadPixels() is called. Please note that texture borders are not supported with compressed textures.

Returns
True on success, false otherwise.

Definition at line 935 of file PureTexture.cpp.

◆ setBorderColor()

TPureBool PureTexture::setBorderColor ( const PureColor & clr)

Sets color of the border.

Texture border color is by default black. No effect until uploadPixels() is called. Please note that texture borders are not supported with compressed textures.

Returns
True on success, false otherwise.

Definition at line 959 of file PureTexture.cpp.

◆ setIsoFilteringMode()

TPureBool PureTexture::setIsoFilteringMode ( TPURE_ISO_TEX_FILTERING minfilter,
TPURE_ISO_TEX_FILTERING magfilter )

Sets the isotropic filtering modes.

Equivalent to calling setMinFilteringMode(minfilter) && setMagFilteringMode(magfilter).

Returns
True on success, false otherwise.

Definition at line 849 of file PureTexture.cpp.

◆ setMagFilteringMode()

TPureBool PureTexture::setMagFilteringMode ( TPURE_ISO_TEX_FILTERING filtering)

Sets the isotropic filtering mode when zooming in (1 texel > 1 pixel).

Only the following 2 values are accepted: PURE_ISO_NEAREST and PURE_ISO_LINEAR.

Returns
True on success, false otherwise.

Definition at line 838 of file PureTexture.cpp.

◆ setMinFilteringMode()

TPureBool PureTexture::setMinFilteringMode ( TPURE_ISO_TEX_FILTERING filtering)

Sets the isotropic filtering mode when zooming out (1 texel < 1 pixel).

If the texture has been created without MIP maps, only PURE_ISO_NEAREST and PURE_ISO_LINEAR are acceptable.

Returns
True on success, false otherwise.

Definition at line 827 of file PureTexture.cpp.

◆ setTextureWrappingMode()

TPureBool PureTexture::setTextureWrappingMode ( TPURE_TEX_WRAPPING tw_s,
TPURE_TEX_WRAPPING tw_t )

Sets the texture wrapping mode.

Parameters
tw_sSpecifies wrapping mode for S texture coordinates.
tw_tSpecifies wrapping mode for T texture coordinates.
Returns
True on success, false otherwise.

Definition at line 913 of file PureTexture.cpp.

◆ uploadPixels()

TPureBool PureTexture::uploadPixels ( )

Uploads pixels in system memory to video memory.

Should be used after directly modifying pixels or changing some of the properties like border. Has effect only if the Texture object is owned by a TextureManager and the Image part of the Texture object still has the pixels in system memory.

Internal format and used texture memory will be updated by this method so those should be queried again in case of interest.

The upload mechanism depends on the CURRENT settings of the owner TextureManager: for example, if the texture compression was set to off by default when the texture was created, the texture may still become compressed if the compression setting has been altered already when calling this method.

This method may change the color component order of the given image temporarily but restores it after creating the texture.

Returns
False if the texture object has no manager, or its manager is not a TextureManager, or pixels are not in system memory anymore. True otherwise.

Definition at line 979 of file PureTexture.cpp.

Friends And Related Symbol Documentation

◆ PureTextureManager

friend class PureTextureManager
friend

Definition at line 184 of file PureTextureManager.h.

Member Data Documentation

◆ pImpl

PureTextureImpl* PureTexture::pImpl
private

Definition at line 182 of file PureTextureManager.h.


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