Class for a texture atlas.
#include <graphics/YiTextureAtlas.h>
Public Member Functions | |
CYITextureAtlas () | |
virtual | ~CYITextureAtlas () |
bool | CreateNewAtlas (uint32_t unWidth, uint32_t unHeight, size_t pages) |
YI_REGION | GetRegion (int32_t width, int32_t height) |
virtual void | SetRegion (ssize_t id, void *pReference, YI_REGION region, const uint8_t *pData, const int32_t stride) |
virtual YI_TEXTURE_DETAILS * | GetTexture (ssize_t ID, void *pReference) |
void | UpdateAtlas () |
const std::shared_ptr< CYIBitmap > | GetBitmap () const |
const std::vector< glm::ivec4 > * | GetNodes (size_t page) const |
virtual std::shared_ptr< CYIAssetTexture > | GetGLTexture () const |
const std::shared_ptr< CYIAssetTexture > | GetTextureAsset () |
YI_LOADED_TEXTURES * | GetLoadedTextures () |
void | SetTextureFilter (CYIAssetTexture::Filtering minificationFilter, CYIAssetTexture::Filtering magnificationFilter) |
void | SetTextureWrap (CYIAssetTexture::WrapMode wrapS, CYIAssetTexture::WrapMode wrapT) |
void | SetName (const CYIString &name) |
const CYIString & | GetName () const |
float | GetAtlasPercentageUsed () const |
bool | RenderAtlasToPng (const CYIString &filePath) const |
void | Reset () |
Protected Member Functions | |
int32_t | Fit (size_t page, size_t unIndex, int32_t width, int32_t height) |
void | Merge (size_t page) |
Protected Attributes | |
CYIString | m_name |
std::shared_ptr< CYIBitmap > | m_Image |
std::vector< glm::ivec4 > | m_Nodes [4] |
std::shared_ptr< CYIAssetTexture > | m_pTextureAsset |
YI_LOADED_TEXTURES | m_Textures |
int32_t | m_width |
int32_t | m_height |
size_t | m_pages |
CYIAssetTexture::TextureConfig | m_textureConfiguration |
size_t | m_unPixelsUsed |
size_t | m_unLastUpdatedSize |
CYITextureAtlas::CYITextureAtlas | ( | ) |
|
virtual |
bool CYITextureAtlas::CreateNewAtlas | ( | uint32_t | unWidth, |
uint32_t | unHeight, | ||
size_t | pages | ||
) |
|
protected |
float CYITextureAtlas::GetAtlasPercentageUsed | ( | ) | const |
Returns the atlas usage as a percentage. The calculation is total pixels / used pixels. Note that this is the exact pixel usage of the atlas. If the packing method used isn't 100% efficient then the atlas will never reach 100% usage. This function returns a value in the range from 0.0 to 1.0.
const std::shared_ptr<CYIBitmap> CYITextureAtlas::GetBitmap | ( | ) | const |
|
virtual |
YI_LOADED_TEXTURES* CYITextureAtlas::GetLoadedTextures | ( | ) |
const CYIString& CYITextureAtlas::GetName | ( | ) | const |
const std::vector<glm::ivec4>* CYITextureAtlas::GetNodes | ( | size_t | page | ) | const |
YI_REGION CYITextureAtlas::GetRegion | ( | int32_t | width, |
int32_t | height | ||
) |
|
virtual |
Reimplemented in CYIAbstractTextAtlas.
|
inline |
|
protected |
bool CYITextureAtlas::RenderAtlasToPng | ( | const CYIString & | filePath | ) | const |
Renders the current contents of the texture atlas to the given file path. Returns true if the image was successfully written.
decoder-png
optional module. void CYITextureAtlas::Reset | ( | ) |
Resets all regions in the atlas and clears the contents of the underlying texture.
void CYITextureAtlas::SetName | ( | const CYIString & | name | ) |
|
virtual |
Reimplemented in CYIAbstractTextAtlas.
void CYITextureAtlas::SetTextureFilter | ( | CYIAssetTexture::Filtering | minificationFilter, |
CYIAssetTexture::Filtering | magnificationFilter | ||
) |
void CYITextureAtlas::SetTextureWrap | ( | CYIAssetTexture::WrapMode | wrapS, |
CYIAssetTexture::WrapMode | wrapT | ||
) |
void CYITextureAtlas::UpdateAtlas | ( | ) |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |