Minetest 5.9.0-dev
 
Loading...
Searching...
No Matches
mapblock_mesh.h File Reference
#include "irrlichttypes_extrabloated.h"
#include "util/numeric.h"
#include "client/tile.h"
#include "voxel.h"
#include <array>
#include <map>
#include <unordered_map>
+ Include dependency graph for mapblock_mesh.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  MeshMakeData
 
class  MeshTriangle
 
class  MapBlockBspTree
 Implements a binary space partitioning tree See also: https://en.wikipedia.org/wiki/Binary_space_partitioning. More...
 
struct  MapBlockBspTree::TreeNode
 
class  PartialMeshBuffer
 
class  MapBlockMesh
 
struct  MapBlockMesh::AnimationInfo
 

Functions

video::SColor encode_light (u16 light, u8 emissive_light)
 
u16 getInteriorLight (MapNode n, s32 increment, const NodeDefManager *ndef)
 
u16 getFaceLight (MapNode n, MapNode n2, const NodeDefManager *ndef)
 
u16 getSmoothLightSolid (const v3s16 &p, const v3s16 &face_dir, const v3s16 &corner, MeshMakeData *data)
 
u16 getSmoothLightTransparent (const v3s16 &p, const v3s16 &corner, MeshMakeData *data)
 
void get_sunlight_color (video::SColorf *sunlight, u32 daynight_ratio)
 
void final_color_blend (video::SColor *result, u16 light, u32 daynight_ratio)
 
void final_color_blend (video::SColor *result, const video::SColor &data, const video::SColorf &dayLight)
 
void getNodeTileN (MapNode mn, const v3s16 &p, u8 tileindex, MeshMakeData *data, TileSpec &tile)
 
void getNodeTile (MapNode mn, const v3s16 &p, const v3s16 &dir, MeshMakeData *data, TileSpec &tile)
 
u8 get_solid_sides (MeshMakeData *data)
 Return bitset of the sides of the mesh that consist of solid nodes only Bits: 0 0 -Z +Z -X +X -Y +Y.
 

Function Documentation

◆ encode_light()

video::SColor encode_light ( u16  light,
u8  emissive_light 
)

Encodes light of a node. The result is not the final color, but a half-baked vertex color. You have to multiply the resulting color with the node's color.

Parameters
lightthe first 8 bits are day light, the last 8 bits are night light
emissive_lightamount of light the surface emits, from 0 to LIGHT_SUN.

Referenced by MapblockMeshGenerator::blendLightColor(), MapblockMeshGenerator::drawAutoLightedCuboid(), MapblockMeshGenerator::drawGlasslikeFramedNode(), MapblockMeshGenerator::drawSolidNode(), final_color_blend(), MapblockMeshGenerator::prepareLiquidNodeDrawing(), ClientEnvironment::step(), GenericCAO::updateLight(), and MapblockMeshGenerator::useTile().

+ Here is the caller graph for this function:

◆ final_color_blend() [1/2]

void final_color_blend ( video::SColor *  result,
const video::SColor &  data,
const video::SColorf &  dayLight 
)

Gives the final SColor shown on screen.

Parameters
resultoutput color
datathe half-baked vertex color
dayLightcolor of the sunlight

◆ final_color_blend() [2/2]

void final_color_blend ( video::SColor *  result,
u16  light,
u32  daynight_ratio 
)

Gives the final SColor shown on screen.

Parameters
resultoutput color
lightfirst 8 bits are day light, second 8 bits are night light

References encode_light(), final_color_blend(), and get_sunlight_color().

Referenced by MapBlockMesh::MapBlockMesh(), MapBlockMesh::animate(), final_color_blend(), ClientEnvironment::step(), GenericCAO::updateLight(), and Game::updatePointedThing().

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

◆ get_solid_sides()

u8 get_solid_sides ( MeshMakeData data)

Return bitset of the sides of the mesh that consist of solid nodes only Bits: 0 0 -Z +Z -X +X -Y +Y.

References NodeDefManager::get(), VoxelManipulator::getNodeRefUnsafe(), MeshMakeData::m_blockpos, MeshMakeData::m_vmanip, MAP_BLOCKSIZE, MeshMakeData::nodedef, MeshMakeData::side_length, and ContentFeatures::solidness.

Referenced by MeshUpdateWorkerThread::doUpdate().

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

◆ get_sunlight_color()

void get_sunlight_color ( video::SColorf *  sunlight,
u32  daynight_ratio 
)

Returns the sunlight's color from the current day-night ratio.

Referenced by MapBlockMesh::MapBlockMesh(), MapBlockMesh::animate(), final_color_blend(), and GameGlobalShaderConstantSetter::onSetConstants().

+ Here is the caller graph for this function:

◆ getFaceLight()

u16 getFaceLight ( MapNode  n,
MapNode  n2,
const NodeDefManager ndef 
)

References getFaceLight(), LIGHTBANK_DAY, and LIGHTBANK_NIGHT.

+ Here is the call graph for this function:

◆ getInteriorLight()

u16 getInteriorLight ( MapNode  n,
s32  increment,
const NodeDefManager ndef 
)

References getInteriorLight(), LIGHTBANK_DAY, and LIGHTBANK_NIGHT.

+ Here is the call graph for this function:

◆ getNodeTile()

void getNodeTile ( MapNode  mn,
const v3s16 p,
const v3s16 dir,
MeshMakeData data,
TileSpec tile 
)

References dir(), MapNode::getFaceDir(), getNodeTileN(), MeshMakeData::nodedef, None, p(), R180, R270, R90, TileSpec::rotation, and TileSpec::world_aligned.

Referenced by MapblockMeshGenerator::getTile().

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

◆ getNodeTileN()

void getNodeTileN ( MapNode  mn,
const v3s16 p,
u8  tileindex,
MeshMakeData data,
TileSpec tile 
)

References TileLayer::color, NodeDefManager::get(), MapNode::getColor(), TileLayer::has_color, TileSpec::layers, MeshMakeData::m_crack_pos_relative, MATERIAL_FLAG_CRACK, TileLayer::material_flags, MeshMakeData::nodedef, p(), TileLayer::texture_id, and ContentFeatures::tiles.

Referenced by getNodeTile(), and MapblockMeshGenerator::getTile().

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

◆ getSmoothLightSolid()

u16 getSmoothLightSolid ( const v3s16 p,
const v3s16 face_dir,
const v3s16 corner,
MeshMakeData data 
)

References getSmoothLightTransparent(), and p().

Referenced by MapblockMeshGenerator::drawSolidNode().

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

◆ getSmoothLightTransparent()

u16 getSmoothLightTransparent ( const v3s16 p,
const v3s16 corner,
MeshMakeData data 
)

References getSmoothLightCombined(), and p().

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

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