summaryrefslogtreecommitdiffstats
path: root/src/AssetManager.hpp
diff options
context:
space:
mode:
authorLaG1924 <12997935+LaG1924@users.noreply.github.com>2018-08-05 02:15:12 +0200
committerLaG1924 <12997935+LaG1924@users.noreply.github.com>2018-08-05 02:15:12 +0200
commitcc3096b4f4649915cf89a5bc4f6b943d667369f5 (patch)
tree4de6e88338b65f3c66c2fdea29a067ec042012d2 /src/AssetManager.hpp
parentReplaced usage of old texture atlas (diff)
downloadAltCraft-cc3096b4f4649915cf89a5bc4f6b943d667369f5.tar
AltCraft-cc3096b4f4649915cf89a5bc4f6b943d667369f5.tar.gz
AltCraft-cc3096b4f4649915cf89a5bc4f6b943d667369f5.tar.bz2
AltCraft-cc3096b4f4649915cf89a5bc4f6b943d667369f5.tar.lz
AltCraft-cc3096b4f4649915cf89a5bc4f6b943d667369f5.tar.xz
AltCraft-cc3096b4f4649915cf89a5bc4f6b943d667369f5.tar.zst
AltCraft-cc3096b4f4649915cf89a5bc4f6b943d667369f5.zip
Diffstat (limited to '')
-rw-r--r--src/AssetManager.hpp64
1 files changed, 1 insertions, 63 deletions
diff --git a/src/AssetManager.hpp b/src/AssetManager.hpp
index 0663f48..3975b37 100644
--- a/src/AssetManager.hpp
+++ b/src/AssetManager.hpp
@@ -13,53 +13,6 @@
#include "Block.hpp"
#include "TextureAtlas.hpp"
-class Texture;
-
-struct TextureCoordinates {
- TextureCoordinates(float x = -1, float y = -1, float w = -1, float h = -1)
- : x(x), y(y), w(w), h(h) {}
-
- bool operator==(const TextureCoordinates &rhs) const {
- return x == rhs.x &&
- y == rhs.y &&
- w == rhs.w &&
- h == rhs.h;
- }
-
- explicit operator bool() const {
- return !(*this == TextureCoordinates(-1, -1, -1, -1));
- }
-
- double x, y, w, h;
-
- operator glm::vec4() const {
- return glm::vec4(x, y, w, h);
- }
-};
-
-struct BlockTextureId {
- //Block sides: 0 - bottom, 1 - top, 2 - north, 3 - south, 4 - west, 5 - east 6 - every side
- BlockTextureId(int id = 0, int state = 0, int side = 6)
- : id(id), state(state), side(side) {}
-
- int id : 9;
- int state : 4;
- int side : 3;
-
-
- bool operator<(const BlockTextureId &rhs) const {
- if (id < rhs.id)
- return true;
- if (rhs.id < id)
- return false;
- if (state < rhs.state)
- return true;
- if (rhs.state < state)
- return false;
- return side < rhs.side;
- }
-};
-
struct BlockModel {
bool IsBlock = false;
std::string BlockName;
@@ -167,10 +120,7 @@ struct AssetTexture : Asset {
};
class AssetManager {
- Texture *textureAtlas;
std::map<std::string, BlockId> assetIds;
- std::map<std::string, TextureCoordinates> assetTextures;
- std::map<BlockTextureId,glm::vec4> textureAtlasIndexes;
std::map<BlockId, std::string> blockIdToBlockName;
std::unique_ptr<AssetTreeNode> assetTree;
std::unique_ptr<TextureAtlas> atlas;
@@ -178,21 +128,9 @@ public:
AssetManager();
~AssetManager();
-
- void LoadTextureResources();
-
- TextureCoordinates GetTextureByAssetName(const std::string &AssetName);
-
- std::string GetTextureAssetNameByBlockId(BlockTextureId block);
-
- GLuint GetTextureAtlas();
-
- const std::map<BlockTextureId,glm::vec4> &GetTextureAtlasIndexes();
-
+
void LoadIds();
- TextureCoordinates GetTextureByBlock(BlockTextureId block);
-
static AssetManager& Instance();
const BlockModel *GetBlockModelByBlockId(BlockId block);