2#include <engine/engine_export.h>
69 virtual auto
get_render_states(
bool apply_cull = true,
bool depth_write = true,
bool depth_test = true) const
104 auto clone()
const -> std::shared_ptr<material>
override;
130 return subsurface_color_;
139 subsurface_color_ = val;
148 return emissive_color_;
157 emissive_color_ = val;
166 return surface_data_.x;
175 surface_data_.x = roughness;
184 return surface_data_.y;
193 surface_data_.y = metalness;
202 return surface_data_.z;
211 surface_data_.z = bumpiness;
220 return surface_data_.w;
229 surface_data_.w = alpha_test_value;
238 return surface_data_;
247 math::vec4 surface_data2{};
249 surface_data2[0] = metalness_roughness_combined() ? 1.0f : 0.0f;
251 return surface_data2;
256 return metalness_map_ == roughness_map_;
283 return dither_threshold_;
292 dither_threshold_ = threshold;
337 return roughness_map_;
346 roughness_map_ = val;
355 return metalness_map_;
364 metalness_map_ = val;
391 return emissive_map_;
426 math::vec4 surface_data_{
438 math::vec2 dither_threshold_{
Class representing a GPU program.
Base class for materials used in rendering.
static auto default_normal_map() -> asset_handle< gfx::texture > &
Gets the default normal map.
static auto default_color_map() -> asset_handle< gfx::texture > &
Gets the default color map.
std::weak_ptr< material > wptr
std::shared_ptr< material > sptr
void set_cull_type(cull_type val)
Sets the culling type of the material.
virtual auto submit(gpu_program *program) const -> bool
Submits the material properties to the GPU program.
virtual auto get_render_states(bool apply_cull=true, bool depth_write=true, bool depth_test=true) const -> uint64_t
Gets the render states for the material.
cull_type cull_type_
< The culling type for this material.
std::unique_ptr< material > uptr
auto get_cull_type() const -> cull_type
Gets the culling type of the material.
virtual auto clone() const -> material::sptr
Clones a materiial.
Class for physically-based rendering (PBR) materials.
auto get_surface_data2() const -> math::vec4
Gets additional surface data for the material.
auto get_dither_threshold() const -> const math::vec2 &
Gets the dither threshold of the material.
auto get_emissive_map() const -> const asset_handle< gfx::texture > &
Gets the emissive map of the material.
void set_subsurface_color(const math::color &val)
Sets the subsurface color of the material.
void set_roughness_map(const asset_handle< gfx::texture > &val)
Sets the roughness map of the material.
void set_base_color(const math::color &val)
Sets the base color of the material.
auto metalness_roughness_combined() const -> bool
auto get_subsurface_color() const -> const math::color &
Gets the subsurface color of the material.
void set_color_map(const asset_handle< gfx::texture > &val)
Sets the color map of the material.
void set_ao_map(const asset_handle< gfx::texture > &val)
Sets the ambient occlusion map of the material.
auto get_color_map() const -> const asset_handle< gfx::texture > &
Gets the color map of the material.
auto get_alpha_test_value() const -> float
Gets the alpha test value of the material.
auto get_bumpiness() const -> float
Gets the bumpiness of the material.
auto get_roughness() const -> float
Gets the roughness of the material.
auto get_metalness() const -> float
Gets the metalness of the material.
void set_dither_threshold(const math::vec2 &threshold)
Sets the dither threshold of the material.
auto get_surface_data() const -> const math::vec4 &
Gets the surface data of the material.
void set_bumpiness(float bumpiness)
Sets the bumpiness of the material.
void set_emissive_map(const asset_handle< gfx::texture > &val)
Sets the emissive 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_emissive_color(const math::color &val)
Sets the emissive color of the material.
auto get_metalness_map() const -> const asset_handle< gfx::texture > &
Gets the metalness map of the material.
auto get_tiling() const -> const math::vec2 &
Gets the tiling factor of the material.
void set_alpha_test_value(float alpha_test_value)
Sets the alpha test value of the material.
auto get_normal_map() const -> const asset_handle< gfx::texture > &
Gets the normal map of the material.
void set_metalness_map(const asset_handle< gfx::texture > &val)
Sets the metalness map of the material.
void set_tiling(const math::vec2 &tiling)
Sets the tiling factor of the material.
void set_roughness(float roughness)
Sets the roughness of the material.
void set_metalness(float metalness)
Sets the metalness of the material.
auto get_base_color() const -> const math::color &
Gets the base color of the material.
auto get_emissive_color() const -> const math::color &
Gets the emissive color of the material.
auto get_ao_map() const -> const asset_handle< gfx::texture > &
Gets the ambient occlusion map of the material.
cull_type
Enum representing the type of culling to be used.
@ counter_clockwise
Cull counter-clockwise faces.
@ clockwise
Cull clockwise faces.
Represents a handle to an asset, providing access and management functions.