You.i Engine
CYISDFTextAtlas Class Reference

Detailed Description

Class for a signed distance field text atlas.

This type of atlas is used with CYISDFAtlasTextSceneNode.

No instance of CYISDFTextAtlas will exist unless a CYISDFAtlasTextSceneNode is created and tries to use an SDF atlas. This will result in creating an SDF atlas with the default parameters. If the app wants to specify their own SDF parameters, they can create an SDF atlas and add it to CYITextEngine. CYISDFAtlasTextSceneNode will not create a new SDF atlas if one already exists.

#include <graphics/YiSDFTextAtlas.h>

Inheritance diagram for CYISDFTextAtlas:

Public Member Functions

 CYISDFTextAtlas (int32_t sDFFontSize=64, int32_t sDFRadius=4)
 
virtual ~CYISDFTextAtlas ()
 
virtual bool CreateNewFontAtlas (uint32_t width, uint32_t height) override
 
virtual void SetRegion (ssize_t id, void *pReference, YI_REGION region, GlyphData glyphData) override
 
int32_t GetSDFFontSize () const
 
int32_t GetSDFRadius () const
 
- Public Member Functions inherited from CYIAbstractTextAtlas
 CYIAbstractTextAtlas ()
 
virtual ~CYIAbstractTextAtlas ()
 
virtual void SetRegion (ssize_t id, void *pReference, YI_REGION region, const uint8_t *pData, const int32_t stride) override final
 
virtual YI_TEXTURE_DETAILSGetTexture (ssize_t id, void *pReference) override
 
int32_t GetGlyphPadding () const
 
bool AddGlyph (const uint32_t glyphWidth, const uint32_t glyphHeight, YI_GLYPH_DETAILS *pGlyphDetails, GlyphData glyphData)
 
- Public Member Functions inherited from CYITextureAtlas
 CYITextureAtlas ()
 
virtual ~CYITextureAtlas ()
 
bool CreateNewAtlas (uint32_t unWidth, uint32_t unHeight, size_t pages)
 
YI_REGION GetRegion (int32_t width, int32_t height)
 
void UpdateAtlas ()
 
const std::shared_ptr< CYIBitmapGetBitmap () const
 
const std::vector< glm::ivec4 > * GetNodes (size_t page) const
 
virtual std::shared_ptr< CYIAssetTextureGetGLTexture () const
 
const std::shared_ptr< CYIAssetTextureGetTextureAsset ()
 
YI_LOADED_TEXTURESGetLoadedTextures ()
 
void SetTextureFilter (CYIAssetTexture::Filtering minificationFilter, CYIAssetTexture::Filtering magnificationFilter)
 
void SetTextureWrap (CYIAssetTexture::WrapMode wrapS, CYIAssetTexture::WrapMode wrapT)
 
void SetName (const CYIString &name)
 
const CYIStringGetName () const
 
float GetAtlasPercentageUsed () const
 
bool RenderAtlasToPng (const CYIString &filePath) const
 
void Reset ()
 
- Public Member Functions inherited from CYISignalHandler
 CYISignalHandler ()
 
 CYISignalHandler (const CYISignalHandler &rSignalHandler)
 
virtual ~CYISignalHandler ()
 
CYISignalHandleroperator= (const CYISignalHandler &rSignalHandler)
 
void MoveToThread (CYIThread *pThread)
 This function allows the user to override the default thread affinity to any CYIThread that may or may not be running. More...
 
CYIThreadHandle GetThreadAffinity () const
 
void SetThreadAffinity (const CYIThreadHandle &rThreadAffinity)
 
virtual bool IsConnected () const
 
virtual bool IsConnected (const CYISignalBase &rSignal) const
 
void Disconnect (CYISignalBase &rSignal)
 
void DisconnectFromAllSignals ()
 
- Public Member Functions inherited from CYIThread::Listener
 Listener ()
 
virtual ~Listener ()
 
virtual void OnThreadStarted (CYIThread *)
 
virtual void OnThreadTerminated (CYIThread *)
 
virtual void OnThreadFinished (CYIThread *)
 

Protected Member Functions

virtual bool CompareGlyphDetails (YI_GLYPH_DETAILS *pLeft, YI_GLYPH_DETAILS *pRight) const override
 
- Protected Member Functions inherited from CYIAbstractTextAtlas
void SetGlyphPadding (int32_t glyphPadding)
 
- Protected Member Functions inherited from CYITextureAtlas
int32_t Fit (size_t page, size_t unIndex, int32_t width, int32_t height)
 
void Merge (size_t page)
 

Additional Inherited Members

- Protected Attributes inherited from CYITextureAtlas
CYIString m_name
 
std::shared_ptr< CYIBitmapm_Image
 
std::vector< glm::ivec4 > m_Nodes [4]
 
std::shared_ptr< CYIAssetTexturem_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
 

Constructor & Destructor Documentation

◆ CYISDFTextAtlas()

CYISDFTextAtlas::CYISDFTextAtlas ( int32_t  sDFFontSize = 64,
int32_t  sDFRadius = 4 
)

◆ ~CYISDFTextAtlas()

virtual CYISDFTextAtlas::~CYISDFTextAtlas ( )
virtual

Member Function Documentation

◆ CompareGlyphDetails()

virtual bool CYISDFTextAtlas::CompareGlyphDetails ( YI_GLYPH_DETAILS pLeft,
YI_GLYPH_DETAILS pRight 
) const
overrideprotectedvirtual

Overridden to compare font ID and glyph ID. Font size is not considered.

Reimplemented from CYIAbstractTextAtlas.

◆ CreateNewFontAtlas()

virtual bool CYISDFTextAtlas::CreateNewFontAtlas ( uint32_t  width,
uint32_t  height 
)
overridevirtual

Should be implemented to do any internal initialization of the text atlas such as creating the atlas buffer. The width and height of the buffer are given as parameters.

Implements CYIAbstractTextAtlas.

◆ GetSDFFontSize()

int32_t CYISDFTextAtlas::GetSDFFontSize ( ) const

Returns the font size used to render glyphs in the atlas.

◆ GetSDFRadius()

int32_t CYISDFTextAtlas::GetSDFRadius ( ) const

Returns the radius in pixels to render the SDF at.

◆ SetRegion()

virtual void CYISDFTextAtlas::SetRegion ( ssize_t  id,
void *  pReference,
YI_REGION  region,
GlyphData  glyphData 
)
overridevirtual

Renders an SDF into the given region using the given data as input to the algorithm.

Implements CYIAbstractTextAtlas.


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