summaryrefslogtreecommitdiffstats
path: root/src/AssetManager.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/AssetManager.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/AssetManager.cpp b/src/AssetManager.cpp
index 25e9f24..9e360c0 100644
--- a/src/AssetManager.cpp
+++ b/src/AssetManager.cpp
@@ -603,7 +603,20 @@ AssetTreeNode * AssetManager::GetAssetByAssetName(const std::string & assetName)
}
void AssetManager::LoadTextures() {
-
+ std::vector<TextureData> textureData;
+ size_t id = 0;
+ RecursiveWalkAsset("/minecraft/textures/", [&](AssetTreeNode &node) {
+ TextureData data;
+ AssetTexture *textureAsset = dynamic_cast<AssetTexture*>(node.asset.get());
+ if (!textureAsset)
+ return;
+ data.data = std::move(textureAsset->textureData);
+ data.width = textureAsset->realWidth;
+ data.height = textureAsset->realHeight;
+ textureData.push_back(data);
+ textureAsset->id = id++;
+ });
+ atlas = std::make_unique<TextureAtlas>(textureData);
}
void AssetManager::ParseAssetTexture(AssetTreeNode &node) {