DDraceNetwork Docs
CAtlas Class Reference

Classes

struct  SSection
 
struct  SSectionKeyEquals
 
struct  SSectionKeyHash
 

Public Member Functions

void Clear (size_t TextureDimension)
 
void IncreaseDimension (size_t NewTextureDimension)
 
bool Add (size_t Width, size_t Height, int &PosX, int &PosY)
 

Private Member Functions

void AddSection (size_t X, size_t Y, size_t W, size_t H)
 
void UseSection (const SSection &Section, size_t Width, size_t Height, int &PosX, int &PosY)
 

Private Attributes

size_t m_TextureDimension
 
std::vector< SSectionm_vSections
 
std::unordered_map< std::tuple< size_t, size_t >, std::vector< SSection >, SSectionKeyHash, SSectionKeyEqualsm_SectionsMap
 

Static Private Attributes

static constexpr size_t MIN_SECTION_DIMENSION = 6
 
static constexpr size_t MAX_SECTION_DIMENSION_MAPPED = 8 * MIN_SECTION_DIMENSION
 

Member Function Documentation

◆ Add()

bool CAtlas::Add ( size_t  Width,
size_t  Height,
int &  PosX,
int &  PosY 
)
inline

◆ AddSection()

void CAtlas::AddSection ( size_t  X,
size_t  Y,
size_t  W,
size_t  H 
)
inlineprivate

◆ Clear()

void CAtlas::Clear ( size_t  TextureDimension)
inline

◆ IncreaseDimension()

void CAtlas::IncreaseDimension ( size_t  NewTextureDimension)
inline

◆ UseSection()

void CAtlas::UseSection ( const SSection Section,
size_t  Width,
size_t  Height,
int &  PosX,
int &  PosY 
)
inlineprivate

Member Data Documentation

◆ m_SectionsMap

std::unordered_map<std::tuple<size_t, size_t>, std::vector<SSection>, SSectionKeyHash, SSectionKeyEquals> CAtlas::m_SectionsMap
private

◆ m_TextureDimension

size_t CAtlas::m_TextureDimension
private

◆ m_vSections

std::vector<SSection> CAtlas::m_vSections
private

◆ MAX_SECTION_DIMENSION_MAPPED

constexpr size_t CAtlas::MAX_SECTION_DIMENSION_MAPPED = 8 * MIN_SECTION_DIMENSION
staticconstexprprivate

Sections with larger width or height will be stored in m_vSections. Sections with width and height equal or smaller will be stored in m_SectionsMap. This achieves a good balance between the size of the vector storing all large sections and the map storing vectors of all sections with specific small sizes. Lowering this value will result in the size of m_vSections becoming the bottleneck. Increasing this value will result in the map becoming the bottleneck.

◆ MIN_SECTION_DIMENSION

constexpr size_t CAtlas::MIN_SECTION_DIMENSION = 6
staticconstexprprivate

Sections with a smaller width or height will not be created when cutting larger sections, to prevent collecting many small, mostly unusable sections.


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