removed lighting/night/spawn bools, now we just reference rendermode directly
This commit is contained in:
6
chunk.py
6
chunk.py
@@ -134,7 +134,7 @@ def render_to_image(chunkcoords, img, imgcoords, quadtreeobj, cave=False, queue=
|
||||
|
||||
If the chunk doesn't exist, return False.
|
||||
Else, returns True."""
|
||||
a = ChunkRenderer(chunkcoords, quadtreeobj.world, quadtreeobj, queue)
|
||||
a = ChunkRenderer(chunkcoords, quadtreeobj.world, quadtreeobj.rendermode, queue)
|
||||
try:
|
||||
a.chunk_render(img, imgcoords[0], imgcoords[1], cave)
|
||||
return True
|
||||
@@ -162,7 +162,7 @@ class NoSuchChunk(Exception):
|
||||
pass
|
||||
|
||||
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.
|
||||
chunkcoors should be a tuple: (chunkX, chunkY)
|
||||
|
||||
@@ -189,7 +189,7 @@ class ChunkRenderer(object):
|
||||
self.chunkY = chunkcoords[1]
|
||||
|
||||
self.world = worldobj
|
||||
self.quadtree = quadtreeobj
|
||||
self.rendermode = rendermode
|
||||
|
||||
if self.world.useBiomeData:
|
||||
# make sure we've at least *tried* to load the color arrays in this process...
|
||||
|
||||
@@ -84,9 +84,6 @@ class QuadtreeGen(object):
|
||||
self.imgformat = imgformat
|
||||
self.optimizeimg = optimizeimg
|
||||
|
||||
self.lighting = rendermode in ("lighting", "night", "spawn")
|
||||
self.night = rendermode in ("night", "spawn")
|
||||
self.spawn = rendermode in ("spawn",)
|
||||
self.rendermode = rendermode
|
||||
|
||||
# Make the destination dir
|
||||
|
||||
@@ -16,16 +16,19 @@
|
||||
*/
|
||||
|
||||
#include "overviewer.h"
|
||||
#include <string.h>
|
||||
|
||||
/* decides which render mode to use */
|
||||
RenderModeInterface *get_render_mode(RenderState *state) {
|
||||
/* default: normal */
|
||||
RenderModeInterface *iface = &rendermode_normal;
|
||||
PyObject *quadtree = PyObject_GetAttrString(state->self, "quadtree");
|
||||
PyObject *lighting = PyObject_GetAttrString(quadtree, "lighting");
|
||||
PyObject *rendermode_py = PyObject_GetAttrString(state->self, "rendermode");
|
||||
const char *rendermode = PyString_AsString(rendermode_py);
|
||||
|
||||
if (PyObject_IsTrue(lighting))
|
||||
if (strcmp(rendermode, "lighting") == 0) {
|
||||
iface = &rendermode_lighting;
|
||||
}
|
||||
|
||||
Py_DECREF(rendermode_py);
|
||||
return iface;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user