very minorly optimise BlockInfo.CalcCulling

This commit is contained in:
UnknownShadow200 2018-03-14 22:06:03 +11:00
parent 3cea320efc
commit 9118b55e87
5 changed files with 6 additions and 10 deletions

View File

@ -328,7 +328,7 @@ void Block_RecalculateBB(BlockID block) {
void Block_CalcStretch(BlockID block) {
/* faces which can be stretched on X axis */
if (Block_MinBB[block].X == 0.0f && Block_MaxBB[block].X == 1.0f) {
Block_CanStretch[block] |= 0x3C;
Block_CanStretch[block] |= 0x3C;
} else {
Block_CanStretch[block] &= 0xC3; /* ~0x3C */
}
@ -362,7 +362,7 @@ bool Block_IsHidden(BlockID block, BlockID other) {
bool canSkip = (bType == COLLIDE_SOLID && oType == COLLIDE_SOLID) || bType != COLLIDE_SOLID;
return canSkip;
}
void Block_CalcCulling(BlockID block, BlockID other) {
if (!Block_IsHidden(block, other)) {
/* Block is not hidden at all, so we can just entirely skip per-face check */
@ -393,7 +393,7 @@ void Block_CalcCulling(BlockID block, BlockID other) {
}
bool Block_IsFaceHidden(BlockID block, BlockID other, Face face) {
return (Block_Hidden[(block * BLOCK_COUNT) | other] & (1 << face)) != 0;
return (Block_Hidden[(block * BLOCK_COUNT) | other] & (1 << face)) != 0;
}
void Block_UpdateCullingAll(void) {

View File

@ -84,7 +84,7 @@
#define BLOCK_CPE_COUNT (BLOCK_MAX_CPE + 1)
#if USE16_BIT
#define BLOCK_MAX_DEFINED 0x3FF
#define BLOCK_MAX_DEFINED 0x3FF
#else
#define BLOCK_MAX_DEFINED 0xFF
#endif

View File

@ -152,8 +152,8 @@ void Builder_Stretch(Int32 x1, Int32 y1, Int32 z1) {
}
Builder_X = x; Builder_Y = y; Builder_Z = z;
Builder_FullBright = Block_FullBright[b];
UInt32 tileIdx = b * BLOCK_COUNT;
Builder_FullBright = Block_FullBright[b];
UInt32 tileIdx = b * BLOCK_COUNT;
/* All of these function calls are inlined as they can be called tens of millions to hundreds of millions of times. */
if (Builder_Counts[index] == 0 ||

View File

@ -216,7 +216,6 @@
<ClInclude Include="MapGenerator.h" />
<ClInclude Include="MapRenderer.h" />
<ClInclude Include="ModelCache.h" />
<ClInclude Include="NetworkEnums.h" />
<ClInclude Include="Options.h" />
<ClInclude Include="Particle.h" />
<ClInclude Include="Physics.h" />

View File

@ -231,9 +231,6 @@
<ClInclude Include="Camera.h">
<Filter>Header Files\Utils</Filter>
</ClInclude>
<ClInclude Include="NetworkEnums.h">
<Filter>Header Files\Network</Filter>
</ClInclude>
<ClInclude Include="AABB.h">
<Filter>Header Files\Math</Filter>
</ClInclude>