block_class_is_subset implementation pass
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
|
||||
#include "../overviewer.h"
|
||||
#include "../mc_id.h"
|
||||
#include "../block_class.h"
|
||||
#include "biomes.h"
|
||||
|
||||
typedef struct {
|
||||
@@ -95,19 +96,20 @@ base_draw(void *data, RenderState *state, PyObject *src, PyObject *mask, PyObjec
|
||||
*/
|
||||
if (/* grass, but not snowgrass */
|
||||
(state->block == block_grass && get_data(state, BLOCKS, state->x, state->y+1, state->z) != 78) ||
|
||||
/* water */
|
||||
state->block == block_flowing_water || state->block == block_water ||
|
||||
/* leaves */
|
||||
state->block == block_leaves || state->block == block_leaves2 ||
|
||||
block_class_is_subset(state->block,(mc_block_t[]){
|
||||
block_vine,
|
||||
block_waterlily,
|
||||
block_flowing_water,
|
||||
block_water,
|
||||
block_leaves,
|
||||
block_leaves2
|
||||
},
|
||||
6) ||
|
||||
/* tallgrass, but not dead shrubs */
|
||||
(state->block == block_tallgrass && state->block_data != 0) ||
|
||||
/* pumpkin/melon stem, not fully grown. Fully grown stems
|
||||
* get constant brown color (see textures.py) */
|
||||
(((state->block == block_pumpkin_stem) || (state->block == block_melon_stem)) && (state->block_data != 7)) ||
|
||||
/* vines */
|
||||
state->block == block_vine ||
|
||||
/* lily pads */
|
||||
state->block == block_waterlily ||
|
||||
/* doublePlant grass & ferns */
|
||||
(state->block == block_double_plant && (state->block_data == 2 || state->block_data == 3)) ||
|
||||
/* doublePlant grass & ferns tops */
|
||||
@@ -125,18 +127,21 @@ base_draw(void *data, RenderState *state, PyObject *src, PyObject *mask, PyObjec
|
||||
}
|
||||
|
||||
switch (state->block) {
|
||||
case 2:
|
||||
/* grass */
|
||||
case block_grass:
|
||||
case block_tallgrass:
|
||||
case block_pumpkin_stem:
|
||||
case block_melon_stem:
|
||||
case block_vine:
|
||||
case block_waterlily:
|
||||
case block_double_plant:
|
||||
color_table = self->grasscolor;
|
||||
break;
|
||||
case 8:
|
||||
case 9:
|
||||
/* water */
|
||||
case block_flowing_water:
|
||||
case block_water:
|
||||
color_table = self->watercolor;
|
||||
break;
|
||||
case 18:
|
||||
case 161:
|
||||
/* leaves */
|
||||
case block_leaves:
|
||||
case block_leaves2:
|
||||
color_table = self->foliagecolor;
|
||||
if (state->block_data == 2)
|
||||
{
|
||||
@@ -145,30 +150,6 @@ base_draw(void *data, RenderState *state, PyObject *src, PyObject *mask, PyObjec
|
||||
flip_xy = 1;
|
||||
}
|
||||
break;
|
||||
case 31:
|
||||
/* tall grass */
|
||||
color_table = self->grasscolor;
|
||||
break;
|
||||
case 104:
|
||||
/* pumpkin stem */
|
||||
color_table = self->grasscolor;
|
||||
break;
|
||||
case 105:
|
||||
/* melon stem */
|
||||
color_table = self->grasscolor;
|
||||
break;
|
||||
case 106:
|
||||
/* vines */
|
||||
color_table = self->grasscolor;
|
||||
break;
|
||||
case 111:
|
||||
/* lily pads */
|
||||
color_table = self->grasscolor;
|
||||
break;
|
||||
case 175:
|
||||
/* doublePlant grass & ferns */
|
||||
color_table = self->grasscolor;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
};
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
#include "../overviewer.h"
|
||||
#include "../mc_id.h"
|
||||
#include "../block_class.h"
|
||||
|
||||
typedef struct {
|
||||
float opacity;
|
||||
@@ -35,16 +36,17 @@ edge_lines_draw(void *data, RenderState *state, PyObject *src, PyObject *mask, P
|
||||
PrimitiveEdgeLines *self = (PrimitiveEdgeLines *)data;
|
||||
|
||||
/* Draw some edge lines! */
|
||||
if (state->block == block_stone_slab || state->block == block_snow_layer || !is_transparent(state->block)) {
|
||||
if (block_class_is_subset(state->block,(mc_block_t[]){block_stone_slab,block_snow_layer},2)
|
||||
|| !is_transparent(state->block)) {
|
||||
Imaging img_i = imaging_python_to_c(state->img);
|
||||
unsigned char ink[] = {0, 0, 0, 255 * self->opacity};
|
||||
unsigned short side_block;
|
||||
int x = state->x, y = state->y, z = state->z;
|
||||
|
||||
int increment=0;
|
||||
if ((state->block == block_stone_slab || state->block == block_wooden_slab) && ((state->block_data & 0x8) == 0 )) // half-steps BUT no upsidown half-steps
|
||||
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 ((state->block == block_snow_layer) || (state->block == block_unpowered_repeater) || (state->block == block_powered_repeater)) // snow, redstone repeaters (on and off)
|
||||
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)
|
||||
increment=9;
|
||||
|
||||
/* +X side */
|
||||
@@ -52,9 +54,9 @@ edge_lines_draw(void *data, RenderState *state, PyObject *src, PyObject *mask, P
|
||||
if (side_block != state->block && (is_transparent(side_block) || render_mode_hidden(state->rendermode, x+1, y, z)) &&
|
||||
/* WARNING: ugly special case approaching */
|
||||
/* if the block is a slab and the side block is a stair don't draw anything, it can give very ugly results */
|
||||
!((state->block == block_stone_slab || state->block == block_wooden_slab) && ((side_block == block_oak_stairs) || (side_block == block_stone_stairs) || (side_block == block_brick_stairs) ||
|
||||
(side_block == block_stone_brick_stairs) || (side_block == block_nether_brick_stairs) || (side_block == block_sandstone_stairs) || (side_block == block_spruce_stairs) || (side_block == block_birch_stairs) ||
|
||||
(side_block == block_jungle_stairs)))) {
|
||||
!(block_class_is_subset(state->block,(mc_block_t[]){block_wooden_slab,block_stone_slab},2)
|
||||
&& (block_class_is_subset(side_block,block_class_stair,block_class_stair_len))
|
||||
)) {
|
||||
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);
|
||||
}
|
||||
@@ -64,9 +66,10 @@ edge_lines_draw(void *data, RenderState *state, PyObject *src, PyObject *mask, P
|
||||
if (side_block != state->block && (is_transparent(side_block) || render_mode_hidden(state->rendermode, x, y, z-1)) &&
|
||||
/* WARNING: ugly special case approaching */
|
||||
/* if the block is a slab and the side block is a stair don't draw anything, it can give very ugly results */
|
||||
!((state->block == block_stone_slab || state->block == block_wooden_slab) && ((side_block == block_oak_stairs) || (side_block == block_stone_stairs) || (side_block == block_brick_stairs) ||
|
||||
(side_block == block_stone_brick_stairs) || (side_block == block_nether_brick_stairs) || (side_block == block_sandstone_stairs) || (side_block == block_spruce_stairs) || (side_block == block_birch_stairs) ||
|
||||
(side_block == block_jungle_stairs)))) {
|
||||
!(
|
||||
block_class_is_subset(state->block,(mc_block_t[]){block_stone_slab,block_wooden_slab},2)
|
||||
&& (block_class_is_subset(side_block,block_class_stair,block_class_stair_len))
|
||||
)) {
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
#include "../overviewer.h"
|
||||
#include "../mc_id.h"
|
||||
#include "../block_class.h"
|
||||
#include "lighting.h"
|
||||
#include <math.h>
|
||||
|
||||
@@ -139,7 +140,7 @@ estimate_blocklevel(RenderPrimitiveLighting *self, RenderState *state,
|
||||
blocklevel = get_data(state, BLOCKLIGHT, x, y, z);
|
||||
|
||||
/* no longer a guess */
|
||||
if (!(block == block_stone_slab || block == block_oak_stairs || block == block_stone_stairs || block == block_brick_stairs || block == block_stone_brick_stairs || block == block_red_sandstone_stairs || block == block_stone_slab2 || block == block_purpur_slab ) && authoratative) {
|
||||
if (!block_class_is_subset(block,block_class_alt_height,block_class_alt_height_len) && authoratative) {
|
||||
*authoratative = 1;
|
||||
}
|
||||
|
||||
@@ -160,9 +161,7 @@ get_lighting_color(RenderPrimitiveLighting *self, RenderState *state,
|
||||
|
||||
/* special half-step handling, stairs handling */
|
||||
/* Anvil also needs to be here, blockid 145 */
|
||||
if (block == block_stone_slab || block == block_oak_stairs || block == block_stone_stairs || block == block_brick_stairs || block == block_stone_brick_stairs || block == block_nether_brick_stairs ||
|
||||
block == block_sandstone_stairs || block == block_spruce_stairs || block == block_birch_stairs || block == block_jungle_stairs || block == block_anvil || block == block_quartz_stairs ||
|
||||
block == block_acacia_stairs || block == block_dark_oak_stairs || block == block_red_sandstone_stairs || block == block_stone_slab2 || block == block_purpur_stairs || block == block_purpur_slab ) {
|
||||
if ( block_class_is_subset(block,block_class_alt_height,block_class_alt_height_len) || block == block_anvil) {
|
||||
unsigned int upper_block;
|
||||
|
||||
/* stairs and half-blocks take the skylevel from the upper block if it's transparent */
|
||||
@@ -171,10 +170,7 @@ get_lighting_color(RenderPrimitiveLighting *self, RenderState *state,
|
||||
do {
|
||||
upper_counter++;
|
||||
upper_block = get_data(state, BLOCKS, x, y + upper_counter, z);
|
||||
} while (upper_block == block_stone_slab || upper_block == block_oak_stairs || upper_block == block_stone_stairs || upper_block == block_brick_stairs ||
|
||||
upper_block == block_stone_brick_stairs || upper_block == block_nether_brick_stairs || upper_block == block_sandstone_stairs || upper_block == block_spruce_stairs ||
|
||||
upper_block == block_birch_stairs || upper_block == block_jungle_stairs || upper_block == block_quartz_stairs || upper_block == block_acacia_stairs ||
|
||||
upper_block == block_dark_oak_stairs || upper_block == block_red_sandstone_stairs || upper_block == block_stone_slab2 || upper_block == block_purpur_stairs || upper_block == block_purpur_slab );
|
||||
} while (block_class_is_subset(upper_block,block_class_alt_height,block_class_alt_height_len));
|
||||
if (is_transparent(upper_block)) {
|
||||
skylevel = get_data(state, SKYLIGHT, x, y + upper_counter, z);
|
||||
} else {
|
||||
@@ -187,7 +183,7 @@ get_lighting_color(RenderPrimitiveLighting *self, RenderState *state,
|
||||
|
||||
}
|
||||
|
||||
if (block == block_flowing_lava || block == block_lava) {
|
||||
if (block_class_is_subset(block,(mc_block_t[]){block_flowing_lava,block_lava},2)) {
|
||||
/* lava blocks should always be lit! */
|
||||
*r = 255;
|
||||
*g = 255;
|
||||
@@ -306,7 +302,7 @@ lighting_draw(void *data, RenderState *state, PyObject *src, PyObject *mask, PyO
|
||||
self = (RenderPrimitiveLighting *)data;
|
||||
x = state->x, y = state->y, z = state->z;
|
||||
|
||||
if ((state->block == block_flowing_water) || (state->block == block_water)) { /* special case for water */
|
||||
if (block_class_is_subset(state->block,(mc_block_t[]){block_flowing_water,block_water},2)) { /* special case for water */
|
||||
/* looks like we need a new case for lighting, there are
|
||||
* blocks that are transparent for occlusion calculations and
|
||||
* need per-face shading if the face is drawn. */
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
#include "../overviewer.h"
|
||||
#include "../mc_id.h"
|
||||
#include "../block_class.h"
|
||||
#include "nether.h"
|
||||
|
||||
static void
|
||||
@@ -36,7 +37,7 @@ walk_chunk(RenderState *state, RenderPrimitiveNether *data) {
|
||||
|
||||
for (y = NETHER_ROOF-1; y>=0; y--) {
|
||||
id = get_data(state, BLOCKS, x, y - (state->chunky * 16), z);
|
||||
if (id == block_bedrock || id == block_netherrack || id == block_quartz_ore || id == block_lava)
|
||||
if (block_class_is_subset(id,(mc_block_t[]){block_bedrock,block_netherrack,block_quartz_ore,block_lava},4))
|
||||
data->remove_block[x+1][y][z+1] = 1;
|
||||
else
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user