diff options
author | LaG1924 <12997935+LaG1924@users.noreply.github.com> | 2018-08-04 16:57:19 +0200 |
---|---|---|
committer | LaG1924 <12997935+LaG1924@users.noreply.github.com> | 2018-08-05 01:36:50 +0200 |
commit | d311a65e0c86aaec94f6d9a61d5f9b374f90aa5c (patch) | |
tree | baf9e5bfad75047e639eede1603216b2c8bf8b47 /src/AssetManager.cpp | |
parent | Loading texture data in AssetTree (diff) | |
download | AltCraft-d311a65e0c86aaec94f6d9a61d5f9b374f90aa5c.tar AltCraft-d311a65e0c86aaec94f6d9a61d5f9b374f90aa5c.tar.gz AltCraft-d311a65e0c86aaec94f6d9a61d5f9b374f90aa5c.tar.bz2 AltCraft-d311a65e0c86aaec94f6d9a61d5f9b374f90aa5c.tar.lz AltCraft-d311a65e0c86aaec94f6d9a61d5f9b374f90aa5c.tar.xz AltCraft-d311a65e0c86aaec94f6d9a61d5f9b374f90aa5c.tar.zst AltCraft-d311a65e0c86aaec94f6d9a61d5f9b374f90aa5c.zip |
Diffstat (limited to 'src/AssetManager.cpp')
-rw-r--r-- | src/AssetManager.cpp | 15 |
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) { |