#include <clientmap.h>
Classes | |
struct | DrawDescriptor |
class | MapBlockComparer |
Public Member Functions | |
ClientMap (Client *client, RenderingEngine *rendering_engine, MapDrawControl &control, s32 id) | |
bool | maySaveBlocks () override |
void | updateCamera (v3f pos, v3f dir, f32 fov, v3s16 offset, video::SColor light_color) |
MapSector * | emergeSector (v2s16 p) override |
virtual void | OnRegisterSceneNode () override |
virtual void | render () override |
virtual const aabb3f & | getBoundingBox () const override |
void | getBlocksInViewRange (v3s16 cam_pos_nodes, v3s16 *p_blocks_min, v3s16 *p_blocks_max, float range=-1.0f) |
void | updateDrawList () |
void | touchMapBlocks () |
void | updateDrawListShadow (v3f shadow_light_pos, v3f shadow_light_dir, float radius, float length) |
bool | needsUpdateDrawList () |
void | renderMap (video::IVideoDriver *driver, s32 pass) |
void | renderMapShadows (video::IVideoDriver *driver, const video::SMaterial &material, s32 pass, int frame, int total_frames) |
int | getBackgroundBrightness (float max_d, u32 daylight_factor, int oldvalue, bool *sunlight_seen_result) |
void | renderPostFx (CameraMode cam_mode) |
void | PrintInfo (std::ostream &out) override |
const MapDrawControl & | getControl () const |
f32 | getWantedRange () const |
f32 | getCameraFov () const |
void | onSettingChanged (std::string_view name, bool all) |
Public Member Functions inherited from Map | |
Map (IGameDef *gamedef) | |
virtual | ~Map () |
DISABLE_CLASS_COPY (Map) | |
void | addEventReceiver (MapEventReceiver *event_receiver) |
void | removeEventReceiver (MapEventReceiver *event_receiver) |
void | dispatchEvent (const MapEditEvent &event) |
MapSector * | getSectorNoGenerateNoLock (v2s16 p2d) |
MapSector * | getSectorNoGenerate (v2s16 p2d) |
MapBlock * | getBlockNoCreate (v3s16 p) |
MapBlock * | getBlockNoCreateNoEx (v3s16 p) |
virtual MapBlock * | emergeBlock (v3s16 p, bool create_blank=true) |
const NodeDefManager * | getNodeDefManager () |
bool | isValidPosition (v3s16 p) |
void | setNode (v3s16 p, MapNode n) |
MapNode | getNode (v3s16 p, bool *is_valid_position=NULL) |
virtual void | addNodeAndUpdate (v3s16 p, MapNode n, std::map< v3s16, MapBlock * > &modified_blocks, bool remove_metadata=true) |
void | removeNodeAndUpdate (v3s16 p, std::map< v3s16, MapBlock * > &modified_blocks) |
bool | addNodeWithEvent (v3s16 p, MapNode n, bool remove_metadata=true) |
bool | removeNodeWithEvent (v3s16 p) |
virtual void | beginSave () |
virtual void | endSave () |
virtual void | save (ModifiedState save_level) |
virtual bool | saveBlock (MapBlock *block) |
virtual bool | deleteBlock (v3s16 blockpos) |
void | timerUpdate (float dtime, float unload_timeout, s32 max_loaded_blocks, std::vector< v3s16 > *unloaded_blocks=NULL) |
void | unloadUnreferencedBlocks (std::vector< v3s16 > *unloaded_blocks=NULL) |
void | deleteSectors (std::vector< v2s16 > &list) |
std::vector< v3s16 > | findNodesWithMetadata (v3s16 p1, v3s16 p2) |
NodeMetadata * | getNodeMetadata (v3s16 p) |
bool | setNodeMetadata (v3s16 p, NodeMetadata *meta) |
Sets metadata for a node. | |
void | removeNodeMetadata (v3s16 p) |
NodeTimer | getNodeTimer (v3s16 p) |
void | setNodeTimer (const NodeTimer &t) |
void | removeNodeTimer (v3s16 p) |
template<typename F > | |
void | forEachNodeInArea (v3s16 minp, v3s16 maxp, F func) |
bool | isBlockOccluded (MapBlock *block, v3s16 cam_pos_nodes) |
bool | isBlockOccluded (v3s16 pos_relative, v3s16 cam_pos_nodes, bool simple_check=false) |
Protected Member Functions | |
virtual | ~ClientMap () |
void | reportMetrics (u64 save_time_us, u32 saved_blocks, u32 all_blocks) override |
Protected Member Functions inherited from Map | |
bool | determineAdditionalOcclusionCheck (v3s16 pos_camera, const core::aabbox3d< s16 > &block_bounds, v3s16 &to_check) |
bool | isOccluded (v3s16 pos_camera, v3s16 pos_target, float step, float stepfac, float start_offset, float end_offset, u32 needed_count) |
Private Member Functions | |
bool | isMeshOccluded (MapBlock *mesh_block, u16 mesh_size, v3s16 cam_pos_nodes) |
void | updateTransparentMeshBuffers () |
Private Attributes | |
Client * | m_client |
RenderingEngine * | m_rendering_engine |
aabb3f | m_box |
MapDrawControl & | m_control |
v3f | m_camera_position = v3f(0,0,0) |
v3f | m_camera_direction = v3f(0,0,1) |
f32 | m_camera_fov = M_PI |
v3s16 | m_camera_offset |
video::SColor | m_camera_light_color = video::SColor(0xFFFFFFFF) |
bool | m_needs_update_transparent_meshes = true |
std::map< v3s16, MapBlock *, MapBlockComparer > | m_drawlist |
std::vector< MapBlock * > | m_keeplist |
std::map< v3s16, MapBlock * > | m_drawlist_shadow |
bool | m_needs_update_drawlist |
std::set< v2s16 > | m_last_drawn_sectors |
bool | m_cache_trilinear_filter |
bool | m_cache_bilinear_filter |
bool | m_cache_anistropic_filter |
u16 | m_cache_transparency_sorting_distance |
bool | m_loops_occlusion_culler |
bool | m_enable_raytraced_culling |
Additional Inherited Members | |
Protected Attributes inherited from Map | |
IGameDef * | m_gamedef |
std::set< MapEventReceiver * > | m_event_receivers |
std::unordered_map< v2s16, MapSector * > | m_sectors |
MapSector * | m_sector_cache = nullptr |
v2s16 | m_sector_cache_p |
const NodeDefManager * | m_nodedef |
ClientMap::ClientMap | ( | Client * | client, |
RenderingEngine * | rendering_engine, | ||
MapDrawControl & | control, | ||
s32 | id ) |
References BS, ClientMap_settings, g_settings, m_box, on_settings_changed(), onSettingChanged(), and Settings::registerChangedCallback().
|
protectedvirtual |
References Settings::deregisterAllChangedCallbacks(), and g_settings.
Reimplemented from Map.
References Map::getSectorNoGenerate(), Map::m_gamedef, and Map::m_sectors.
int ClientMap::getBackgroundBrightness | ( | float | max_d, |
u32 | daylight_factor, | ||
int | oldvalue, | ||
bool * | sunlight_seen_result ) |
References ARRLEN, BS, dir(), floatToInt(), g_profiler, MapNode::getLightBlend(), NodeDefManager::getLightingFlags(), Map::getNode(), getVisibleBrightness(), ContentLightingFlags::has_light, m_camera_direction, m_camera_position, Map::m_nodedef, myrand_range(), and SPT_AVG.
void ClientMap::getBlocksInViewRange | ( | v3s16 | cam_pos_nodes, |
v3s16 * | p_blocks_min, | ||
v3s16 * | p_blocks_max, | ||
float | range = -1.0f ) |
References m_control, MAP_BLOCKSIZE, and MapDrawControl::wanted_range.
Referenced by touchMapBlocks(), and updateDrawList().
|
inline |
References m_camera_fov.
Referenced by Client::sendPlayerPos(), and writePlayerPos().
|
inline |
References m_control.
|
inline |
References m_control, and MapDrawControl::wanted_range.
Referenced by Client::sendPlayerPos(), and writePlayerPos().
|
private |
References Map::getBlockNoCreateNoEx(), MapBlock::getPos(), MapBlock::getPosRelative(), Map::isBlockOccluded(), and MAP_BLOCKSIZE.
Referenced by updateDrawList().
|
inlineoverridevirtual |
Reimplemented from Map.
|
inline |
References m_needs_update_drawlist.
|
overridevirtual |
void ClientMap::onSettingChanged | ( | std::string_view | name, |
bool | all ) |
References g_settings, Settings::get(), Settings::getBool(), Settings::getU16(), m_cache_anistropic_filter, m_cache_bilinear_filter, m_cache_transparency_sorting_distance, m_cache_trilinear_filter, m_enable_raytraced_culling, and m_loops_occlusion_culler.
Referenced by ClientMap().
|
overridevirtual |
Reimplemented from Map.
|
overridevirtual |
void ClientMap::renderMap | ( | video::IVideoDriver * | driver, |
s32 | pass ) |
References analyze_block(), MapBlockMesh::animate(), animated, Profiler::avg(), BS, MapBlockMesh::decreaseAnimationForceTimer(), errorstream, g_profiler, RenderingEngine::get_shadow_renderer(), ShadowRenderer::get_texture(), Client::getAnimationTime(), MapBlockMesh::getBoundingRadius(), MapBlockMesh::getBoundingSphereCenter(), Client::getCamera(), Client::getCrackLevel(), Environment::getDayNightRatio(), Client::getEnv(), Camera::getFrustumCuller(), MapBlockMesh::getMesh(), Client::getMeshGrid(), MeshGrid::getMeshPos(), MapBlock::getPosRelative(), MapBlockMesh::getTransparentBuffers(), intToFloat(), ShadowRenderer::is_active(), MapBlockMesh::isAnimationForced(), m_cache_anistropic_filter, m_cache_bilinear_filter, m_cache_trilinear_filter, m_camera_offset, m_camera_position, m_client, m_control, m_drawlist, m_last_drawn_sectors, m_rendering_engine, MAP_BLOCKSIZE, MAX_TILE_LAYERS, MapDrawControl::range_all, setMaterialFilters(), MapDrawControl::show_wireframe, TimeTaker::stop(), ShadowRenderer::TEXTURE_LAYER_SHADOW, updateTransparentMeshBuffers(), and ZoneScoped.
Referenced by render().
void ClientMap::renderMapShadows | ( | video::IVideoDriver * | driver, |
const video::SMaterial & | material, | ||
s32 | pass, | ||
int | frame, | ||
int | total_frames ) |
References Profiler::avg(), BS, g_profiler, g_settings, Settings::getBool(), MapBlockMesh::getMesh(), Client::getMeshGrid(), MeshGrid::getMeshPos(), IShaderSource::getShader(), Client::getShaderSource(), intToFloat(), m_camera_offset, m_client, m_drawlist_shadow, MAP_BLOCKSIZE, MAX_TILE_LAYERS, NDT_ALLFACES, TimeTaker::stop(), and TILE_MATERIAL_WAVING_LEAVES.
Referenced by ShadowRenderer::renderShadowMap().
void ClientMap::renderPostFx | ( | CameraMode | cam_mode | ) |
References MapDrawControl::allow_noclip, BS, CAMERA_MODE_FIRST, floatToInt(), NodeDefManager::get(), Map::getNode(), m_camera_light_color, m_camera_position, m_control, Map::m_nodedef, ContentFeatures::post_effect_color, and ContentFeatures::post_effect_color_shaded.
Referenced by MapPostFxStep::run().
|
overrideprotectedvirtual |
Reimplemented from Map.
References Profiler::avg(), and g_profiler.
void ClientMap::touchMapBlocks | ( | ) |
References Profiler::avg(), BS, floatToInt(), g_profiler, MapSector::getBlocks(), getBlocksInViewRange(), MapBlockMesh::getBoundingRadius(), MapBlockMesh::getBoundingSphereCenter(), MapSector::getPos(), MapBlock::getPosRelative(), intToFloat(), m_camera_position, m_control, m_loops_occlusion_culler, Map::m_sectors, MAP_BLOCKSIZE, MapDrawControl::range_all, MapBlock::resetUsageTimer(), MapSector::size(), SPT_AVG, and MapDrawControl::wanted_range.
References BS, dir(), floatToInt(), getContainerPos(), m_camera_direction, m_camera_fov, m_camera_light_color, m_camera_offset, m_camera_position, m_needs_update_drawlist, m_needs_update_transparent_meshes, and MAP_BLOCKSIZE.
void ClientMap::updateDrawList | ( | ) |
References MapDrawControl::allow_noclip, Profiler::avg(), BS, MeshGrid::cell_size, CONTENT_IGNORE, floatToInt(), g_profiler, NodeDefManager::get(), MapBlockFlags::Chunk::getBits(), Map::getBlockNoCreateNoEx(), MapSector::getBlockNoCreateNoEx(), MapSector::getBlocks(), getBlocksInViewRange(), MapBlockMesh::getBoundingRadius(), MapBlockMesh::getBoundingSphereCenter(), Client::getCamera(), MeshGrid::getCellPos(), MapBlockFlags::getChunk(), getContainerPos(), MapNode::getContent(), Camera::getFrustumCuller(), Client::getMeshGrid(), MeshGrid::getMeshPos(), Map::getNode(), MapBlock::getPos(), MapSector::getPos(), MapBlock::getPosRelative(), Map::getSectorNoGenerate(), intToFloat(), isMeshOccluded(), m_camera_position, m_client, m_control, m_drawlist, m_enable_raytraced_culling, m_keeplist, m_loops_occlusion_culler, m_needs_update_drawlist, Map::m_nodedef, Map::m_sectors, MAP_BLOCKSIZE, MapDrawControl::range_all, MapBlock::refDrop(), MapBlock::refGrab(), MapBlock::resetUsageTimer(), MapSector::size(), SPT_AVG, and MapDrawControl::wanted_range.
void ClientMap::updateDrawListShadow | ( | v3f | shadow_light_pos, |
v3f | shadow_light_dir, | ||
float | radius, | ||
float | length ) |
References Profiler::avg(), BS, g_profiler, MapSector::getBlocks(), MapBlockMesh::getBoundingRadius(), MapBlockMesh::getBoundingSphereCenter(), MapBlock::getPos(), MapBlock::getPosRelative(), intToFloat(), m_drawlist_shadow, Map::m_sectors, MapBlock::refDrop(), MapBlock::refGrab(), MapBlock::resetUsageTimer(), MapSector::size(), and SPT_AVG.
|
private |
References Profiler::avg(), BS, MapBlockMesh::consolidateTransparentBuffers(), g_profiler, MapBlockMesh::getBoundingRadius(), MapBlockMesh::getBoundingSphereCenter(), MapBlock::getPos(), MapBlock::getPosRelative(), MapBlockMesh::getTransparentBuffers(), intToFloat(), m_cache_transparency_sorting_distance, m_camera_position, m_drawlist, m_needs_update_transparent_meshes, SPT_AVG, and MapBlockMesh::updateTransparentBuffers().
Referenced by renderMap().
|
private |
|
private |
Referenced by onSettingChanged(), and renderMap().
|
private |
Referenced by onSettingChanged(), and renderMap().
|
private |
Referenced by onSettingChanged(), and updateTransparentMeshBuffers().
|
private |
Referenced by onSettingChanged(), and renderMap().
Referenced by getBackgroundBrightness(), and updateCamera().
|
private |
Referenced by getCameraFov(), and updateCamera().
|
private |
Referenced by renderPostFx(), and updateCamera().
|
private |
Referenced by renderMap(), renderMapShadows(), and updateCamera().
|
private |
Referenced by renderMap(), renderMapShadows(), and updateDrawList().
|
private |
Referenced by getBlocksInViewRange(), getControl(), getWantedRange(), renderMap(), renderPostFx(), touchMapBlocks(), and updateDrawList().
|
private |
Referenced by renderMap(), updateDrawList(), and updateTransparentMeshBuffers().
Referenced by renderMapShadows(), and updateDrawListShadow().
|
private |
Referenced by onSettingChanged(), and updateDrawList().
|
private |
Referenced by updateDrawList().
|
private |
Referenced by renderMap().
|
private |
Referenced by onSettingChanged(), touchMapBlocks(), and updateDrawList().
|
private |
Referenced by needsUpdateDrawList(), updateCamera(), and updateDrawList().
|
private |
Referenced by updateCamera(), and updateTransparentMeshBuffers().
|
private |
Referenced by renderMap().