Fix alpha for liquid nodes (#5494)
[oweals/minetest.git] / src / nodedef.h
index da3345d8023ebc2307ac3c1391eae545f2d1e281..07a962ed0f2a883bc9659781ddf66431a32b3f17 100644 (file)
@@ -218,14 +218,14 @@ struct TileDef
 
        struct TileAnimationParams animation;
 
-       TileDef()
+       TileDef() :
+               name(""),
+               backface_culling(true),
+               tileable_horizontal(true),
+               tileable_vertical(true),
+               has_color(false),
+               color(video::SColor(0xFFFFFFFF))
        {
-               name = "";
-               backface_culling = true;
-               tileable_horizontal = true;
-               tileable_vertical = true;
-               has_color = false;
-               color = video::SColor(0xFFFFFFFF);
                animation.type = TAT_NONE;
        }
 
@@ -280,6 +280,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.
@@ -380,13 +382,13 @@ struct ContentFeatures
        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 +407,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,