Luanti 5.11.0-dev
 
Loading...
Searching...
No Matches
texture_override.h
Go to the documentation of this file.
1// Luanti
2// SPDX-License-Identifier: LGPL-2.1-or-later
3// Copyright (C) 2020 Hugues Ross <hugues.ross@gmail.com>
4
5#pragma once
6
7#include "irrlichttypes.h"
8#include <string>
9#include <vector>
10
11typedef u16 override_t;
12
15{
16 INVALID = 0,
17 TOP = 1 << 0,
18 BOTTOM = 1 << 1,
19 LEFT = 1 << 2,
20 RIGHT = 1 << 3,
21 FRONT = 1 << 4,
22 BACK = 1 << 5,
23 INVENTORY = 1 << 6,
24 WIELD = 1 << 7,
25 SPECIAL_1 = 1 << 8,
26 SPECIAL_2 = 1 << 9,
27 SPECIAL_3 = 1 << 10,
28 SPECIAL_4 = 1 << 11,
29 SPECIAL_5 = 1 << 12,
30 SPECIAL_6 = 1 << 13,
31
32 SIDES = LEFT | RIGHT | FRONT | BACK,
37};
38
40{
41 std::string id;
42 std::string texture;
45
46 // Helper function for checking if an OverrideTarget is found in
47 // a TextureOverride without casting
48 inline bool hasTarget(OverrideTarget overrideTarget) const
49 {
50 return (target & static_cast<override_t>(overrideTarget)) != 0;
51 }
52};
53
56{
57public:
58 TextureOverrideSource(const std::string &filepath);
59
61 std::vector<TextureOverride> getItemTextureOverrides() const;
62
64 std::vector<TextureOverride> getNodeTileOverrides() const;
65
66private:
67 std::vector<TextureOverride> m_overrides;
68};
Class that provides texture override information from a texture pack.
Definition texture_override.h:56
std::vector< TextureOverride > getItemTextureOverrides() const
Get all overrides that apply to item definitions.
Definition texture_override.cpp:105
TextureOverrideSource(const std::string &filepath)
Definition texture_override.cpp:36
std::vector< TextureOverride > getNodeTileOverrides() const
Get all overrides that apply to node definitions.
Definition texture_override.cpp:118
std::vector< TextureOverride > m_overrides
Definition texture_override.h:67
Definition texture_override.h:40
u8 world_scale
Definition texture_override.h:44
bool hasTarget(OverrideTarget overrideTarget) const
Definition texture_override.h:48
std::string texture
Definition texture_override.h:42
std::string id
Definition texture_override.h:41
override_t target
Definition texture_override.h:43
OverrideTarget
Bitmask enum specifying what a texture override should apply to.
Definition texture_override.h:15
u16 override_t
Definition texture_override.h:11