Class for managing hardware images. More...
Public Types | |
enum | eWrapping { WRAP_REPEAT , WRAP_CLAMP } |
Texture filter enumeration. More... | |
enum | eFilter { FILTER_NEAREST , FILTER_LINEAR } |
Texture filter enumeration. More... | |
enum | eLoader { LOADER_LOAD , LOADER_UNLOAD , LOADER_SHUTDOWN } |
Texture callback command enumeration. More... | |
typedef uint_t(* | LoaderProc) (Texture *pThis, eLoader uCommand) |
Function prototype for loading callback. | |
Public Member Functions | |
const Burger::StaticRTTI * | get_StaticRTTI (void) const noexcept override |
Get the description to the class. | |
Texture () | |
Default constructor. | |
Texture (eWrapping uWrapping, eFilter uFilter) | |
Default constructor. | |
virtual | ~Texture () |
Default destructor. | |
uint_t | CheckLoad (Display *pDisplay) override |
Load the pixel data. | |
void | Release (Display *pDisplay) override |
Release hardware resources. | |
uint_t | LoadImageMemory (void) |
Call the loader callback with the command LOADER_LOAD. | |
void | UnloadImageMemory (void) |
Call the loader callback with the command LOADER_UNLOAD. | |
void | ShutdownImageMemory (void) |
Call the loader callback with the command LOADER_SHUTDOWN. | |
const Image * | GetImage (void) const |
Get a pointer to the contained Image record. | |
Image * | GetImage (void) |
Get a pointer to the contained Image record. | |
const uint8_t * | GetImage (uint_t uMipMap) const |
Get a pointer to the bitmap. | |
uint_t | GetWidth (void) const |
Get the width of the texture. | |
uint_t | GetWidth (uint_t uMipMap) const |
Get the width of the texture at a mip map level. | |
uint_t | GetHeight (void) const |
Get the height of the texture. | |
uint_t | GetHeight (uint_t uMipMap) const |
Get the height of the texture at a mip map level. | |
uintptr_t | GetStride (void) const |
Get the byte stride of each scan line of the texture. | |
uintptr_t | GetStride (uint_t uMipMap) const |
Get the byte stride of each scan line of the texture at a mip map level. | |
Image::ePixelTypes | GetType (void) const |
Get the type of data contained in the texture. | |
uint_t | GetMipMapCount (void) const |
Get the number of mip map levels. | |
void | SetImageDirty (void) |
Set the image updated flag. | |
eWrapping | GetWrappingS (void) const |
Get the wrapping setting for the S (U) coordinate. | |
void | SetWrappingS (eWrapping uWrapping) |
Set the wrapping setting for the S (U) coordinate. | |
eWrapping | GetWrappingT (void) const |
Get the wrapping setting for the T (V) coordinate. | |
void | SetWrappingT (eWrapping uWrapping) |
Set the wrapping setting for the T (V) coordinate. | |
void | SetWrapping (eWrapping uWrapping) |
Set the wrapping setting for the S and T (U/V) coordinate. | |
eFilter | GetMinFilter (void) const |
Get the filter setting for the minimum scaling. | |
void | SetMinFilter (eFilter uFilter) |
Set the filter setting for the minimum scaling. | |
eFilter | GetMagFilter (void) const |
Get the filter setting for the maximum scaling. | |
void | SetMagFilter (eFilter uFilter) |
Set the filter setting for the maximum scaling. | |
void | SetFilter (eFilter uFilter) |
Set the filter setting for the minimum and maximum scaling. | |
LoaderProc | GetLoader (void) const |
Get the pointer to the texture reload callback. | |
void | SetLoader (LoaderProc pCallback) |
Set the function pointer to the texture loading callback. | |
void | LoadTGA (RezFile *pRezFile, uint_t uRezNum) |
Set the texture to load the image from a TGA file. | |
void | LoadTGA (const char *pFilename) |
Set the texture to load the image from a TGA file. | |
void | LoadTGA (Filename *pFilename) |
Set the texture to load the image from a TGA file. | |
void | LoadPNG (RezFile *pRezFile, uint_t uRezNum) |
Set the texture to load the image from a PNG file. | |
void | LoadPNG (const char *pFilename) |
Set the texture to load the image from a PNG file. | |
void | LoadPNG (Filename *pFilename) |
Set the texture to load the image from a PNG file. | |
void | LoadBMP (RezFile *pRezFile, uint_t uRezNum) |
Set the texture to load the image from a BMP file. | |
void | LoadBMP (const char *pFilename) |
Set the texture to load the image from a BMP file. | |
void | LoadBMP (Filename *pFilename) |
Set the texture to load the image from a BMP file. | |
void | LoadGIF (RezFile *pRezFile, uint_t uRezNum) |
Set the texture to load the image from a GIF file. | |
void | LoadGIF (const char *pFilename) |
Set the texture to load the image from a GIF file. | |
void | LoadGIF (Filename *pFilename) |
Set the texture to load the image from a GIF file. | |
uint_t | GetTextureID (void) const |
![]() | |
DisplayObject * | GetNext (void) const |
Get the next display object in the global linked list. | |
DisplayObject * | GetPrevious (void) const |
Get the previous display object in the global linked list. | |
![]() | |
ReferenceCounter () noexcept | |
Sets the reference count to zero. | |
virtual | ~ReferenceCounter () |
Destructor. | |
void | AddRef (void) noexcept |
Increase the reference count by 1. | |
void | Release (void) noexcept |
Decrease the reference count by 1. | |
![]() | |
const char * | get_class_name (void) const noexcept |
Get the name of the class. | |
virtual | ~Base () noexcept=default |
Destructor. | |
Static Public Member Functions | |
static int | GetWrapping (eWrapping uWrapping) |
static int | GetFilter (eFilter uFilter) |
![]() | |
static DisplayObject * | GetFirstObject (void) |
Get the first display object in the global linked list. | |
static void | ReleaseAll (Display *pDisplay) |
Release all display objects. | |
Static Public Attributes | |
static const Burger::StaticRTTI | g_StaticRTTI |
The global description of the class. | |
![]() | |
static const Burger::StaticRTTI | g_StaticRTTI |
The global description of the class. | |
![]() | |
static const Burger::StaticRTTI | g_StaticRTTI |
The global description of the class. | |
![]() | |
static const Burger::StaticRTTI | g_StaticRTTI |
The global description of the class. | |
Protected Types | |
enum | eDirtyFlags { DIRTY_WRAPPING_S =0x01 , DIRTY_WRAPPING_T =0x02 , DIRTY_MIN =0x04 , DIRTY_MAG =0x08 , DIRTY_IMAGE =0x10 , DIRTY_EXTRA =0x20 } |
Bit flags for data to update. More... | |
Protected Attributes | |
LoaderProc | m_pLoader |
Function to load the image in case of texture purge. | |
void * | m_pUserData |
Pointer to user data for the loader. | |
uint_t | m_uTextureID |
OpenGL Texture ID. | |
Image | m_Image |
Description of the texture data. | |
eWrapping | m_eWrappingS |
Wrapping setting for the S value. | |
eWrapping | m_eWrappingT |
Wrapping setting for the T value. | |
eFilter | m_eMinFilter |
Filter for shrinkage. | |
eFilter | m_eMagFilter |
Filter for expansion. | |
uint_t | m_uDirty |
Values needed to be updated. | |
![]() | |
DisplayObject * | m_pNextDisplayObject |
Pointer to the next DisplayObject. | |
DisplayObject * | m_pPrevDisplayObject |
Pointer to the previous DisplayObject. | |
Private Member Functions | |
Texture (const Texture &)=delete | |
Texture & | operator= (const Texture &)=delete |
Texture (Texture &&)=delete | |
Texture & | operator= (Texture &&)=delete |
Static Private Member Functions | |
static uint_t | CallbackRezFileTGA (Texture *pTexture, eLoader uLoader) |
Private callback to load TGA files from a resource file. | |
static uint_t | CallbackFileTGA (Texture *pTexture, eLoader uLoader) |
Private callback to load TGA files from a file. | |
static uint_t | CallbackFilenameTGA (Texture *pTexture, eLoader uLoader) |
Private callback to load TGA files from a file. | |
static uint_t | CallbackRezFilePNG (Texture *pTexture, eLoader uLoader) |
Private callback to load PNG files from a resource file. | |
static uint_t | CallbackFilePNG (Texture *pTexture, eLoader uLoader) |
Private callback to load PNG files from a file. | |
static uint_t | CallbackFilenamePNG (Texture *pTexture, eLoader uLoader) |
Private callback to load PNG files from a file. | |
static uint_t | CallbackRezFileBMP (Texture *pTexture, eLoader uLoader) |
Private callback to load BMP files from a resource file. | |
static uint_t | CallbackFileBMP (Texture *pTexture, eLoader uLoader) |
Private callback to load BMP files from a file. | |
static uint_t | CallbackFilenameBMP (Texture *pTexture, eLoader uLoader) |
Private callback to load BMP files from a file. | |
static uint_t | CallbackRezFileGIF (Texture *pTexture, eLoader uLoader) |
Private callback to load GIF files from a resource file. | |
static uint_t | CallbackFileGIF (Texture *pTexture, eLoader uLoader) |
Private callback to load GIF files from a file. | |
static uint_t | CallbackFilenameGIF (Texture *pTexture, eLoader uLoader) |
Private callback to load GIF files from a file. | |
Additional Inherited Members | |
![]() | |
DisplayObject (void) | |
Add this display object to the global linked list. | |
virtual | ~DisplayObject () |
Remove this display object from the global linked list. | |
![]() | |
static DisplayObject * | g_pHead = NULL |
Global pointer to the linked list of display objects. | |
Class for managing hardware images.
This class is the mechanism for loading raw pixels into a video card for GPU rendering. A mechanism is provided to allow arbitrary uploads to video memory in cases of GPU memory purges by the video display driver
Function prototype for loading callback.
|
protected |
Bit flags for data to update.
Flags to mark which records have been changed to so they can be uploaded to the device driver
Texture callback command enumeration.
When the custom texture loader is called, one of these three commands are passed. LOADER_LOAD is when the Image record needed to be set up, LOADER_UNLOAD when the pixel data can be purged from memory and LOADER_SHUTDOWN when the function will never be called again.
Enumerator | |
---|---|
LOADER_LOAD | Command to load a texture into the Image. |
LOADER_UNLOAD | Command to release the memory in the Image if allowed. |
LOADER_SHUTDOWN | Force all memory to be released. |
|
privatedelete |
|
privatedelete |
Burger::Texture::Texture | ( | ) |
Default constructor.
Initialize to an empty texture, set the wrapping to WRAP_REPEAT and filter FILTER_NEAREST
Default constructor.
Initialize to an empty texture, set the wrapping to WRAP_REPEAT and filter FILTER_NEAREST
|
virtual |
Default destructor.
Release all data
|
staticprivate |
Private callback to load BMP files from a file.
Function to handle the loading and conversion to an Image of a BMP file found in a file
|
staticprivate |
Private callback to load GIF files from a file.
Function to handle the loading and conversion to an Image of a GIF file found in a file
|
staticprivate |
Private callback to load BMP files from a file.
Function to handle the loading and conversion to an Image of a BMP file found in a file
|
staticprivate |
Private callback to load GIF files from a file.
Function to handle the loading and conversion to an Image of a GIF file found in a file
|
staticprivate |
Private callback to load PNG files from a file.
Function to handle the loading and conversion to an Image of a PNG file found in a file
|
staticprivate |
Private callback to load TGA files from a file.
Function to handle the loading and conversion to an Image of a TGA file found in a file
|
staticprivate |
Private callback to load PNG files from a file.
Function to handle the loading and conversion to an Image of a PNG file found in a file
|
staticprivate |
Private callback to load TGA files from a file.
Function to handle the loading and conversion to an Image of a TGA file found in a file
|
staticprivate |
Private callback to load BMP files from a resource file.
Function to handle the loading and conversion to an Image of a BMP file found in a resource file
|
staticprivate |
Private callback to load GIF files from a resource file.
Function to handle the loading and conversion to an Image of a GIF file found in a resource file
|
staticprivate |
Private callback to load PNG files from a resource file.
Function to handle the loading and conversion to an Image of a PNG file found in a resource file
|
staticprivate |
Private callback to load TGA files from a resource file.
Function to handle the loading and conversion to an Image of a TGA file found in a resource file
Load the pixel data.
Allow the derived class to load a texture from disk and convert into a proper Image
Implements Burger::DisplayObject.
Reimplemented in Burger::TextureDirectX9.
|
overridevirtualnoexcept |
Get the description to the class.
This virtual function will pull the pointer to the StaticRTTI instance that has the name of the class. Due to it being virtual, it will be the name of the most derived class.
Reimplemented from Burger::DisplayObject.
Reimplemented in Burger::TextureDirectX9.
|
static |
Get the height of the texture at a mip map level.
uMipMap | Mip map level to query |
|
inline |
Get the height of the texture.
|
inline |
Get a pointer to the bitmap.
uMipMap | Mip map level (0 is for the base bitmap) |
|
inline |
Get a pointer to the contained Image record.
|
inline |
Get a pointer to the contained Image record.
|
inline |
Get the pointer to the texture reload callback.
|
inline |
Get the filter setting for the maximum scaling.
|
inline |
Get the filter setting for the minimum scaling.
|
inline |
Get the number of mip map levels.
|
inline |
Get the byte stride of each scan line of the texture at a mip map level.
uMipMap | Mip map level to query |
|
inline |
Get the byte stride of each scan line of the texture.
|
inline |
|
inline |
Get the type of data contained in the texture.
Get the width of the texture at a mip map level.
uMipMap | Mip map level to query |
|
inline |
Get the width of the texture.
|
static |
|
inline |
Get the wrapping setting for the S (U) coordinate.
|
inline |
Get the wrapping setting for the T (V) coordinate.
void BURGER_API Burger::Texture::LoadBMP | ( | const char * | pFilename | ) |
Set the texture to load the image from a BMP file.
Set up for loading a hardware texture from a BMP file stored in a file
void BURGER_API Burger::Texture::LoadBMP | ( | Filename * | pFilename | ) |
Set the texture to load the image from a BMP file.
Set up for loading a hardware texture from a BMP file stored in a file
void BURGER_API Burger::Texture::LoadBMP | ( | RezFile * | pRezFile, |
uint_t | uRezNum ) |
Set the texture to load the image from a BMP file.
Set up for loading a hardware texture from a BMP file stored in a RezFile
void BURGER_API Burger::Texture::LoadGIF | ( | const char * | pFilename | ) |
Set the texture to load the image from a GIF file.
Set up for loading a hardware texture from a GIF file stored in a file
void BURGER_API Burger::Texture::LoadGIF | ( | Filename * | pFilename | ) |
Set the texture to load the image from a GIF file.
Set up for loading a hardware texture from a GIF file stored in a file
void BURGER_API Burger::Texture::LoadGIF | ( | RezFile * | pRezFile, |
uint_t | uRezNum ) |
Set the texture to load the image from a GIF file.
Set up for loading a hardware texture from a GIF file stored in a RezFile
uint_t BURGER_API Burger::Texture::LoadImageMemory | ( | void | ) |
Call the loader callback with the command LOADER_LOAD.
void BURGER_API Burger::Texture::LoadPNG | ( | const char * | pFilename | ) |
Set the texture to load the image from a PNG file.
Set up for loading a hardware texture from a PNG file stored in a file
void BURGER_API Burger::Texture::LoadPNG | ( | Filename * | pFilename | ) |
Set the texture to load the image from a PNG file.
Set up for loading a hardware texture from a PNG file stored in a file
void BURGER_API Burger::Texture::LoadPNG | ( | RezFile * | pRezFile, |
uint_t | uRezNum ) |
Set the texture to load the image from a PNG file.
Set up for loading a hardware texture from a PNG file stored in a RezFile
void BURGER_API Burger::Texture::LoadTGA | ( | const char * | pFilename | ) |
Set the texture to load the image from a TGA file.
Set up for loading a hardware texture from a TGA file stored in a file
void BURGER_API Burger::Texture::LoadTGA | ( | Filename * | pFilename | ) |
Set the texture to load the image from a TGA file.
Set up for loading a hardware texture from a TGA file stored in a file
void BURGER_API Burger::Texture::LoadTGA | ( | RezFile * | pRezFile, |
uint_t | uRezNum ) |
Set the texture to load the image from a TGA file.
Set up for loading a hardware texture from a TGA file stored in a RezFile
|
overridevirtual |
Release hardware resources.
Allow the derived class to release hardware resources
Implements Burger::DisplayObject.
Reimplemented in Burger::TextureDirectX9.
|
inline |
Set the filter setting for the minimum and maximum scaling.
uFilter | The new wrapping setting for the minimum and maximum scaling |
|
inline |
Set the image updated flag.
If the texture is modified by the application, call this function to alert the texture manager to upload the new bitmap into the hardware on the next rendering pass.
|
inline |
Set the function pointer to the texture loading callback.
pCallback | The new pointer to the texture loading callback |
|
inline |
Set the filter setting for the maximum scaling.
uFilter | The new filter setting for the maximum scaling |
|
inline |
Set the filter setting for the minimum scaling.
uFilter | The new filter setting for the minimum scaling |
|
inline |
Set the wrapping setting for the S and T (U/V) coordinate.
uWrapping | The new wrapping setting for the S and T (U/V) coordinate |
|
inline |
Set the wrapping setting for the S (U) coordinate.
uWrapping | The new wrapping setting for the S (U) coordinate |
|
inline |
Set the wrapping setting for the T (V) coordinate.
uWrapping | The new wrapping setting for the T (V) coordinate |
void BURGER_API Burger::Texture::ShutdownImageMemory | ( | void | ) |
Call the loader callback with the command LOADER_SHUTDOWN.
void BURGER_API Burger::Texture::UnloadImageMemory | ( | void | ) |
Call the loader callback with the command LOADER_UNLOAD.
|
static |
The global description of the class.
This record contains the name of this class and a reference to the parent
|
protected |
Filter for expansion.
|
protected |
Filter for shrinkage.
|
protected |
Wrapping setting for the S value.
|
protected |
Wrapping setting for the T value.
|
protected |
Description of the texture data.
|
protected |
Function to load the image in case of texture purge.
|
protected |
Pointer to user data for the loader.
|
protected |
Values needed to be updated.