0

fixed snow/half-step edge lines

This commit is contained in:
Aaron Griffith
2011-04-03 00:15:48 -04:00
parent 4276176227
commit e5660bf925

View File

@@ -176,33 +176,45 @@ rendermode_normal_draw(void *data, RenderState *state, PyObject *src, PyObject *
/* Draw some edge lines! */ /* Draw some edge lines! */
// draw.line(((imgx+12,imgy+increment), (imgx+22,imgy+5+increment)), fill=(0,0,0), width=1) // draw.line(((imgx+12,imgy+increment), (imgx+22,imgy+5+increment)), fill=(0,0,0), width=1)
if (!is_transparent(state->block)) { if (state->block == 44 || state->block == 78 || !is_transparent(state->block)) {
Imaging img_i = imaging_python_to_c(state->img); Imaging img_i = imaging_python_to_c(state->img);
unsigned char ink[] = {0,0,0,40}; unsigned char ink[] = {0,0,0,40};
int increment=0; int increment=0;
if (state->block == 44) if (state->block == 44) // half-step
increment=6; increment=6;
else if (state->block == 78) else if (state->block == 78) // snow
increment=9; increment=9;
if ((state->x == 15) && (state->up_right_blocks != Py_None) && is_transparent(getArrayByte3D(state->up_right_blocks, 0, state->y, state->z))) { if ((state->x == 15) && (state->up_right_blocks != Py_None)) {
ImagingDrawLine(img_i, state->imgx+12, state->imgy+1+increment, state->imgx+22+1, state->imgy+5+1+increment, &ink, 1); unsigned char side_block = getArrayByte3D(state->up_right_blocks, 0, state->y, state->z);
ImagingDrawLine(img_i, state->imgx+12, state->imgy+increment, state->imgx+22+1, state->imgy+5+increment, &ink, 1); if (side_block != state->block && is_transparent(side_block)) {
} else if ((state->x != 15) && is_transparent(getArrayByte3D(state->blocks, state->x+1, state->y, state->z))) { ImagingDrawLine(img_i, state->imgx+12, state->imgy+1+increment, state->imgx+22+1, state->imgy+5+1+increment, &ink, 1);
ImagingDrawLine(img_i, state->imgx+12, state->imgy+1+increment, state->imgx+22+1, state->imgy+5+1+increment, &ink, 1); ImagingDrawLine(img_i, state->imgx+12, state->imgy+increment, state->imgx+22+1, state->imgy+5+increment, &ink, 1);
ImagingDrawLine(img_i, state->imgx+12, state->imgy+increment, state->imgx+22+1, state->imgy+5+increment, &ink, 1); }
} else if (state->x != 15) {
unsigned char side_block = getArrayByte3D(state->blocks, state->x+1, state->y, state->z);
if (side_block != state->block && is_transparent(side_block)) {
ImagingDrawLine(img_i, state->imgx+12, state->imgy+1+increment, state->imgx+22+1, state->imgy+5+1+increment, &ink, 1);
ImagingDrawLine(img_i, state->imgx+12, state->imgy+increment, state->imgx+22+1, state->imgy+5+increment, &ink, 1);
}
} }
// if y != 0 and blocks[x,y-1,z] == 0 // if y != 0 and blocks[x,y-1,z] == 0
// chunk boundries are annoying // chunk boundries are annoying
if ((state->y == 0) && (state->up_left_blocks != Py_None) && is_transparent(getArrayByte3D(state->up_left_blocks, state->x, 15, state->z))) { if ((state->y == 0) && (state->up_left_blocks != Py_None)) {
ImagingDrawLine(img_i, state->imgx, state->imgy+6+1+increment, state->imgx+12+1, state->imgy+1+increment, &ink, 1); unsigned char side_block = getArrayByte3D(state->up_left_blocks, state->x, 15, state->z);
ImagingDrawLine(img_i, state->imgx, state->imgy+6+increment, state->imgx+12+1, state->imgy+increment, &ink, 1); if (side_block != state->block && is_transparent(side_block)) {
} else if ((state->y != 0) && is_transparent(getArrayByte3D(state->blocks, state->x, state->y-1, state->z))) { ImagingDrawLine(img_i, state->imgx, state->imgy+6+1+increment, state->imgx+12+1, state->imgy+1+increment, &ink, 1);
// draw.line(((imgx,imgy+6+increment), (imgx+12,imgy+increment)), fill=(0,0,0), width=1) ImagingDrawLine(img_i, state->imgx, state->imgy+6+increment, state->imgx+12+1, state->imgy+increment, &ink, 1);
ImagingDrawLine(img_i, state->imgx, state->imgy+6+1+increment, state->imgx+12+1, state->imgy+1+increment, &ink, 1); }
ImagingDrawLine(img_i, state->imgx, state->imgy+6+increment, state->imgx+12+1, state->imgy+increment, &ink, 1); } else if (state->y != 0) {
unsigned char side_block = getArrayByte3D(state->blocks, state->x, state->y-1, state->z);
if (side_block != state->block && is_transparent(side_block)) {
// draw.line(((imgx,imgy+6+increment), (imgx+12,imgy+increment)), fill=(0,0,0), width=1)
ImagingDrawLine(img_i, state->imgx, state->imgy+6+1+increment, state->imgx+12+1, state->imgy+1+increment, &ink, 1);
ImagingDrawLine(img_i, state->imgx, state->imgy+6+increment, state->imgx+12+1, state->imgy+increment, &ink, 1);
}
} }
} }
} }