Unravel Engine C++ Reference
Loading...
Searching...
No Matches
unravel::pbr_material Class Reference

Class for physically-based rendering (PBR) materials. More...

#include <material.h>

Inheritance diagram for unravel::pbr_material:
crtp_meta_type< pbr_material, material >

Public Member Functions

auto clone () const -> std::shared_ptr< material > override
 
auto get_base_color () const -> const math::color &
 Gets the base color of the material.
 
void set_base_color (const math::color &val)
 Sets the base color of the material.
 
auto get_subsurface_color () const -> const math::color &
 Gets the subsurface color of the material.
 
void set_subsurface_color (const math::color &val)
 Sets the subsurface color of the material.
 
auto get_emissive_color () const -> const math::color &
 Gets the emissive color of the material.
 
void set_emissive_color (const math::color &val)
 Sets the emissive color of the material.
 
auto get_emissive_intensity () const -> float
 
void set_emissive_intensity (float val)
 
auto get_roughness () const -> float
 Gets the roughness of the material.
 
void set_roughness (float roughness)
 Sets the roughness of the material.
 
auto get_metalness () const -> float
 Gets the metalness of the material.
 
void set_metalness (float metalness)
 Sets the metalness of the material.
 
auto get_bumpiness () const -> float
 Gets the bumpiness of the material.
 
void set_bumpiness (float bumpiness)
 Sets the bumpiness of the material.
 
auto get_alpha_mode () const -> alpha_mode
 Gets the alpha mode (opaque / mask / blend).
 
void set_alpha_mode (alpha_mode mode)
 Sets the alpha mode.
 
auto get_alpha_cutoff () const -> float
 Gets the alpha cutoff used when alpha_mode is alpha_mode::mask.
 
void set_alpha_cutoff (float cutoff)
 Sets the alpha cutoff for alpha_mode::mask materials.
 
auto uses_alpha_cutout () const -> bool
 True when alpha_mode is alpha_mode::mask (hard alpha clip + cutout shadows).
 
auto casts_shadow () const -> bool
 True when this material should contribute to shadow maps.
 
auto make_shadow_cutout_state () const -> shadow_cutout_state
 Snapshot of shader state needed by the shadow cutout pass.
 
void infer_alpha_mode_from_legacy_cutoff ()
 Infer alpha_mode when loading legacy assets that only stored a cutoff value.
 
auto get_surface_data () const -> const math::vec4 &
 Gets the surface data of the material.
 
auto get_surface_data2 () const -> math::vec4
 Gets additional surface data for the material.
 
auto metalness_roughness_combined () const -> bool
 
auto get_tiling () const -> const math::vec2 &
 Gets the tiling factor of the material.
 
void set_tiling (const math::vec2 &tiling)
 Sets the tiling factor of the material.
 
auto get_dither_threshold () const -> const math::vec2 &
 Gets the dither threshold of the material.
 
void set_dither_threshold (const math::vec2 &threshold)
 Sets the dither threshold of the material.
 
auto get_color_map () const -> const asset_handle< gfx::texture > &
 Gets the color map of the material.
 
void set_color_map (const asset_handle< gfx::texture > &val)
 Sets the color map of the material.
 
auto get_normal_map () const -> const asset_handle< gfx::texture > &
 Gets the normal map of the material.
 
void set_normal_map (const asset_handle< gfx::texture > &val)
 Sets the normal map of the material.
 
auto get_roughness_map () const -> const asset_handle< gfx::texture > &
 Gets the roughness map of the material.
 
void set_roughness_map (const asset_handle< gfx::texture > &val)
 Sets the roughness map of the material.
 
auto get_metalness_map () const -> const asset_handle< gfx::texture > &
 Gets the metalness map of the material.
 
void set_metalness_map (const asset_handle< gfx::texture > &val)
 Sets the metalness map of the material.
 
auto get_ao_map () const -> const asset_handle< gfx::texture > &
 Gets the ambient occlusion map of the material.
 
void set_ao_map (const asset_handle< gfx::texture > &val)
 Sets the ambient occlusion map of the material.
 
auto get_emissive_map () const -> const asset_handle< gfx::texture > &
 Gets the emissive map of the material.
 
void set_emissive_map (const asset_handle< gfx::texture > &val)
 Sets the emissive map of the material.
 
- Public Member Functions inherited from crtp_meta_type< pbr_material, material >
virtual auto get_meta_type () const -> entt::meta_type
 
auto is () const -> bool
 
auto is (const entt::meta_type &type) const -> bool
 
virtual auto as_derived () -> entt::meta_any
 

Additional Inherited Members

- Static Public Member Functions inherited from crtp_meta_type< pbr_material, material >
static auto get_static_meta_type () -> entt::meta_type
 

Detailed Description

Class for physically-based rendering (PBR) materials.

