diff --git a/overviewer_core/src/iterate.c b/overviewer_core/src/iterate.c index 5639ae9..f28b41a 100644 --- a/overviewer_core/src/iterate.c +++ b/overviewer_core/src/iterate.c @@ -412,11 +412,15 @@ chunk_render(PyObject *self, PyObject *args) { PyObject *tmp; unsigned char ancilData = getArrayByte3D(state.blockdata_expanded, state.x, state.y, state.z); + state.block_data = ancilData; if ((state.block == 2) || (state.block == 9) || (state.block == 20) || (state.block == 54) || (state.block == 55) || (state.block == 85) || (state.block == 90)) { ancilData = generate_pseudo_data(&state, ancilData); + state.block_pdata = ancilData; + } else { + state.block_pdata = 0; } tmp = PyTuple_New(2); diff --git a/overviewer_core/src/overviewer.h b/overviewer_core/src/overviewer.h index a0c5316..e7057e7 100644 --- a/overviewer_core/src/overviewer.h +++ b/overviewer_core/src/overviewer.h @@ -70,6 +70,8 @@ typedef struct { /* the block position and type, and the block array */ int x, y, z; unsigned char block; + unsigned char block_data; + unsigned char block_pdata; PyObject *blockdata_expanded; PyObject *blocks; PyObject *up_left_blocks; diff --git a/overviewer_core/src/rendermode-lighting.c b/overviewer_core/src/rendermode-lighting.c index c515db5..8e073ec 100644 --- a/overviewer_core/src/rendermode-lighting.c +++ b/overviewer_core/src/rendermode-lighting.c @@ -293,7 +293,20 @@ rendermode_lighting_draw(void *data, RenderState *state, PyObject *src, PyObject self = (RenderModeLighting *)data; x = state->x, y = state->y, z = state->z; - if (is_transparent(state->block)) { + if (state->block == 9) { /* special case for water */ + /* looks like we need a new case for lighting, there are + * blocks that are transparent and need per-face shading + * if the face is drawn. */ + if ((state->block_pdata & 16) == 16) { + do_shading_with_mask(self, state, x, y, z+1, self->facemasks[0]); + } + if ((state->block_pdata & 2) == 2) { /* bottom left */ + do_shading_with_mask(self, state, x-1, y, z, self->facemasks[1]); + } + if ((state->block_pdata & 4) == 4) { /* bottom right */ + do_shading_with_mask(self, state, x, y+1, z, self->facemasks[2]); + } + } else if (is_transparent(state->block)) { /* transparent: do shading on whole block */ do_shading_with_mask(self, state, x, y, z, mask_light); } else {