mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-12 16:15:20 +02: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:
@@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user