From b984185f0ce84b6ed39678f1e705d41cc77d40e5 Mon Sep 17 00:00:00 2001 From: Aaron Griffith Date: Tue, 11 Oct 2011 21:27:20 -0400 Subject: [PATCH] smooth lighting mode now covers every block with 6 triangles --- .../src/rendermode-smooth-lighting.c | 46 ++++++++++++++++++- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/overviewer_core/src/rendermode-smooth-lighting.c b/overviewer_core/src/rendermode-smooth-lighting.c index 80570b0..2384440 100644 --- a/overviewer_core/src/rendermode-smooth-lighting.c +++ b/overviewer_core/src/rendermode-smooth-lighting.c @@ -50,8 +50,50 @@ rendermode_smooth_lighting_hidden(void *data, RenderState *state, int x, int y, static void rendermode_smooth_lighting_draw(void *data, RenderState *state, PyObject *src, PyObject *mask, PyObject *mask_light) { - /* nothing special to do */ - rendermode_lighting.draw(data, state, src, mask, mask_light); + int x = state->imgx, y = state->imgy; + + if (is_transparent(state->block)) + { + /* transparent blocks are rendered as usual, with flat lighting */ + rendermode_lighting.draw(data, state, src, mask, mask_light); + return; + } + + /* non-transparent blocks get the special smooth treatment */ + + /* nothing special to do, but we do want to avoid vanilla + * lighting mode draws */ + rendermode_normal.draw(data, state, src, mask, mask_light); + + /* draw a triangle on top of each block */ + draw_triangle(state->img, + x+12, y, 255, 0, 0, + x+24, y+6, 0, 255, 0, + x, y+6, 0, 0, 255); + draw_triangle(state->img, + x+24, y+6, 255, 0, 0, + x, y+6, 0, 255, 0, + x+12, y+12, 0, 0, 255); + + /* left side... */ + draw_triangle(state->img, + x, y+6, 255, 0, 0, + x+12, y+12, 0, 255, 0, + x+12, y+24, 0, 0, 255); + draw_triangle(state->img, + x+12, y+24, 255, 0, 0, + x, y+6, 0, 255, 0, + x, y+18, 0, 0, 255); + + /* right side... */ + draw_triangle(state->img, + x+24, y+6, 255, 0, 0, + x+12, y+12, 0, 255, 0, + x+12, y+24, 0, 0, 255); + draw_triangle(state->img, + x+12, y+24, 255, 0, 0, + x+24, y+6, 0, 255, 0, + x+24, y+18, 0, 0, 255); } RenderModeInterface rendermode_smooth_lighting = {