Render outer block layer separately

isolation_bkp/dynres
Dominik Madarász 2021-11-01 20:59:30 +01:00
parent a7c060660e
commit 28c41baa93
4 changed files with 21 additions and 1 deletions

View File

@ -65,7 +65,7 @@ ActPlaceIceRink(void) {
for (int y = 0; y < 100; y++) { for (int y = 0; y < 100; y++) {
for (int x = 0; x < 100; x++) { for (int x = 0; x < 100; x++) {
world_block_lookup l = world_block_from_realpos((p->x - (x*bs)/2.0f), p->y - (y*bs)/2.0f); world_block_lookup l = world_block_from_realpos((p->x - (x*bs)/2.0f), p->y - (y*bs)/2.0f);
world_chunk_replace_block(l.chunk_id, l.id, watr_id); world_chunk_place_block(l.chunk_id, l.id, watr_id);
} }
} }

View File

@ -22,6 +22,15 @@ void DEBUG_draw_ground_3d(uint64_t key, entity_view * data) {
RenderTexture2D tex = GetChunkTexture(key); RenderTexture2D tex = GetChunkTexture(key);
DrawCubeTexture(tex.texture, (Vector3){x+half_size, 0.0f, y+half_size}, size, 0.01f, size, WHITE); DrawCubeTexture(tex.texture, (Vector3){x+half_size, 0.0f, y+half_size}, size, 0.01f, size, WHITE);
for (size_t ty = 0; ty < view->chunk_size; ty++) {
for (size_t tx = 0; tx < view->chunk_size; tx++) {
uint8_t blk_id = data->outer_blocks[(ty*view->chunk_size)+tx];
if (blk_id != 0) {
DrawCubeTexture(GetBlockImage(blk_id), (Vector3){x + tx*WORLD_BLOCK_SIZE+half_block_size, 32.0f, y + ty*WORLD_BLOCK_SIZE+half_block_size}, 64, 0.01f, 64, WHITE);
}
}
}
for (int by = 0; by < 16; by++) { for (int by = 0; by < 16; by++) {
for (int bx = 0; bx < 16; bx++) { for (int bx = 0; bx < 16; bx++) {
switch (blocks_get_flags(data->blocks[by*16+bx])) { switch (blocks_get_flags(data->blocks[by*16+bx])) {

View File

@ -30,6 +30,15 @@ void DEBUG_draw_ground(uint64_t key, entity_view * data) {
DrawTextEco(TextFormat("%d %d", (int)data->x, (int)data->y), (int16_t)x+15, (int16_t)y+15, 200 , ColorAlpha(BLACK, data->tran_time*zoom_overlay_tran), 0.0); DrawTextEco(TextFormat("%d %d", (int)data->x, (int)data->y), (int16_t)x+15, (int16_t)y+15, 200 , ColorAlpha(BLACK, data->tran_time*zoom_overlay_tran), 0.0);
} }
for (size_t ty = 0; ty < view->chunk_size; ty++) {
for (size_t tx = 0; tx < view->chunk_size; tx++) {
uint8_t blk_id = data->outer_blocks[(ty*view->chunk_size)+tx];
if (blk_id != 0) {
DrawTextureRec(GetBlockImage(blk_id), ASSET_SRC_RECT(), (Vector2){x+tx*WORLD_BLOCK_SIZE, y+ty*WORLD_BLOCK_SIZE}, ColorAlpha(WHITE, data->tran_time));
}
}
}
}break; }break;
default:break; default:break;

View File

@ -121,10 +121,12 @@ void blocks_build_chunk_tex(uint64_t id, uint8_t *chunk_blocks, uint8_t *outer_c
Rectangle dst = {x*blk_dims + half_block, y*blk_dims + half_block, blk_dims, blk_dims}; Rectangle dst = {x*blk_dims + half_block, y*blk_dims + half_block, blk_dims, blk_dims};
DrawTexturePro(blk, src, dst, (Vector2){half_block, half_block}, rot, WHITE); DrawTexturePro(blk, src, dst, (Vector2){half_block, half_block}, rot, WHITE);
#if 0
if (outer_chunk_blocks[(y*view->chunk_size)+x] != 0) { if (outer_chunk_blocks[(y*view->chunk_size)+x] != 0) {
Texture2D blk2 = blocks[outer_chunk_blocks[(y*view->chunk_size)+x]].img; Texture2D blk2 = blocks[outer_chunk_blocks[(y*view->chunk_size)+x]].img;
DrawTexturePro(blk2, src, dst, (Vector2){half_block, half_block}, rot, WHITE); DrawTexturePro(blk2, src, dst, (Vector2){half_block, half_block}, rot, WHITE);
} }
#endif
#endif #endif
} }
} }