Definition at line 111 of file material.h.

Member Function Documentation

◆ casts_shadow()

auto unravel::pbr_material::casts_shadow ( ) const -> bool
nodiscard

True when this material should contribute to shadow maps.

Definition at line 117 of file material.cpp.

◆ clone()

auto unravel::pbr_material::clone ( ) const -> std::shared_ptr<material>
override

Definition at line 85 of file material.cpp.

◆ get_alpha_cutoff()

auto unravel::pbr_material::get_alpha_cutoff ( ) const -> float
inline

Gets the alpha cutoff used when alpha_mode is alpha_mode::mask.

Definition at line 252 of file material.h.

◆ get_alpha_mode()

auto unravel::pbr_material::get_alpha_mode ( ) const -> alpha_mode
inline

Gets the alpha mode (opaque / mask / blend).

Definition at line 239 of file material.h.

◆ get_ao_map()

auto unravel::pbr_material::get_ao_map ( ) const -> const asset_handle<gfx::texture>&
inline

Gets the ambient occlusion map of the material.

Returns
A constant reference to the ambient occlusion map asset handle.

Definition at line 417 of file material.h.

◆ get_base_color()

auto unravel::pbr_material::get_base_color ( ) const -> const math::color&
inline

Gets the base color of the material.

Returns
A constant reference to the base color.

Definition at line 122 of file material.h.

◆ get_bumpiness()

auto unravel::pbr_material::get_bumpiness ( ) const -> float
inline

Gets the bumpiness of the material.

Returns
The bumpiness value.

Definition at line 222 of file material.h.

◆ get_color_map()

auto unravel::pbr_material::get_color_map ( ) const -> const asset_handle<gfx::texture>&
inline

Gets the color map of the material.

Returns
A constant reference to the color map asset handle.

Definition at line 345 of file material.h.

◆ get_dither_threshold()

auto unravel::pbr_material::get_dither_threshold ( ) const -> const math::vec2&
inline

Gets the dither threshold of the material.

Returns
A constant reference to the dither threshold vector.

Definition at line 327 of file material.h.

◆ get_emissive_color()

auto unravel::pbr_material::get_emissive_color ( ) const -> const math::color&
inline

Gets the emissive color of the material.

Returns
A constant reference to the emissive color.

Definition at line 158 of file material.h.

◆ get_emissive_intensity()

auto unravel::pbr_material::get_emissive_intensity ( ) const -> float
inline

Definition at line 172 of file material.h.

◆ get_emissive_map()

auto unravel::pbr_material::get_emissive_map ( ) const -> const asset_handle<gfx::texture>&
inline

Gets the emissive map of the material.

Returns
A constant reference to the emissive map asset handle.

Definition at line 435 of file material.h.

◆ get_metalness()

auto unravel::pbr_material::get_metalness ( ) const -> float
inline

Gets the metalness of the material.

Returns
The metalness value.

Definition at line 204 of file material.h.

◆ get_metalness_map()

auto unravel::pbr_material::get_metalness_map ( ) const -> const asset_handle<gfx::texture>&
inline

Gets the metalness map of the material.

Returns
A constant reference to the metalness map asset handle.

Definition at line 399 of file material.h.

◆ get_normal_map()

auto unravel::pbr_material::get_normal_map ( ) const -> const asset_handle<gfx::texture>&
inline

Gets the normal map of the material.

Returns
A constant reference to the normal map asset handle.

Definition at line 363 of file material.h.

◆ get_roughness()

auto unravel::pbr_material::get_roughness ( ) const -> float
inline

Gets the roughness of the material.

Returns
The roughness value.

Definition at line 186 of file material.h.

◆ get_roughness_map()

auto unravel::pbr_material::get_roughness_map ( ) const -> const asset_handle<gfx::texture>&
inline

Gets the roughness map of the material.

Returns
A constant reference to the roughness map asset handle.

Definition at line 381 of file material.h.

◆ get_subsurface_color()

auto unravel::pbr_material::get_subsurface_color ( ) const -> const math::color&
inline

Gets the subsurface color of the material.

Returns
A constant reference to the subsurface color.

Definition at line 140 of file material.h.

◆ get_surface_data()

auto unravel::pbr_material::get_surface_data ( ) const -> const math::vec4&
inline

Gets the surface data of the material.

Returns
A constant reference to the surface data vector.

Definition at line 278 of file material.h.

◆ get_surface_data2()

auto unravel::pbr_material::get_surface_data2 ( ) const -> math::vec4
inline

Gets additional surface data for the material.

Returns
A vector containing additional surface data.

Definition at line 287 of file material.h.

◆ get_tiling()

auto unravel::pbr_material::get_tiling ( ) const -> const math::vec2&
inline

Gets the tiling factor of the material.

Returns
A constant reference to the tiling vector.

Definition at line 309 of file material.h.

◆ infer_alpha_mode_from_legacy_cutoff()

void unravel::pbr_material::infer_alpha_mode_from_legacy_cutoff ( )

Infer alpha_mode when loading legacy assets that only stored a cutoff value.

Definition at line 134 of file material.cpp.

◆ make_shadow_cutout_state()

auto unravel::pbr_material::make_shadow_cutout_state ( ) const -> shadow_cutout_state
nodiscard

Snapshot of shader state needed by the shadow cutout pass.

Definition at line 122 of file material.cpp.

◆ metalness_roughness_combined()

auto unravel::pbr_material::metalness_roughness_combined ( ) const -> bool
inline

Definition at line 300 of file material.h.

◆ set_alpha_cutoff()

void unravel::pbr_material::set_alpha_cutoff ( float cutoff)

Sets the alpha cutoff for alpha_mode::mask materials.

Definition at line 97 of file material.cpp.

◆ set_alpha_mode()

void unravel::pbr_material::set_alpha_mode ( alpha_mode mode)

Sets the alpha mode.

Definition at line 91 of file material.cpp.

◆ set_ao_map()

void unravel::pbr_material::set_ao_map ( const asset_handle< gfx::texture > & val)
inline

Sets the ambient occlusion map of the material.

Parameters
valThe ambient occlusion map asset handle to set.

Definition at line 426 of file material.h.

◆ set_base_color()

void unravel::pbr_material::set_base_color ( const math::color & val)
inline

Sets the base color of the material.

Parameters
valThe base color to set.

Definition at line 131 of file material.h.

◆ set_bumpiness()

void unravel::pbr_material::set_bumpiness ( float bumpiness)
inline

Sets the bumpiness of the material.

Parameters
bumpinessThe bumpiness value to set.

Definition at line 231 of file material.h.

◆ set_color_map()

void unravel::pbr_material::set_color_map ( const asset_handle< gfx::texture > & val)
inline

Sets the color map of the material.

Parameters
valThe color map asset handle to set.

Definition at line 354 of file material.h.

◆ set_dither_threshold()

void unravel::pbr_material::set_dither_threshold ( const math::vec2 & threshold)
inline

Sets the dither threshold of the material.

Parameters
thresholdThe dither threshold to set.

Definition at line 336 of file material.h.

◆ set_emissive_color()

void unravel::pbr_material::set_emissive_color ( const math::color & val)
inline

Sets the emissive color of the material.

Parameters
valThe emissive color to set.

Definition at line 167 of file material.h.

◆ set_emissive_intensity()

void unravel::pbr_material::set_emissive_intensity ( float val)
inline

Definition at line 177 of file material.h.

◆ set_emissive_map()

void unravel::pbr_material::set_emissive_map ( const asset_handle< gfx::texture > & val)
inline

Sets the emissive map of the material.

Parameters
valThe emissive map asset handle to set.

Definition at line 444 of file material.h.

◆ set_metalness()

void unravel::pbr_material::set_metalness ( float metalness)
inline

Sets the metalness of the material.

Parameters
metalnessThe metalness value to set.

Definition at line 213 of file material.h.

◆ set_metalness_map()

void unravel::pbr_material::set_metalness_map ( const asset_handle< gfx::texture > & val)
inline

Sets the metalness map of the material.

Parameters
valThe metalness map asset handle to set.

Definition at line 408 of file material.h.

◆ set_normal_map()

void unravel::pbr_material::set_normal_map ( const asset_handle< gfx::texture > & val)
inline

Sets the normal map of the material.

Parameters
valThe normal map asset handle to set.

Definition at line 372 of file material.h.

◆ set_roughness()

void unravel::pbr_material::set_roughness ( float roughness)
inline

Sets the roughness of the material.

Parameters
roughnessThe roughness value to set.

Definition at line 195 of file material.h.

◆ set_roughness_map()

void unravel::pbr_material::set_roughness_map ( const asset_handle< gfx::texture > & val)
inline

Sets the roughness map of the material.

Parameters
valThe roughness map asset handle to set.

Definition at line 390 of file material.h.

◆ set_subsurface_color()

void unravel::pbr_material::set_subsurface_color ( const math::color & val)
inline

Sets the subsurface color of the material.

Parameters
valThe subsurface color to set.

Definition at line 149 of file material.h.

◆ set_tiling()

void unravel::pbr_material::set_tiling ( const math::vec2 & tiling)
inline

Sets the tiling factor of the material.

Parameters
tilingThe tiling factor to set.

Definition at line 318 of file material.h.

◆ uses_alpha_cutout()

auto unravel::pbr_material::uses_alpha_cutout ( ) const -> bool
nodiscard

True when alpha_mode is alpha_mode::mask (hard alpha clip + cutout shadows).

Definition at line 112 of file material.cpp.


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