From 70bf8a7fb24bfb0e9aaa09b8211446434f23bcb9 Mon Sep 17 00:00:00 2001 From: Aaron Griffith Date: Wed, 13 Apr 2011 09:14:27 -0400 Subject: [PATCH 01/10] README update for settings.py, --rendermodes --- README.rst | 138 +++++++++++++++++++++++++++-------------------------- 1 file changed, 71 insertions(+), 67 deletions(-) diff --git a/README.rst b/README.rst index 2b07d45..616e8d2 100644 --- a/README.rst +++ b/README.rst @@ -8,14 +8,19 @@ http://github.com/brownan/Minecraft-Overviewer Generates large resolution images of a Minecraft map. In short, this program reads in Minecraft world files and renders very large -resolution images. It performs a similar function to the existing Minecraft -Cartographer program but with a slightly different goal in mind: to generate -large resolution images such that one can zoom in and see details. +resolution images that can be viewed through a Google Maps interface. It +performs a similar function to the existing Minecraft Cartographer program but +with a slightly different goal in mind: to generate large resolution images +such that one can zoom in and see details. See some examples here! http://github.com/brownan/Minecraft-Overviewer/wiki/Map-examples -(To contact me, send me a message on Github) +Further documentation may be found at +https://github.com/brownan/Minecraft-Overviewer/wiki/Documentation + +To contact the developers and other users, go to the site at the top of this +README, or go to #overviewer on irc.freenode.net. Features ======== @@ -56,6 +61,12 @@ If something doesn't work, let me know. Using the Overviewer ==================== +For a quick-start guide, see +https://github.com/brownan/Minecraft-Overviewer/wiki/Quick-Start-Guide + +If you are upgrading from an older Overviewer to the new DTT code, see +https://github.com/brownan/Minecraft-Overviewer/wiki/DTT-Upgrade-Guide + Disclaimers ----------- Before you dive into using this, just be aware that, for large maps, there is a @@ -89,7 +100,7 @@ you can use the Overviewer: texture packs out there. Biome Tinting -~~~~~~~~~~~~~ +------------- With the Halloween update, biomes were added to Minecraft. In order to get biome-accurate tinting, the Overviewer can use biome data produced by the Minecraft Biome Extractor tool. This tool can be downloaded from: @@ -102,12 +113,12 @@ then the Overviewer will use a static tinting for grass and leaves. Compiling the C Extension ------------------------- -The C Extension for Overviewer is no longer optional. In addition to providing -a higher quality image compositing function that looks better on maps with lighting -enabled, it now does the bulk of the rendering. +The C Extension for Overviewer is no longer optional. In addition to +providing a higher quality image compositing function that looks better on +maps with lighting enabled, it now does the bulk of the rendering. -If you downloaded Overviewer as a binary package, this extension will already be -compiled for you. +If you downloaded Overviewer as a binary package, this extension will already +be compiled for you. If you have a C compiler and the Python development libraries set up, you can compile this extension like this:: @@ -119,7 +130,7 @@ look for a package named 'python-dev', 'python-devel' or similar. Also, some Python distributions do not install "Imaging.h" and "ImPlatform.h" properly. If you get errors complaining about them, you can get them from the PIL source, or at . Just put them in -the same directory as "_composite.c". +the same directory as "overviewer.py". For more detailed instructions, check the wiki: https://github.com/brownan/Minecraft-Overviewer/wiki/Build-Instructions @@ -142,12 +153,6 @@ Options -h, --help Shows the list of options and exits ---imgformat=FORMAT - Set the output image format used for the tiles. The default is 'png', - but 'jpg' is also supported. Note that regardless of what you choose, - Overviewer will still use PNG for cached images to avoid recompression - artifacts. - -p PROCS, --processes=PROCS Adding the "-p" option will utilize more cores during processing. This can speed up rendering quite a bit. The default is set to the same @@ -157,34 +162,6 @@ Options python overviewer.py -p 5 --z ZOOM, --zoom=ZOOM - The Overviewer by default will detect how many zoom levels are required - to show your entire map. This option sets it manually. - - *You do not normally need to set this option!* - - This is equivalent to setting the dimensions of the highest zoom level. It - does not actually change how the map is rendered, but rather *how much of - the map is rendered.* (Calling this option "zoom" may be a bit misleading, - I know) - - To be precise, it sets the width and height of the highest zoom level, in - tiles. A zoom level of z means the highest zoom level of your map will be - 2^z by 2^z tiles. - - This option map be useful if you have some outlier chunks causing your map - to be too large, or you want to render a smaller portion of your map, - instead of rendering everything. - - This will render your map with 7 zoom levels:: - - python overviewer.py -z 7 - - Remember that each additional zoom level adds 4 times as many tiles as - the last. This can add up fast, zoom level 10 has over a million tiles. - Tiles with no content will not be rendered, but they still take a small - amount of time to process. - -d, --delete This option changes the mode of execution. No tiles are rendered, and instead, files are deleted. @@ -204,38 +181,65 @@ Options a certain date. Or perhaps you can incrementally update your map by passing in a subset of regions each time. It's up to you! ---lighting - This option enables map lighting, using lighting information stored by - Minecraft inside the chunks. This will make your map prettier, at the cost - of update speed. - - Note that for existing, unlit maps, you may want to clear your cache - (with -d) before updating the map to use lighting. Otherwise, only updated - chunks will have lighting enabled. +--rendermodes=MODE1[,MODE2,...] + Use this option to specify which render mode to use, such as lighting or + night. Use --list-rendermodes to get a list of available rendermodes, and + a short description of each. If you provide more than one mode (separated + by commas), Overviewer will render all of them at once, and provide a + toggle on the resulting map to switch between them. ---night - This option enables --lighting, and renders the world at night. - ---web-assets-hook=HOOK - This option lets you specify a script to run after the web assets have been - copied into the output directory, but before any tile rendering takes - place. This is an ideal time to do any custom postprocessing for markers.js - or other web assets. - - The script should be executable, and it should accept one argument: - the path to the output directory. +--list-rendermodes + List the available render modes, and a short description of each. Settings -------- - You can optionally store settings in a file named settings.py. It is a regular python script, so you can use any python functions or modules you want. -This section needs to be expanded +For a sample settings file, look at 'sample.settings.py'. Note that this file +is not meant to be used directly, but instead it should be used as a +collection of examples to guide writing your own. -For a sample settings file, look at sample.settings.py +Here's a (possibly incomplete) list of available settings, which are available +in settings.py. Note that you can also set command-line options in a similar +way. +imgformat=FORMAT + Set the output image format used for the tiles. The default is 'png', + but 'jpg' is also supported. + +zoom=ZOOM + The Overviewer by default will detect how many zoom levels are required + to show your entire map. This option sets it manually. + + *You do not normally need to set this option!* + + This is equivalent to setting the dimensions of the highest zoom level. It + does not actually change how the map is rendered, but rather *how much of + the map is rendered.* (Calling this option "zoom" may be a bit misleading, + I know) + + To be precise, it sets the width and height of the highest zoom level, in + tiles. A zoom level of z means the highest zoom level of your map will be + 2^z by 2^z tiles. + + This option map be useful if you have some outlier chunks causing your map + to be too large, or you want to render a smaller portion of your map, + instead of rendering everything. + + Remember that each additional zoom level adds 4 times as many tiles as + the last. This can add up fast, zoom level 10 has over a million tiles. + Tiles with no content will not be rendered, but they still take a small + amount of time to process. + +web_assets_hook + This option lets you define a function to run after the web assets have + been copied into the output directory, but before any tile rendering takes + place. This is an ideal time to do any custom postprocessing for + markers.js or other web assets. + + This function should accept one argument: a QuadtreeGen object. Viewing the Results ------------------- From bbf52a77aefdc4c43aeea971bb4907b40f7340c5 Mon Sep 17 00:00:00 2001 From: Aaron Griffith Date: Wed, 13 Apr 2011 11:15:19 -0400 Subject: [PATCH 02/10] added CONTRIBUTORS.rst --- CONTRIBUTORS.rst | 53 ++++++++++++++++++++++++++++++++++++++++++++++++ README.rst | 2 +- 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 CONTRIBUTORS.rst diff --git a/CONTRIBUTORS.rst b/CONTRIBUTORS.rst new file mode 100644 index 0000000..e251b41 --- /dev/null +++ b/CONTRIBUTORS.rst @@ -0,0 +1,53 @@ +============ +Contributors +============ + +This file contains a list of every person who has contributed code to +Overviewer. It was created from the git commit log, and should include +everyone, but we may have missed a few. + +Not currently included (but hopefully soon) are countless testers and bug +reporters that helped fixed the many bugs that have popped up in the course of +development. + +--------------- +Original Author +--------------- + + * Andrew Brown + +------------------------- +Long-term Contributions +------------------------- + +These contributors have made many changes, over a fairly long time span, or +for many different parts of the code. + + * Alejandro Aguilera + * Andrew Chin + * Aaron Griffith + * Alex Headley + * Alex Jurkiewicz + * Xon + +------------------------ +Short-term Contributions +------------------------ + +These contributors have made specific changes for a particular bug fix or +feature. + + * arrai + * Kyle Brantley + * cbarber + * Alex Cline + * Stephen Fluin + * Benjamin Herr + * Ryan Hitchman + * Jenny + * Michael Jensen + * Ryan McCue + * Morlok8k + * Gregory Short + * Sam Steele + * timwolla diff --git a/README.rst b/README.rst index 616e8d2..1d0e9ab 100644 --- a/README.rst +++ b/README.rst @@ -1,7 +1,7 @@ ==================== Minecraft Overviewer ==================== -By Andrew Brown and contributors +By Andrew Brown and contributors (see CONTRIBUTORS.rst). http://github.com/brownan/Minecraft-Overviewer From b89ea8db8c16523de47318f139f468c6e5fdf0fa Mon Sep 17 00:00:00 2001 From: Alejandro Aguilera Date: Wed, 13 Apr 2011 19:53:03 +0200 Subject: [PATCH 03/10] Working cave rendermode without tinting. --- chunk.py | 16 +++- setup.py | 2 +- src/rendermode-cave.c | 190 ++++++++++++++++++++++++++++++++++++++++++ src/rendermodes.c | 1 + src/rendermodes.h | 14 ++++ 5 files changed, 221 insertions(+), 2 deletions(-) create mode 100644 src/rendermode-cave.c diff --git a/chunk.py b/chunk.py index 977fdfa..9db1194 100644 --- a/chunk.py +++ b/chunk.py @@ -284,7 +284,14 @@ class ChunkRenderer(object): self._load_up_right() return self._up_right_blocks up_right_blocks = property(_load_up_right_blocks) - + + def _load_up_right_skylight(self): + """Loads and returns lower-right skylight array""" + if not hasattr(self, "_up_right_skylight"): + self._load_up_right() + return self._up_right_skylight + up_right_skylight = property(_load_up_right_skylight) + def _load_up_left(self): """Loads and sets data from upper-left chunk""" chunk_path = self.world.get_region_path(self.chunkX, self.chunkY - 1) @@ -305,6 +312,13 @@ class ChunkRenderer(object): return self._up_left_blocks up_left_blocks = property(_load_up_left_blocks) + def _load_up_left_skylight(self): + """Loads and returns lower-right skylight array""" + if not hasattr(self, "_up_left_skylight"): + self._load_up_left() + return self._up_left_skylight + up_left_skylight = property(_load_up_left_skylight) + def generate_pseudo_ancildata(self,x,y,z,blockid, north_position = 0 ): """ Generates a pseudo ancillary data for blocks that depend of what are surrounded and don't have ancillary data diff --git a/setup.py b/setup.py index 0a36bcf..32360fb 100644 --- a/setup.py +++ b/setup.py @@ -55,7 +55,7 @@ except: pil_include = [] c_overviewer_files = ['src/main.c', 'src/composite.c', 'src/iterate.c', 'src/endian.c'] -c_overviewer_files += ['src/rendermodes.c', 'src/rendermode-normal.c', 'src/rendermode-lighting.c', 'src/rendermode-night.c', 'src/rendermode-spawn.c'] +c_overviewer_files += ['src/rendermodes.c', 'src/rendermode-normal.c', 'src/rendermode-lighting.c', 'src/rendermode-night.c', 'src/rendermode-spawn.c', 'src/rendermode-cave.c'] c_overviewer_files += ['src/Draw.c'] c_overviewer_includes = ['src/overviewer.h', 'src/rendermodes.h'] setup_kwargs['ext_modules'].append(Extension('c_overviewer', c_overviewer_files, include_dirs=['.', numpy_include] + pil_include, depends=c_overviewer_includes, extra_link_args=[])) diff --git a/src/rendermode-cave.c b/src/rendermode-cave.c new file mode 100644 index 0000000..85d7d93 --- /dev/null +++ b/src/rendermode-cave.c @@ -0,0 +1,190 @@ +/* + * 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 +//~ +//~ /* figures out the black_coeff from a given skylight and blocklight, used in + //~ lighting calculations -- note this is *different* from the one in + //~ rendermode-lighting.c (the "skylight - 11" part) */ +//~ static float calculate_darkness(unsigned char skylight, unsigned char blocklight) { + //~ return 1.0f - powf(0.8f, 15.0 - MAX(blocklight, skylight - 11)); +//~ } + +static int +rendermode_cave_occluded(void *data, RenderState *state) { + int x = state->x, y = state->y, z = state->z; + RenderModeCave* self; + self = (RenderModeCave *)data; + + /* check if the block is touching skylight */ + if (z != 127) { + + if (getArrayByte3D(self->skylight, x, y, z+1) != 0) { + return 1; + } + + if ((x == 15)) { + if (self->up_right_skylight != Py_None) { + if (getArrayByte3D(self->up_right_skylight, 0, y, z) != 0) { + return 1; + } + } + } else { + if (getArrayByte3D(self->skylight, x+1, y, z) != 0) { + return 1; + } + } + + if (x == 0) { + if (self->left_skylight != Py_None) { + if (getArrayByte3D(self->left_skylight, 15, y, z) != 0) { + return 1; + } + } + } else { + if (getArrayByte3D(self->skylight, x-1, y, z) != 0) { + return 1; + } + } + + if (y == 15) { + if (self->right_skylight != Py_None) { + if (getArrayByte3D(self->right_skylight, 0, y, z) != 0) { + return 1; + } + } + } else { + if (getArrayByte3D(self->skylight, x, y+1, z) != 0) { + return 1; + } + } + + if (y == 0) { + if (self->up_left_skylight != Py_None) { + if (getArrayByte3D(self->up_left_skylight, 15, y, z) != 0) { + return 1; + } + } + } else { + if (getArrayByte3D(self->skylight, x, y-1, z) != 0) { + return 1; + } + } + + /* check for normal occlusion */ + /* use ajacent chunks, if not you get blocks spreaded in chunk edges */ + if ( (x == 0) && (y != 15) ) { + if (state->left_blocks != Py_None) { + if (!is_transparent(getArrayByte3D(state->left_blocks, 15, y, z)) && + !is_transparent(getArrayByte3D(state->blocks, x, y, z+1)) && + !is_transparent(getArrayByte3D(state->blocks, x, y+1, z))) { + return 1; + } + } else { + return 1; + } + } + + if ( (x != 0) && (y == 15) ) { + if (state->right_blocks != Py_None) { + if (!is_transparent(getArrayByte3D(state->blocks, x-1, y, z)) && + !is_transparent(getArrayByte3D(state->right_blocks, x, 0, z)) && + !is_transparent(getArrayByte3D(state->blocks, x, y, z+1))) { + return 1; + } + } else { + return 1; + } + } + + if ( (x == 0) && (y == 15) ) { + if ((state->left_blocks != Py_None) && + (state->right_blocks != Py_None)) { + if (!is_transparent(getArrayByte3D(state->left_blocks, 15, y, z)) && + !is_transparent(getArrayByte3D(state->right_blocks, x, 0, z)) && + !is_transparent(getArrayByte3D(state->blocks, x, y, z+1))) { + return 1; + } + } else { + return 1; + } + } + + if ( (x != 0) && (y != 15) && + !is_transparent(getArrayByte3D(state->blocks, x-1, y, z)) && + !is_transparent(getArrayByte3D(state->blocks, x, y, z+1)) && + !is_transparent(getArrayByte3D(state->blocks, x, y+1, z))) { + return 1; + } + + } else { /* if z == 127 don't skip */ + return 1; + } + + return 0; +} + +static int +rendermode_cave_start(void *data, RenderState *state) { + RenderModeCave* self; + self = (RenderModeCave *)data; + + /* first, chain up */ + int ret = rendermode_normal.start(data, state); + if (ret != 0) + return ret; + + /* if there's skylight we are in the surface! */ + self->skylight = PyObject_GetAttrString(state->self, "skylight"); + self->left_skylight = PyObject_GetAttrString(state->self, "left_skylight"); + self->right_skylight = PyObject_GetAttrString(state->self, "right_skylight"); + self->up_left_skylight = PyObject_GetAttrString(state->self, "up_left_skylight"); + self->up_right_skylight = PyObject_GetAttrString(state->self, "up_right_skylight"); + + return 0; +} + +static void +rendermode_cave_finish(void *data, RenderState *state) { + RenderModeCave* self; + self = (RenderModeCave *)data; + + Py_DECREF(self->skylight); + Py_DECREF(self->left_skylight); + Py_DECREF(self->right_skylight); + Py_DECREF(self->up_left_skylight); + Py_DECREF(self->up_right_skylight); + + rendermode_normal.finish(data, state); +} + +static void +rendermode_cave_draw(void *data, RenderState *state, PyObject *src, PyObject *mask) { + /* nothing special to do */ + rendermode_normal.draw(data, state, src, mask); + +} + +RenderModeInterface rendermode_cave = { + "cave", "render only caves in normal mode", + sizeof(RenderModeCave), + rendermode_cave_start, + rendermode_cave_finish, + rendermode_cave_occluded, + rendermode_cave_draw, +}; diff --git a/src/rendermodes.c b/src/rendermodes.c index 0ef5550..08ac140 100644 --- a/src/rendermodes.c +++ b/src/rendermodes.c @@ -26,6 +26,7 @@ static RenderModeInterface *render_modes[] = { &rendermode_lighting, &rendermode_night, &rendermode_spawn, + &rendermode_cave, NULL }; diff --git a/src/rendermodes.h b/src/rendermodes.h index 3027a7f..babc551 100644 --- a/src/rendermodes.h +++ b/src/rendermodes.h @@ -119,4 +119,18 @@ typedef struct { } RenderModeSpawn; extern RenderModeInterface rendermode_spawn; +/* CAVE */ +typedef struct { + /* render blocks with lighting mode */ + RenderModeNormal parent; + /* data used to know where the surface is */ + PyObject *skylight; + PyObject *left_skylight; + PyObject *right_skylight; + PyObject *up_left_skylight; + PyObject *up_right_skylight; + +} RenderModeCave; +extern RenderModeInterface rendermode_cave; + #endif /* __RENDERMODES_H_INCLUDED__ */ From 1fb77cf6e6c15d53bc2bbec95794ce143f93691b Mon Sep 17 00:00:00 2001 From: Alejandro Aguilera Date: Wed, 13 Apr 2011 20:10:44 +0200 Subject: [PATCH 04/10] Add code to remove lakes and seas. --- src/rendermode-cave.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/rendermode-cave.c b/src/rendermode-cave.c index 85d7d93..f532a00 100644 --- a/src/rendermode-cave.c +++ b/src/rendermode-cave.c @@ -27,7 +27,7 @@ static int rendermode_cave_occluded(void *data, RenderState *state) { - int x = state->x, y = state->y, z = state->z; + int x = state->x, y = state->y, z = state->z, dz = 0; RenderModeCave* self; self = (RenderModeCave *)data; @@ -132,10 +132,30 @@ rendermode_cave_occluded(void *data, RenderState *state) { return 1; } - } else { /* if z == 127 don't skip */ + } else { /* if z == 127 skip */ return 1; } + /* check for lakes and seas and don't render them */ + /* at this point of the code the block has no skylight + * and is not occluded, but a deep sea can fool these + * 2 tests */ + + if ((getArrayByte3D(state->blocks, x, y, z) == 9) || + (getArrayByte3D(state->blocks, x, y, z+1) == 9)) { + + for (dz = z+1; dz < 127; dz++) { + if (getArrayByte3D(self->skylight, x, y, dz) != 0) { + return 1; + } + if (getArrayByte3D(state->blocks, x, y, dz) != 9) { + /* we are out of the water! */ + return 0; + } + } + } + + return 0; } From 8165ce979d2f3411b840fd9d0161f230331944c8 Mon Sep 17 00:00:00 2001 From: Alejandro Aguilera Date: Thu, 14 Apr 2011 00:32:12 +0200 Subject: [PATCH 05/10] Add depth tinting to cave rendermode. --- chunk.py | 6 ++++-- src/rendermode-cave.c | 29 +++++++++++++++++++++++++---- src/rendermodes.h | 4 ++++ 3 files changed, 33 insertions(+), 6 deletions(-) diff --git a/chunk.py b/chunk.py index 9db1194..a5766d6 100644 --- a/chunk.py +++ b/chunk.py @@ -472,8 +472,10 @@ def generate_depthcolors(): g = 0 b = 0 for z in range(128): - img = Image.new("RGB", (24,24), (r,g,b)) - depth_colors.append(img) + depth_colors.append(r) + depth_colors.append(g) + depth_colors.append(b) + if z < 32: g += 7 elif z < 64: diff --git a/src/rendermode-cave.c b/src/rendermode-cave.c index f532a00..88a7d83 100644 --- a/src/rendermode-cave.c +++ b/src/rendermode-cave.c @@ -144,12 +144,13 @@ rendermode_cave_occluded(void *data, RenderState *state) { if ((getArrayByte3D(state->blocks, x, y, z) == 9) || (getArrayByte3D(state->blocks, x, y, z+1) == 9)) { - for (dz = z+1; dz < 127; dz++) { + for (dz = z+1; dz < 127; dz++) { /* go up and check for skylight */ if (getArrayByte3D(self->skylight, x, y, dz) != 0) { return 1; } if (getArrayByte3D(state->blocks, x, y, dz) != 9) { - /* we are out of the water! */ + /* we are out of the water! and there's no skylight + * , i.e. is a cave lake or something similar */ return 0; } } @@ -176,6 +177,10 @@ rendermode_cave_start(void *data, RenderState *state) { self->up_left_skylight = PyObject_GetAttrString(state->self, "up_left_skylight"); self->up_right_skylight = PyObject_GetAttrString(state->self, "up_right_skylight"); + /* colors for tinting */ + self->depth_colors = PyObject_GetAttrString(state->chunk, "depth_colors"); + + return 0; } @@ -190,14 +195,30 @@ rendermode_cave_finish(void *data, RenderState *state) { Py_DECREF(self->up_left_skylight); Py_DECREF(self->up_right_skylight); + Py_DECREF(self->depth_colors); + rendermode_normal.finish(data, state); } static void rendermode_cave_draw(void *data, RenderState *state, PyObject *src, PyObject *mask) { - /* nothing special to do */ + RenderModeCave* self; + self = (RenderModeCave *)data; + + int z = state->z; + int r = 0, g = 0, b = 0; + + /* draw the normal block */ rendermode_normal.draw(data, state, src, mask); - + + /* get the colors and tint and tint */ + /* TODO TODO for a nether mode there isn't tinting! */ + r = PyInt_AsLong(PyList_GetItem(self->depth_colors, 0 + z*3)); + g = PyInt_AsLong(PyList_GetItem(self->depth_colors, 1 + z*3)); + b = PyInt_AsLong(PyList_GetItem(self->depth_colors, 2 + z*3)); + + tint_with_mask(state->img, r, g, b, mask, state->imgx, state->imgy, 0, 0); + } RenderModeInterface rendermode_cave = { diff --git a/src/rendermodes.h b/src/rendermodes.h index babc551..70e9c46 100644 --- a/src/rendermodes.h +++ b/src/rendermodes.h @@ -123,12 +123,16 @@ extern RenderModeInterface rendermode_spawn; typedef struct { /* render blocks with lighting mode */ RenderModeNormal parent; + /* data used to know where the surface is */ PyObject *skylight; PyObject *left_skylight; PyObject *right_skylight; PyObject *up_left_skylight; PyObject *up_right_skylight; + + /* colors used for tinting */ + PyObject *depth_colors; } RenderModeCave; extern RenderModeInterface rendermode_cave; From 8fa515fa5986edcc932ef8a56465cbd828006d22 Mon Sep 17 00:00:00 2001 From: Aaron Griffith Date: Thu, 14 Apr 2011 15:12:18 -0400 Subject: [PATCH 06/10] fixes for building cave mode on windows --- src/rendermode-cave.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/rendermode-cave.c b/src/rendermode-cave.c index 88a7d83..ae5b565 100644 --- a/src/rendermode-cave.c +++ b/src/rendermode-cave.c @@ -163,10 +163,11 @@ rendermode_cave_occluded(void *data, RenderState *state) { static int rendermode_cave_start(void *data, RenderState *state) { RenderModeCave* self; + int ret; self = (RenderModeCave *)data; /* first, chain up */ - int ret = rendermode_normal.start(data, state); + ret = rendermode_normal.start(data, state); if (ret != 0) return ret; @@ -203,10 +204,11 @@ rendermode_cave_finish(void *data, RenderState *state) { static void rendermode_cave_draw(void *data, RenderState *state, PyObject *src, PyObject *mask) { RenderModeCave* self; + int z, r, g, b; self = (RenderModeCave *)data; - int z = state->z; - int r = 0, g = 0, b = 0; + z = state->z; + r = 0, g = 0, b = 0; /* draw the normal block */ rendermode_normal.draw(data, state, src, mask); From 0e04becbe9d1cc0bec4bcb08615e3e44ae8197c9 Mon Sep 17 00:00:00 2001 From: Andrew Chin Date: Thu, 14 Apr 2011 21:24:08 -0400 Subject: [PATCH 07/10] Fix missing path component in utils.py --- util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util.py b/util.py index 83f5383..7a0323d 100644 --- a/util.py +++ b/util.py @@ -39,7 +39,7 @@ def findGitVersion(): with open(os.path.join(this_dir,".git","HEAD")) as f: data = f.read().strip() if data.startswith("ref: "): - if not os.path.exists(os.path.join(this_dir,data[5:])): + if not os.path.exists(os.path.join(this_dir, ".git", data[5:])): return data with open(os.path.join(this_dir, ".git", data[5:])) as g: return g.read().strip() From af559f6b880d9fccac1ff34997c5038582f210d0 Mon Sep 17 00:00:00 2001 From: Aaron Griffith Date: Fri, 15 Apr 2011 09:02:39 -0700 Subject: [PATCH 08/10] bumped extension version for cave mode --- src/overviewer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/overviewer.h b/src/overviewer.h index 6eac848..db93a67 100644 --- a/src/overviewer.h +++ b/src/overviewer.h @@ -26,7 +26,7 @@ // increment this value if you've made a change to the c extesion // and want to force users to rebuild -#define OVERVIEWER_EXTENSION_VERSION 3 +#define OVERVIEWER_EXTENSION_VERSION 4 /* Python PIL, and numpy headers */ #include From 1ef6efab8d3e070c88da7a614e4094bd3305fed0 Mon Sep 17 00:00:00 2001 From: Alejandro Aguilera Date: Sat, 16 Apr 2011 13:11:37 +0200 Subject: [PATCH 09/10] Change _iterate_regionfiles to use glob instead of os.walk. The function gets simpler in this way With this you can fool overviewer to render the nether just poiting the "DIM-1" instead the world dir. (and you also need to copy the level.dat to the DIM-1 directory, because nether has not spawn) --- world.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/world.py b/world.py index b1b0ca7..7f7bab1 100644 --- a/world.py +++ b/world.py @@ -16,6 +16,7 @@ import functools import os import os.path +from glob import glob import multiprocessing import Queue import sys @@ -287,12 +288,10 @@ class World(object): p = f.split(".") yield (int(p[1]), int(p[2]), join(self.worlddir, 'region', f)) else: - for dirpath, dirnames, filenames in os.walk(os.path.join(self.worlddir, 'region')): - if not dirnames and filenames and "DIM-1" not in dirpath: - for f in filenames: - if f.startswith("r.") and f.endswith(".mcr"): - p = f.split(".") - yield (int(p[1]), int(p[2]), join(dirpath, f)) + for path in glob(os.path.join(self.worlddir, 'region') + "/r.*.*.mcr"): + dirpath, f = os.path.split(path) + p = f.split(".") + yield (int(p[1]), int(p[2]), join(dirpath, f)) def get_save_dir(): """Returns the path to the local saves directory From f30a5db2a185564ee77a7ffd2aa96b68f6f77a79 Mon Sep 17 00:00:00 2001 From: Aaron Griffith Date: Sat, 16 Apr 2011 11:18:46 -0400 Subject: [PATCH 10/10] destination directory will now be created recursively, if needed --- quadtree.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quadtree.py b/quadtree.py index d4018f6..51cb46e 100644 --- a/quadtree.py +++ b/quadtree.py @@ -69,7 +69,7 @@ class QuadtreeGen(object): # Make the destination dir if not os.path.exists(destdir): - os.mkdir(destdir) + os.makedirs(os.path.abspath(destdir)) if tiledir is None: tiledir = rendermode self.tiledir = tiledir