Merge branch 'master' into rewrite
This commit is contained in:
@@ -28,6 +28,7 @@ static PyObject *transparent_blocks = NULL;
|
||||
static PyObject *solid_blocks = NULL;
|
||||
static PyObject *fluid_blocks = NULL;
|
||||
static PyObject *nospawn_blocks = NULL;
|
||||
static PyObject *nodata_blocks = NULL;
|
||||
|
||||
PyObject *init_chunk_render(void) {
|
||||
|
||||
@@ -74,6 +75,9 @@ PyObject *init_chunk_render(void) {
|
||||
nospawn_blocks = PyObject_GetAttrString(textures, "nospawn_blocks");
|
||||
if (!nospawn_blocks)
|
||||
return NULL;
|
||||
nodata_blocks = PyObject_GetAttrString(textures, "nodata_blocks");
|
||||
if (!nodata_blocks)
|
||||
return NULL;
|
||||
|
||||
block_properties = calloc(max_blockid, sizeof(unsigned char));
|
||||
for (i = 0; i < max_blockid; i++) {
|
||||
@@ -89,6 +93,8 @@ PyObject *init_chunk_render(void) {
|
||||
block_properties[i] |= 1 << FLUID;
|
||||
if (PySequence_Contains(nospawn_blocks, block))
|
||||
block_properties[i] |= 1 << NOSPAWN;
|
||||
if (PySequence_Contains(nodata_blocks, block))
|
||||
block_properties[i] |= 1 << NODATA;
|
||||
|
||||
Py_DECREF(block);
|
||||
}
|
||||
@@ -502,22 +508,30 @@ chunk_render(PyObject *self, PyObject *args) {
|
||||
}
|
||||
|
||||
/* everything stored here will be a borrowed ref */
|
||||
|
||||
ancilData = getArrayByte3D(state.blockdatas, state.x, state.y, state.z);
|
||||
state.block_data = ancilData;
|
||||
/* block that need pseudo ancildata:
|
||||
* grass, water, glass, chest, restone wire,
|
||||
* ice, fence, portal, iron bars, glass panes */
|
||||
if ((state.block == 2) || (state.block == 9) ||
|
||||
(state.block == 20) || (state.block == 54) ||
|
||||
(state.block == 55) || (state.block == 79) ||
|
||||
(state.block == 85) || (state.block == 90) ||
|
||||
(state.block == 101) || (state.block == 102) ||
|
||||
(state.block == 113)) {
|
||||
ancilData = generate_pseudo_data(&state, ancilData);
|
||||
state.block_pdata = ancilData;
|
||||
} else {
|
||||
|
||||
if (block_has_property(state.block, NODATA)) {
|
||||
/* block shouldn't have data associated with it, set it to 0 */
|
||||
ancilData = 0;
|
||||
state.block_data = 0;
|
||||
state.block_pdata = 0;
|
||||
} else {
|
||||
/* block has associated data, use it */
|
||||
ancilData = getArrayByte3D(state.blockdatas, state.x, state.y, state.z);
|
||||
state.block_data = ancilData;
|
||||
/* block that need pseudo ancildata:
|
||||
* grass, water, glass, chest, restone wire,
|
||||
* ice, fence, portal, iron bars, glass panes */
|
||||
if ((state.block == 2) || (state.block == 9) ||
|
||||
(state.block == 20) || (state.block == 54) ||
|
||||
(state.block == 55) || (state.block == 79) ||
|
||||
(state.block == 85) || (state.block == 90) ||
|
||||
(state.block == 101) || (state.block == 102) ||
|
||||
(state.block == 113)) {
|
||||
ancilData = generate_pseudo_data(&state, ancilData);
|
||||
state.block_pdata = ancilData;
|
||||
} else {
|
||||
state.block_pdata = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* make sure our block info is in-bounds */
|
||||
@@ -526,6 +540,9 @@ chunk_render(PyObject *self, PyObject *args) {
|
||||
|
||||
/* get the texture */
|
||||
t = PyList_GET_ITEM(blockmap, max_data * state.block + ancilData);
|
||||
/* if we don't get a texture, try it again with 0 data */
|
||||
if ((t == NULL || t == Py_None) && ancilData != 0)
|
||||
t = PyList_GET_ITEM(blockmap, max_data * state.block);
|
||||
|
||||
/* if we found a proper texture, render it! */
|
||||
if (t != NULL && t != Py_None)
|
||||
|
||||
@@ -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 16
|
||||
#define OVERVIEWER_EXTENSION_VERSION 18
|
||||
|
||||
/* Python PIL, and numpy headers */
|
||||
#include <Python.h>
|
||||
@@ -102,6 +102,7 @@ typedef enum
|
||||
SOLID,
|
||||
FLUID,
|
||||
NOSPAWN,
|
||||
NODATA,
|
||||
} BlockProperty;
|
||||
/* globals set in init_chunk_render, here because they're used
|
||||
in block_has_property */
|
||||
|
||||
@@ -246,8 +246,8 @@ get_lighting_color(RenderPrimitiveLighting *self, RenderState *state,
|
||||
skylevel = getArrayByte3D(skylight, local_x, local_y, local_z);
|
||||
blocklevel = getArrayByte3D(blocklight, local_x, local_y, local_z);
|
||||
|
||||
/* special half-step handling */
|
||||
if (block == 44 || block == 53 || block == 67 || block == 108 || block == 109) {
|
||||
/* special half-step handling, stairs handling */
|
||||
if (block == 44 || block == 53 || block == 67 || block == 108 || block == 109 || block == 114) {
|
||||
unsigned int upper_block;
|
||||
|
||||
/* stairs and half-blocks take the skylevel from the upper block if it's transparent */
|
||||
|
||||
Reference in New Issue
Block a user