diff options
Diffstat (limited to 'src/client/content_mapblock.h')
-rw-r--r-- | src/client/content_mapblock.h | 61 |
1 files changed, 33 insertions, 28 deletions
diff --git a/src/client/content_mapblock.h b/src/client/content_mapblock.h index 97947cdbe..73ff11333 100644 --- a/src/client/content_mapblock.h +++ b/src/client/content_mapblock.h @@ -25,7 +25,8 @@ with this program; if not, write to the Free Software Foundation, Inc., struct MeshMakeData; struct MeshCollector; -struct LightPair { +struct LightPair +{ u8 lightDay; u8 lightNight; @@ -33,26 +34,29 @@ struct LightPair { explicit LightPair(u16 value) : lightDay(value & 0xff), lightNight(value >> 8) {} LightPair(u8 valueA, u8 valueB) : lightDay(valueA), lightNight(valueB) {} LightPair(float valueA, float valueB) : - lightDay(core::clamp(core::round32(valueA), 0, 255)), - lightNight(core::clamp(core::round32(valueB), 0, 255)) {} + lightDay(core::clamp(core::round32(valueA), 0, 255)), + lightNight(core::clamp(core::round32(valueB), 0, 255)) + { + } operator u16() const { return lightDay | lightNight << 8; } }; -struct LightInfo { +struct LightInfo +{ float light_day; float light_night; float light_boosted; LightPair getPair(float sunlight_boost = 0.0) const { - return LightPair( - (1 - sunlight_boost) * light_day - + sunlight_boost * light_boosted, - light_night); + return LightPair((1 - sunlight_boost) * light_day + + sunlight_boost * light_boosted, + light_night); } }; -struct LightFrame { +struct LightFrame +{ f32 lightsDay[8]; f32 lightsNight[8]; bool sunlight[8]; @@ -67,10 +71,10 @@ public: const NodeDefManager *nodedef; scene::IMeshManipulator *meshmanip; -// options + // options bool enable_mesh_cache; -// current node + // current node v3s16 blockpos_nodes; v3s16 p; v3f origin; @@ -82,30 +86,30 @@ public: TileSpec tile; float scale; -// lighting + // lighting void getSmoothLightFrame(); LightInfo 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); + 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); -// face drawing + // face drawing void drawQuad(v3f *vertices, const v3s16 &normal = v3s16(0, 0, 0), - float vertical_tiling = 1.0); + float vertical_tiling = 1.0); -// cuboid drawing! + // cuboid drawing! void drawCuboid(const aabb3f &box, TileSpec *tiles, int tilecount, - const LightInfo *lights , const f32 *txc); + const LightInfo *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); + TileSpec *tiles = NULL, int tile_count = 0); -// liquid-specific + // liquid-specific bool top_is_same_liquid; bool draw_liquid_bottom; TileSpec tile_liquid; @@ -113,7 +117,8 @@ public: content_t c_flowing; content_t c_source; video::SColor color_liquid_top; - struct NeighborData { + struct NeighborData + { f32 level; content_t content; bool is_same_liquid; @@ -130,13 +135,13 @@ public: void drawLiquidTop(); void drawLiquidBottom(); -// raillike-specific + // raillike-specific // name of the group that enables connecting to raillike nodes of different kind static const std::string raillike_groupname; int raillike_group; bool isSameRail(v3s16 dir); -// plantlike-specific + // plantlike-specific PlantlikeStyle draw_style; v3f offset; int rotate_degree; @@ -145,14 +150,14 @@ public: float plant_height; void drawPlantlikeQuad(float rotation, float quad_offset = 0, - bool offset_top_only = false); + bool offset_top_only = false); void drawPlantlike(); -// firelike-specific - void drawFirelikeQuad(float rotation, float opening_angle, - float offset_h, float offset_v = 0.0); + // firelike-specific + void drawFirelikeQuad(float rotation, float opening_angle, float offset_h, + float offset_v = 0.0); -// drawtypes + // drawtypes void drawLiquidNode(); void drawGlasslikeNode(); void drawGlasslikeFramedNode(); @@ -167,7 +172,7 @@ public: void drawNodeboxNode(); void drawMeshNode(); -// common + // common void errorUnknownDrawtype(); void drawNode(); |