Luanti 5.10.0-dev
 
Loading...
Searching...
No Matches
ClientMap Class Reference

#include <clientmap.h>

+ Inheritance diagram for ClientMap:
+ Collaboration diagram for ClientMap:

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)
 
MapSectoremergeSector (v2s16 p) override
 
virtual void OnRegisterSceneNode () override
 
virtual void render () override
 
virtual const aabb3fgetBoundingBox () 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 MapDrawControlgetControl () 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)
 
MapSectorgetSectorNoGenerateNoLock (v2s16 p2d)
 
MapSectorgetSectorNoGenerate (v2s16 p2d)
 
MapBlockgetBlockNoCreate (v3s16 p)
 
MapBlockgetBlockNoCreateNoEx (v3s16 p)
 
virtual MapBlockemergeBlock (v3s16 p, bool create_blank=true)
 
const NodeDefManagergetNodeDefManager ()
 
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< v3s16findNodesWithMetadata (v3s16 p1, v3s16 p2)
 
NodeMetadatagetNodeMetadata (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

Clientm_client
 
RenderingEnginem_rendering_engine
 
aabb3f m_box
 
MapDrawControlm_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 *, MapBlockComparerm_drawlist
 
std::vector< MapBlock * > m_keeplist
 
std::map< v3s16, MapBlock * > m_drawlist_shadow
 
bool m_needs_update_drawlist
 
std::set< v2s16m_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
IGameDefm_gamedef
 
std::set< MapEventReceiver * > m_event_receivers
 
std::unordered_map< v2s16, MapSector * > m_sectors
 
MapSectorm_sector_cache = nullptr
 
v2s16 m_sector_cache_p
 
const NodeDefManagerm_nodedef
 

Constructor & Destructor Documentation

◆ ClientMap()

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().

+ Here is the call graph for this function:

◆ ~ClientMap()

ClientMap::~ClientMap ( )
protectedvirtual

References Settings::deregisterAllChangedCallbacks(), and g_settings.

+ Here is the call graph for this function:

Member Function Documentation

◆ emergeSector()

MapSector * ClientMap::emergeSector ( v2s16 p)
overridevirtual

Reimplemented from Map.

References Map::getSectorNoGenerate(), Map::m_gamedef, and Map::m_sectors.

+ Here is the call graph for this function:

◆ getBackgroundBrightness()

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.

+ Here is the call graph for this function:

◆ getBlocksInViewRange()

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().

+ Here is the caller graph for this function:

◆ getBoundingBox()

virtual const aabb3f & ClientMap::getBoundingBox ( ) const
inlineoverridevirtual

References m_box.

◆ getCameraFov()

f32 ClientMap::getCameraFov ( ) const
inline

References m_camera_fov.

Referenced by Client::sendPlayerPos(), and writePlayerPos().

+ Here is the caller graph for this function:

◆ getControl()

const MapDrawControl & ClientMap::getControl ( ) const
inline

References m_control.

◆ getWantedRange()

f32 ClientMap::getWantedRange ( ) const
inline

References m_control, and MapDrawControl::wanted_range.

Referenced by Client::sendPlayerPos(), and writePlayerPos().

+ Here is the caller graph for this function:

◆ isMeshOccluded()

bool ClientMap::isMeshOccluded ( MapBlock * mesh_block,
u16 mesh_size,
v3s16 cam_pos_nodes )
private

References Map::getBlockNoCreateNoEx(), MapBlock::getPos(), MapBlock::getPosRelative(), Map::isBlockOccluded(), and MAP_BLOCKSIZE.

Referenced by updateDrawList().

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

◆ maySaveBlocks()

bool ClientMap::maySaveBlocks ( )
inlineoverridevirtual

Reimplemented from Map.

◆ needsUpdateDrawList()

bool ClientMap::needsUpdateDrawList ( )
inline

◆ OnRegisterSceneNode()

void ClientMap::OnRegisterSceneNode ( )
overridevirtual

◆ onSettingChanged()

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().

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

◆ PrintInfo()

void ClientMap::PrintInfo ( std::ostream & out)
overridevirtual

Reimplemented from Map.

◆ render()

void ClientMap::render ( )
overridevirtual

References renderMap().

+ Here is the call graph for this function:

◆ renderMap()

◆ renderMapShadows()

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().

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

◆ renderPostFx()

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().

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

◆ reportMetrics()

void ClientMap::reportMetrics ( u64 save_time_us,
u32 saved_blocks,
u32 all_blocks )
overrideprotectedvirtual

Reimplemented from Map.

References Profiler::avg(), and g_profiler.

+ Here is the call graph for this function:

◆ touchMapBlocks()

◆ updateCamera()

void ClientMap::updateCamera ( v3f pos,
v3f dir,
f32 fov,
v3s16 offset,
video::SColor light_color )

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.

+ Here is the call graph for this function:

◆ updateDrawList()

◆ updateDrawListShadow()

void ClientMap::updateDrawListShadow ( v3f shadow_light_pos,
v3f shadow_light_dir,
float radius,
float length )

◆ updateTransparentMeshBuffers()

void ClientMap::updateTransparentMeshBuffers ( )
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().

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

Member Data Documentation

◆ m_box

aabb3f ClientMap::m_box
private
Initial value:
= aabb3f(-BS * 1000000, -BS * 1000000, -BS * 1000000,
BS * 1000000, BS * 1000000, BS * 1000000)
#define BS
Definition constants.h:61
core::aabbox3d< f32 > aabb3f
Definition irr_aabb3d.h:11

Referenced by ClientMap(), and getBoundingBox().

◆ m_cache_anistropic_filter

bool ClientMap::m_cache_anistropic_filter
private

Referenced by onSettingChanged(), and renderMap().

◆ m_cache_bilinear_filter

bool ClientMap::m_cache_bilinear_filter
private

Referenced by onSettingChanged(), and renderMap().

◆ m_cache_transparency_sorting_distance

u16 ClientMap::m_cache_transparency_sorting_distance
private

◆ m_cache_trilinear_filter

bool ClientMap::m_cache_trilinear_filter
private

Referenced by onSettingChanged(), and renderMap().

◆ m_camera_direction

v3f ClientMap::m_camera_direction = v3f(0,0,1)
private

◆ m_camera_fov

f32 ClientMap::m_camera_fov = M_PI
private

Referenced by getCameraFov(), and updateCamera().

◆ m_camera_light_color

video::SColor ClientMap::m_camera_light_color = video::SColor(0xFFFFFFFF)
private

Referenced by renderPostFx(), and updateCamera().

◆ m_camera_offset

v3s16 ClientMap::m_camera_offset
private

◆ m_camera_position

◆ m_client

Client* ClientMap::m_client
private

◆ m_control

◆ m_drawlist

std::map<v3s16, MapBlock*, MapBlockComparer> ClientMap::m_drawlist
private

◆ m_drawlist_shadow

std::map<v3s16, MapBlock*> ClientMap::m_drawlist_shadow
private

◆ m_enable_raytraced_culling

bool ClientMap::m_enable_raytraced_culling
private

Referenced by onSettingChanged(), and updateDrawList().

◆ m_keeplist

std::vector<MapBlock*> ClientMap::m_keeplist
private

Referenced by updateDrawList().

◆ m_last_drawn_sectors

std::set<v2s16> ClientMap::m_last_drawn_sectors
private

Referenced by renderMap().

◆ m_loops_occlusion_culler

bool ClientMap::m_loops_occlusion_culler
private

◆ m_needs_update_drawlist

bool ClientMap::m_needs_update_drawlist
private

◆ m_needs_update_transparent_meshes

bool ClientMap::m_needs_update_transparent_meshes = true
private

◆ m_rendering_engine

RenderingEngine* ClientMap::m_rendering_engine
private

Referenced by renderMap().


The documentation for this class was generated from the following files: