#include <content_mapblock.h>
Classes | |
struct | LiquidData |
struct | PlantlikeData |
struct | RaillikeData |
Public Member Functions | |
MapblockMeshGenerator (MeshMakeData *input, MeshCollector *output, scene::IMeshManipulator *mm) | |
void | generate () |
void | renderSingle (content_t node, u8 param2=0x00) |
Private Member Functions | |
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) |
void | getTile (int index, TileSpec *tile) |
void | getTile (v3s16 direction, TileSpec *tile) |
void | getSpecialTile (int index, TileSpec *tile, bool apply_crack=false) |
void | drawQuad (v3f *vertices, const v3s16 &normal=v3s16(0, 0, 0), float vertical_tiling=1.0) |
template<typename Fn > | |
void | drawCuboid (const aabb3f &box, TileSpec *tiles, int tilecount, const f32 *txc, u8 mask, Fn &&face_lighter) |
void | generateCuboidTextureCoords (aabb3f const &box, f32 *coords) |
void | drawAutoLightedCuboid (aabb3f box, f32 const *txc=nullptr, TileSpec *tiles=nullptr, int tile_count=0, u8 mask=0) |
u8 | getNodeBoxMask (aabb3f box, u8 solid_neighbors, u8 sametype_neighbors) const |
void | prepareLiquidNodeDrawing () |
void | getLiquidNeighborhood () |
void | calculateCornerLevels () |
f32 | getCornerLevel (int i, int k) const |
void | drawLiquidSides () |
void | drawLiquidTop () |
void | drawLiquidBottom () |
bool | isSameRail (v3s16 dir) |
void | drawPlantlikeQuad (float rotation, float quad_offset=0, bool offset_top_only=false) |
void | drawPlantlike (bool is_rooted=false) |
void | drawFirelikeQuad (float rotation, float opening_angle, float offset_h, float offset_v=0.0) |
void | drawSolidNode () |
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 () |
void | errorUnknownDrawtype () |
void | drawNode () |
Private Attributes | ||
MeshMakeData *const | data | |
MeshCollector *const | collector | |
const NodeDefManager *const | nodedef | |
scene::IMeshManipulator *const | meshmanip | |
const v3s16 | blockpos_nodes | |
struct { | ||
v3s16 p | ||
v3f origin | ||
MapNode n | ||
const ContentFeatures * f | ||
LightPair light | ||
LightFrame frame | ||
video::SColor color | ||
TileSpec tile | ||
f32 scale | ||
} | cur_node | |
LiquidData | cur_liquid | |
bool | smooth_liquids = false | |
RaillikeData | cur_rail | |
PlantlikeData | cur_plant | |
Static Private Attributes | |
static const std::string | raillike_groupname = "connect_to_raillike" |
MapblockMeshGenerator::MapblockMeshGenerator | ( | MeshMakeData * | input, |
MeshCollector * | output, | ||
scene::IMeshManipulator * | mm ) |
References BS, cur_node, and SMOOTH_LIGHTING_OVERSIZE.
Referenced by blendLightColor(), blendLightColor(), and drawAutoLightedCuboid().
|
private |
References blendLight(), cur_node, encode_light(), and light.
Referenced by drawLiquidBottom(), drawLiquidSides(), drawLiquidTop(), drawMeshNode(), and drawQuad().
|
private |
References applyFacesShading(), blendLight(), color, cur_node, encode_light(), light, and MYMAX.
|
private |
References MapblockMeshGenerator::LiquidData::corner_levels, cur_liquid, and getCornerLevel().
Referenced by drawLiquidNode().
|
private |
References BS, data, drawAutoLightedCuboid(), getSmoothLightFrame(), getTile(), and MeshMakeData::m_smooth_lighting.
Referenced by drawNode().
|
private |
References applyFacesShading(), blendLight(), color, cur_node, data, Diag02, Diag13, drawCuboid(), encode_light(), generateCuboidTextureCoords(), LightInfo::getPair(), light_indices, lightDiff(), MeshMakeData::m_smooth_lighting, MYMAX, and scale.
Referenced by drawAllfacesNode(), drawFencelikeNode(), drawGlasslikeFramedNode(), and drawNodeboxNode().
|
private |
References MeshCollector::append(), collector, Diag13, MYMIN, quad_indices_02, quad_indices_13, and setupCuboidVertices().
Referenced by drawAutoLightedCuboid(), and drawSolidNode().
|
private |
References blockpos_nodes, BS, cur_node, data, drawAutoLightedCuboid(), ContentFeatures::drawtype, NodeDefManager::get(), VoxelManipulator::getNodeNoEx(), TileSpec::layers, MeshMakeData::m_vmanip, MATERIAL_FLAG_CRACK, NDT_FENCELIKE, nodedef, R90, TileSpec::rotation, and useTile().
Referenced by drawNode().
|
private |
References blockpos_nodes, BS, CONTENT_AIR, CONTENT_IGNORE, cur_node, D6D_XN, D6D_XP, D6D_YN, D6D_YP, D6D_ZN, D6D_ZP, data, drawFirelikeQuad(), g_6dirs, MapNode::getContent(), VoxelManipulator::getNodeNoEx(), MeshMakeData::m_vmanip, and useTile().
Referenced by drawNode().
|
private |
References BS, cur_node, drawQuad(), and scale.
Referenced by drawFirelikeNode().
|
private |
References blockpos_nodes, BS, CPT2_GLASSLIKE_LIQUID_LEVEL, cur_node, D6D_XN, D6D_XP, D6D_YN, D6D_YP, D6D_ZN, D6D_ZP, data, dir(), drawAutoLightedCuboid(), drawQuad(), encode_light(), FRAMED_EDGE_COUNT, FRAMED_NEIGHBOR_COUNT, g_26dirs, g_6dirs, MapNode::getContent(), VoxelManipulator::getNodeNoEx(), getSpecialTile(), getTile(), MeshMakeData::m_smooth_lighting, and MeshMakeData::m_vmanip.
Referenced by drawNode().
|
private |
References blockpos_nodes, BS, cur_node, D6D_XN, D6D_XP, D6D_YN, D6D_YP, D6D_ZN, D6D_ZP, data, dir(), drawQuad(), g_6dirs, MapNode::getContent(), VoxelManipulator::getNodeNoExNoEmerge(), MeshMakeData::m_vmanip, and useTile().
Referenced by drawNode().
|
private |
References MeshCollector::append(), blendLightColor(), BS, collector, MapblockMeshGenerator::LiquidData::color_top, cur_liquid, cur_node, data, MeshMakeData::m_smooth_lighting, quad_indices, and MapblockMeshGenerator::LiquidData::tile_top.
Referenced by drawLiquidNode().
|
private |
References calculateCornerLevels(), cur_liquid, MapblockMeshGenerator::LiquidData::draw_bottom, drawLiquidBottom(), drawLiquidSides(), drawLiquidTop(), getLiquidNeighborhood(), prepareLiquidNodeDrawing(), and MapblockMeshGenerator::LiquidData::top_is_same_liquid.
Referenced by drawNode().
|
private |
References MeshCollector::append(), blendLightColor(), BS, collector, MapblockMeshGenerator::LiquidData::NeighborData::content, MapblockMeshGenerator::LiquidData::corner_levels, cur_liquid, cur_node, data, NodeDefManager::get(), MapblockMeshGenerator::LiquidData::NeighborData::is_same_liquid, MeshMakeData::m_smooth_lighting, MapblockMeshGenerator::LiquidData::neighbors, nodedef, quad_indices, MapblockMeshGenerator::LiquidData::tile, MapblockMeshGenerator::LiquidData::NeighborData::top_is_same_liquid, and MapblockMeshGenerator::LiquidData::top_is_same_liquid.
Referenced by drawLiquidNode().
|
private |
References MeshCollector::append(), blendLightColor(), blockpos_nodes, BS, collector, MapblockMeshGenerator::LiquidData::color_top, MapblockMeshGenerator::LiquidData::corner_levels, cur_liquid, cur_node, data, dir(), MapblockMeshGenerator::LiquidData::NeighborData::level, MeshMakeData::m_smooth_lighting, MapblockMeshGenerator::LiquidData::neighbors, quad_indices, smooth_liquids, and MapblockMeshGenerator::LiquidData::tile_top.
Referenced by drawLiquidNode().
|
private |
References MeshCollector::append(), blendLightColor(), cloneMesh(), collector, CPT2_4DIR, CPT2_COLORED_4DIR, CPT2_COLORED_DEGROTATE, CPT2_COLORED_FACEDIR, CPT2_COLORED_WALLMOUNTED, CPT2_DEGROTATE, CPT2_FACEDIR, CPT2_WALLMOUNTED, cur_node, data, MeshMakeData::m_smooth_lighting, meshmanip, MYMIN, nodedef, recalculateBoundingBox(), rotateMeshBy6dFacedir(), rotateMeshXZby(), tile, useTile(), wallmounted_to_facedir, and warningstream.
Referenced by drawNode().
|
private |
References BS, cur_node, data, drawAllfacesNode(), drawFencelikeNode(), drawFirelikeNode(), drawGlasslikeFramedNode(), drawGlasslikeNode(), drawLiquidNode(), drawMeshNode(), drawNodeboxNode(), drawPlantlikeNode(), drawPlantlikeRootedNode(), drawRaillikeNode(), drawSignlikeNode(), drawSolidNode(), drawTorchlikeNode(), errorUnknownDrawtype(), getInteriorLight(), getSmoothLightFrame(), intToFloat(), MeshMakeData::m_smooth_lighting, NDT_AIRLIKE, NDT_ALLFACES, NDT_FENCELIKE, NDT_FIRELIKE, NDT_FLOWINGLIQUID, NDT_GLASSLIKE, NDT_GLASSLIKE_FRAMED, NDT_LIQUID, NDT_MESH, NDT_NODEBOX, NDT_NORMAL, NDT_PLANTLIKE, NDT_PLANTLIKE_ROOTED, NDT_RAILLIKE, NDT_SIGNLIKE, NDT_TORCHLIKE, and nodedef.
Referenced by generate(), and renderSingle().
|
private |
References blockpos_nodes, BS, CPT2_4DIR, CPT2_COLORED_4DIR, CPT2_COLORED_FACEDIR, CPT2_COLORED_WALLMOUNTED, CPT2_FACEDIR, CPT2_LEVELED, CPT2_WALLMOUNTED, cur_node, data, dir(), drawAutoLightedCuboid(), ContentFeatures::drawtype, NodeDefManager::get(), MapNode::getNodeBoxes(), getNodeBoxMask(), VoxelManipulator::getNodeNoEx(), getTile(), TileLayer::isTransparent(), TileSpec::layers, MeshMakeData::m_vmanip, NDT_NORMAL, NODEBOX_CONNECTED, NodeDefManager::nodeboxConnects(), nodedef, MapNode::param0, MapNode::param2, and tile.
Referenced by drawNode().
|
private |
References BS, CPT2_COLORED_DEGROTATE, CPT2_DEGROTATE, CPT2_LEVELED, CPT2_MESHOPTIONS, cur_node, cur_plant, MapblockMeshGenerator::PlantlikeData::draw_style, drawPlantlikeQuad(), DWM_XN, DWM_XP, DWM_YP, DWM_ZN, DWM_ZP, MapblockMeshGenerator::PlantlikeData::face_num, MO_BIT_RANDOM_OFFSET, MO_BIT_RANDOM_OFFSET_Y, MO_BIT_SCALE_SQRT2, MO_MASK_STYLE, PseudoRandom::next(), nodedef, MapblockMeshGenerator::PlantlikeData::offset, MapblockMeshGenerator::PlantlikeData::plant_height, PLANT_STYLE_CROSS, PLANT_STYLE_CROSS2, PLANT_STYLE_HASH, PLANT_STYLE_HASH2, PLANT_STYLE_STAR, MapblockMeshGenerator::PlantlikeData::random_offset_Y, and MapblockMeshGenerator::PlantlikeData::rotate_degree.
Referenced by drawPlantlikeNode(), and drawPlantlikeRootedNode().
|
private |
References drawPlantlike(), and useTile().
Referenced by drawNode().
|
private |
References BS, cur_node, cur_plant, drawQuad(), DWM_XN, DWM_XP, DWM_YN, DWM_YP, DWM_ZN, DWM_ZP, MapblockMeshGenerator::PlantlikeData::face_num, PseudoRandom::next(), nodedef, MapblockMeshGenerator::PlantlikeData::offset, MapblockMeshGenerator::PlantlikeData::plant_height, MapblockMeshGenerator::PlantlikeData::random_offset_Y, MapblockMeshGenerator::PlantlikeData::rotate_degree, and scale.
Referenced by drawPlantlike().
|
private |
References blockpos_nodes, BS, cur_node, data, drawPlantlike(), drawSolidNode(), getInteriorLight(), VoxelManipulator::getNodeNoEx(), getSmoothLightFrame(), MeshMakeData::m_smooth_lighting, MeshMakeData::m_vmanip, MATERIAL_FLAG_CRACK_OVERLAY, nodedef, and useTile().
Referenced by drawNode().
|
private |
References MeshCollector::append(), applyFacesShading(), blendLightColor(), collector, cur_node, data, MeshMakeData::m_smooth_lighting, and quad_indices.
Referenced by drawFirelikeQuad(), drawGlasslikeFramedNode(), drawGlasslikeNode(), drawPlantlikeQuad(), drawRaillikeNode(), drawSignlikeNode(), and drawTorchlikeNode().
|
private |
References BS, cur_node, cur_rail, dir(), drawQuad(), isSameRail(), MATERIAL_FLAG_BACKFACE_CULLING, MATERIAL_FLAG_CRACK_OVERLAY, MapblockMeshGenerator::RaillikeData::raillike_group, raillike_groupname, and useTile().
Referenced by drawNode().
|
private |
References BS, cur_node, drawQuad(), DWM_S1, DWM_S2, DWM_XN, DWM_XP, DWM_YN, DWM_YP, DWM_ZN, DWM_ZP, MATERIAL_FLAG_BACKFACE_CULLING, MATERIAL_FLAG_CRACK_OVERLAY, nodedef, and useTile().
Referenced by drawNode().
|
private |
References applyFacesShading(), blockpos_nodes, BS, color, CONTENT_AIR, CONTENT_IGNORE, cur_node, data, Diag02, Diag13, drawCuboid(), encode_light(), generateCuboidTextureCoords(), NodeDefManager::get(), MapNode::getContent(), getFaceLight(), VoxelManipulator::getNodeNoEx(), getSmoothLightSolid(), getTile(), intToFloat(), TileSpec::layers, light_dirs, light_indices, lightDiff(), MeshMakeData::m_smooth_lighting, MeshMakeData::m_vmanip, MATERIAL_FLAG_BACKFACE_CULLING, MATERIAL_FLAG_TILEABLE_HORIZONTAL, MATERIAL_FLAG_TILEABLE_VERTICAL, NDT_LIQUID, NDT_NORMAL, and nodedef.
Referenced by drawNode(), and drawPlantlikeRootedNode().
|
private |
References BS, cur_node, drawQuad(), DWM_S1, DWM_S2, DWM_XN, DWM_XP, DWM_YN, DWM_YP, DWM_ZN, DWM_ZP, MATERIAL_FLAG_BACKFACE_CULLING, MATERIAL_FLAG_CRACK_OVERLAY, nodedef, and useTile().
Referenced by drawNode().
|
private |
References cur_node, FATAL_ERROR, and infostream.
Referenced by drawNode().
void MapblockMeshGenerator::generate | ( | ) |
References blockpos_nodes, cur_node, data, drawNode(), NodeDefManager::get(), VoxelManipulator::getNodeNoEx(), MeshMakeData::m_vmanip, nodedef, MeshMakeData::side_length, and ZoneScoped.
Referenced by MapBlockMesh::MapBlockMesh().
|
private |
References BS.
Referenced by drawAutoLightedCuboid(), and drawSolidNode().
|
private |
References BS, MapblockMeshGenerator::LiquidData::c_flowing, MapblockMeshGenerator::LiquidData::c_source, MapblockMeshGenerator::LiquidData::NeighborData::content, CONTENT_AIR, cur_liquid, MapblockMeshGenerator::LiquidData::NeighborData::level, MapblockMeshGenerator::LiquidData::neighbors, and MapblockMeshGenerator::LiquidData::NeighborData::top_is_same_liquid.
Referenced by calculateCornerLevels().
|
private |
References blockpos_nodes, MapblockMeshGenerator::LiquidData::c_flowing, MapblockMeshGenerator::LiquidData::c_source, MapblockMeshGenerator::LiquidData::NeighborData::content, CONTENT_IGNORE, cur_liquid, cur_node, data, NodeDefManager::get(), MapNode::getContent(), VoxelManipulator::getNodeNoEx(), MapblockMeshGenerator::LiquidData::NeighborData::is_same_liquid, MapblockMeshGenerator::LiquidData::NeighborData::level, LIQUID_LEVEL_MASK, LIQUID_LEVEL_MAX, ContentFeatures::liquid_range, MeshMakeData::m_vmanip, MapblockMeshGenerator::LiquidData::neighbors, nodedef, MapNode::param2, rangelim, and MapblockMeshGenerator::LiquidData::NeighborData::top_is_same_liquid.
Referenced by drawLiquidNode().
|
private |
References ALPHAMODE_OPAQUE, BS, and cur_node.
Referenced by drawNodeboxNode().
|
private |
References blockpos_nodes, cur_node, data, getSmoothLightTransparent(), light, light_dirs, LightPair::lightDay, and LightPair::lightNight.
Referenced by drawAllfacesNode(), drawNode(), and drawPlantlikeRootedNode().
|
private |
References TileLayer::color, cur_node, TileLayer::has_color, TileSpec::layers, MATERIAL_FLAG_CRACK, TileLayer::material_flags, TileLayer::texture_id, and tile.
Referenced by drawGlasslikeFramedNode(), prepareLiquidNodeDrawing(), and useTile().
|
private |
References cur_node, data, getNodeTileN(), and tile.
Referenced by drawAllfacesNode(), drawGlasslikeFramedNode(), drawNodeboxNode(), drawSolidNode(), and useTile().
|
private |
References blockpos_nodes, cur_node, cur_rail, data, dir(), ContentFeatures::drawtype, NodeDefManager::get(), MapNode::getContent(), ContentFeatures::getGroup(), VoxelManipulator::getNodeNoEx(), MeshMakeData::m_vmanip, NDT_RAILLIKE, nodedef, MapblockMeshGenerator::RaillikeData::raillike_group, and raillike_groupname.
Referenced by drawRaillikeNode().
|
private |
References blockpos_nodes, MapblockMeshGenerator::LiquidData::c_flowing, MapblockMeshGenerator::LiquidData::c_source, MapblockMeshGenerator::LiquidData::color_top, cur_liquid, cur_node, data, MapblockMeshGenerator::LiquidData::draw_bottom, encode_light(), NodeDefManager::get(), MapNode::getContent(), getInteriorLight(), NodeDefManager::getLightingFlags(), VoxelManipulator::getNodeNoEx(), getSpecialTile(), ContentLightingFlags::has_light, MeshMakeData::m_smooth_lighting, MeshMakeData::m_vmanip, nodedef, MapblockMeshGenerator::LiquidData::tile, MapblockMeshGenerator::LiquidData::tile_top, and MapblockMeshGenerator::LiquidData::top_is_same_liquid.
Referenced by drawLiquidNode().
void MapblockMeshGenerator::renderSingle | ( | content_t | node, |
u8 | param2 = 0x00 ) |
References cur_node, drawNode(), NodeDefManager::get(), and nodedef.
Referenced by createSpecialNodeMesh().
|
private |
References cur_node, data, encode_light(), getSpecialTile(), getTile(), MeshMakeData::m_crack_pos_relative, and MeshMakeData::m_smooth_lighting.
Referenced by drawFencelikeNode(), drawFirelikeNode(), drawGlasslikeNode(), drawMeshNode(), drawPlantlikeNode(), drawPlantlikeRootedNode(), drawRaillikeNode(), drawSignlikeNode(), and drawTorchlikeNode().
|
private |
|
private |
Referenced by drawCuboid(), drawLiquidBottom(), drawLiquidSides(), drawLiquidTop(), drawMeshNode(), and drawQuad().
video::SColor MapblockMeshGenerator::color |
Referenced by blendLightColor(), drawAutoLightedCuboid(), and drawSolidNode().
|
private |
struct { ... } MapblockMeshGenerator::cur_node |
Referenced by blendLight(), blendLightColor(), blendLightColor(), drawAutoLightedCuboid(), drawFencelikeNode(), drawFirelikeNode(), drawFirelikeQuad(), drawGlasslikeFramedNode(), drawGlasslikeNode(), drawLiquidBottom(), drawLiquidSides(), drawLiquidTop(), drawMeshNode(), drawNode(), drawNodeboxNode(), drawPlantlike(), drawPlantlikeQuad(), drawPlantlikeRootedNode(), drawQuad(), drawRaillikeNode(), drawSignlikeNode(), drawSolidNode(), drawTorchlikeNode(), errorUnknownDrawtype(), generate(), getLiquidNeighborhood(), getNodeBoxMask(), getSmoothLightFrame(), getSpecialTile(), getTile(), getTile(), isSameRail(), prepareLiquidNodeDrawing(), renderSingle(), and useTile().
|
private |
Referenced by drawPlantlike(), and drawPlantlikeQuad().
|
private |
Referenced by drawRaillikeNode(), and isSameRail().
|
private |
Referenced by drawAllfacesNode(), drawAutoLightedCuboid(), drawFencelikeNode(), drawFirelikeNode(), drawGlasslikeFramedNode(), drawGlasslikeNode(), drawLiquidBottom(), drawLiquidSides(), drawLiquidTop(), drawMeshNode(), drawNode(), drawNodeboxNode(), drawPlantlikeRootedNode(), drawQuad(), drawSolidNode(), generate(), getLiquidNeighborhood(), getSmoothLightFrame(), getTile(), getTile(), isSameRail(), prepareLiquidNodeDrawing(), and useTile().
const ContentFeatures* MapblockMeshGenerator::f |
LightFrame MapblockMeshGenerator::frame |
LightPair MapblockMeshGenerator::light |
Referenced by blendLightColor(), blendLightColor(), and getSmoothLightFrame().
|
private |
Referenced by drawMeshNode().
MapNode MapblockMeshGenerator::n |
|
private |
Referenced by drawFencelikeNode(), drawLiquidSides(), drawMeshNode(), drawNode(), drawNodeboxNode(), drawPlantlike(), drawPlantlikeQuad(), drawPlantlikeRootedNode(), drawSignlikeNode(), drawSolidNode(), drawTorchlikeNode(), generate(), getLiquidNeighborhood(), isSameRail(), prepareLiquidNodeDrawing(), and renderSingle().
v3f MapblockMeshGenerator::origin |
v3s16 MapblockMeshGenerator::p |
|
staticprivate |
Referenced by drawRaillikeNode(), and isSameRail().
f32 MapblockMeshGenerator::scale |
Referenced by drawAutoLightedCuboid(), drawFirelikeQuad(), and drawPlantlikeQuad().
|
private |
Referenced by drawLiquidTop().
TileSpec MapblockMeshGenerator::tile |
Referenced by drawMeshNode(), drawNodeboxNode(), getSpecialTile(), getTile(), and getTile().