From 027419fa5fcdc77a432ffe3d6b67b7493b182c29 Mon Sep 17 00:00:00 2001 From: CounterPillow Date: Tue, 10 May 2011 18:28:25 +0200 Subject: [PATCH] Moved the blockid check further up in the for-loop to increase performance while rendering empty chunks. --- src/iterate.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/iterate.c b/src/iterate.c index 7fd3d3f..9f9be9a 100644 --- a/src/iterate.c +++ b/src/iterate.c @@ -364,6 +364,12 @@ chunk_render(PyObject *self, PyObject *args) { for (state.z = 0; state.z < 128; state.z++) { state.imgy -= 12; + + /* get blockid */ + state.block = getArrayByte3D(blocks_py, state.x, state.y, state.z); + if (state.block == 0) { + continue; + } /* make sure we're rendering inside the image boundaries */ if ((state.imgx >= imgsize0 + 24) || (state.imgx <= -24)) { @@ -373,11 +379,6 @@ chunk_render(PyObject *self, PyObject *args) { continue; } - /* get blockid */ - state.block = getArrayByte3D(blocks_py, state.x, state.y, state.z); - if (state.block == 0) { - continue; - } /* decref'd on replacement *and* at the end of the z for block */ if (blockid) {