3 Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 2.1 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 #include <IMeshManipulator.h>
34 class MapblockMeshGenerator
38 MeshCollector *collector;
40 INodeDefManager *nodedef;
41 scene::IMeshManipulator *meshmanip;
44 bool enable_mesh_cache;
51 const ContentFeatures *f;
59 void getSmoothLightFrame();
60 u16 blendLight(const v3f &vertex_pos);
61 video::SColor blendLightColor(const v3f &vertex_pos);
62 video::SColor blendLightColor(const v3f &vertex_pos, const v3f &vertex_normal);
64 void useTile(int index = 0, u8 set_flags = MATERIAL_FLAG_CRACK_OVERLAY,
65 u8 reset_flags = 0, bool special = false);
66 void getTile(v3s16 direction, TileSpec *tile);
67 void getSpecialTile(int index, TileSpec *tile, bool apply_crack = false);
70 void drawQuad(v3f *vertices, const v3s16 &normal = v3s16(0, 0, 0),
71 float vertical_tiling = 1.0);
74 void drawCuboid(const aabb3f &box, TileSpec *tiles, int tilecount,
75 const u16 *lights , const f32 *txc);
76 void generateCuboidTextureCoords(aabb3f const &box, f32 *coords);
77 void drawAutoLightedCuboid(aabb3f box, const f32 *txc = NULL,
78 TileSpec *tiles = NULL, int tile_count = 0);
81 bool top_is_same_liquid;
83 TileSpec tile_liquid_top;
86 video::SColor color_liquid_top;
91 bool top_is_same_liquid;
93 NeighborData liquid_neighbors[3][3];
94 f32 corner_levels[2][2];
96 void prepareLiquidNodeDrawing();
97 void getLiquidNeighborhood();
98 void calculateCornerLevels();
99 f32 getCornerLevel(int i, int k);
100 void drawLiquidSides();
101 void drawLiquidTop();
104 // name of the group that enables connecting to raillike nodes of different kind
105 static const std::string raillike_groupname;
107 bool isSameRail(v3s16 dir);
109 // plantlike-specific
110 PlantlikeStyle draw_style;
113 bool random_offset_Y;
117 void drawPlantlikeQuad(float rotation, float quad_offset = 0,
118 bool offset_top_only = false);
119 void drawPlantlike();
122 void drawFirelikeQuad(float rotation, float opening_angle,
123 float offset_h, float offset_v = 0.0);
126 void drawLiquidNode();
127 void drawGlasslikeNode();
128 void drawGlasslikeFramedNode();
129 void drawAllfacesNode();
130 void drawTorchlikeNode();
131 void drawSignlikeNode();
132 void drawPlantlikeNode();
133 void drawPlantlikeRootedNode();
134 void drawFirelikeNode();
135 void drawFencelikeNode();
136 void drawRaillikeNode();
137 void drawNodeboxNode();
141 void errorUnknownDrawtype();
145 MapblockMeshGenerator(MeshMakeData *input, MeshCollector *output);