diff options
author | Dániel Juhász <juhdanad@gmail.com> | 2017-03-10 18:25:58 +0100 |
---|---|---|
committer | Auke Kok <sofar@foo-projects.org> | 2017-04-08 18:39:15 -0700 |
commit | 58d83a7bb2f992194c3df304b1dcbb81f98f78c0 (patch) | |
tree | 4beedb69ac8b9b74352ef52c3a1d27004e77bc1d /src/itemdef.h | |
parent | d4e9dd4643607192f5adebeecda86f25074f02cd (diff) | |
download | minetest-58d83a7bb2f992194c3df304b1dcbb81f98f78c0.tar.gz minetest-58d83a7bb2f992194c3df304b1dcbb81f98f78c0.tar.bz2 minetest-58d83a7bb2f992194c3df304b1dcbb81f98f78c0.zip |
Hardware coloring for itemstacks
Adds the possibility to colorize item stacks based on their metadata.
In the item/node definition you can specify palette (an image file)
and color (fallback color if the item has no palette or metadata).
Then you can add palette_index to the metadata.
Dropped itemstacks with different colors do not merge.
Diffstat (limited to 'src/itemdef.h')
-rw-r--r-- | src/itemdef.h | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/itemdef.h b/src/itemdef.h index 01ec4fa2f..2d7ff570d 100644 --- a/src/itemdef.h +++ b/src/itemdef.h @@ -30,6 +30,11 @@ with this program; if not, write to the Free Software Foundation, Inc., class IGameDef; class Client; struct ToolCapabilities; +#ifndef SERVER +#include "client/tile.h" +struct ItemMesh; +struct ItemStack; +#endif /* Base item definition @@ -57,6 +62,8 @@ struct ItemDefinition */ std::string inventory_image; // Optional for nodes, mandatory for tools/craftitems std::string wield_image; // If empty, inventory_image or mesh (only nodes) is used + std::string palette_image; // If specified, the item will be colorized based on this + video::SColor color; // The fallback color of the node. v3f wield_scale; /* @@ -110,8 +117,15 @@ public: virtual video::ITexture* getInventoryTexture(const std::string &name, Client *client) const=0; // Get item wield mesh - virtual scene::IMesh* getWieldMesh(const std::string &name, + virtual ItemMesh* getWieldMesh(const std::string &name, Client *client) const=0; + // Get item palette + virtual Palette* getPalette(const std::string &name, + Client *client) const = 0; + // Returns the base color of an item stack: the color of all + // tiles that do not define their own color. + virtual video::SColor getItemstackColor(const ItemStack &stack, + Client *client) const = 0; #endif virtual void serialize(std::ostream &os, u16 protocol_version)=0; @@ -136,7 +150,7 @@ public: virtual video::ITexture* getInventoryTexture(const std::string &name, Client *client) const=0; // Get item wield mesh - virtual scene::IMesh* getWieldMesh(const std::string &name, + virtual ItemMesh* getWieldMesh(const std::string &name, Client *client) const=0; #endif |