mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/LCE-Revelations.git
synced 2026-07-18 03:48:26 +00:00
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:
@@ -932,6 +932,7 @@ bool Level::setTileAndData(int x, int y, int z, int tile, int data, int updateFl
|
||||
int old = c->getTile(x & 15, y, z & 15);
|
||||
int olddata = c->getData( x & 15, y, z & 15);
|
||||
#endif
|
||||
int prevTile = c->getTile(x & 15, y, z & 15);
|
||||
result = c->setTileAndData(x & 15, y, z & 15, tile, data);
|
||||
if( updateFlags != Tile::UPDATE_INVISIBLE_NO_LIGHT)
|
||||
{
|
||||
@@ -939,7 +940,11 @@ bool Level::setTileAndData(int x, int y, int z, int tile, int data, int updateFl
|
||||
PIXBeginNamedEvent(0,"Checking light %d %d %d",x,y,z);
|
||||
PIXBeginNamedEvent(0,"was %d, %d now %d, %d",old,olddata,tile,data);
|
||||
#endif
|
||||
checkLight(x, y, z);
|
||||
if (Tile::lightBlock[tile & 0xff] != Tile::lightBlock[prevTile & 0xff] ||
|
||||
Tile::lightEmission[tile & 0xff] != Tile::lightEmission[prevTile & 0xff])
|
||||
{
|
||||
checkLight(x, y, z);
|
||||
}
|
||||
PIXEndNamedEvent();
|
||||
PIXEndNamedEvent();
|
||||
}
|
||||
@@ -3687,13 +3692,11 @@ vector<shared_ptr<Entity> > *Level::getEntities(shared_ptr<Entity> except, AABB
|
||||
int zc0 = Mth::floor((bb->z0 - 2) / 16);
|
||||
int zc1 = Mth::floor((bb->z1 + 2) / 16);
|
||||
|
||||
#ifdef __PSVITA__
|
||||
#ifdef _ENTITIES_RW_SECTION
|
||||
// AP - RW critical sections are expensive so enter it here so we only have to call it once instead of X times
|
||||
EnterCriticalRWSection(&LevelChunk::m_csEntities, false);
|
||||
#else
|
||||
EnterCriticalSection(&LevelChunk::m_csEntities);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
for (int xc = xc0; xc <= xc1; xc++)
|
||||
@@ -3706,12 +3709,10 @@ vector<shared_ptr<Entity> > *Level::getEntities(shared_ptr<Entity> except, AABB
|
||||
}
|
||||
MemSect(0);
|
||||
|
||||
#ifdef __PSVITA__
|
||||
#ifdef _ENTITIES_RW_SECTION
|
||||
LeaveCriticalRWSection(&LevelChunk::m_csEntities, false);
|
||||
#else
|
||||
LeaveCriticalSection(&LevelChunk::m_csEntities);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return &es;
|
||||
@@ -3730,13 +3731,11 @@ vector<shared_ptr<Entity> > *Level::getEntitiesOfClass(const type_info& baseClas
|
||||
int zc1 = Mth::floor((bb->z1 + 2) / 16);
|
||||
vector<shared_ptr<Entity> > *es = new vector<shared_ptr<Entity> >();
|
||||
|
||||
#ifdef __PSVITA__
|
||||
#ifdef _ENTITIES_RW_SECTION
|
||||
// AP - RW critical sections are expensive so enter it here so we only have to call it once instead of X times
|
||||
EnterCriticalRWSection(&LevelChunk::m_csEntities, false);
|
||||
#else
|
||||
EnterCriticalSection(&LevelChunk::m_csEntities);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
for (int xc = xc0; xc <= xc1; xc++)
|
||||
@@ -3750,12 +3749,10 @@ vector<shared_ptr<Entity> > *Level::getEntitiesOfClass(const type_info& baseClas
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __PSVITA__
|
||||
#ifdef _ENTITIES_RW_SECTION
|
||||
LeaveCriticalRWSection(&LevelChunk::m_csEntities, false);
|
||||
#else
|
||||
LeaveCriticalSection(&LevelChunk::m_csEntities);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return es;
|
||||
|
||||
Reference in New Issue
Block a user