]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/nodedef.h
Overlays for wield and inventory images (#6107)
[dragonfireclient.git] / src / nodedef.h
index da3345d8023ebc2307ac3c1391eae545f2d1e281..22ed2f1277b84dedba36d49931a4718ecb74e779 100644 (file)
@@ -17,19 +17,17 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
 
-#ifndef NODEDEF_HEADER
-#define NODEDEF_HEADER
+#pragma once
 
 #include "irrlichttypes_bloated.h"
 #include <string>
 #include <iostream>
 #include <map>
 #include <list>
-#include "util/numeric.h"
 #include "mapnode.h"
 #ifndef SERVER
 #include "client/tile.h"
-#include "shader.h"
+#include <IMeshManipulator.h>
 class Client;
 #endif
 #include "itemgroup.h"
@@ -139,7 +137,7 @@ class TextureSettings {
        bool enable_mesh_cache;
        bool enable_minimap;
 
-       TextureSettings() {}
+       TextureSettings() = default;
 
        void readSettings();
 };
@@ -186,6 +184,8 @@ enum NodeDrawType
        NDT_GLASSLIKE_FRAMED_OPTIONAL,
        // Uses static meshes
        NDT_MESH,
+       // Combined plantlike-on-solid
+       NDT_PLANTLIKE_ROOTED,
 };
 
 // Mesh options for NDT_PLANTLIKE with CPT2_MESHOPTIONS
@@ -207,25 +207,19 @@ enum PlantlikeStyle {
 
 struct TileDef
 {
-       std::string name;
-       bool backface_culling; // Takes effect only in special cases
-       bool tileable_horizontal;
-       bool tileable_vertical;
+       std::string name = "";
+       bool backface_culling = true; // Takes effect only in special cases
+       bool tileable_horizontal = true;
+       bool tileable_vertical = true;
        //! If true, the tile has its own color.
-       bool has_color;
+       bool has_color = false;
        //! The color of the tile.
-       video::SColor color;
+       video::SColor color = video::SColor(0xFFFFFFFF);
 
        struct TileAnimationParams animation;
 
        TileDef()
        {
-               name = "";
-               backface_culling = true;
-               tileable_horizontal = true;
-               tileable_vertical = true;
-               has_color = false;
-               color = video::SColor(0xFFFFFFFF);
                animation.type = TAT_NONE;
        }
 
@@ -280,6 +274,8 @@ struct ContentFeatures
 #endif
        float visual_scale; // Misc. scale parameter
        TileDef tiledef[6];
+       // These will be drawn over the base tiles.
+       TileDef tiledef_overlay[6];
        TileDef tiledef_special[CF_SPECIAL_COUNT]; // eg. flowing liquid
        // If 255, the node is opaque.
        // Otherwise it uses texture alpha.
@@ -373,20 +369,20 @@ struct ContentFeatures
        */
 
        ContentFeatures();
-       ~ContentFeatures();
+       ~ContentFeatures() = default;
        void reset();
        void serialize(std::ostream &os, u16 protocol_version) const;
        void deSerialize(std::istream &is);
        void serializeOld(std::ostream &os, u16 protocol_version) const;
        void deSerializeOld(std::istream &is, int version);
        /*!
-        * Since vertex alpha is no lnger supported, this method
-        * adds instructions to the texture names to blend alpha there.
+        * Since vertex alpha is no longer supported, this method
+        * adds opacity directly to the texture pixels.
         *
-        * tiledef, tiledef_special and alpha must be initialized
-        * before calling this.
+        * \param tiles array of the tile definitions.
+        * \param length length of tiles
         */
-       void correctAlpha();
+       void correctAlpha(TileDef *tiles, int length);
 
        /*
                Some handy methods
@@ -405,7 +401,7 @@ struct ContentFeatures
        }
 
 #ifndef SERVER
-       void fillTileAttribs(ITextureSource *tsrc, TileSpec *tile, TileDef *tiledef,
+       void fillTileAttribs(ITextureSource *tsrc, TileLayer *tile, TileDef *tiledef,
                u32 shader_id, bool use_normal_texture, bool backface_culling,
                u8 material_type);
        void updateTextures(ITextureSource *tsrc, IShaderSource *shdsrc,
@@ -415,8 +411,9 @@ struct ContentFeatures
 
 class INodeDefManager {
 public:
-       INodeDefManager(){}
-       virtual ~INodeDefManager(){}
+       INodeDefManager() = default;
+       virtual ~INodeDefManager() = default;
+
        // Get node definition
        virtual const ContentFeatures &get(content_t c) const=0;
        virtual const ContentFeatures &get(const MapNode &n) const=0;
@@ -430,8 +427,6 @@ class INodeDefManager {
 
        virtual void serialize(std::ostream &os, u16 protocol_version) const=0;
 
-       virtual bool getNodeRegistrationStatus() const=0;
-
        virtual void pendNodeResolve(NodeResolver *nr)=0;
        virtual bool cancelNodeResolveCallback(NodeResolver *nr)=0;
        virtual bool nodeboxConnects(const MapNode from, const MapNode to, u8 connect_face)=0;
@@ -444,9 +439,9 @@ class INodeDefManager {
 
 class IWritableNodeDefManager : public INodeDefManager {
 public:
-       IWritableNodeDefManager(){}
-       virtual ~IWritableNodeDefManager(){}
-       virtual IWritableNodeDefManager* clone()=0;
+       IWritableNodeDefManager() = default;
+       virtual ~IWritableNodeDefManager() = default;
+
        // Get node definition
        virtual const ContentFeatures &get(content_t c) const=0;
        virtual const ContentFeatures &get(const MapNode &n) const=0;
@@ -489,7 +484,6 @@ class IWritableNodeDefManager : public INodeDefManager {
        virtual void serialize(std::ostream &os, u16 protocol_version) const=0;
        virtual void deSerialize(std::istream &is)=0;
 
-       virtual bool getNodeRegistrationStatus() const=0;
        virtual void setNodeRegistrationStatus(bool completed)=0;
 
        virtual void pendNodeResolve(NodeResolver *nr)=0;
@@ -515,12 +509,10 @@ class NodeResolver {
 
        void nodeResolveInternal();
 
-       u32 m_nodenames_idx;
-       u32 m_nnlistsizes_idx;
+       u32 m_nodenames_idx = 0;
+       u32 m_nnlistsizes_idx = 0;
        std::vector<std::string> m_nodenames;
        std::vector<size_t> m_nnlistsizes;
-       INodeDefManager *m_ndef;
-       bool m_resolve_done;
+       INodeDefManager *m_ndef = nullptr;
+       bool m_resolve_done = false;
 };
-
-#endif