From 8b275c0b0a1064a813ef14a109b64e1fce461893 Mon Sep 17 00:00:00 2001 From: LaG1924 <12997935+LaG1924@users.noreply.github.com> Date: Mon, 7 Aug 2017 20:08:15 +0500 Subject: 2017-08-07 --- src/AssetManager.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/AssetManager.cpp') diff --git a/src/AssetManager.cpp b/src/AssetManager.cpp index 351a118..28c08fa 100644 --- a/src/AssetManager.cpp +++ b/src/AssetManager.cpp @@ -37,6 +37,7 @@ void AssetManager::LoadTextureResources() { std::string filename = index["meta"]["image"].get(); float textureWidth = index["meta"]["size"]["w"].get(); float textureHeight = index["meta"]["size"]["h"].get(); + size_t sizeName = 0,sizeTexture = 0; for (auto &it:index["frames"]) { auto frame = it["frame"]; TextureCoordinates coord; @@ -47,9 +48,11 @@ void AssetManager::LoadTextureResources() { std::string assetName = it["filename"].get(); assetName.insert(0, "minecraft/textures/"); assetName.erase(assetName.length() - 4); + assetName.shrink_to_fit(); + sizeName += sizeof(assetName) + assetName.capacity(); + sizeTexture += sizeof(coord); assetTextures[assetName] = coord; } - textureAtlas = new Texture(filename); LOG(INFO) << "Texture atlas id is " << textureAtlas->texture; } @@ -141,7 +144,7 @@ std::string AssetManager::GetTextureAssetNameByBlockId(BlockTextureId block) { } GLuint AssetManager::GetTextureAtlas() { - return textureAtlas->texture; + return textureAtlas->texture; } TextureCoordinates AssetManager::GetTextureByBlock(BlockTextureId block) { -- cgit v1.2.3