#include "mapblock_mesh.h"
#include "client.h"
#include "mapblock.h"
#include "map.h"
#include "profiler.h"
#include "shader.h"
#include "mesh.h"
#include "minimap.h"
#include "content_mapblock.h"
#include "util/directiontables.h"
#include "client/meshgen/collector.h"
#include "client/renderingengine.h"
#include <array>
Classes | |
struct | FastFace |
Functions | |
static u8 | getInteriorLight (enum LightBank bank, MapNode n, s32 increment, const NodeDefManager *ndef) |
u16 | getInteriorLight (MapNode n, s32 increment, const NodeDefManager *ndef) |
static u8 | getFaceLight (enum LightBank bank, MapNode n, MapNode n2, v3s16 face_dir, const NodeDefManager *ndef) |
u16 | getFaceLight (MapNode n, MapNode n2, const v3s16 &face_dir, const NodeDefManager *ndef) |
static u16 | getSmoothLightCombined (const v3s16 &p, const std::array< v3s16, 8 > &dirs, MeshMakeData *data) |
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) |
static void | getNodeVertexDirs (const v3s16 &dir, v3s16 *vertex_dirs) |
static void | getNodeTextureCoords (v3f base, const v3f &scale, const v3s16 &dir, float *u, float *v) |
static void | makeFastFace (const TileSpec &tile, u16 li0, u16 li1, u16 li2, u16 li3, const v3f &tp, const v3f &p, const v3s16 &dir, const v3f &scale, std::vector< FastFace > &dest) |
static u8 | face_contents (content_t m1, content_t m2, bool *equivalent, const NodeDefManager *ndef) |
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) |
static void | getTileInfo (MeshMakeData *data, const v3s16 &p, const v3s16 &face_dir, bool &makes_face, v3s16 &p_corrected, v3s16 &face_dir_corrected, u16 *lights, u8 &waving, TileSpec &tile) |
static void | updateFastFaceRow (MeshMakeData *data, const v3s16 &&startpos, v3s16 translate_dir, const v3f &&translate_dir_f, const v3s16 &&face_dir, std::vector< FastFace > &dest) |
static void | updateAllFastFaceRows (MeshMakeData *data, std::vector< FastFace > &dest) |
static void | applyTileColor (PreMeshBuffer &pmb) |
video::SColor | encode_light (u16 light, u8 emissive_light) |
Variables | |
static const v3s16 | vertex_dirs_table [] |
|
static |
References TileLayer::color, PreMeshBuffer::layer, and PreMeshBuffer::vertices.
Referenced by MapBlockMesh::MapBlockMesh().
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.
light | the first 8 bits are day light, the last 8 bits are night light |
emissive_light | amount of light the surface emits, from 0 to LIGHT_SUN. |
Referenced by MapblockMeshGenerator::blendLightColor(), MapblockMeshGenerator::drawCuboid(), MapblockMeshGenerator::drawGlasslikeFramedNode(), final_color_blend(), makeFastFace(), MapblockMeshGenerator::prepareLiquidNodeDrawing(), and MapblockMeshGenerator::useTile().
|
static |
References CONTENT_IGNORE, NodeDefManager::get(), ContentFeatures::isLiquid(), ContentFeatures::sameLiquid(), ContentFeatures::solidness, and ContentFeatures::visual_solidness.
Referenced by getTileInfo().
void final_color_blend | ( | video::SColor * | result, |
const video::SColor & | data, | ||
const video::SColorf & | dayLight | ||
) |
Gives the final SColor shown on screen.
result | output color |
data | the half-baked vertex color |
dayLight | color of the sunlight |
void final_color_blend | ( | video::SColor * | result, |
u16 | light, | ||
u32 | daynight_ratio | ||
) |
Gives the final SColor shown on screen.
result | output color |
light | first 8 bits are day light, second 8 bits are night light |
References encode_light(), and get_sunlight_color().
Referenced by MapBlockMesh::MapBlockMesh(), MapBlockMesh::animate(), ClientEnvironment::step(), and Game::updatePointedThing().
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().
|
static |
References decode_light(), NodeDefManager::get(), MapNode::getLight(), ContentFeatures::light_source, and MYMAX.
Referenced by getFaceLight(), and getTileInfo().
u16 getFaceLight | ( | MapNode | n, |
MapNode | n2, | ||
const v3s16 & | face_dir, | ||
const NodeDefManager * | ndef | ||
) |
References getFaceLight(), LIGHTBANK_DAY, and LIGHTBANK_NIGHT.
|
static |
References decode_light(), MapNode::getLight(), LIGHT_SUN, and rangelim.
Referenced by MapblockMeshGenerator::drawNode(), MapblockMeshGenerator::drawPlantlikeRootedNode(), getInteriorLight(), MapblockMeshGenerator::prepareLiquidNodeDrawing(), ClientEnvironment::step(), and Game::updatePointedThing().
u16 getInteriorLight | ( | MapNode | n, |
s32 | increment, | ||
const NodeDefManager * | ndef | ||
) |
References getInteriorLight(), LIGHTBANK_DAY, and LIGHTBANK_NIGHT.
|
static |
References dir().
Referenced by makeFastFace().
void getNodeTile | ( | MapNode | mn, |
const v3s16 & | p, | ||
const v3s16 & | dir, | ||
MeshMakeData * | data, | ||
TileSpec & | tile | ||
) |
References dir(), MapNode::getFaceDir(), getNodeTileN(), MeshMakeData::m_client, IGameDef::ndef(), p(), TileSpec::rotation, and TileSpec::world_aligned.
Referenced by MapblockMeshGenerator::getTile(), and getTileInfo().
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_client, MeshMakeData::m_crack_pos_relative, MATERIAL_FLAG_CRACK, TileLayer::material_flags, IGameDef::ndef(), p(), TileLayer::texture_id, and ContentFeatures::tiles.
Referenced by getNodeTile(), and MapblockMeshGenerator::getTile().
References dir(), idx, and vertex_dirs_table.
Referenced by getTileInfo(), and makeFastFace().
|
static |
References CONTENT_IGNORE, CPT_LIGHT, decode_light(), g_settings, NodeDefManager::get(), MapNode::getContent(), Settings::getFloat(), MapNode::getLightNoChecks(), VoxelManipulator::getNodeNoExNoEmerge(), ContentFeatures::light_propagates, ContentFeatures::light_source, LIGHT_SUN, LIGHTBANK_DAY, LIGHTBANK_NIGHT, MeshMakeData::m_client, MeshMakeData::m_vmanip, IGameDef::ndef(), p(), ContentFeatures::param_type, rangelim, and ContentFeatures::solidness.
Referenced by getSmoothLightTransparent().
u16 getSmoothLightSolid | ( | const v3s16 & | p, |
const v3s16 & | face_dir, | ||
const v3s16 & | corner, | ||
MeshMakeData * | data | ||
) |
References getSmoothLightTransparent(), and p().
Referenced by getTileInfo().
u16 getSmoothLightTransparent | ( | const v3s16 & | p, |
const v3s16 & | corner, | ||
MeshMakeData * | data | ||
) |
References getSmoothLightCombined(), and p().
Referenced by MapblockMeshGenerator::getSmoothLightFrame(), and getSmoothLightSolid().
|
static |
References CONTENT_IGNORE, TileSpec::emissive_light, face_contents(), NodeDefManager::get(), MapNode::getContent(), getFaceLight(), VoxelManipulator::getNodeRefUnsafe(), VoxelManipulator::getNodeRefUnsafeCheckFlags(), getNodeTile(), getNodeVertexDirs(), getSmoothLightSolid(), TileSpec::layers, ContentFeatures::light_source, MeshMakeData::m_blockpos, MeshMakeData::m_client, MeshMakeData::m_smooth_lighting, MeshMakeData::m_vmanip, MAP_BLOCKSIZE, MATERIAL_FLAG_BACKFACE_CULLING, TileLayer::material_flags, IGameDef::ndef(), p(), and ContentFeatures::waving.
Referenced by updateFastFaceRow().
|
static |
References applyFacesShading(), BS, dir(), TileSpec::emissive_light, encode_light(), getNodeTextureCoords(), getNodeVertexDirs(), p(), TileSpec::rotation, FastFace::tile, FastFace::vertex_0_2_connected, FastFace::vertices, and TileSpec::world_aligned.
Referenced by updateFastFaceRow().
|
static |
References MAP_BLOCKSIZE, and updateFastFaceRow().
Referenced by MapBlockMesh::MapBlockMesh().
|
static |
References Profiler::avg(), g_profiler, g_settings, Settings::getBool(), getTileInfo(), TileSpec::isTileable(), makeFastFace(), MAP_BLOCKSIZE, and p().
Referenced by updateAllFastFaceRows().
|
static |
Referenced by getNodeVertexDirs().