do not render internal faces for water
This is closer to the old water rendering method, and better allows users to see underwater structures.
This commit is contained in:
@@ -283,22 +283,12 @@ generate_pseudo_data(RenderState *state, unsigned short ancilData) {
|
|||||||
if (get_data(state, BLOCKS, x, y+1, z) == 78)
|
if (get_data(state, BLOCKS, x, y+1, z) == 78)
|
||||||
return 0x10;
|
return 0x10;
|
||||||
return ancilData;
|
return ancilData;
|
||||||
} else if (state->block == 9) { /* water */
|
} else if (state->block == 8 || state->block == 9) { /* water */
|
||||||
|
data = check_adjacent_blocks(state, x, y, z, state->block) ^ 0x0f;
|
||||||
/* an aditional bit for top is added to the 4 bits of check_adjacent_blocks */
|
/* an aditional bit for top is added to the 4 bits of check_adjacent_blocks */
|
||||||
if (ancilData == 0) { /* static water */
|
if (get_data(state, BLOCKS, x, y+1, z) != state->block)
|
||||||
if (get_data(state, BLOCKS, x, y+1, z) == 9) {
|
data |= 0x10;
|
||||||
data = 0;
|
return data;
|
||||||
} else {
|
|
||||||
data = 16;
|
|
||||||
}
|
|
||||||
return data; /* = 0b10000 */
|
|
||||||
} else if ((ancilData > 0) && (ancilData < 8)) { /* flowing water */
|
|
||||||
data = (check_adjacent_blocks(state, x, y, z, state->block) ^ 0x0f) | 0x10;
|
|
||||||
return data;
|
|
||||||
} else if (ancilData >= 8) { /* falling water */
|
|
||||||
data = (check_adjacent_blocks(state, x, y, z, state->block) ^ 0x0f);
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
} else if ((state->block == 20) || (state->block == 79) || (state->block == 95)) { /* glass and ice and stained glass*/
|
} else if ((state->block == 20) || (state->block == 79) || (state->block == 95)) { /* glass and ice and stained glass*/
|
||||||
/* an aditional bit for top is added to the 4 bits of check_adjacent_blocks
|
/* an aditional bit for top is added to the 4 bits of check_adjacent_blocks
|
||||||
* Note that stained glass encodes 16 colors using 4 bits. this pushes us over the 8-bits of an unsigned char,
|
* Note that stained glass encodes 16 colors using 4 bits. this pushes us over the 8-bits of an unsigned char,
|
||||||
@@ -708,7 +698,8 @@ chunk_render(PyObject *self, PyObject *args) {
|
|||||||
* grass, water, glass, chest, restone wire,
|
* grass, water, glass, chest, restone wire,
|
||||||
* ice, fence, portal, iron bars, glass panes,
|
* ice, fence, portal, iron bars, glass panes,
|
||||||
* trapped chests, stairs */
|
* trapped chests, stairs */
|
||||||
if ((state.block == 2) || (state.block == 9) ||
|
if ((state.block == 2) ||
|
||||||
|
(state.block == 8) || (state.block == 9) ||
|
||||||
(state.block == 20) || (state.block == 54) ||
|
(state.block == 20) || (state.block == 54) ||
|
||||||
(state.block == 55) ||
|
(state.block == 55) ||
|
||||||
/* doors */
|
/* doors */
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
// 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 extesion
|
||||||
// and want to force users to rebuild
|
// and want to force users to rebuild
|
||||||
#define OVERVIEWER_EXTENSION_VERSION 53
|
#define OVERVIEWER_EXTENSION_VERSION 54
|
||||||
|
|
||||||
/* Python PIL, and numpy headers */
|
/* Python PIL, and numpy headers */
|
||||||
#include <Python.h>
|
#include <Python.h>
|
||||||
|
|||||||
@@ -1005,16 +1005,11 @@ def saplings(self, blockid, data):
|
|||||||
# bedrock
|
# bedrock
|
||||||
block(blockid=7, top_image="assets/minecraft/textures/block/bedrock.png")
|
block(blockid=7, top_image="assets/minecraft/textures/block/bedrock.png")
|
||||||
|
|
||||||
@material(blockid=8, data=range(16), fluid=True, transparent=True, nospawn=True)
|
# water, glass, and ice (no inner surfaces)
|
||||||
def water(self, blockid, data):
|
|
||||||
watertex = self.load_water()
|
|
||||||
return self.build_block(watertex, watertex)
|
|
||||||
|
|
||||||
# other water, glass, and ice (no inner surfaces)
|
|
||||||
# uses pseudo-ancildata found in iterate.c
|
# uses pseudo-ancildata found in iterate.c
|
||||||
@material(blockid=[9, 20, 79, 95], data=range(512), fluid=(9,), transparent=True, nospawn=True, solid=(79, 20, 95))
|
@material(blockid=[8, 9, 20, 79, 95], data=range(512), fluid=(8, 9), transparent=True, nospawn=True, solid=(79, 20, 95))
|
||||||
def no_inner_surfaces(self, blockid, data):
|
def no_inner_surfaces(self, blockid, data):
|
||||||
if blockid == 9:
|
if blockid == 8 or blockid == 9:
|
||||||
texture = self.load_water()
|
texture = self.load_water()
|
||||||
elif blockid == 20:
|
elif blockid == 20:
|
||||||
texture = self.load_image_texture("assets/minecraft/textures/block/glass.png")
|
texture = self.load_image_texture("assets/minecraft/textures/block/glass.png")
|
||||||
@@ -1024,7 +1019,7 @@ def no_inner_surfaces(self, blockid, data):
|
|||||||
texture = self.load_image_texture("assets/minecraft/textures/block/ice.png")
|
texture = self.load_image_texture("assets/minecraft/textures/block/ice.png")
|
||||||
|
|
||||||
# now that we've used the lower 4 bits to get color, shift down to get the 5 bits that encode face hiding
|
# now that we've used the lower 4 bits to get color, shift down to get the 5 bits that encode face hiding
|
||||||
if blockid != 9: # water doesn't have a shifted pseudodata
|
if not (blockid == 8 or blockid == 9): # water doesn't have a shifted pseudodata
|
||||||
data = data >> 4
|
data = data >> 4
|
||||||
|
|
||||||
if (data & 0b10000) == 16:
|
if (data & 0b10000) == 16:
|
||||||
|
|||||||
Reference in New Issue
Block a user