Luanti 5.18.0-dev
Loading...
Searching...
No Matches
content_mapblock.cpp File Reference
#include <cmath>
#include "content_mapblock.h"
#include "util/basic_macros.h"
#include "util/numeric.h"
#include "util/directiontables.h"
#include "util/tracy_wrapper.h"
#include "mapblock_mesh.h"
#include "node_visuals.h"
#include "nodedef.h"
#include "client/tile.h"
#include "mesh.h"
#include "client/meshgen/collector.h"
#include "client/renderingengine.h"
#include "client.h"
#include "noise.h"
#include <SMesh.h>
#include <IMeshBuffer.h>
Include dependency graph for content_mapblock.cpp:

Macros

#define SMOOTH_LIGHTING_OVERSIZE   1.0
#define FRAMED_EDGE_COUNT   12
#define FRAMED_NEIGHBOR_COUNT   18

Enumerations

enum class  QuadDiagonal { Diag02 , Diag13 }

Functions

static std::array< video::S3DVertex, 24 > setupCuboidVertices (const aabb3f &box, const f32 *txc, const TileSpec *tiles, int tilecount, v3s16 alignment)
static u8 getFaceLight (enum LightBank bank, MapNode n, MapNode n2, const NodeDefManager *ndef)
static LightPair getFaceLight (MapNode n, MapNode n2, const NodeDefManager *ndef)
static LightPair getSmoothLightCorner (const v3s16 &p, const v3s16 &corner, MeshMakeData *data)
static QuadDiagonal getSmoothLightingQuadDiagonal (const LightPair(&lights)[4])

Variables

static constexpr v3s16 light_dirs [8]
static constexpr v3s16 tile_dirs [6]
static constexpr v3s16 nodebox_connection_dirs [6]
static constexpr u8 light_indices [6][4]
static constexpr u16 quad_indices_02 [] = {0, 1, 2, 2, 3, 0}
static constexpr u16 quad_indices_13 [] = {0, 1, 3, 3, 1, 2}
static const auto & quad_indices = quad_indices_02

Macro Definition Documentation

◆ FRAMED_EDGE_COUNT

#define FRAMED_EDGE_COUNT   12

◆ FRAMED_NEIGHBOR_COUNT

#define FRAMED_NEIGHBOR_COUNT   18

◆ SMOOTH_LIGHTING_OVERSIZE

#define SMOOTH_LIGHTING_OVERSIZE   1.0

Enumeration Type Documentation

◆ QuadDiagonal

enum class QuadDiagonal
strong
Enumerator
Diag02 
Diag13 

Function Documentation

◆ getFaceLight() [1/2]

u8 getFaceLight ( enum LightBank bank,
MapNode n,
MapNode n2,
const NodeDefManager * ndef )
static

References MapNode::getLight(), NodeDefManager::getLightingFlags(), and ContentLightingFlags::light_source.

Referenced by MapblockMeshGenerator::drawSolidNode(), and getFaceLight().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getFaceLight() [2/2]

LightPair getFaceLight ( MapNode n,
MapNode n2,
const NodeDefManager * ndef )
static

References getFaceLight(), LIGHTBANK_DAY, and LIGHTBANK_NIGHT.

Here is the call graph for this function:

◆ getSmoothLightCorner()

LightPair getSmoothLightCorner ( const v3s16 & p,
const v3s16 & corner,
MeshMakeData * data )
static

References CONTENT_IGNORE, CPT_LIGHT, ContentFeatures::drawtype, g_settings, NodeDefManager::get(), MapNode::getContent(), MapNode::getLight(), ContentFeatures::getLightingFlags(), VoxelManipulator::getNodeNoExNoEmerge(), ContentFeatures::light_propagates, ContentFeatures::light_source, LIGHT_SUN, LIGHTBANK_DAY, LIGHTBANK_NIGHT, MeshMakeData::m_nodedef, MeshMakeData::m_vmanip, NDT_solidness, p(), ContentFeatures::param_type, and rangelim().

Referenced by MapblockMeshGenerator::drawSolidNode(), and MapblockMeshGenerator::getSmoothLightFrame().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getSmoothLightingQuadDiagonal()

QuadDiagonal getSmoothLightingQuadDiagonal ( const LightPair(&) lights[4])
inlinestatic

References Diag02, Diag13, LightPair::lightDay, and LightPair::lightNight.

Referenced by MapblockMeshGenerator::drawAutoLightedCuboid(), and MapblockMeshGenerator::drawSolidNode().

Here is the caller graph for this function:

◆ setupCuboidVertices()

std::array< video::S3DVertex, 24 > setupCuboidVertices ( const aabb3f & box,
const f32 * txc,
const TileSpec * tiles,
int tilecount,
v3s16 alignment )
static

References TileSpec::layers, MYMIN, None, R180, R270, R90, TileSpec::rotation, TileLayer::scale, TileSpec::world_aligned, x, and y.

Referenced by MapblockMeshGenerator::drawCuboid().

Here is the caller graph for this function:

Variable Documentation

◆ light_dirs

v3s16 light_dirs[8]
staticconstexpr
Initial value:
= {
v3s16(-1, -1, -1),
v3s16(-1, -1, 1),
v3s16(-1, 1, -1),
v3s16(-1, 1, 1),
v3s16( 1, -1, -1),
v3s16( 1, -1, 1),
v3s16( 1, 1, -1),
v3s16( 1, 1, 1),
}
core::vector3d< s16 > v3s16
Definition irr_v3d.h:13

Referenced by MapblockMeshGenerator::drawSolidNode(), and MapblockMeshGenerator::getSmoothLightFrame().

◆ light_indices

u8 light_indices[6][4]
staticconstexpr
Initial value:
= {
{3, 7, 6, 2},
{0, 4, 5, 1},
{6, 7, 5, 4},
{3, 2, 0, 1},
{7, 3, 1, 5},
{2, 6, 4, 0},
}

Referenced by MapblockMeshGenerator::drawAutoLightedCuboid(), and MapblockMeshGenerator::drawSolidNode().

◆ nodebox_connection_dirs

v3s16 nodebox_connection_dirs[6]
staticconstexpr
Initial value:
= {
v3s16( 0, 1, 0),
v3s16( 0, -1, 0),
v3s16( 0, 0, -1),
v3s16(-1, 0, 0),
v3s16( 0, 0, 1),
v3s16( 1, 0, 0),
}

Referenced by MapblockMeshGenerator::drawNodeboxNode().

◆ quad_indices

◆ quad_indices_02

u16 quad_indices_02[] = {0, 1, 2, 2, 3, 0}
staticconstexpr

◆ quad_indices_13

u16 quad_indices_13[] = {0, 1, 3, 3, 1, 2}
staticconstexpr

◆ tile_dirs

v3s16 tile_dirs[6]
staticconstexpr
Initial value:
= {
v3s16( 0, 1, 0),
v3s16( 0, -1, 0),
v3s16( 1, 0, 0),
v3s16(-1, 0, 0),
v3s16( 0, 0, 1),
v3s16( 0, 0, -1)
}

Referenced by MapblockMeshGenerator::drawAllfacesNode(), MapblockMeshGenerator::drawNodeboxNode(), and MapblockMeshGenerator::drawSolidNode().