1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-22 17:18:39 +00:00

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.
This commit is contained in:
Dániel Juhász 2017-03-10 18:25:58 +01:00 committed by Auke Kok
parent d4e9dd4643
commit 58d83a7bb2
23 changed files with 308 additions and 139 deletions

View file

@ -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