aboutsummaryrefslogtreecommitdiff
path: root/src/mapblock_mesh.h
Commit message (Expand)AuthorAge
* Remove workaround in itemdef.cpp to enable/disable/enable "enable_shaders" se...Craig Robbins2015-02-11
* Revert "Remove workaround in itemdef.cpp to enable/disable/enable "enable_sha...Craig Robbins2015-02-11
* Remove workaround in itemdef.cpp to enable/disable/enable "enable_shaders" se...Craig Robbins2015-02-11
* Implement WieldMeshSceneNode which improves wield mesh renderingKahrl2014-11-08
* Add meshnode drawtype.RealBadAngel2014-10-18
* Node highlighting.RealBadAngel2014-09-17
* Pass pointer to nodedef directly to avoid recalculation in quite often called...sapier2014-04-06
* Fix rendering glitches when far from the center of the mapNovatux2014-03-04
* Migrate to STL containers/algorithms.Ilya Zhuravlev2013-03-11
* Update Copyright YearsSfan52013-02-24
* Change Minetest-c55 to MinetestPilzAdam2013-02-24
* Handle day-night transition in shader and make light sources brighter when sh...Perttu Ahola2012-12-02
* Optimize headersPerttu Ahola2012-06-17
* Node texture animationPerttu Ahola2012-06-16
* Switch the license to be LGPLv2/later, with small parts still remaining as GP...Perttu Ahola2012-06-05
* MapBlockMesh, mesh animation system, urgent mesh updates, athmospheric light,...Kahrl2012-03-15
* The huge item definition and item namespace unification patch (itemdef), see ...Kahrl2012-01-12
* GameDef compilesPerttu Ahola2011-11-29
* Create framework for getting rid of global definitions of node/tool/item/what...Perttu Ahola2011-11-29
* Made dark places tint slightly in bluePerttu Ahola2011-07-23
* Moved stuff from mapblock{h,cpp} to mapblock_mesh.{h,cpp} and content_mapbloc...Perttu Ahola2011-06-17
pan class="hl ppc">#include <IMeshManipulator.h> struct MeshMakeData; struct MeshCollector; 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]; }; class MapblockMeshGenerator { public: MeshMakeData *data; MeshCollector *collector; INodeDefManager *nodedef; scene::IMeshManipulator *meshmanip; // options bool enable_mesh_cache; // current node v3s16 blockpos_nodes; v3s16 p; v3f origin; MapNode n; const ContentFeatures *f; LightPair light; LightFrame frame; video::SColor color; TileSpec tile; float scale; // lighting void getSmoothLightFrame(); 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); // face drawing void drawQuad(v3f *vertices, const v3s16 &normal = v3s16(0, 0, 0), float vertical_tiling = 1.0); // cuboid drawing! void drawCuboid(const aabb3f &box, TileSpec *tiles, int tilecount, 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; TileSpec tile_liquid; TileSpec tile_liquid_top; content_t c_flowing; content_t c_source; video::SColor color_liquid_top; struct NeighborData { f32 level; content_t content; bool is_same_liquid; bool top_is_same_liquid; }; NeighborData liquid_neighbors[3][3]; f32 corner_levels[2][2]; void prepareLiquidNodeDrawing(); void getLiquidNeighborhood(); void calculateCornerLevels(); f32 getCornerLevel(int i, int k); void drawLiquidSides(); void drawLiquidTop(); // 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 PlantlikeStyle draw_style; v3f offset; int rotate_degree; bool random_offset_Y; int face_num; float plant_height; void drawPlantlikeQuad(float rotation, float quad_offset = 0, bool offset_top_only = false); void drawPlantlike(); // firelike-specific void drawFirelikeQuad(float rotation, float opening_angle, float offset_h, float offset_v = 0.0); // drawtypes void drawLiquidNode(); void drawGlasslikeNode(); void drawGlasslikeFramedNode(); void drawAllfacesNode(); void drawTorchlikeNode(); void drawSignlikeNode(); void drawPlantlikeNode(); void drawPlantlikeRootedNode(); void drawFirelikeNode(); void drawFencelikeNode(); void drawRaillikeNode(); void drawNodeboxNode(); void drawMeshNode(); // common void errorUnknownDrawtype(); void drawNode(); public: MapblockMeshGenerator(MeshMakeData *input, MeshCollector *output); void generate(); void renderSingle(content_t node); };