Antkeeper  0.0.1
Public Types | Public Member Functions | List of all members
render::material_variable< T > Class Template Reference

Material variable. More...

#include <material-variable.hpp>

Inheritance diagram for render::material_variable< T >:
render::material_variable_base

Public Types

using element_type = T
 Material variable element type. More...
 

Public Member Functions

 material_variable (std::size_t size, const element_type &value=element_type())
 Constructs a material variable. More...
 
 material_variable ()
 Constructs a material variable with a single element. More...
 
 material_variable (std::initializer_list< element_type > list)
 Constructs a material variable from a list of element values. More...
 
virtual constexpr material_variable_type type () const noexcept override
 Returns the material variable data type. More...
 
std::size_t size () const noexcept override
 Returns the number of elements in an array variable, or 1 if the variable is not an array. More...
 
std::unique_ptr< material_variable_baseclone () const override
 Creates a copy of this material property. More...
 
void set (const element_type &value)
 Sets the value of the the variable, or the value of the first element if the variable is an array. More...
 
void set (std::size_t index, const element_type &value)
 Sets the value of a single element in an array variable. More...
 
const element_typeget () const
 Returns a reference to the first element in the array. More...
 
const element_typeget (std::size_t index) const
 Returns a reference to the element at a given index. More...
 
const element_typedata () const noexcept
 Returns a pointer to the element array. More...
 
- Public Member Functions inherited from render::material_variable_base
virtual ~material_variable_base ()=default
 Destructs a material variable base. More...
 

Detailed Description

template<class T>
class render::material_variable< T >

Material variable.

Template Parameters
TMaterial variable value type.

Definition at line 65 of file material-variable.hpp.

Member Typedef Documentation

◆ element_type

template<class T >
using render::material_variable< T >::element_type = T

Material variable element type.

Definition at line 69 of file material-variable.hpp.

Constructor & Destructor Documentation

◆ material_variable() [1/3]

template<class T >
render::material_variable< T >::material_variable ( std::size_t  size,
const element_type value = element_type() 
)
inlineexplicit

Constructs a material variable.

Parameters
sizeNumber of elements in the array, or 1 if the variable is not an array.
valueValue with which to initialize the elements.

Definition at line 77 of file material-variable.hpp.

◆ material_variable() [2/3]

template<class T >
render::material_variable< T >::material_variable ( )
inline

Constructs a material variable with a single element.

Definition at line 84 of file material-variable.hpp.

◆ material_variable() [3/3]

template<class T >
render::material_variable< T >::material_variable ( std::initializer_list< element_type list)
inlineexplicit

Constructs a material variable from a list of element values.

Parameters
listList of element values.

Definition at line 93 of file material-variable.hpp.

Member Function Documentation

◆ clone()

template<class T >
std::unique_ptr<material_variable_base> render::material_variable< T >::clone ( ) const
inlineoverridevirtual

Creates a copy of this material property.

Implements render::material_variable_base.

Definition at line 104 of file material-variable.hpp.

◆ data()

template<class T >
const element_type* render::material_variable< T >::data ( ) const
inlinenoexcept

Returns a pointer to the element array.

Definition at line 153 of file material-variable.hpp.

◆ get() [1/2]

template<class T >
const element_type& render::material_variable< T >::get ( ) const
inline

Returns a reference to the first element in the array.

Definition at line 133 of file material-variable.hpp.

◆ get() [2/2]

template<class T >
const element_type& render::material_variable< T >::get ( std::size_t  index) const
inline

Returns a reference to the element at a given index.

Parameters
indexIndex of an element.
Returns
Reference to the element at index.

Definition at line 145 of file material-variable.hpp.

◆ set() [1/2]

template<class T >
void render::material_variable< T >::set ( const element_type value)
inline

Sets the value of the the variable, or the value of the first element if the variable is an array.

Parameters
valueValue to set.

Definition at line 114 of file material-variable.hpp.

◆ set() [2/2]

template<class T >
void render::material_variable< T >::set ( std::size_t  index,
const element_type value 
)
inline

Sets the value of a single element in an array variable.

Parameters
indexIndex of an element.
valueValue to set.

Definition at line 125 of file material-variable.hpp.

◆ size()

template<class T >
std::size_t render::material_variable< T >::size ( ) const
inlineoverridevirtualnoexcept

Returns the number of elements in an array variable, or 1 if the variable is not an array.

Implements render::material_variable_base.

Definition at line 99 of file material-variable.hpp.

◆ type()

constexpr material_variable_type render::matvar_texture_cube::type ( ) const
inlineconstexproverridevirtualnoexcept

Returns the material variable data type.

Implements render::material_variable_base.

Definition at line 232 of file material-variable.hpp.


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