mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-16 02:56:09 -04:00
Make initial block face visibility calculation much faster by avoiding redundant work for most blocks
Reduces initial calculation time from ~11 ms to ~2 ms on my PC, and from ~1300 ms to ~130 ms on the DS
This commit is contained in:
parent
873899d676
commit
c8dfb45973
@ -345,7 +345,13 @@ static void Block_CalcCulling(BlockID block, BlockID other) {
|
||||
cc_bool occludedX, occludedY, occludedZ, bothLiquid;
|
||||
int f;
|
||||
|
||||
/* Some blocks may not cull 'other' block, in which case just skip per-face check */
|
||||
/* Fast path: Full opaque neighbouring blocks will always have all shared faces hidden */
|
||||
if (Blocks.FullOpaque[block] && Blocks.FullOpaque[other]) {
|
||||
Blocks.Hidden[(block * BLOCK_COUNT) + other] = 0x3F;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Some blocks may not cull 'other' block, in which case just skip detailed check */
|
||||
/* e.g. sprite blocks, default leaves, will not cull any other blocks */
|
||||
if (!Block_MightCull(block, other)) {
|
||||
Blocks.Hidden[(block * BLOCK_COUNT) + other] = 0;
|
||||
@ -380,6 +386,7 @@ static void Block_CalcCulling(BlockID block, BlockID other) {
|
||||
/* Updates culling data of all blocks */
|
||||
static void Block_UpdateAllCulling(void) {
|
||||
int block, neighbour;
|
||||
|
||||
for (block = BLOCK_AIR; block < BLOCK_COUNT; block++) {
|
||||
Block_CalcStretch((BlockID)block);
|
||||
for (neighbour = BLOCK_AIR; neighbour < BLOCK_COUNT; neighbour++) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user