GETileAtlas

Maps block type IDs to UV rects (CnaEngine::Graphics::UvRect) in object-m.png via BlockTypes::tileUV().

Overview

Data-only: no texture pixels are loaded and nothing is drawn. It computes each tile's rect in the sheet kSheetW × kSheetH = 1301 × 1431 (object-m.png) with the game's own BlockTypes::tileUV() — kTileSize = 64, kSheetCols = 20, kSheetGap = 1 (65 px pitch: 64 px icon + 1 px inter-tile gap — confirmed against mobile-eggbert's Pixmap::GetSrcRectangle) — and returns it as a CnaEngine::Graphics::UvRect (fields u0, v0, u1, v1).

History: the class first wrapped an Easy3D::TextureAtlas grid registration; it moved to BlockTypes::tileUV() on 2026-07-09 (half-texel inset against seams). When easy-3d was replaced by cna-engine on 2026-10-20, only the rect type changed — Easy3D::UvRect (U0, V0, U1, V1) became CnaEngine::Graphics::UvRect; the UV computation is unchanged.

Sources: src/GalaxyEggbertCNA/Game/GETileAtlas.hpp and .cpp.

API

class GETileAtlas {
public:
    GETileAtlas() = default;
    CnaEngine::Graphics::UvRect GetTileUv(int blockType) const;
};

GetTileUv(blockType)

Returns an all-zero UvRect for blockType <= 0 (Air) or any type outside the sheet's grid; otherwise the rect from BlockTypes::tileUV() (in BlockTypes.hpp), which applies a half-texel inset to avoid seam bleeding.

Bug fixed 2026-07-04 The atlas grid registration originally assumed a flat 64 px pitch with no inter-tile gap; accounting for the sheet's real 65 px pitch (1 px gap) fixed visible seam artifacts.

Dependencies

BlockTypes, and cna-engine's CnaEngine::Graphics::UvRect (until 2026-10-20: Easy3D::UvRect).