Skip to content

Engine → Renderer → material_asset.h

material_asset

Syntax

class CONJURE_API material_asset

Constructors

AccessSignatureDescription
publicmaterial_asset();
publicexplicit material_asset( material_desc desc, std::string name = {});
publicmaterial_asset( const material_asset &) = default;
publicmaterial_asset( material_asset &&) noexcept = default;

Destructors

AccessSignatureDescription
public~material_asset();

Variables

AccessNameTypeDefaultDescription
privatemDescmaterial_desc{}
privatemNamestd::string{}

Functions

Public

desc

[[nodiscard]] const material_desc &desc() const noexcept;
[[nodiscard]] material_desc &desc() noexcept;

fallback

[[nodiscard]] static material_asset fallback();

The magenta fallback material.

name

[[nodiscard]] std::string_view name() const noexcept;

parse_blob

[[nodiscard]] static core::result<material_asset> parse_blob(
    std::span<const std::byte> bytes);

parse_json over a blob's bytes.

parse_json

[[nodiscard]] static core::result<material_asset> parse_json(
    std::string_view text);

Parses the JSON form. Fails with PARSE_FAILURE for invalid JSON and INVALID_ARGUMENT for a wrong member type, an unknown enumerator or a malformed uuid.

set_name

void set_name(
    std::string name);

texture_flags

[[nodiscard]] u32 texture_flags() const noexcept;

Bit i set when texture slot i references an asset (non-null uuid), bound or not.

to_json

[[nodiscard]] std::string to_json() const;

The canonical JSON form (sorted keys, deterministic).

write_blob

[[nodiscard]] std::vector<std::byte> write_blob() const;

The JSON form as blob bytes.

Operator Overloads

Public

operator=

material_asset &operator=(
    const material_asset &) = default;
material_asset &operator=(
    material_asset &&) noexcept = default;

operator==

[[nodiscard]] bool operator==(
    const material_asset &other) const noexcept;