3 Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 2.1 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #include "clientmap.h"
22 #include "mapblock_mesh.h"
23 #include <IMaterialRenderer.h>
26 #include "mapsector.h"
31 #include "camera.h" // CameraModes
32 #include "util/mathconstants.h"
33 #include "util/basic_macros.h"
38 MapDrawControl &control,
39 scene::ISceneNode* parent,
40 scene::ISceneManager* mgr,
43 Map(dout_client, client),
44 scene::ISceneNode(parent, mgr, id),
47 m_camera_position(0,0,0),
48 m_camera_direction(0,0,1),
51 m_box = aabb3f(-BS*1000000,-BS*1000000,-BS*1000000,
52 BS*1000000,BS*1000000,BS*1000000);
54 /* TODO: Add a callback function so these can be updated when a setting
55 * changes. At this point in time it doesn't matter (e.g. /set
56 * is documented to change server settings only)
58 * TODO: Local caching of settings is not optimal and should at some stage
59 * be updated to use a global settings object for getting thse values
60 * (as opposed to the this local caching). This can be addressed in
63 m_cache_trilinear_filter = g_settings->getBool("trilinear_filter");
64 m_cache_bilinear_filter = g_settings->getBool("bilinear_filter");
65 m_cache_anistropic_filter = g_settings->getBool("anisotropic_filter");
69 ClientMap::~ClientMap()
71 /*MutexAutoLock lock(mesh_mutex);
80 MapSector * ClientMap::emergeSector(v2s16 p2d)
82 DSTACK(FUNCTION_NAME);
83 // Check that it doesn't exist already
85 return getSectorNoGenerate(p2d);
87 catch(InvalidPositionException &e)
92 ClientMapSector *sector = new ClientMapSector(this, p2d, m_gamedef);
95 //MutexAutoLock lock(m_sector_mutex); // Bulk comment-out
96 m_sectors[p2d] = sector;
102 void ClientMap::OnRegisterSceneNode()
106 SceneManager->registerNodeForRendering(this, scene::ESNRP_SOLID);
107 SceneManager->registerNodeForRendering(this, scene::ESNRP_TRANSPARENT);
110 ISceneNode::OnRegisterSceneNode();
113 static bool isOccluded(Map *map, v3s16 p0, v3s16 p1, float step, float stepfac,
114 float start_off, float end_off, u32 needed_count, INodeDefManager *nodemgr)
116 float d0 = (float)BS * p0.getDistanceFrom(p1);
118 v3f uf = v3f(u0.X, u0.Y, u0.Z) * BS;
120 v3f p0f = v3f(p0.X, p0.Y, p0.Z) * BS;
122 for(float s=start_off; s<d0+end_off; s+=step){
123 v3f pf = p0f + uf * s;
124 v3s16 p = floatToInt(pf, BS);
125 MapNode n = map->getNodeNoEx(p);
126 bool is_transparent = false;
127 const ContentFeatures &f = nodemgr->get(n);
129 is_transparent = (f.visual_solidness != 2);
131 is_transparent = (f.solidness != 2);
134 if(count >= needed_count)
142 void ClientMap::getBlocksInViewRange(v3s16 cam_pos_nodes,
143 v3s16 *p_blocks_min, v3s16 *p_blocks_max)
145 v3s16 box_nodes_d = m_control.wanted_range * v3s16(1, 1, 1);
146 // Define p_nodes_min/max as v3s32 because 'cam_pos_nodes -/+ box_nodes_d'
147 // can exceed the range of v3s16 when a large view range is used near the
150 cam_pos_nodes.X - box_nodes_d.X,
151 cam_pos_nodes.Y - box_nodes_d.Y,
152 cam_pos_nodes.Z - box_nodes_d.Z);
154 cam_pos_nodes.X + box_nodes_d.X,
155 cam_pos_nodes.Y + box_nodes_d.Y,
156 cam_pos_nodes.Z + box_nodes_d.Z);
157 // Take a fair amount as we will be dropping more out later
158 // Umm... these additions are a bit strange but they are needed.
159 *p_blocks_min = v3s16(
160 p_nodes_min.X / MAP_BLOCKSIZE - 3,
161 p_nodes_min.Y / MAP_BLOCKSIZE - 3,
162 p_nodes_min.Z / MAP_BLOCKSIZE - 3);
163 *p_blocks_max = v3s16(
164 p_nodes_max.X / MAP_BLOCKSIZE + 1,
165 p_nodes_max.Y / MAP_BLOCKSIZE + 1,
166 p_nodes_max.Z / MAP_BLOCKSIZE + 1);
169 void ClientMap::updateDrawList(video::IVideoDriver* driver)
171 ScopeProfiler sp(g_profiler, "CM::updateDrawList()", SPT_AVG);
172 g_profiler->add("CM::updateDrawList() count", 1);
174 for (std::map<v3s16, MapBlock*>::iterator i = m_drawlist.begin();
175 i != m_drawlist.end(); ++i) {
176 MapBlock *block = i->second;
181 v3f camera_position = m_camera_position;
182 v3f camera_direction = m_camera_direction;
183 f32 camera_fov = m_camera_fov;
185 // Use a higher fov to accomodate faster camera movements.
186 // Blocks are cropped better when they are drawn.
187 // Or maybe they aren't? Well whatever.
190 v3s16 cam_pos_nodes = floatToInt(camera_position, BS);
193 getBlocksInViewRange(cam_pos_nodes, &p_blocks_min, &p_blocks_max);
195 // Number of blocks in rendering range
196 u32 blocks_in_range = 0;
197 // Number of blocks occlusion culled
198 u32 blocks_occlusion_culled = 0;
199 // Number of blocks in rendering range but don't have a mesh
200 u32 blocks_in_range_without_mesh = 0;
201 // Blocks that had mesh that would have been drawn according to
202 // rendering range (if max blocks limit didn't kick in)
203 u32 blocks_would_have_drawn = 0;
204 // Blocks that were drawn and had a mesh
205 u32 blocks_drawn = 0;
206 // Blocks which had a corresponding meshbuffer for this pass
207 //u32 blocks_had_pass_meshbuf = 0;
208 // Blocks from which stuff was actually drawn
209 //u32 blocks_without_stuff = 0;
210 // Distance to farthest drawn block
211 float farthest_drawn = 0;
213 // No occlusion culling when free_move is on and camera is
215 bool occlusion_culling_enabled = true;
216 if (g_settings->getBool("free_move")) {
217 MapNode n = getNodeNoEx(cam_pos_nodes);
218 if (n.getContent() == CONTENT_IGNORE ||
219 m_nodedef->get(n).solidness == 2)
220 occlusion_culling_enabled = false;
223 for (std::map<v2s16, MapSector*>::iterator si = m_sectors.begin();
224 si != m_sectors.end(); ++si) {
225 MapSector *sector = si->second;
226 v2s16 sp = sector->getPos();
228 if (m_control.range_all == false) {
229 if (sp.X < p_blocks_min.X || sp.X > p_blocks_max.X ||
230 sp.Y < p_blocks_min.Z || sp.Y > p_blocks_max.Z)
234 MapBlockVect sectorblocks;
235 sector->getBlocks(sectorblocks);
238 Loop through blocks in sector
241 u32 sector_blocks_drawn = 0;
243 for (MapBlockVect::iterator i = sectorblocks.begin();
244 i != sectorblocks.end(); ++i) {
245 MapBlock *block = *i;
248 Compare block position to camera position, skip
249 if not seen on display
252 if (block->mesh != NULL)
253 block->mesh->updateCameraOffset(m_camera_offset);
255 float range = 100000 * BS;
256 if (m_control.range_all == false)
257 range = m_control.wanted_range * BS;
260 if (!isBlockInSight(block->getPos(), camera_position,
261 camera_direction, camera_fov, range, &d))
267 Ignore if mesh doesn't exist
269 if (block->mesh == NULL) {
270 blocks_in_range_without_mesh++;
277 v3s16 cpn = block->getPos() * MAP_BLOCKSIZE;
278 cpn += v3s16(MAP_BLOCKSIZE / 2, MAP_BLOCKSIZE / 2, MAP_BLOCKSIZE / 2);
281 float startoff = BS * 1;
282 // The occlusion search of 'isOccluded()' must stop short of the target
283 // point by distance 'endoff' (end offset) to not enter the target mapblock.
284 // For the 8 mapblock corners 'endoff' must therefore be the maximum diagonal
285 // of a mapblock, because we must consider all view angles.
286 // sqrt(1^2 + 1^2 + 1^2) = 1.732
287 float endoff = -BS * MAP_BLOCKSIZE * 1.732050807569;
288 v3s16 spn = cam_pos_nodes;
289 s16 bs2 = MAP_BLOCKSIZE / 2 + 1;
290 // to reduce the likelihood of falsely occluded blocks
291 // require at least two solid blocks
292 // this is a HACK, we should think of a more precise algorithm
293 u32 needed_count = 2;
294 if (occlusion_culling_enabled &&
295 // For the central point of the mapblock 'endoff' can be halved
296 isOccluded(this, spn, cpn,
297 step, stepfac, startoff, endoff / 2.0f, needed_count, m_nodedef) &&
298 isOccluded(this, spn, cpn + v3s16(bs2,bs2,bs2),
299 step, stepfac, startoff, endoff, needed_count, m_nodedef) &&
300 isOccluded(this, spn, cpn + v3s16(bs2,bs2,-bs2),
301 step, stepfac, startoff, endoff, needed_count, m_nodedef) &&
302 isOccluded(this, spn, cpn + v3s16(bs2,-bs2,bs2),
303 step, stepfac, startoff, endoff, needed_count, m_nodedef) &&
304 isOccluded(this, spn, cpn + v3s16(bs2,-bs2,-bs2),
305 step, stepfac, startoff, endoff, needed_count, m_nodedef) &&
306 isOccluded(this, spn, cpn + v3s16(-bs2,bs2,bs2),
307 step, stepfac, startoff, endoff, needed_count, m_nodedef) &&
308 isOccluded(this, spn, cpn + v3s16(-bs2,bs2,-bs2),
309 step, stepfac, startoff, endoff, needed_count, m_nodedef) &&
310 isOccluded(this, spn, cpn + v3s16(-bs2,-bs2,bs2),
311 step, stepfac, startoff, endoff, needed_count, m_nodedef) &&
312 isOccluded(this, spn, cpn + v3s16(-bs2,-bs2,-bs2),
313 step, stepfac, startoff, endoff, needed_count, m_nodedef)) {
314 blocks_occlusion_culled++;
318 // This block is in range. Reset usage timer.
319 block->resetUsageTimer();
321 // Limit block count in case of a sudden increase
322 blocks_would_have_drawn++;
323 if (blocks_drawn >= m_control.wanted_max_blocks &&
324 !m_control.range_all &&
325 d > m_control.wanted_range * BS)
330 m_drawlist[block->getPos()] = block;
332 sector_blocks_drawn++;
334 if (d / BS > farthest_drawn)
335 farthest_drawn = d / BS;
337 } // foreach sectorblocks
339 if (sector_blocks_drawn != 0)
340 m_last_drawn_sectors.insert(sp);
343 m_control.blocks_would_have_drawn = blocks_would_have_drawn;
344 m_control.blocks_drawn = blocks_drawn;
345 m_control.farthest_drawn = farthest_drawn;
347 g_profiler->avg("CM: blocks in range", blocks_in_range);
348 g_profiler->avg("CM: blocks occlusion culled", blocks_occlusion_culled);
349 if (blocks_in_range != 0)
350 g_profiler->avg("CM: blocks in range without mesh (frac)",
351 (float)blocks_in_range_without_mesh / blocks_in_range);
352 g_profiler->avg("CM: blocks drawn", blocks_drawn);
353 g_profiler->avg("CM: farthest drawn", farthest_drawn);
354 g_profiler->avg("CM: wanted max blocks", m_control.wanted_max_blocks);
360 std::vector<scene::IMeshBuffer*> bufs;
363 struct MeshBufListList
365 std::vector<MeshBufList> lists;
372 void add(scene::IMeshBuffer *buf)
374 for(std::vector<MeshBufList>::iterator i = lists.begin();
375 i != lists.end(); ++i){
377 video::SMaterial &m = buf->getMaterial();
379 // comparing a full material is quite expensive so we don't do it if
380 // not even first texture is equal
381 if (l.m.TextureLayer[0].Texture != m.TextureLayer[0].Texture)
385 l.bufs.push_back(buf);
390 l.m = buf->getMaterial();
391 l.bufs.push_back(buf);
396 void ClientMap::renderMap(video::IVideoDriver* driver, s32 pass)
398 DSTACK(FUNCTION_NAME);
400 bool is_transparent_pass = pass == scene::ESNRP_TRANSPARENT;
403 if (pass == scene::ESNRP_SOLID)
404 prefix = "CM: solid: ";
406 prefix = "CM: transparent: ";
409 This is called two times per frame, reset on the non-transparent one
411 if (pass == scene::ESNRP_SOLID)
412 m_last_drawn_sectors.clear();
415 Get time for measuring timeout.
417 Measuring time is very useful for long delays when the
418 machine is swapping a lot.
423 Get animation parameters
425 float animation_time = m_client->getAnimationTime();
426 int crack = m_client->getCrackLevel();
427 u32 daynight_ratio = m_client->getEnv().getDayNightRatio();
429 v3f camera_position = m_camera_position;
430 v3f camera_direction = m_camera_direction;
431 f32 camera_fov = m_camera_fov;
434 Get all blocks and draw all visible ones
437 u32 vertex_count = 0;
438 u32 meshbuffer_count = 0;
440 // For limiting number of mesh animations per frame
441 u32 mesh_animate_count = 0;
442 u32 mesh_animate_count_far = 0;
444 // Blocks that were drawn and had a mesh
445 u32 blocks_drawn = 0;
446 // Blocks which had a corresponding meshbuffer for this pass
447 u32 blocks_had_pass_meshbuf = 0;
448 // Blocks from which stuff was actually drawn
449 u32 blocks_without_stuff = 0;
452 Draw the selected MapBlocks
456 ScopeProfiler sp(g_profiler, prefix + "drawing blocks", SPT_AVG);
458 MeshBufListList drawbufs;
460 for (std::map<v3s16, MapBlock*>::iterator i = m_drawlist.begin();
461 i != m_drawlist.end(); ++i) {
462 MapBlock *block = i->second;
464 // If the mesh of the block happened to get deleted, ignore it
465 if (block->mesh == NULL)
469 if (!isBlockInSight(block->getPos(), camera_position,
470 camera_direction, camera_fov, 100000 * BS, &d))
475 //MutexAutoLock lock(block->mesh_mutex);
476 MapBlockMesh *mapBlockMesh = block->mesh;
477 assert(mapBlockMesh);
478 // Pretty random but this should work somewhat nicely
479 bool faraway = d >= BS * 50;
480 //bool faraway = d >= m_control.wanted_range * BS;
481 if (mapBlockMesh->isAnimationForced() || !faraway ||
482 mesh_animate_count_far < (m_control.range_all ? 200 : 50)) {
483 bool animated = mapBlockMesh->animate(faraway, animation_time,
484 crack, daynight_ratio);
486 mesh_animate_count++;
487 if (animated && faraway)
488 mesh_animate_count_far++;
490 mapBlockMesh->decreaseAnimationForceTimer();
495 Get the meshbuffers of the block
498 //MutexAutoLock lock(block->mesh_mutex);
500 MapBlockMesh *mapBlockMesh = block->mesh;
501 assert(mapBlockMesh);
503 scene::IMesh *mesh = mapBlockMesh->getMesh();
506 u32 c = mesh->getMeshBufferCount();
507 for (u32 i = 0; i < c; i++)
509 scene::IMeshBuffer *buf = mesh->getMeshBuffer(i);
511 buf->getMaterial().setFlag(video::EMF_TRILINEAR_FILTER, m_cache_trilinear_filter);
512 buf->getMaterial().setFlag(video::EMF_BILINEAR_FILTER, m_cache_bilinear_filter);
513 buf->getMaterial().setFlag(video::EMF_ANISOTROPIC_FILTER, m_cache_anistropic_filter);
514 buf->getMaterial().setFlag(video::EMF_WIREFRAME, m_control.show_wireframe);
516 const video::SMaterial& material = buf->getMaterial();
517 video::IMaterialRenderer* rnd =
518 driver->getMaterialRenderer(material.MaterialType);
519 bool transparent = (rnd && rnd->isTransparent());
520 if (transparent == is_transparent_pass) {
521 if (buf->getVertexCount() == 0)
522 errorstream << "Block [" << analyze_block(block)
523 << "] contains an empty meshbuf" << std::endl;
530 std::vector<MeshBufList> &lists = drawbufs.lists;
532 int timecheck_counter = 0;
533 for (std::vector<MeshBufList>::iterator i = lists.begin();
534 i != lists.end(); ++i) {
536 if (timecheck_counter > 50) {
537 timecheck_counter = 0;
539 if (time2 > time1 + 4) {
540 infostream << "ClientMap::renderMap(): "
541 "Rendering takes ages, returning."
547 MeshBufList &list = *i;
549 driver->setMaterial(list.m);
551 for (std::vector<scene::IMeshBuffer*>::iterator j = list.bufs.begin();
552 j != list.bufs.end(); ++j) {
553 scene::IMeshBuffer *buf = *j;
554 driver->drawMeshBuffer(buf);
555 vertex_count += buf->getVertexCount();
562 // Log only on solid pass because values are the same
563 if (pass == scene::ESNRP_SOLID) {
564 g_profiler->avg("CM: animated meshes", mesh_animate_count);
565 g_profiler->avg("CM: animated meshes (far)", mesh_animate_count_far);
568 g_profiler->avg(prefix + "vertices drawn", vertex_count);
569 if (blocks_had_pass_meshbuf != 0)
570 g_profiler->avg(prefix + "meshbuffers per block",
571 (float)meshbuffer_count / (float)blocks_had_pass_meshbuf);
572 if (blocks_drawn != 0)
573 g_profiler->avg(prefix + "empty blocks (frac)",
574 (float)blocks_without_stuff / blocks_drawn);
576 /*infostream<<"renderMap(): is_transparent_pass="<<is_transparent_pass
577 <<", rendered "<<vertex_count<<" vertices."<<std::endl;*/
580 static bool getVisibleBrightness(Map *map, v3f p0, v3f dir, float step,
581 float step_multiplier, float start_distance, float end_distance,
582 INodeDefManager *ndef, u32 daylight_factor, float sunlight_min_d,
583 int *result, bool *sunlight_seen)
585 int brightness_sum = 0;
586 int brightness_count = 0;
587 float distance = start_distance;
590 pf += dir * distance;
592 bool nonlight_seen = false;
593 bool allow_allowing_non_sunlight_propagates = false;
594 bool allow_non_sunlight_propagates = false;
595 // Check content nearly at camera position
597 v3s16 p = floatToInt(p0 /*+ dir * 3*BS*/, BS);
598 MapNode n = map->getNodeNoEx(p);
599 if(ndef->get(n).param_type == CPT_LIGHT &&
600 !ndef->get(n).sunlight_propagates)
601 allow_allowing_non_sunlight_propagates = true;
603 // If would start at CONTENT_IGNORE, start closer
605 v3s16 p = floatToInt(pf, BS);
606 MapNode n = map->getNodeNoEx(p);
607 if(n.getContent() == CONTENT_IGNORE){
609 pf = p0 + dir * 2*newd;
614 for(int i=0; distance < end_distance; i++){
617 step *= step_multiplier;
619 v3s16 p = floatToInt(pf, BS);
620 MapNode n = map->getNodeNoEx(p);
621 if(allow_allowing_non_sunlight_propagates && i == 0 &&
622 ndef->get(n).param_type == CPT_LIGHT &&
623 !ndef->get(n).sunlight_propagates){
624 allow_non_sunlight_propagates = true;
626 if(ndef->get(n).param_type != CPT_LIGHT ||
627 (!ndef->get(n).sunlight_propagates &&
628 !allow_non_sunlight_propagates)){
629 nonlight_seen = true;
635 if(distance >= sunlight_min_d && *sunlight_seen == false
636 && nonlight_seen == false)
637 if(n.getLight(LIGHTBANK_DAY, ndef) == LIGHT_SUN)
638 *sunlight_seen = true;
640 brightness_sum += decode_light(n.getLightBlend(daylight_factor, ndef));
644 if(brightness_count == 0)
646 *result = brightness_sum / brightness_count;
647 /*std::cerr<<"Sampled "<<brightness_count<<" points; result="
648 <<(*result)<<std::endl;*/
652 int ClientMap::getBackgroundBrightness(float max_d, u32 daylight_factor,
653 int oldvalue, bool *sunlight_seen_result)
655 const bool debugprint = false;
656 static v3f z_directions[50] = {
659 static f32 z_offsets[sizeof(z_directions)/sizeof(*z_directions)] = {
662 if(z_directions[0].X < -99){
663 for(u32 i=0; i<sizeof(z_directions)/sizeof(*z_directions); i++){
664 z_directions[i] = v3f(
665 0.01 * myrand_range(-100, 100),
667 0.01 * myrand_range(-100, 100)
669 z_offsets[i] = 0.01 * myrand_range(0,100);
673 std::cerr<<"In goes "<<PP(m_camera_direction)<<", out comes ";
674 int sunlight_seen_count = 0;
675 float sunlight_min_d = max_d*0.8;
676 if(sunlight_min_d > 35*BS)
677 sunlight_min_d = 35*BS;
678 std::vector<int> values;
679 for(u32 i=0; i<sizeof(z_directions)/sizeof(*z_directions); i++){
680 v3f z_dir = z_directions[i];
682 core::CMatrix4<f32> a;
683 a.buildRotateFromTo(v3f(0,1,0), z_dir);
684 v3f dir = m_camera_direction;
689 step = max_d / 35 * 1.5;
690 float off = step * z_offsets[i];
691 bool sunlight_seen_now = false;
692 bool ok = getVisibleBrightness(this, m_camera_position, dir,
693 step, 1.0, max_d*0.6+off, max_d, m_nodedef, daylight_factor,
695 &br, &sunlight_seen_now);
696 if(sunlight_seen_now)
697 sunlight_seen_count++;
700 values.push_back(br);
701 // Don't try too much if being in the sun is clear
702 if(sunlight_seen_count >= 20)
705 int brightness_sum = 0;
706 int brightness_count = 0;
707 std::sort(values.begin(), values.end());
708 u32 num_values_to_use = values.size();
709 if(num_values_to_use >= 10)
710 num_values_to_use -= num_values_to_use/2;
711 else if(num_values_to_use >= 7)
712 num_values_to_use -= num_values_to_use/3;
713 u32 first_value_i = (values.size() - num_values_to_use) / 2;
715 for(u32 i=0; i < first_value_i; i++)
716 std::cerr<<values[i]<<" ";
719 for(u32 i=first_value_i; i < first_value_i+num_values_to_use; i++){
721 std::cerr<<values[i]<<" ";
722 brightness_sum += values[i];
727 for(u32 i=first_value_i+num_values_to_use; i < values.size(); i++)
728 std::cerr<<values[i]<<" ";
731 if(brightness_count == 0){
732 MapNode n = getNodeNoEx(floatToInt(m_camera_position, BS));
733 if(m_nodedef->get(n).param_type == CPT_LIGHT){
734 ret = decode_light(n.getLightBlend(daylight_factor, m_nodedef));
739 /*float pre = (float)brightness_sum / (float)brightness_count;
745 ret = MYMAX(0, MYMIN(255, preint));*/
746 ret = brightness_sum / brightness_count;
749 std::cerr<<"Result: "<<ret<<" sunlight_seen_count="
750 <<sunlight_seen_count<<std::endl;
751 *sunlight_seen_result = (sunlight_seen_count > 0);
755 void ClientMap::renderPostFx(CameraMode cam_mode)
757 // Sadly ISceneManager has no "post effects" render pass, in that case we
758 // could just register for that and handle it in renderMap().
760 MapNode n = getNodeNoEx(floatToInt(m_camera_position, BS));
762 // - If the player is in a solid node, make everything black.
763 // - If the player is in liquid, draw a semi-transparent overlay.
764 // - Do not if player is in third person mode
765 const ContentFeatures& features = m_nodedef->get(n);
766 video::SColor post_effect_color = features.post_effect_color;
767 if(features.solidness == 2 && !(g_settings->getBool("noclip") &&
768 m_client->checkLocalPrivilege("noclip")) &&
769 cam_mode == CAMERA_MODE_FIRST)
771 post_effect_color = video::SColor(255, 0, 0, 0);
773 if (post_effect_color.getAlpha() != 0)
775 // Draw a full-screen rectangle
776 video::IVideoDriver* driver = SceneManager->getVideoDriver();
777 v2u32 ss = driver->getScreenSize();
778 core::rect<s32> rect(0,0, ss.X, ss.Y);
779 driver->draw2DRectangle(post_effect_color, rect);
783 void ClientMap::PrintInfo(std::ostream &out)