X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Fcontent_mapblock.h;h=7b90ce4b9081cb4c28502058e8444b5863ce6763;hb=3face01a202040e4feff3b0936b4aa89c051c98d;hp=51c5fc6ea70cb1bf3009a2eb82731700e6233b87;hpb=ef285b2815962a7a01791059ed984cb12fdba4dd;p=oweals%2Fminetest.git diff --git a/src/content_mapblock.h b/src/content_mapblock.h index 51c5fc6ea..7b90ce4b9 100644 --- a/src/content_mapblock.h +++ b/src/content_mapblock.h @@ -17,17 +17,28 @@ with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef CONTENT_MAPBLOCK_HEADER -#define CONTENT_MAPBLOCK_HEADER -#include "util/numeric.h" +#pragma once + #include "nodedef.h" #include struct MeshMakeData; struct MeshCollector; -struct LightFrame -{ +struct LightPair { + u8 lightA; + u8 lightB; + + LightPair() = default; + explicit LightPair(u16 value) : lightA(value & 0xff), lightB(value >> 8) {} + LightPair(u8 valueA, u8 valueB) : lightA(valueA), lightB(valueB) {} + LightPair(float valueA, float valueB) : + lightA(core::clamp(core::round32(valueA), 0, 255)), + lightB(core::clamp(core::round32(valueB), 0, 255)) {} + operator u16() const { return lightA | lightB << 8; } +}; + +struct LightFrame { f32 lightsA[8]; f32 lightsB[8]; }; @@ -38,7 +49,7 @@ public: MeshMakeData *data; MeshCollector *collector; - INodeDefManager *nodedef; + const NodeDefManager *nodedef; scene::IMeshManipulator *meshmanip; // options @@ -50,7 +61,7 @@ public: v3f origin; MapNode n; const ContentFeatures *f; - u16 light; + LightPair light; LightFrame frame; video::SColor color; TileSpec tile; @@ -58,12 +69,13 @@ public: // lighting void getSmoothLightFrame(); - u16 blendLight(const v3f &vertex_pos); + LightPair blendLight(const v3f &vertex_pos); video::SColor blendLightColor(const v3f &vertex_pos); video::SColor blendLightColor(const v3f &vertex_pos, const v3f &vertex_normal); void useTile(int index = 0, u8 set_flags = MATERIAL_FLAG_CRACK_OVERLAY, u8 reset_flags = 0, bool special = false); + void getTile(int index, TileSpec *tile); void getTile(v3s16 direction, TileSpec *tile); void getSpecialTile(int index, TileSpec *tile, bool apply_crack = false); @@ -73,13 +85,14 @@ public: // cuboid drawing! void drawCuboid(const aabb3f &box, TileSpec *tiles, int tilecount, - const u16 *lights , const f32 *txc); + const LightPair *lights , const f32 *txc); void generateCuboidTextureCoords(aabb3f const &box, f32 *coords); void drawAutoLightedCuboid(aabb3f box, const f32 *txc = NULL, TileSpec *tiles = NULL, int tile_count = 0); // liquid-specific bool top_is_same_liquid; + bool draw_liquid_bottom; TileSpec tile_liquid; TileSpec tile_liquid_top; content_t c_flowing; @@ -100,6 +113,7 @@ public: f32 getCornerLevel(int i, int k); void drawLiquidSides(); void drawLiquidTop(); + void drawLiquidBottom(); // raillike-specific // name of the group that enables connecting to raillike nodes of different kind @@ -145,6 +159,5 @@ public: public: MapblockMeshGenerator(MeshMakeData *input, MeshCollector *output); void generate(); + void renderSingle(content_t node); }; - -#endif