Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
+GNU Lesser General Public License for more details.
-You should have received a copy of the GNU General Public License along
+You should have received a copy of the GNU Lesser General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "mapblock.h"
#include "profiler.h"
#include "settings.h"
+#include "util/mathconstants.h"
#define PP(x) "("<<(x).X<<","<<(x).Y<<","<<(x).Z<<")"
m_control(control),
m_camera_position(0,0,0),
m_camera_direction(0,0,1),
- m_camera_fov(PI)
+ m_camera_fov(M_PI)
{
m_camera_mutex.Init();
assert(m_camera_mutex.IsInitialized());
Occlusion culling
*/
+ // No occlusion culling when free_move is on and camera is
+ // inside ground
+ bool occlusion_culling_enabled = true;
+ if(g_settings->getBool("free_move")){
+ MapNode n = getNodeNoEx(cam_pos_nodes);
+ if(n.getContent() == CONTENT_IGNORE ||
+ nodemgr->get(n).solidness == 2)
+ occlusion_culling_enabled = false;
+ }
+
v3s16 cpn = block->getPos() * MAP_BLOCKSIZE;
cpn += v3s16(MAP_BLOCKSIZE/2, MAP_BLOCKSIZE/2, MAP_BLOCKSIZE/2);
float step = BS*1;
s16 bs2 = MAP_BLOCKSIZE/2 + 1;
u32 needed_count = 1;
if(
+ occlusion_culling_enabled &&
isOccluded(this, spn, cpn + v3s16(0,0,0),
step, stepfac, startoff, endoff, needed_count, nodemgr) &&
isOccluded(this, spn, cpn + v3s16(bs2,bs2,bs2),
float newd = 2*BS;
pf = p0 + dir * 2*newd;
distance = newd;
+ sunlight_min_d = 0;
}
}
for(int i=0; distance < end_distance; i++){
if(z_directions[0].X < -99){
for(u32 i=0; i<sizeof(z_directions)/sizeof(*z_directions); i++){
z_directions[i] = v3f(
- 0.01 * myrand_range(-80, 80),
+ 0.01 * myrand_range(-100, 100),
1.0,
- 0.01 * myrand_range(-80, 80)
+ 0.01 * myrand_range(-100, 100)
);
z_offsets[i] = 0.01 * myrand_range(0,100);
}