summaryrefslogtreecommitdiffstats
path: root/src/AssetManager.cpp
diff options
context:
space:
mode:
authorLaG1924 <12997935+LaG1924@users.noreply.github.com>2017-08-07 17:08:15 +0200
committerLaG1924 <12997935+LaG1924@users.noreply.github.com>2017-08-07 17:08:15 +0200
commit8b275c0b0a1064a813ef14a109b64e1fce461893 (patch)
tree7bb1cc13d2eb9be2a344b4cd35f5e581df970f0d /src/AssetManager.cpp
parent2017-08-05 (diff)
downloadAltCraft-8b275c0b0a1064a813ef14a109b64e1fce461893.tar
AltCraft-8b275c0b0a1064a813ef14a109b64e1fce461893.tar.gz
AltCraft-8b275c0b0a1064a813ef14a109b64e1fce461893.tar.bz2
AltCraft-8b275c0b0a1064a813ef14a109b64e1fce461893.tar.lz
AltCraft-8b275c0b0a1064a813ef14a109b64e1fce461893.tar.xz
AltCraft-8b275c0b0a1064a813ef14a109b64e1fce461893.tar.zst
AltCraft-8b275c0b0a1064a813ef14a109b64e1fce461893.zip
Diffstat (limited to 'src/AssetManager.cpp')
-rw-r--r--src/AssetManager.cpp7
1 files changed, 5 insertions, 2 deletions
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<std::string>();
float textureWidth = index["meta"]["size"]["w"].get<int>();
float textureHeight = index["meta"]["size"]["h"].get<int>();
+ 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<std::string>();
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) {