Commit graph

5 commits

Author SHA1 Message Date
Racc 68efba88bd optimisation
Chunk.cpp/h:
- thread_local occluder table via std::array<bool,256> IIFE; queries
  isSolidRender() for all 255 tile types instead of only stone/dirt/bedrock
- Null-check getChunkAt() early-out with correct COMPILED/NOTSKYLIT/EMPTY flags
- Defer Region + TileRenderer construction past empty-check to skip 9 chunk
  lookups and 128KB memset for empty chunks (common post-teleport)
- Replace Win32 TLS API (TlsAlloc/TlsSetValue/TlsGetValue) + new/delete
  with static thread_local array for per-thread tileIds storage

LevelRenderer.cpp:
- Rewrite updateDirtyChunks nearest-chunk search as linear ClipChunk scan;
  dirty-flag checked before any distance work, batch-clear empty dirty chunks
  upfront via isRenderChunkEmpty to shrink dirty set across frames
- const on all distance/flag locals

Region.h/cpp:
- Stack buffer flatChunks_stack[16] for common render-chunk regions (4x4),
  std::unique_ptr<LevelChunk*[]> heap fallback for large pathfinding regions;
  eliminates per-rebuild heap alloc/free on the hot path
- Deleted copy/move ops; std::fill_n for null-init; static constexpr constant

TileRenderer.h/cpp:
- static thread_local cache array replaces per-instance new/delete
- Remove dead getLightColorCount, cacheOwned, conditional delete[]
- static constexpr cache size; defaulted destructor

Level.cpp: Region constructed directly on stack (no copy)
stdafx.h: added <array>
2026-03-09 17:57:01 +00:00
ModMaker101 2be856a2d4
Fix Chunk destructor segfault using smart pointers #112 (#414) 2026-03-04 22:43:29 +07:00
void_17 119bff3514 Revert "shared_ptr -> std::shared_ptr"
This reverts commit 7074f35e4b.
2026-03-02 17:37:16 +07:00
void_17 7074f35e4b shared_ptr -> std::shared_ptr
This is one of the first commits in a plan to remove all `using namespace std;` lines in the entire codebase as it is considered anti-pattern today.
2026-03-02 15:58:20 +07:00
daoge_cmd b691c43c44 Initial commit 2026-03-01 12:16:08 +08:00