diff --git a/overviewer_core/src/rendermode-smooth-lighting.c b/overviewer_core/src/rendermode-smooth-lighting.c new file mode 100644 index 0000000..80570b0 --- /dev/null +++ b/overviewer_core/src/rendermode-smooth-lighting.c @@ -0,0 +1,68 @@ +/* + * This file is part of the Minecraft Overviewer. + * + * Minecraft Overviewer is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License as published + * by the Free Software Foundation, either version 3 of the License, or (at + * your option) any later version. + * + * Minecraft Overviewer is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with the Overviewer. If not, see . + */ + +#include "overviewer.h" +#include + +static int +rendermode_smooth_lighting_start(void *data, RenderState *state, PyObject *options) { + RenderModeNight* self; + + /* first, chain up */ + int ret = rendermode_lighting.start(data, state, options); + if (ret != 0) + return ret; + + return 0; +} + +static void +rendermode_smooth_lighting_finish(void *data, RenderState *state) { + /* nothing special to do */ + rendermode_lighting.finish(data, state); +} + +static int +rendermode_smooth_lighting_occluded(void *data, RenderState *state, int x, int y, int z) { + /* no special occlusion here */ + return rendermode_lighting.occluded(data, state, x, y, z); +} + +static int +rendermode_smooth_lighting_hidden(void *data, RenderState *state, int x, int y, int z) { + /* no special hiding here */ + return rendermode_lighting.hidden(data, state, x, y, z); +} + +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); +} + +RenderModeInterface rendermode_smooth_lighting = { + "smooth-lighting", "Smooth Lighting", + "like \"lighting\", except smooth", + NULL, + &rendermode_lighting, + sizeof(RenderModeSmoothLighting), + rendermode_smooth_lighting_start, + rendermode_smooth_lighting_finish, + rendermode_smooth_lighting_occluded, + rendermode_smooth_lighting_hidden, + rendermode_smooth_lighting_draw, +}; diff --git a/overviewer_core/src/rendermodes.c b/overviewer_core/src/rendermodes.c index ff7858d..31acdb7 100644 --- a/overviewer_core/src/rendermodes.c +++ b/overviewer_core/src/rendermodes.c @@ -26,6 +26,7 @@ static RenderModeInterface *render_modes[] = { &rendermode_normal, &rendermode_lighting, &rendermode_night, + &rendermode_smooth_lighting, &rendermode_spawn, &rendermode_cave, &rendermode_mineral, diff --git a/overviewer_core/src/rendermodes.h b/overviewer_core/src/rendermodes.h index 1a145cf..25d774e 100644 --- a/overviewer_core/src/rendermodes.h +++ b/overviewer_core/src/rendermodes.h @@ -190,6 +190,13 @@ typedef struct { } RenderModeNight; extern RenderModeInterface rendermode_night; +/* SMOOTH LIGHTING */ +typedef struct { + /* inherits from lighting */ + RenderModeLighting parent; +} RenderModeSmoothLighting; +extern RenderModeInterface rendermode_smooth_lighting; + /* SPAWN */ typedef struct { /* inherits from overlay */ diff --git a/setup.py b/setup.py index cd1b7d0..a881f9c 100755 --- a/setup.py +++ b/setup.py @@ -149,7 +149,7 @@ except: # used to figure out what files to compile -render_modes = ['normal', 'overlay', 'lighting', 'night', 'spawn', 'cave', 'mineral'] +render_modes = ['normal', 'overlay', 'lighting', 'night', 'smooth-lighting', 'spawn', 'cave', 'mineral'] c_overviewer_files = ['main.c', 'composite.c', 'iterate.c', 'endian.c', 'rendermodes.c'] c_overviewer_files += map(lambda mode: 'rendermode-%s.c' % (mode,), render_modes)