3 Copyright (C) 2020 Hugues Ross <hugues.ross@gmail.com>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 2.1 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 #include "irrlichttypes.h"
26 typedef u16 override_t;
28 //! Bitmask enum specifying what a texture override should apply to
29 enum class OverrideTarget : override_t
48 SIDES = LEFT | RIGHT | FRONT | BACK,
49 ALL_FACES = TOP | BOTTOM | SIDES,
50 ALL_SPECIAL = SPECIAL_1 | SPECIAL_2 | SPECIAL_3 | SPECIAL_4 | SPECIAL_5 | SPECIAL_6,
51 NODE_TARGETS = ALL_FACES | ALL_SPECIAL,
52 ITEM_TARGETS = INVENTORY | WIELD,
56 struct TextureOverride
60 override_t target = 0;
63 // Helper function for checking if an OverrideTarget is found in
64 // a TextureOverride without casting
65 inline bool hasTarget(OverrideTarget overrideTarget) const
67 return (target & static_cast<override_t>(overrideTarget)) != 0;
71 //! Class that provides texture override information from a texture pack
72 class TextureOverrideSource
75 TextureOverrideSource(std::string filepath);
77 //! Get all overrides that apply to item definitions
78 std::vector<TextureOverride> getItemTextureOverrides();
80 //! Get all overrides that apply to node definitions
81 std::vector<TextureOverride> getNodeTileOverrides();
84 std::vector<TextureOverride> m_overrides;