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

Base class for materials used in rendering. More...

#include <material.h>

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

Public Types

using sptr = std::shared_ptr<material>
 
using wptr = std::weak_ptr<material>
 
using uptr = std::unique_ptr<material>
 

Public Member Functions

 material ()=default
 
virtual ~material ()=default
 
virtual auto submit (gpu_program *program) const -> bool
 Submits the material properties to the GPU program.
 
auto get_cull_type () const -> cull_type
 Gets the culling type of the material.
 
void set_cull_type (cull_type val)
 Sets the culling type of the material.
 
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.
 
virtual auto clone () const -> material::sptr
 Clones a materiial.
 
- Public Member Functions inherited from crtp_meta_type< 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
 

Static Public Member Functions

static auto default_color_map () -> asset_handle< gfx::texture > &
 Gets the default color map.
 
static auto default_normal_map () -> asset_handle< gfx::texture > &
 Gets the default normal map.
 
- Static Public Member Functions inherited from crtp_meta_type< material >
static auto get_static_meta_type () -> entt::meta_type
 

Protected Attributes

cull_type cull_type_ = cull_type::counter_clockwise
 < The culling type for this material.
 

Detailed Description

Base class for materials used in rendering.

Definition at line 31 of file material.h.

Member Typedef Documentation

◆ sptr

using unravel::material::sptr = std::shared_ptr<material>

Definition at line 36 of file material.h.

◆ uptr

using unravel::material::uptr = std::unique_ptr<material>

Definition at line 38 of file material.h.

◆ wptr

using unravel::material::wptr = std::weak_ptr<material>

Definition at line 37 of file material.h.

Constructor & Destructor Documentation

◆ material()

unravel::material::material ( )
default

◆ ~material()

virtual unravel::material::~material ( )
virtualdefault

Member Function Documentation

◆ clone()

auto unravel::material::clone ( ) const -> material::sptr
virtual

Clones a materiial.

Returns
A shared_pointer to the new material

Definition at line 9 of file material.cpp.

◆ default_color_map()

auto unravel::material::default_color_map ( ) -> asset_handle<gfx::texture>&
static

Gets the default color map.

Returns
A reference to the default color map asset handle.

Definition at line 15 of file material.cpp.

◆ default_normal_map()

auto unravel::material::default_normal_map ( ) -> asset_handle<gfx::texture>&
static

Gets the default normal map.

Returns
A reference to the default normal map asset handle.

Definition at line 21 of file material.cpp.

◆ get_cull_type()

auto unravel::material::get_cull_type ( ) const -> cull_type

Gets the culling type of the material.

Returns
The culling type.

Definition at line 32 of file material.cpp.

◆ get_render_states()

auto unravel::material::get_render_states ( bool apply_cull = true,
bool depth_write = true,
bool depth_test = true ) const -> uint64_t
virtual

Gets the render states for the material.

Parameters
apply_cullWhether to apply culling.
depth_writeWhether to write to the depth buffer.
depth_testWhether to perform depth testing.
Returns
The render states as a 64-bit integer.

Definition at line 42 of file material.cpp.

◆ set_cull_type()

void unravel::material::set_cull_type ( cull_type val)

Sets the culling type of the material.

Parameters
valThe culling type to set.

Definition at line 37 of file material.cpp.

◆ submit()

auto unravel::material::submit ( gpu_program * program) const -> bool
virtual

Submits the material properties to the GPU program.

Parameters
programThe GPU program to submit the properties to.

Definition at line 27 of file material.cpp.

Member Data Documentation

◆ cull_type_

cull_type unravel::material::cull_type_ = cull_type::counter_clockwise
protected

< The culling type for this material.

Definition at line 92 of file material.h.


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