0

Fixed lighting issue

If more than one half-step or stair is stacked on top of another, the
bottom steps/stairs will be black in a lighting render.  This is now
fixed
This commit is contained in:
Andrew Chin
2011-08-18 20:40:36 -04:00
parent d19ee7d280
commit 320f7a178c
2 changed files with 9 additions and 4 deletions

View File

@@ -26,7 +26,7 @@
// increment this value if you've made a change to the c extesion // increment this value if you've made a change to the c extesion
// and want to force users to rebuild // and want to force users to rebuild
#define OVERVIEWER_EXTENSION_VERSION 8 #define OVERVIEWER_EXTENSION_VERSION 9
/* Python PIL, and numpy headers */ /* Python PIL, and numpy headers */
#include <Python.h> #include <Python.h>

View File

@@ -185,9 +185,14 @@ get_lighting_coefficient(RenderModeLighting *self, RenderState *state,
/* stairs and half-blocks take the skylevel from the upper block if it's transparent */ /* stairs and half-blocks take the skylevel from the upper block if it's transparent */
if (local_z != 127) { if (local_z != 127) {
upper_block = getArrayByte3D(blocks, local_x, local_y, local_z + 1); int upper_counter = 0;
/* but if the upper_block is one of these special half-steps, we need to look at *its* upper_block */
do {
upper_counter++;
upper_block = getArrayByte3D(blocks, local_x, local_y, local_z + upper_counter);
} while ((upper_block == 44 || upper_block == 54 || upper_block == 67) && local_z < 127);
if (is_transparent(upper_block)) { if (is_transparent(upper_block)) {
skylevel = getArrayByte3D(skylight, local_x, local_y, local_z + 1); skylevel = getArrayByte3D(skylight, local_x, local_y, local_z + upper_counter);
} }
} else { } else {
upper_block = 0; upper_block = 0;
@@ -195,7 +200,7 @@ get_lighting_coefficient(RenderModeLighting *self, RenderState *state,
} }
/* the block has a bad blocklevel, estimate it from neigborhood /* the block has a bad blocklevel, estimate it from neigborhood
/* use given coordinates, no local ones! */ * use given coordinates, no local ones! */
blocklevel = estimate_blocklevel(self, state, x, y, z, NULL); blocklevel = estimate_blocklevel(self, state, x, y, z, NULL);
} }