VoxelEngine
 
Loading...
Searching...
No Matches
BlockMaterial.h
1#pragma once
2
3#include <array>
4
5#include "../Globals.h"
6#include "Face.h"
7#include "Side.h"
8
9namespace engine {
10
12 std::array<TexID, static_cast<size_t>(FaceTag::Count)> m_textures{};
13 // std::unordered_map<std::string, TexID> textures;
14
15 TexID forTag(FaceTag tag) const { return m_textures[static_cast<size_t>(tag)]; }
16
17 BlockMaterial& add(FaceTag tag, TexID texture) {
18 if (tag == FaceTag::All) {
19 for (int i = 0; i < static_cast<size_t>(FaceTag::Count); i++)
20 m_textures[i] = texture;
21 return *this;
22 }
23
24 if (tag == FaceTag::Side) {
25 for (auto face : IterateXZFaces)
26 m_textures[static_cast<size_t>(face)] = texture;
27 }
28
29 m_textures[static_cast<size_t>(tag)] = texture;
30
31 return *this;
32 }
33 };
34} // namespace engine
Definition BlockMaterial.h:11