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.
22 #include "irrlichttypes_extrabloated.h"
30 // Overrides limits by drawing everything
31 bool range_all
= false;
32 // Wanted drawing range
33 float wanted_range
= 0.0f
;
34 // show a wire frame for debugging
35 bool show_wireframe
= false;
44 This is the only map class that is able to render itself on screen.
47 class ClientMap
: public Map
, public scene::ISceneNode
52 MapDrawControl
&control
,
56 virtual ~ClientMap() = default;
60 return MAPTYPE_CLIENT
;
68 void updateCamera(const v3f
&pos
, const v3f
&dir
, f32 fov
, const v3s16
&offset
)
70 m_camera_position
= pos
;
71 m_camera_direction
= dir
;
73 m_camera_offset
= offset
;
77 Forcefully get a sector from somewhere
79 MapSector
* emergeSector(v2s16 p
);
81 //void deSerializeSector(v2s16 p2d, std::istream &is);
87 virtual void OnRegisterSceneNode();
91 video::IVideoDriver
* driver
= SceneManager
->getVideoDriver();
92 driver
->setTransform(video::ETS_WORLD
, AbsoluteTransformation
);
93 renderMap(driver
, SceneManager
->getSceneNodeRenderPass());
96 virtual const aabb3f
&getBoundingBox() const
101 void getBlocksInViewRange(v3s16 cam_pos_nodes
,
102 v3s16
*p_blocks_min
, v3s16
*p_blocks_max
);
103 void updateDrawList();
104 void renderMap(video::IVideoDriver
* driver
, s32 pass
);
106 int getBackgroundBrightness(float max_d
, u32 daylight_factor
,
107 int oldvalue
, bool *sunlight_seen_result
);
109 void renderPostFx(CameraMode cam_mode
);
111 // For debug printing
112 virtual void PrintInfo(std::ostream
&out
);
114 const MapDrawControl
& getControl() const { return m_control
; }
115 f32
getCameraFov() const { return m_camera_fov
; }
119 aabb3f m_box
= aabb3f(-BS
* 1000000, -BS
* 1000000, -BS
* 1000000,
120 BS
* 1000000, BS
* 1000000, BS
* 1000000);
122 MapDrawControl
&m_control
;
124 v3f m_camera_position
= v3f(0,0,0);
125 v3f m_camera_direction
= v3f(0,0,1);
126 f32 m_camera_fov
= M_PI
;
127 v3s16 m_camera_offset
;
129 std::map
<v3s16
, MapBlock
*> m_drawlist
;
131 std::set
<v2s16
> m_last_drawn_sectors
;
133 bool m_cache_trilinear_filter
;
134 bool m_cache_bilinear_filter
;
135 bool m_cache_anistropic_filter
;