![]() |
Lysa
0.0
Lysa 3D Engine
|
Lysa resources pack binary file format containing all resources for a game, referred by app://
Classes | |
| struct | Entry |
| struct | Header |
Public Member Functions | |
| ResourcesPack (const std::filesystem::path &filePath) | |
| virtual | ~ResourcesPack () = default |
| bool | contains (std::string_view relativePath) const |
| virtual void | load (std::string_view relativePath, std::vector< char > &out) const |
| bool | containsPrefix (std::string_view prefix) const |
| void | forEachEntry (std::string_view directoryPath, const std::function< void (bool isDirectory, const std::string &relativePath)> &callback, bool recursive) const |
| virtual 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} |
Protected Member Functions | |
| const Entry * | find (std::string_view relativePath) const |
Protected Attributes | |
| std::ifstream | file |
| std::vector< Entry > | directory |
| ResourcesPack | ( | const std::filesystem::path & | filePath | ) |
Opens and parses a pack file, loading its directory into memory. Automatically done in VirtualFS from the configuration.
|
virtualdefault |
| 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.
|
protected |
| void forEachEntry | ( | std::string_view | directoryPath, |
| const std::function< void (bool isDirectory, const std::string &relativePath)> & | callback, | ||
| bool | recursive | ||
| ) | const |
Iterates over the entries located under a directory prefix.
Directories are implicit in the pack format: they are derived from the stored entry paths and each one is reported exactly once.
| directoryPath | Directory path inside the pack (empty string for the root). |
| callback | Called for each entry with isDirectory and the path relative to directoryPath. |
| recursive | If true, also reports the entries of the sub-directories. |
|
virtual |
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.
Subclasses can override this to transform the loaded bytes (e.g. decryption).
|
virtual |
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
|
protected |
|
mutableprotected |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |