Skip to content

Fixed edge-lines and side rendering for snow layers #1959

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion overviewer_core/src/primitives/edge-lines.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,13 @@ edge_lines_draw(void* data, RenderState* state, PyObject* src, PyObject* mask, P
int32_t increment = 0;
if (block_class_is_subset(state->block, (mc_block_t[]){block_wooden_slab, block_stone_slab}, 2) && ((state->block_data & 0x8) == 0)) // half-steps BUT no upsidown half-steps
increment = 6;
else if (block_class_is_subset(state->block, (mc_block_t[]){block_snow_layer, block_unpowered_repeater, block_powered_repeater}, 3)) // snow, redstone repeaters (on and off)
else if (block_class_is_subset(state->block, (mc_block_t[]){block_unpowered_repeater, block_powered_repeater}, 2)) // redstone repeaters (on and off)
increment = 9;
else if (state->block == block_snow_layer) {
uint32_t block_data = get_data(state, DATA, x, y, z);
// height calculation from textures.py -> def snow
increment = (int)((12.0f - (12.0f / 8.0f * (float)block_data)));
}

/* +X side */
side_block = get_data(state, BLOCKS, x + 1, y, z);
Expand Down
9 changes: 7 additions & 2 deletions overviewer_core/textures.py
Original file line number Diff line number Diff line change
Expand Up @@ -3601,8 +3601,6 @@ def draw_east():
# snow
@material(blockid=78, data=list(range(1, 9)), transparent=True, solid=True)
def snow(self, blockid, data):
# still not rendered correctly: data other than 0

tex = self.load_image_texture("assets/minecraft/textures/block/snow.png")

y = 16 - (data * 2)
Expand All @@ -3616,6 +3614,13 @@ def snow(self, blockid, data):
side = self.transform_image_side(sidetex)
otherside = side.transpose(Image.FLIP_LEFT_RIGHT)

sidealpha = side.split()[3]
side = ImageEnhance.Brightness(side).enhance(0.9)
side.putalpha(sidealpha)
othersidealpha = otherside.split()[3]
otherside = ImageEnhance.Brightness(otherside).enhance(0.8)
otherside.putalpha(othersidealpha)

alpha_over(img, side, (0, 6), side)
alpha_over(img, otherside, (12, 6), otherside)
alpha_over(img, top, (0, 12 - int(12 / 8 * data)), top)
Expand Down