feat: read the bounding boxes of the client's bricks from its brickdb

BrickBounds reads the <Bounding><AABB/> of every Primitives/<designID>.xml in
the client's res/brickdb.zip (through the asset manager, so packed and
unpacked clients both work), by design ID. A design listed only as another
primitive's alias gets that primitive's box. Get() reads the file the first
time it is called and keeps the boxes for every later call.

The zip is read by a small reader in dCommon (Zip::ForEachEntry) that handles
stored and deflated entries, with a raw inflate added to ZCompression.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-11-04 21:14:28 -06:00
parent a163264adf
commit ba41bf0311
8 changed files with 393 additions and 0 deletions

18
dCommon/Zip.h Normal file
View File

@@ -0,0 +1,18 @@
// Darkflame Universe
// Copyright 2025
#ifndef ZIP_H
#define ZIP_H
#include <functional>
#include <string_view>
namespace Zip {
// Calls `visit` with the name and contents of every entry of the zip archive `zip` whose name `wanted` accepts, in
// the archive's order. Stored and deflated entries are read; others, and entries that fail to read, are skipped.
// Returns false when the archive's directory can't be read.
bool ForEachEntry(std::string_view zip, const std::function<bool(std::string_view name)>& wanted,
const std::function<void(std::string_view name, std::string_view data)>& visit);
};
#endif //!ZIP_H