Base texture class, subclasses of which depend on the render spec (DX, GL etc.)
More...
#include <Texture.h>
|
| CBaseTexture (unsigned int width=0, unsigned int height=0, unsigned int format=XB_FMT_A8R8G8B8) |
|
virtual | ~CBaseTexture () |
|
bool | LoadFromMemory (unsigned int width, unsigned int height, unsigned int pitch, unsigned int format, bool hasAlpha, const unsigned char *pixels) |
|
bool | LoadPaletted (unsigned int width, unsigned int height, unsigned int pitch, unsigned int format, const unsigned char *pixels, const COLOR *palette) |
|
bool | HasAlpha () const |
|
void | SetMipmapping () |
|
bool | IsMipmapped () const |
|
void | SetScalingMethod (TEXTURE_SCALING scalingMethod) |
|
TEXTURE_SCALING | GetScalingMethod () const |
|
void | SetCacheMemory (bool bCacheMemory) |
|
bool | GetCacheMemory () const |
|
virtual void | CreateTextureObject ()=0 |
|
virtual void | DestroyTextureObject ()=0 |
|
virtual void | LoadToGPU ()=0 |
|
virtual void | BindToUnit (unsigned int unit)=0 |
|
unsigned char * | GetPixels () const |
|
unsigned int | GetPitch () const |
|
unsigned int | GetRows () const |
|
unsigned int | GetTextureWidth () const |
|
unsigned int | GetTextureHeight () const |
|
unsigned int | GetWidth () const |
|
unsigned int | GetHeight () const |
|
unsigned int | GetOriginalWidth () const |
| return the original width of the image, before scaling/cropping More...
|
|
unsigned int | GetOriginalHeight () const |
| return the original height of the image, before scaling/cropping More...
|
|
int | GetOrientation () const |
|
void | SetOrientation (int orientation) |
|
void | Update (unsigned int width, unsigned int height, unsigned int pitch, unsigned int format, const unsigned char *pixels, bool loadToGPU) |
|
void | Allocate (unsigned int width, unsigned int height, unsigned int format) |
|
void | ClampToEdge () |
|
|
static CBaseTexture * | LoadFromFile (const std::string &texturePath, unsigned int idealWidth=0, unsigned int idealHeight=0, bool requirePixels=false, const std::string &strMimeType="") |
| Load a texture from a file Loads a texture from a file, restricting in size if needed based on maxHeight and maxWidth. Note that these are the ideal size to load at - the returned texture may be smaller or larger than these. More...
|
|
static CBaseTexture * | LoadFromFileInMemory (unsigned char *buffer, size_t bufferSize, const std::string &mimeType, unsigned int idealWidth=0, unsigned int idealHeight=0) |
| Load a texture from a file in memory Loads a texture from a file in memory, restricting in size if needed based on maxHeight and maxWidth. Note that these are the ideal size to load at - the returned texture may be smaller or larger than these. More...
|
|
static unsigned int | PadPow2 (unsigned int x) |
|
static bool | SwapBlueRed (unsigned char *pixels, unsigned int height, unsigned int pitch, unsigned int elements=4, unsigned int offset=0) |
|
|
bool | LoadFromFileInMem (unsigned char *buffer, size_t size, const std::string &mimeType, unsigned int maxWidth, unsigned int maxHeight) |
|
bool | LoadFromFileInternal (const std::string &texturePath, unsigned int maxWidth, unsigned int maxHeight, bool requirePixels, const std::string &strMimeType="") |
|
bool | LoadIImage (IImage *pImage, unsigned char *buffer, unsigned int bufSize, unsigned int width, unsigned int height) |
|
unsigned int | GetPitch (unsigned int width) const |
|
unsigned int | GetRows (unsigned int height) const |
|
unsigned int | GetBlockSize () const |
|
Base texture class, subclasses of which depend on the render spec (DX, GL etc.)
◆ CBaseTexture()
CBaseTexture::CBaseTexture |
( |
unsigned int |
width = 0 , |
|
|
unsigned int |
height = 0 , |
|
|
unsigned int |
format = XB_FMT_A8R8G8B8 |
|
) |
| |
◆ ~CBaseTexture()
CBaseTexture::~CBaseTexture |
( |
| ) |
|
|
virtual |
◆ Allocate()
void CBaseTexture::Allocate |
( |
unsigned int |
width, |
|
|
unsigned int |
height, |
|
|
unsigned int |
format |
|
) |
| |
◆ BindToUnit()
virtual void CBaseTexture::BindToUnit |
( |
unsigned int |
unit | ) |
|
|
pure virtual |
◆ ClampToEdge()
void CBaseTexture::ClampToEdge |
( |
| ) |
|
◆ CreateTextureObject()
virtual void CBaseTexture::CreateTextureObject |
( |
| ) |
|
|
pure virtual |
◆ DestroyTextureObject()
virtual void CBaseTexture::DestroyTextureObject |
( |
| ) |
|
|
pure virtual |
◆ GetBlockSize()
unsigned int CBaseTexture::GetBlockSize |
( |
| ) |
const |
|
protected |
◆ GetCacheMemory()
bool CBaseTexture::GetCacheMemory |
( |
| ) |
const |
|
inline |
◆ GetHeight()
unsigned int CBaseTexture::GetHeight |
( |
| ) |
const |
|
inline |
◆ GetOrientation()
int CBaseTexture::GetOrientation |
( |
| ) |
const |
|
inline |
◆ GetOriginalHeight()
unsigned int CBaseTexture::GetOriginalHeight |
( |
| ) |
const |
|
inline |
return the original height of the image, before scaling/cropping
◆ GetOriginalWidth()
unsigned int CBaseTexture::GetOriginalWidth |
( |
| ) |
const |
|
inline |
return the original width of the image, before scaling/cropping
◆ GetPitch() [1/2]
unsigned int CBaseTexture::GetPitch |
( |
| ) |
const |
|
inline |
◆ GetPitch() [2/2]
unsigned int CBaseTexture::GetPitch |
( |
unsigned int |
width | ) |
const |
|
protected |
◆ GetPixels()
unsigned char * CBaseTexture::GetPixels |
( |
| ) |
const |
|
inline |
◆ GetRows() [1/2]
unsigned int CBaseTexture::GetRows |
( |
| ) |
const |
|
inline |
◆ GetRows() [2/2]
unsigned int CBaseTexture::GetRows |
( |
unsigned int |
height | ) |
const |
|
protected |
◆ GetScalingMethod()
◆ GetTextureHeight()
unsigned int CBaseTexture::GetTextureHeight |
( |
| ) |
const |
|
inline |
◆ GetTextureWidth()
unsigned int CBaseTexture::GetTextureWidth |
( |
| ) |
const |
|
inline |
◆ GetWidth()
unsigned int CBaseTexture::GetWidth |
( |
| ) |
const |
|
inline |
◆ HasAlpha()
bool CBaseTexture::HasAlpha |
( |
| ) |
const |
◆ IsMipmapped()
bool CBaseTexture::IsMipmapped |
( |
| ) |
const |
◆ LoadFromFile()
CBaseTexture * CBaseTexture::LoadFromFile |
( |
const std::string & |
texturePath, |
|
|
unsigned int |
idealWidth = 0 , |
|
|
unsigned int |
idealHeight = 0 , |
|
|
bool |
requirePixels = false , |
|
|
const std::string & |
strMimeType = "" |
|
) |
| |
|
static |
Load a texture from a file Loads a texture from a file, restricting in size if needed based on maxHeight and maxWidth. Note that these are the ideal size to load at - the returned texture may be smaller or larger than these.
- Parameters
-
texturePath | the path of the texture to load. |
idealWidth | the ideal width of the texture (defaults to 0, no ideal width). |
idealHeight | the ideal height of the texture (defaults to 0, no ideal height). |
strMimeType | mimetype of the given texture if available (defaults to empty) |
- Returns
- a CBaseTexture pointer to the created texture - NULL if the texture failed to load.
◆ LoadFromFileInMem()
bool CBaseTexture::LoadFromFileInMem |
( |
unsigned char * |
buffer, |
|
|
size_t |
size, |
|
|
const std::string & |
mimeType, |
|
|
unsigned int |
maxWidth, |
|
|
unsigned int |
maxHeight |
|
) |
| |
|
protected |
◆ LoadFromFileInMemory()
CBaseTexture * CBaseTexture::LoadFromFileInMemory |
( |
unsigned char * |
buffer, |
|
|
size_t |
bufferSize, |
|
|
const std::string & |
mimeType, |
|
|
unsigned int |
idealWidth = 0 , |
|
|
unsigned int |
idealHeight = 0 |
|
) |
| |
|
static |
Load a texture from a file in memory Loads a texture from a file in memory, restricting in size if needed based on maxHeight and maxWidth. Note that these are the ideal size to load at - the returned texture may be smaller or larger than these.
- Parameters
-
buffer | the memory buffer holding the file. |
bufferSize | the size of buffer. |
mimeType | the mime type of the file in buffer. |
idealWidth | the ideal width of the texture (defaults to 0, no ideal width). |
idealHeight | the ideal height of the texture (defaults to 0, no ideal height). |
- Returns
- a CBaseTexture pointer to the created texture - NULL if the texture failed to load.
◆ LoadFromFileInternal()
bool CBaseTexture::LoadFromFileInternal |
( |
const std::string & |
texturePath, |
|
|
unsigned int |
maxWidth, |
|
|
unsigned int |
maxHeight, |
|
|
bool |
requirePixels, |
|
|
const std::string & |
strMimeType = "" |
|
) |
| |
|
protected |
◆ LoadFromMemory()
bool CBaseTexture::LoadFromMemory |
( |
unsigned int |
width, |
|
|
unsigned int |
height, |
|
|
unsigned int |
pitch, |
|
|
unsigned int |
format, |
|
|
bool |
hasAlpha, |
|
|
const unsigned char * |
pixels |
|
) |
| |
◆ LoadIImage()
bool CBaseTexture::LoadIImage |
( |
IImage * |
pImage, |
|
|
unsigned char * |
buffer, |
|
|
unsigned int |
bufSize, |
|
|
unsigned int |
width, |
|
|
unsigned int |
height |
|
) |
| |
|
protected |
◆ LoadPaletted()
bool CBaseTexture::LoadPaletted |
( |
unsigned int |
width, |
|
|
unsigned int |
height, |
|
|
unsigned int |
pitch, |
|
|
unsigned int |
format, |
|
|
const unsigned char * |
pixels, |
|
|
const COLOR * |
palette |
|
) |
| |
◆ LoadToGPU()
virtual void CBaseTexture::LoadToGPU |
( |
| ) |
|
|
pure virtual |
◆ PadPow2()
unsigned int CBaseTexture::PadPow2 |
( |
unsigned int |
x | ) |
|
|
static |
◆ SetCacheMemory()
void CBaseTexture::SetCacheMemory |
( |
bool |
bCacheMemory | ) |
|
|
inline |
◆ SetMipmapping()
void CBaseTexture::SetMipmapping |
( |
| ) |
|
◆ SetOrientation()
void CBaseTexture::SetOrientation |
( |
int |
orientation | ) |
|
|
inline |
◆ SetScalingMethod()
◆ SwapBlueRed()
bool CBaseTexture::SwapBlueRed |
( |
unsigned char * |
pixels, |
|
|
unsigned int |
height, |
|
|
unsigned int |
pitch, |
|
|
unsigned int |
elements = 4 , |
|
|
unsigned int |
offset = 0 |
|
) |
| |
|
static |
◆ Update()
void CBaseTexture::Update |
( |
unsigned int |
width, |
|
|
unsigned int |
height, |
|
|
unsigned int |
pitch, |
|
|
unsigned int |
format, |
|
|
const unsigned char * |
pixels, |
|
|
bool |
loadToGPU |
|
) |
| |
◆ m_bCacheMemory
bool CBaseTexture::m_bCacheMemory = false |
|
protected |
◆ m_format
unsigned int CBaseTexture::m_format |
|
protected |
◆ m_hasAlpha
bool CBaseTexture::m_hasAlpha = true |
|
protected |
◆ m_imageHeight
unsigned int CBaseTexture::m_imageHeight |
|
protected |
◆ m_imageWidth
unsigned int CBaseTexture::m_imageWidth |
|
protected |
◆ m_loadedToGPU
bool CBaseTexture::m_loadedToGPU |
|
protected |
◆ m_mipmapping
bool CBaseTexture::m_mipmapping = false |
|
protected |
◆ m_orientation
int CBaseTexture::m_orientation |
|
protected |
◆ m_originalHeight
unsigned int CBaseTexture::m_originalHeight |
|
protected |
original image height before scaling or cropping
◆ m_originalWidth
unsigned int CBaseTexture::m_originalWidth |
|
protected |
original image width before scaling or cropping
◆ m_pixels
unsigned char* CBaseTexture::m_pixels |
|
protected |
◆ m_scalingMethod
◆ m_textureHeight
unsigned int CBaseTexture::m_textureHeight |
|
protected |
◆ m_textureWidth
unsigned int CBaseTexture::m_textureWidth |
|
protected |
The documentation for this class was generated from the following files: