Toast Engine
Loading...
Searching...
No Matches
assets::MaterialInstance Class Reference

Mirrors a parent Material's parameters, overriding only the values it sets. More...

#include <material_instance.hpp>

Inheritance diagram for assets::MaterialInstance:
Collaboration diagram for assets::MaterialInstance:

Public Member Functions

 MaterialInstance (const toml::table &table, Handle< Schema > schema={})
auto type () const -> std::string_view override
auto serialize (SaveMode mode) const -> std::vector< uint8_t > override
void reload (const toml::table &table) override
 Re-parses the asset contents in place.
auto parent () const -> const Handle< Material > &
 The parent material.
auto shaders () const -> const std::vector< Handle< Shader > > &override
auto settings () const -> MaterialSettings override
auto value (std::string_view key) const -> const DataValue *override
 Looks up a shader parameter value by name.
auto rootMaterial () -> Material *override
 The material owning the render pass, instances return their parent.
Public Member Functions inherited from assets::Material
 Material (const toml::table &table, Handle< Schema > schema={})
auto name () const -> std::string
 Display name of the material.
Public Member Functions inherited from assets::Data
 Data (const toml::table &table, Handle< Schema > schema={})
 Data (const toml::table &table, Handle< Schema > schema, KeepAllKeysTag)
 Stores the schema handle for round-trip serialization but runs free-form buildRoot, keeping every TOML key.
auto operator[] (std::string_view k) -> DataValue &
auto operator[] (std::string_view k) const -> const DataValue &
auto contains (std::string_view k) const -> bool
auto root () const -> const DataValue &
auto schema () const -> const Handle< Schema > &
Public Member Functions inherited from assets::Asset
 Asset (const Asset &)=delete
auto operator= (const Asset &) -> Asset &=delete
auto refCount () const noexcept -> uint32_t

Additional Inherited Members

Static Public Attributes inherited from assets::Data
static constexpr KeepAllKeysTag keep_all_keys {}
Protected Member Functions inherited from assets::Data
virtual void onReloaded ()
Protected Member Functions inherited from assets::Asset
void addRef () noexcept
void release () noexcept
Protected Attributes inherited from assets::Data
DataValue m_root
 Object DataValue holding all fields.
Handle< Schema > m_schema
 optional
bool m_keep_all_keys = false

Detailed Description

Mirrors a parent Material's parameters, overriding only the values it sets.

Member Function Documentation

◆ reload()

void assets::MaterialInstance::reload ( const toml::table & table)
overridevirtual

Re-parses the asset contents in place.

Reimplemented from assets::Material.

Here is the caller graph for this function:

◆ rootMaterial()

auto assets::MaterialInstance::rootMaterial ( ) -> Material *
nodiscardoverridevirtual

The material owning the render pass, instances return their parent.

Reimplemented from assets::Material.

Here is the caller graph for this function:

◆ serialize()

auto assets::MaterialInstance::serialize ( SaveMode mode) const -> std::vector< uint8_t >
nodiscardoverridevirtual

Reimplemented from assets::Material.

◆ settings()

auto assets::MaterialInstance::settings ( ) const -> MaterialSettings
nodiscardoverridevirtual

Reimplemented from assets::Material.

◆ shaders()

auto assets::MaterialInstance::shaders ( ) const -> const std::vector< Handle< Shader > > &
nodiscardoverridevirtual

Reimplemented from assets::Material.

◆ type()

auto assets::MaterialInstance::type ( ) const -> std::string_view
inlinenodiscardoverridevirtual

Reimplemented from assets::Material.

◆ value()

auto assets::MaterialInstance::value ( std::string_view key) const -> const DataValue *
nodiscardoverridevirtual

Looks up a shader parameter value by name.

Reimplemented from assets::Material.

Here is the caller graph for this function:

The documentation for this class was generated from the following files: