0

smooth lighting mode now covers every block with 6 triangles

This commit is contained in:
Aaron Griffith
2011-10-11 21:27:20 -04:00
parent 80a3849a6c
commit b984185f0c

View File

@@ -50,8 +50,50 @@ rendermode_smooth_lighting_hidden(void *data, RenderState *state, int x, int y,
static void static void
rendermode_smooth_lighting_draw(void *data, RenderState *state, PyObject *src, PyObject *mask, PyObject *mask_light) { rendermode_smooth_lighting_draw(void *data, RenderState *state, PyObject *src, PyObject *mask, PyObject *mask_light) {
/* nothing special to do */ int x = state->imgx, y = state->imgy;
rendermode_lighting.draw(data, state, src, mask, mask_light);
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 = { RenderModeInterface rendermode_smooth_lighting = {