Completely change biome code again
Turns out my previous grasp of how Minecraft does this was wrong. This seems to be the correct way. One side effect is that biome data now has less resolution. One only really notices this when looking at water, for which Minecraft does not even use the water colours for in-game, otherwise I can't really tell a big difference. Fixes #1698.
This commit is contained in:
@@ -29,9 +29,9 @@
|
||||
|
||||
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
|
||||
|
||||
// increment this value if you've made a change to the c extesion
|
||||
// increment this value if you've made a change to the c extension
|
||||
// and want to force users to rebuild
|
||||
#define OVERVIEWER_EXTENSION_VERSION 78
|
||||
#define OVERVIEWER_EXTENSION_VERSION 79
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
@@ -84,10 +84,12 @@ typedef struct {
|
||||
int32_t loaded;
|
||||
/* chunk biome array */
|
||||
PyArrayObject* biomes;
|
||||
/* whether this is a 3d biome array */
|
||||
bool new_biomes;
|
||||
/* all the sections in a given chunk */
|
||||
struct {
|
||||
/* all there is to know about each section */
|
||||
PyArrayObject *blocks, *data, *skylight, *blocklight, *biomes;
|
||||
PyArrayObject *blocks, *data, *skylight, *blocklight;
|
||||
} sections[SECTIONS_PER_CHUNK];
|
||||
} ChunkData;
|
||||
typedef struct {
|
||||
@@ -210,7 +212,7 @@ static inline uint32_t get_data(RenderState* state, DataType type, int32_t x, in
|
||||
data_array = state->chunks[chunkx][chunkz].sections[chunky].skylight;
|
||||
break;
|
||||
case BIOMES:
|
||||
data_array = state->chunks[chunkx][chunkz].sections[chunky].biomes;
|
||||
data_array = state->chunks[chunkx][chunkz].biomes;
|
||||
};
|
||||
|
||||
if (data_array == NULL)
|
||||
@@ -218,8 +220,13 @@ static inline uint32_t get_data(RenderState* state, DataType type, int32_t x, in
|
||||
|
||||
if (type == BLOCKS)
|
||||
return getArrayShort3D(data_array, x, y, z);
|
||||
if (type == BIOMES)
|
||||
return getArrayByte2D(data_array, x, z);
|
||||
if (type == BIOMES) {
|
||||
if (state->chunks[chunkx][chunkz].new_biomes) {
|
||||
return getArrayByte3D(data_array, x / 4, y / 4, z / 4);
|
||||
} else {
|
||||
return getArrayByte2D(data_array, x, z);
|
||||
}
|
||||
}
|
||||
return getArrayByte3D(data_array, x, y, z);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user