Struct Asset

Inheritance Relationships

Base Type

Struct Documentation

struct Asset : public CE::Assets::Content2D

Declaration: final

A whole-image quad in local Y-up pixels about a normalized top-left pivot.

Direct construction retains handles without validating their compatibility.

Public Functions

inline Asset(std::shared_ptr<CE::Rendering::Geometry::Buffer2D> geometry, std::shared_ptr<CE::Rendering::Resources::Image> image, std::shared_ptr<const CE::Rendering::Resources::Material> material = {})

Retain an explicitly assembled whole-image value without compatibility/null validation.

See also

Detailed guide

Parameters:
  • geometry – Uploaded quad geometry.

  • image – Uploaded image contents.

  • material – Optional explicit material; this direct constructor creates none. Use from_image()/load() for ordinary default-material creation and upload.

Public Static Functions

static Asset from_image(std::shared_ptr<CE::Rendering::Resources::Image> image, CE::Rendering::Resources::Provider &provider, CE::Rendering::Geometry::Pivot pivot = CE::Rendering::Geometry::Pivot{0.0f, 0.0f}, std::shared_ptr<const CE::Rendering::Resources::Material> material = {})

Declaration: [[nodiscard]]

Upload a six-vertex whole-image quad on the provider’s owner/current context.

See also

Detailed guide

Parameters:
  • image – Non-null, nonempty image compatible with the provider’s backend domain.

  • provider – Borrowed resource owner for geometry/default material creation.

  • pivot – Finite normalized top-left-origin origin; geometry uses local Y-up image pixels.

  • material – Optional override; absent requests the provider’s builtin textured material.

Returns:

Retained geometry/image/material asset, with no cache publication. Invalid image/pivot or backend/default-material/upload failures propagate. CPU vertices are copied during upload and not borrowed by the result.

static Asset load(const std::filesystem::path &file, CE::Rendering::Resources::Provider &provider, CE::Rendering::Geometry::Pivot pivot = CE::Rendering::Geometry::Pivot{0.0f, 0.0f}, std::shared_ptr<const CE::Rendering::Resources::Material> material = {})

Declaration: [[nodiscard]]

Decode/upload an image and construct its whole-image quad on the provider owner.

See also

Detailed guide

Parameters:
  • file – Source path; relative paths use the caller’s working directory.

  • provider – Live compatible resource provider, borrowed for the operation.

  • pivot – Finite normalized top-left-origin pivot.

  • material – Optional override; absent selects the provider textured default.

Returns:

Complete retained asset; failures return no asset and publish no cache entry. File decoding can block; preparation/upload obey provider affinity and exception contracts.