Struct Asset

Inheritance Relationships

Base Type

Struct Documentation

struct Asset : public CE::Assets::Content2D

Declaration: final

Shared tile grid plus definitions for static cells, animated targets, and autotile rules.

Selection samples through the caller’s callback and resolves simulation-owned time. Direct construction rejects duplicate targets but does not revalidate all manifest fields. Keep definitions/resources stable for concurrent read-only queries.

Public Functions

explicit Asset(Data data)

Own tileset metadata and retain uploaded resources.

See also

Detailed guide

Parameters:

data – Resource/metadata transfer bundle.

Throws:

CE::Exceptions::invalid_args – If multiple animations target the same original cell. Does not revalidate every grid, clip duration/cell or backend domain, and creates no default material. Keep source resources valid for concurrent read-only use.

Tile tile(std::size_t cell) const

Declaration: [[nodiscard]]

Create a retained resource view of a static grid cell.

See also

Detailed guide

Parameters:

cell – Row-major ordinal inside this definition’s grid.

Throws:

CE::Exceptions::bad_request – For an out-of-grid cell. No animation substitution is performed.

Animation animation(const std::string &name) const

Declaration: [[nodiscard]]

Copy a named clip into an independent ordinal cursor retaining resources.

See also

Detailed guide

Parameters:

name – Exact clip name.

Throws:

std::out_of_range – For a missing name. An empty clip also rejects.

std::optional<Animation> animation_for(std::size_t target) const

Declaration: [[nodiscard]]

Look up a clip only for its original target cell.

See also

Detailed guide

Parameters:

target – Original target ordinal; this lookup does not validate grid bounds.

Returns:

Independent retained animation, or no value when no clip targets that ordinal.

CE::Assets::Grids::CellIndex cell_at(CE::Assets::Grids::CellIndex target, std::chrono::milliseconds elapsed) const

Declaration: [[nodiscard]]

Resolve at most one original target’s animation from caller-owned time.

See also

Detailed guide

Parameters:
  • target – Original row-major cell inside this grid.

  • elapsed – Nonnegative simulation milliseconds, even for static targets.

Returns:

Original static cell or selected clip-frame cell; never recursively animates the result. Negative/invalid/overflowing timelines throw invalid_args; original/final grid violations throw bad_request.

CE::Assets::Tilesets::Selection::Result select_tile(const std::string &name, const CE::Assets::Tilesets::Selection::Sampler &sampler, const CE::Assets::Tilesets::Selection::Options &options, std::chrono::milliseconds elapsed) const

Declaration: [[nodiscard]]

Sample a named CPU autotile rule, then resolve successful target animation once.

See also

Detailed guide

Parameters:
  • name – Exact autotile rule name; missing names throw out_of_range.

  • sampler – Non-retained synchronous world callback.

  • options – Neighborhood fallback and deterministic variant seed.

  • elapsed – Nonnegative simulation milliseconds; invalid time rejects even if selection would fail.

Returns:

Selector failure unchanged, or final grid cell from cell_at(). Sampler, metadata and timeline failures propagate.

const CE::Assets::Grids::View &view(const std::string &name) const

Declaration: [[nodiscard]]

Borrow a named view for this asset’s lifetime.

See also

Detailed guide

Parameters:

name – Exact metadata key; unknown names throw std::out_of_range. No geometry or cell selection is changed.

CE::Assets::Grids::CellIndex orientation(const std::string &name) const

Declaration: [[nodiscard]]

Copy a named static cell ordinal.

See also

Detailed guide

Parameters:

name – Exact metadata key; unknown names throw std::out_of_range. No animation clock or rendering mutation occurs.

const Rule &autotile(const std::string &name) const

Declaration: [[nodiscard]]

Borrow a named rule for this asset’s lifetime; unknown names throw out_of_range.

See also

Detailed guide

inline const Definition &definition() const

Declaration: [[nodiscard]]

Borrow the owned stable metadata for this asset’s lifetime.

See also

Detailed guide