Engine » Assets module

Adds asset management to Cubos.

Settings

  • assets.io.enabled - whether asset I/O should be done (default: true).
  • assets.io.path - path to the assets directory - will be mounted to /assets/ (default: assets/).
  • assets.io.readOnly - if true, the assets directory will be mounted as read-only (default: true).

Events

  • AssetEvent - (TODO) emitted when an asset is either loaded, modified or unloaded.

Resources

  • Assets - the asset manager, used to access asset data.

Dependencies

Files

file asset.hpp
Classes cubos::engine::AnyAsset and cubos::engine::Asset.
file assets.hpp
Resource cubos::engine::Assets.
file bridge.hpp
Class cubos::engine::AssetBridge.
file file.hpp
Class cubos::engine::FileBridge.
file json.hpp
Class cubos::engine::JSONBridge.
file meta.hpp
Class cubos::engine::AssetMeta.
file plugin.hpp
Plugin entry point.

Classes

class cubos::engine::AnyAsset
Handle to an asset of any type. May either be weak or strong. Weak handles do not guarantee the asset is loaded, while strong handles do.
template<typename T>
class cubos::engine::Asset
Handle to an asset of a specific type.
class cubos::engine::Assets
Resource which manages all assets. Responsible for loading and unloading assets, storing them in memory, and providing access to them.
class cubos::engine::AssetBridge
Bridges are the objects responsible for loading and saving assets from/to disk. They form the bridge between the asset manager and the virtual file system.
class cubos::engine::FileBridge
Abstract bridge type defined to reduce boilerplate code in bridge implementations which open a single file to load and save assets.
template<typename T>
class cubos::engine::JSONBridge
Bridge for loading and saving assets which are serialized to and from a JSON file.
class cubos::engine::AssetMeta
Stores metadata about an asset - the data stored in .meta files. Each asset has a corresponding meta object, which contains load or import parameters.

Typedefs

using AssetMetaRead = core::memory::ReadGuard<AssetMeta, std::shared_lock<std::shared_mutex>>
Read-only guard for an asset's metadata.
using AssetMetaWrite = core::memory::WriteGuard<AssetMeta, std::unique_lock<std::shared_mutex>>
Read-write guard for an asset's metadata.
template<typename T>
using AssetRead = core::memory::ReadGuard<T, std::shared_lock<std::shared_mutex>>
Read-only guard for an asset's data.
template<typename T>
using AssetWrite = core::memory::WriteGuard<T, std::unique_lock<std::shared_mutex>>
Read-write guard for an asset's data.

Functions

auto assetsPlugin(Cubos& cubos) -> CUBOS_ENGINE_API void
Plugin entry function.

Typedef documentation

using AssetMetaRead = core::memory::ReadGuard<AssetMeta, std::shared_lock<std::shared_mutex>>

Read-only guard for an asset's metadata.

using AssetMetaWrite = core::memory::WriteGuard<AssetMeta, std::unique_lock<std::shared_mutex>>

Read-write guard for an asset's metadata.

template<typename T>
using AssetRead = core::memory::ReadGuard<T, std::shared_lock<std::shared_mutex>>

Read-only guard for an asset's data.

Template parameters
T The type of the data to guard.

template<typename T>
using AssetWrite = core::memory::WriteGuard<T, std::unique_lock<std::shared_mutex>>

Read-write guard for an asset's data.

Template parameters
T The type of the data to guard.

Function documentation

CUBOS_ENGINE_API void assetsPlugin(Cubos& cubos)

Plugin entry function.

Parameters
cubos Cubos main class.