Performance optimizations: sound caching, renderer culling, entity and lighting improvements

- Sound engine: cache filesystem probe results to avoid repeated file existence checks; add MA_SOUND_FLAG_DECODE for pre-decoded playback
- Level renderer: column-level frustum culling, compact visible chunk lists to skip empty iteration, lightweight second-pass render path, early-out for non-dirty chunks, scaled recheck period at high render distances
- Entity: cache shared_from_this() to reduce reference counting overhead in move() and checkInsideTiles()
- Level: skip checkLight() when tile light properties unchanged; enable entity locking on all platforms (not just Vita)
- LevelChunk: only rescan min height when the minimum column changes; defer lightGap processing
- LivingEntity: use raw pointer cast instead of dynamic_pointer_cast; cache friction tile lookup
- ServerPlayerGameMode: return whether block was destroyed to avoid redundant tile update packets
This commit is contained in:
Revela
2026-03-18 17:22:04 -05:00
parent 80ba2e0762
commit 0ba923f085
12 changed files with 311 additions and 170 deletions
+8 -12
View File
@@ -1380,16 +1380,12 @@ void LivingEntity::jumpFromGround()
void LivingEntity::travel(float xa, float ya)
{
#ifdef __PSVITA__
// AP - dynamic_pointer_cast is a non-trivial call
// AP - dynamic_pointer_cast is a non-trivial call, use raw pointer instead
Player *thisPlayer = nullptr;
if( this->instanceof(eTYPE_PLAYER) )
if (this->instanceof(eTYPE_PLAYER))
{
thisPlayer = (Player*) this;
}
#else
shared_ptr<Player> thisPlayer = dynamic_pointer_cast<Player>(shared_from_this());
#endif
if (isInWater() && !(thisPlayer && thisPlayer->abilities.flying) )
{
double yo = y;
@@ -1424,13 +1420,14 @@ void LivingEntity::travel(float xa, float ya)
else
{
float friction = 0.91f;
int frictionTile = 0;
if (onGround)
{
frictionTile = level->getTile(Mth::floor(x), Mth::floor(bb->y0) - 1, Mth::floor(z));
friction = 0.6f * 0.91f;
int t = level->getTile(Mth::floor(x), Mth::floor(bb->y0) - 1, Mth::floor(z));
if (t > 0)
if (frictionTile > 0)
{
friction = Tile::tiles[t]->friction * 0.91f;
friction = Tile::tiles[frictionTile]->friction * 0.91f;
}
}
@@ -1452,10 +1449,9 @@ void LivingEntity::travel(float xa, float ya)
if (onGround)
{
friction = 0.6f * 0.91f;
int t = level->getTile( Mth::floor(x), Mth::floor(bb->y0) - 1, Mth::floor(z));
if (t > 0)
if (frictionTile > 0)
{
friction = Tile::tiles[t]->friction * 0.91f;
friction = Tile::tiles[frictionTile]->friction * 0.91f;
}
}
if (onLadder())