Luanti 5.11.0-dev
 
Loading...
Searching...
No Matches
clientmap.cpp File Reference
#include "clientmap.h"
#include "client.h"
#include "client/mesh.h"
#include "mapblock_mesh.h"
#include <IMaterialRenderer.h>
#include <IVideoDriver.h>
#include <matrix4.h>
#include "mapsector.h"
#include "mapblock.h"
#include "nodedef.h"
#include "profiler.h"
#include "settings.h"
#include "camera.h"
#include "util/basic_macros.h"
#include "util/tracy_wrapper.h"
#include "client/renderingengine.h"
#include <queue>
+ Include dependency graph for clientmap.cpp:

Classes

class  MapBlockFlags
 
class  MapBlockFlags::Chunk
 

Functions

static void on_settings_changed (const std::string &name, void *data)
 
template<typename F , typename C >
static u32 transformBuffersToDrawOrder (const MeshBufListMaps::MeshBufList &src, DrawDescriptorList &draw_order, F get_world_pos, C &buffer_trash)
 Copy a list of mesh buffers into the draw order, while potentially merging some.
 
static bool getVisibleBrightness (Map *map, const v3f &p0, v3f dir, float step, float step_multiplier, float start_distance, float end_distance, const NodeDefManager *ndef, u32 daylight_factor, float sunlight_min_d, int *result, bool *sunlight_seen)
 

Variables

static const std::string ClientMap_settings []
 

Function Documentation

◆ getVisibleBrightness()

static bool getVisibleBrightness ( Map * map,
const v3f & p0,
v3f dir,
float step,
float step_multiplier,
float start_distance,
float end_distance,
const NodeDefManager * ndef,
u32 daylight_factor,
float sunlight_min_d,
int * result,
bool * sunlight_seen )
static

References BS, CONTENT_IGNORE, dir(), floatToInt(), MapNode::getContent(), MapNode::getLight(), MapNode::getLightBlend(), NodeDefManager::getLightingFlags(), Map::getNode(), ContentLightingFlags::has_light, LIGHT_SUN, LIGHTBANK_DAY, p(), and ContentLightingFlags::sunlight_propagates.

Referenced by ClientMap::getBackgroundBrightness().

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

◆ on_settings_changed()

static void on_settings_changed ( const std::string & name,
void * data )
static

Referenced by ClientMap::ClientMap().

+ Here is the caller graph for this function:

◆ transformBuffersToDrawOrder()

template<typename F , typename C >
static u32 transformBuffersToDrawOrder ( const MeshBufListMaps::MeshBufList & src,
DrawDescriptorList & draw_order,
F get_world_pos,
C & buffer_trash )
static

Copy a list of mesh buffers into the draw order, while potentially merging some.

Parameters
srcbuffer list
dstdraw order
get_world_posreturns translation for a buffer
buffer_trashoutput container for temporary mesh buffers
Returns
number of buffers that were merged

This is a tradeoff between time spent merging buffers and time spent due to excess drawcalls. Testing has shown that the ideal value is in the low hundreds, as extra CPU work quickly eats up the benefits. In MTG landscape scenes this was found to save around 20-40% of drawcalls.

NOTE: if you attempt to test this with quicktune, it won't give you valid results since HW buffers stick around and Irrlicht handles large amounts inefficiently.

TODO: as a next step we should cache merged meshes, so they do not need to be re-built and can be kept in GPU memory.

References g_settings, RenderingEngine::get_video_driver(), Settings::getU32(), and U16_MAX.

Referenced by ClientMap::renderMap(), and ClientMap::renderMapShadows().

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

Variable Documentation

◆ ClientMap_settings

const std::string ClientMap_settings[]
static
Initial value:
= {
"trilinear_filter",
"bilinear_filter",
"anisotropic_filter",
"transparency_sorting_group_by_buffers",
"transparency_sorting_distance",
"occlusion_culler",
"enable_raytraced_culling",
}

Referenced by ClientMap::ClientMap().