From 240499dc2c766c9d022e6df71e770a116a2c95de Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Sat, 18 Dec 2010 17:46:00 +0200 Subject: before daynight mesh cache --- src/test.cpp | 49 ++++++++++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 21 deletions(-) (limited to 'src/test.cpp') diff --git a/src/test.cpp b/src/test.cpp index 313fe50db..3ed642512 100644 --- a/src/test.cpp +++ b/src/test.cpp @@ -194,7 +194,8 @@ struct TestMapNode // Default values assert(n.d == CONTENT_AIR); - assert(n.getLight() == 0); + assert(n.getLight(LIGHTBANK_DAY) == 0); + assert(n.getLight(LIGHTBANK_NIGHT) == 0); // Transparency n.d = CONTENT_AIR; @@ -431,11 +432,13 @@ struct TestMapBlock // All nodes should have been set to // .d=CONTENT_AIR and .getLight() = 0 for(u16 z=0; z light_sources; // The bottom block is invalid, because we have a shadowing node assert(b.propagateSunlight(light_sources) == false); - assert(b.getNode(v3s16(1,4,0)).getLight() == LIGHT_SUN); - assert(b.getNode(v3s16(1,3,0)).getLight() == LIGHT_SUN); - assert(b.getNode(v3s16(1,2,0)).getLight() == 0); - assert(b.getNode(v3s16(1,1,0)).getLight() == 0); - assert(b.getNode(v3s16(1,0,0)).getLight() == 0); - assert(b.getNode(v3s16(1,2,3)).getLight() == LIGHT_SUN); - assert(b.getFaceLight(p, v3s16(0,1,0)) == LIGHT_SUN); - assert(b.getFaceLight(p, v3s16(0,-1,0)) == 0); + assert(b.getNode(v3s16(1,4,0)).getLight(LIGHTBANK_DAY) == LIGHT_SUN); + assert(b.getNode(v3s16(1,3,0)).getLight(LIGHTBANK_DAY) == LIGHT_SUN); + assert(b.getNode(v3s16(1,2,0)).getLight(LIGHTBANK_DAY) == 0); + assert(b.getNode(v3s16(1,1,0)).getLight(LIGHTBANK_DAY) == 0); + assert(b.getNode(v3s16(1,0,0)).getLight(LIGHTBANK_DAY) == 0); + assert(b.getNode(v3s16(1,2,3)).getLight(LIGHTBANK_DAY) == LIGHT_SUN); + assert(b.getFaceLight(1000, p, v3s16(0,1,0)) == LIGHT_SUN); + assert(b.getFaceLight(1000, p, v3s16(0,-1,0)) == 0); + assert(b.getFaceLight(0, p, v3s16(0,-1,0)) == 0); // According to MapBlock::getFaceLight, // The face on the z+ side should have double-diminished light //assert(b.getFaceLight(p, v3s16(0,0,1)) == diminish_light(diminish_light(LIGHT_MAX))); - assert(b.getFaceLight(p, v3s16(0,0,1)) == diminish_light(LIGHT_MAX)); + // The face on the z+ side should have diminished light + assert(b.getFaceLight(1000, p, v3s16(0,0,1)) == diminish_light(LIGHT_MAX)); } /* Check how the block handles being in between blocks with some non-sunlight @@ -533,7 +540,7 @@ struct TestMapBlock // Make neighbours to exist and set some non-sunlight to them parent.position_valid = true; b.setIsUnderground(true); - parent.node.setLight(LIGHT_MAX/2); + parent.node.setLight(LIGHTBANK_DAY, LIGHT_MAX/2); core::map light_sources; // The block below should be valid because there shouldn't be // sunlight in there either @@ -541,7 +548,7 @@ struct TestMapBlock // Should not touch nodes that are not affected (that is, all of them) //assert(b.getNode(v3s16(1,2,3)).getLight() == LIGHT_SUN); // Should set light of non-sunlighted blocks to 0. - assert(b.getNode(v3s16(1,2,3)).getLight() == 0); + assert(b.getNode(v3s16(1,2,3)).getLight(LIGHTBANK_DAY) == 0); } /* Set up a situation where: @@ -560,7 +567,7 @@ struct TestMapBlock for(u16 x=0; x light_sources; // Bottom block is not valid assert(b.propagateSunlight(light_sources) == false); -- cgit v1.2.3