| 84 | } |
| 85 | |
| 86 | void TileMapAtlas::calculateItemsToRender() |
| 87 | { |
| 88 | AXASSERT(_TGAInfo != nullptr, "tgaInfo must be non-nil"); |
| 89 | |
| 90 | _itemsToRender = 0; |
| 91 | for (int x = 0; x < _TGAInfo->width; x++) |
| 92 | { |
| 93 | for (int y = 0; y < _TGAInfo->height; y++) |
| 94 | { |
| 95 | Color3B* ptr = (Color3B*)_TGAInfo->imageData; |
| 96 | Color3B value = ptr[x + y * _TGAInfo->width]; |
| 97 | if (value.r) |
| 98 | { |
| 99 | ++_itemsToRender; |
| 100 | } |
| 101 | } |
| 102 | } |
| 103 | } |
| 104 | |
| 105 | void TileMapAtlas::loadTGAfile(std::string_view file) |
| 106 | { |