Skip to content

EntropyEngine::Core::IO::PackageWriter

Builds and writes EntropyPackage files. More…

#include <PackageWriter.h>

Name
structImpl
Name
~PackageWriter()
PackageResult< void >write(const std::filesystem::path & outputPath)
Write the package to a file.
voidsetSceneRoot(std::string_view virtualPath)
Set the root scene file path.
PackageWriter &operator=(const PackageWriter & ) =delete
PackageWriter &operator=(PackageWriter && )
boolhasAsset(std::string_view virtualPath) const
Check if a virtual path has been added.
size_tassetCount() const
Get the number of assets added.
voidaddDependency(std::string_view dependencyUri)
Add an external package dependency.
PackageResult< void >addAssetFromFile(std::string_view virtualPath, const std::filesystem::path & sourcePath)
Add an asset from a file on disk.
voidaddAsset(std::string_view virtualPath, std::span< const uint8_t > data)
Add an asset from memory.
PackageWriter(PackageWriterOptions options ={})
PackageWriter(const PackageWriter & ) =delete
PackageWriter(PackageWriter && )
class EntropyEngine::Core::IO::PackageWriter;

Builds and writes EntropyPackage files.

Usage:

PackageWriter writer;
writer.addAsset("scene.usda", sceneData);
writer.addAssetFromFile("meshes/character.mesh", "path/to/character.mesh");
writer.setSceneRoot("scene.usda");
auto result = writer.write("output.epak");
~PackageWriter()
PackageResult< void > write(
const std::filesystem::path & outputPath
)

Write the package to a file.

Parameters:

  • outputPath Destination file path

Return: Result indicating success or failure

void setSceneRoot(
std::string_view virtualPath
)

Set the root scene file path.

Parameters:

  • virtualPath Path to root scene within package (must be an added asset)
PackageWriter & operator=(
const PackageWriter &
) =delete
PackageWriter & operator=(
PackageWriter &&
)
bool hasAsset(
std::string_view virtualPath
) const

Check if a virtual path has been added.

size_t assetCount() const

Get the number of assets added.

void addDependency(
std::string_view dependencyUri
)

Add an external package dependency.

Parameters:

  • dependencyUri URI of required package (e.g., “entropy:core-materials@1.2”)
PackageResult< void > addAssetFromFile(
std::string_view virtualPath,
const std::filesystem::path & sourcePath
)

Add an asset from a file on disk.

Parameters:

  • virtualPath Path within the package
  • sourcePath Path to source file on disk

Return: Result indicating success or failure

void addAsset(
std::string_view virtualPath,
std::span< const uint8_t > data
)

Add an asset from memory.

Parameters:

  • virtualPath Path within the package (e.g., “meshes/character.mesh”)
  • data Raw asset data (will be compressed and optionally encrypted)
explicit PackageWriter(
PackageWriterOptions options ={}
)
PackageWriter(
const PackageWriter &
) =delete
PackageWriter(
PackageWriter &&
)

Updated on 2026-01-26 at 16:50:32 -0500