![]() |
Lysa
0.0
Lysa 3D Engine
|
Lysa resources pack binary file format containing all resources for a game, referred by app://
┌──────────────────────────────────────┐ │ Magic : "LYPACK" (6 bytes) │ │ Version : uint32 │ │ Count : uint32 │ ├──────────────────────────────────────┤ │ Directory [Count entries] │ │ entry[i].path : char[256] │ │ entry[i].offset : uint64 │ │ entry[i].size : uint64 │ ├──────────────────────────────────────┤ │ Data blob │ │ raw resources │ └──────────────────────────────────────┘
Classes | |
| struct | Entry |
| struct | Header |
Public Member Functions | |
| ResourcesPack (const std::filesystem::path &filePath) | |
| bool | contains (std::string_view relativePath) const |
| void | load (std::string_view relativePath, std::vector< char > &out) const |
| bool | containsPrefix (std::string_view prefix) const |
| std::shared_ptr< ResourcesPackStreambuf > | openStream (std::string_view relativePath) const |
Static Public Attributes | |
| static constexpr char | MAGIC [] { 'L','Y','P','A','C','K' } |
| static constexpr auto | VERSION {1} |
| static constexpr size_t | PATH_SIZE {256} |
| ResourcesPack | ( | const std::filesystem::path & | filePath | ) |
Opens and parses a pack file, loading its directory into memory. Automatically done in VirtualFS from the configuration.
| bool contains | ( | std::string_view | relativePath | ) | const |
Checks whether the pack contains an entry for the given path.
| relativePath | Virtual resource path (e.g. "shaders/pbr.vert"). |
true if an entry with that path exists, false otherwise. | bool containsPrefix | ( | std::string_view | prefix | ) | const |
Checks whether the directory contains any entry whose path starts with the given prefix.
| prefix | Path prefix to search for. |
true if at least one entry matches, false otherwise. | void load | ( | std::string_view | relativePath, |
| std::vector< char > & | out | ||
| ) | const |
Loads the raw bytes of a resource into a caller-supplied buffer.
The buffer is resized to fit the resource exactly before the data is copied into it.
| std::shared_ptr<ResourcesPackStreambuf> openStream | ( | std::string_view | relativePath | ) | const |
Creates a streaming buffer over a resource region without loading the entire resource into memory.
The returned ResourcesPackStreambuf can be wrapped in a std::istream to enable incremental, standard-library-compatible reading.
| relativePath | Virtual resource path. |
ResourcesPack instance.
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |