some lighting tweaks

This commit is contained in:
darkrose 2015-08-11 02:42:10 +10:00
parent 02b65400b7
commit f9bcfa15ab
2 changed files with 8 additions and 3 deletions

View File

@ -1100,6 +1100,7 @@ void ServerEnvironment::step(float dtime)
v3s16 test_p;
MapNode testnode;
u8 water_found = 0; // 1 = flowing, 2 = source
bool ignore_found = false;
for(s16 z=-max_d; water_found < 2 && z<=max_d; z++) {
for(s16 x=-max_d; water_found < 2 && x<=max_d; x++) {
test_p = temp_p + v3s16(x,0,z);
@ -1108,6 +1109,8 @@ void ServerEnvironment::step(float dtime)
water_found = 2;
}else if (testnode.getContent() == CONTENT_WATER) {
water_found = 1;
}else if (testnode.getContent() == CONTENT_IGNORE) {
ignore_found = true;
}
}
}
@ -1140,7 +1143,7 @@ void ServerEnvironment::step(float dtime)
m_map->addNodeWithEvent(test_p,n);
}
}
}else{
}else if (!ignore_found) {
// revert to mud
n.setContent(CONTENT_MUD);
m_map->addNodeWithEvent(p,n);

View File

@ -365,13 +365,15 @@ u8 getSmoothLight(v3s16 p, v3s16 corner, VoxelManipulator &vmanip)
p.Z += 1;
for (u32 i=0; i<8; i++) {
MapNode n = vmanip.getNodeNoEx(p - dirs8[i]);
MapNode n = vmanip.getNodeRO(p - dirs8[i]);
if (
content_features(n).param_type == CPT_LIGHT
) {
dl += n.getLight(LIGHTBANK_DAY);
nl += n.getLight(LIGHTBANK_NIGHT);
light_count++;
if (content_features(n).light_source > 0)
ambient_occlusion -= 2.0;
}else if (content_features(n).draw_type == CDT_CUBELIKE) {
ambient_occlusion += 1.0;
}else if (n.getContent() != CONTENT_IGNORE) {
@ -385,7 +387,7 @@ u8 getSmoothLight(v3s16 p, v3s16 corner, VoxelManipulator &vmanip)
dl /= light_count;
nl /= light_count;
if (ambient_occlusion > 4) {
if (ambient_occlusion > 4.0) {
ambient_occlusion = (ambient_occlusion-4) * 0.4 + 1.0;
dl /= ambient_occlusion;
nl /= ambient_occlusion;