From d93c2073896e63aca5a859fe7182ba24dbe84cd3 Mon Sep 17 00:00:00 2001 From: LaG1924 <12997935+LaG1924@users.noreply.github.com> Date: Sun, 28 May 2017 19:16:05 +0500 Subject: 2017-05-28 --- src/core/AssetManager.cpp | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) (limited to 'src/core/AssetManager.cpp') diff --git a/src/core/AssetManager.cpp b/src/core/AssetManager.cpp index 9913c18..003f2f0 100644 --- a/src/core/AssetManager.cpp +++ b/src/core/AssetManager.cpp @@ -1,5 +1,4 @@ -#include -#include + #include "AssetManager.hpp" namespace fs = std::experimental::filesystem; @@ -24,7 +23,7 @@ void AssetManager::LoadIds() { int id = it["type"].get(); int state = it["meta"].get(); std::string blockName = it["text_type"].get(); - assetIds[blockName] = Block(id, state, 0); + assetIds[blockName] = Block(id, 0, state); } LOG(INFO) << "Loaded " << assetIds.size() << " ids"; } @@ -43,14 +42,13 @@ void AssetManager::LoadTextureResources() { auto frame = it["frame"]; TextureCoord coord; coord.x = frame["x"].get(); - coord.y = frame["y"].get(); + coord.y = frame["y"].get();; coord.w = frame["w"].get(); coord.h = frame["h"].get(); std::string assetName = it["filename"].get(); - assetName.insert(0,"minecraft/textures/"); - assetName.erase(assetName.length()-4); - LOG(ERROR)< lookupTable = { + {Block(0), "minecraft/textures/blocks/air"}, + {Block(1, 0), "minecraft/textures/blocks/stone"}, + {Block(1, 1), "minecraft/textures/blocks/stone_granite"}, + + {Block(2, 0, 0), "minecraft/textures/blocks/dirt"}, + {Block(2, 0, 1), "minecraft/textures/blocks/grass_top"}, + {Block(2, 0, 2), "minecraft/textures/blocks/grass_side"}, + {Block(2, 0, 3), "minecraft/textures/blocks/grass_side"}, + {Block(2, 0, 4), "minecraft/textures/blocks/grass_side"}, + {Block(2, 0, 5), "minecraft/textures/blocks/grass_side"}, + {Block(3), "minecraft/textures/blocks/dirt"}, + {Block(4), "minecraft/textures/blocks/cobblestone"}, + }; + return lookupTable[Block(BlockId, BlockSide)]; } const GLuint AssetManager::GetTextureAtlas() { -- cgit v1.2.3