0

removed lighting/night/spawn bools, now we just reference rendermode directly

This commit is contained in:
Aaron Griffith
2011-03-23 00:13:17 -04:00
parent f5264e9306
commit ff464bde3c
3 changed files with 9 additions and 9 deletions

View File

@@ -134,7 +134,7 @@ def render_to_image(chunkcoords, img, imgcoords, quadtreeobj, cave=False, queue=
If the chunk doesn't exist, return False. If the chunk doesn't exist, return False.
Else, returns True.""" Else, returns True."""
a = ChunkRenderer(chunkcoords, quadtreeobj.world, quadtreeobj, queue) a = ChunkRenderer(chunkcoords, quadtreeobj.world, quadtreeobj.rendermode, queue)
try: try:
a.chunk_render(img, imgcoords[0], imgcoords[1], cave) a.chunk_render(img, imgcoords[0], imgcoords[1], cave)
return True return True
@@ -162,7 +162,7 @@ class NoSuchChunk(Exception):
pass pass
class ChunkRenderer(object): class ChunkRenderer(object):
def __init__(self, chunkcoords, worldobj, quadtreeobj, queue): def __init__(self, chunkcoords, worldobj, rendermode, queue):
"""Make a new chunk renderer for the given chunk coordinates. """Make a new chunk renderer for the given chunk coordinates.
chunkcoors should be a tuple: (chunkX, chunkY) chunkcoors should be a tuple: (chunkX, chunkY)
@@ -189,7 +189,7 @@ class ChunkRenderer(object):
self.chunkY = chunkcoords[1] self.chunkY = chunkcoords[1]
self.world = worldobj self.world = worldobj
self.quadtree = quadtreeobj self.rendermode = rendermode
if self.world.useBiomeData: if self.world.useBiomeData:
# make sure we've at least *tried* to load the color arrays in this process... # make sure we've at least *tried* to load the color arrays in this process...

View File

@@ -84,9 +84,6 @@ class QuadtreeGen(object):
self.imgformat = imgformat self.imgformat = imgformat
self.optimizeimg = optimizeimg self.optimizeimg = optimizeimg
self.lighting = rendermode in ("lighting", "night", "spawn")
self.night = rendermode in ("night", "spawn")
self.spawn = rendermode in ("spawn",)
self.rendermode = rendermode self.rendermode = rendermode
# Make the destination dir # Make the destination dir

View File

@@ -16,16 +16,19 @@
*/ */
#include "overviewer.h" #include "overviewer.h"
#include <string.h>
/* decides which render mode to use */ /* decides which render mode to use */
RenderModeInterface *get_render_mode(RenderState *state) { RenderModeInterface *get_render_mode(RenderState *state) {
/* default: normal */ /* default: normal */
RenderModeInterface *iface = &rendermode_normal; RenderModeInterface *iface = &rendermode_normal;
PyObject *quadtree = PyObject_GetAttrString(state->self, "quadtree"); PyObject *rendermode_py = PyObject_GetAttrString(state->self, "rendermode");
PyObject *lighting = PyObject_GetAttrString(quadtree, "lighting"); const char *rendermode = PyString_AsString(rendermode_py);
if (PyObject_IsTrue(lighting)) if (strcmp(rendermode, "lighting") == 0) {
iface = &rendermode_lighting; iface = &rendermode_lighting;
}
Py_DECREF(rendermode_py);
return iface; return iface;
} }