GLSL Struct 1.4.8
glslstruct
Loading...
Searching...
No Matches
glslstruct Namespace Reference

Main namespace of glslstruct library. More...

Namespaces

namespace  uitls
 Utility namespace of glslstruct library.
namespace  utils

Classes

struct  max_alignment_layout_context
 layout context which contains max alignment of all variables More...
struct  struct_added_layout_context
 layout context which contains alignment of last added struct More...
struct  scalar_layout_context
 Scalar Layout additional context. More...
struct  scalar_layout_traits
 Scalar Layout traits. More...
struct  std140_layout_context
 Std140 Layout additional context. More...
struct  std140_layout_traits
 Std140 Layout traits. More...
struct  std430_layout_context
 Std430 Layout additional context. More...
struct  std430_layout_traits
 Std430 Layout traits. More...
class  array_type
 array type container More...
class  vec_type
 vec type container More...
class  base_type
 base class for all glsl type containers More...
class  type_hash_visitor
 visitor which calculate has of type More...
class  mat_type
 mat type container More...
class  scalar_type
 scalar type container More...
class  struct_type
 struct type container More...
class  mat_data
 glsl mat data container More...
struct  scalar_traits< bool >
 scalar_traits for bool values More...
struct  scalar_traits< int >
 scalar_traits for int values More...
struct  scalar_traits< unsigned int >
 scalar_traits for unsigned int values More...
struct  scalar_traits< float >
 scalar_traits for float values More...
struct  scalar_traits< double >
 scalar_traits for double values More...
class  scalar_data
 glsl scalar data container More...
class  vec_data
 glsl vec data container More...
struct  mat_traits< glm::mat< C, R, T, Q > >
 mat_traits for glm::mat values More...
struct  mat_traits< mstd::mat< C, R, T > >
 mat_traits for mstd::mat values More...
struct  vec_traits< glm::vec< L, T, Q > >
 vec_traits for glm::vec values More...
struct  vec_traits< mstd::vec< N, T > >
 vec_traits for mstd::vec values More...
class  type
 intermediate glsl type containers More...
class  var_data
 container for all variable data More...
struct  glsl_variable
 container for variables for easier initialization of layouts More...
struct  glsl_value
 container for values for easier initialization of structs More...
struct  is_type_visitor
 struct with bool_constant which is true if type T is type visitor More...
class  glsl_opengl_writer
 struct to opengl glsl writer More...
class  glsl_vulkan_writer
 struct to vulkan glsl writer More...
class  base_layout
 base layout container More...
struct  is_layout_traits
 Type trait to check if T is a valid layout trait. More...
class  base_parser
 base template class of structs parser More...
class  base_struct
 base class for glsl struct representation More...
struct  is_glsl_layout
 helper struct to check if type is glsl layout More...
struct  is_glsl_layout< base_layout< T > >
struct  is_glsl_simple
 check if type is glsl simple (is of scalar or vec or mat type) More...
struct  is_glsl_struct
 helper struct to check if type is glsl struct More...
struct  is_glsl_struct< base_struct< L > >
struct  is_glsl_type
 check if T is glsl type (not base_type container but derived from base_type container) More...
struct  is_glsl_base_type
 check if T is base_type container More...
struct  mat_traits
 Contains all static functions needed for layout and struct classes to interpret given mat type as glsl mat value. More...
struct  is_glsl_mat
 struct with bool_constant which is true if type can be converted to glsl mat type More...
struct  scalar_traits
 Contains all static functions needed for layout and struct classes to interpret given scalar type as glsl scalar value. More...
struct  is_glsl_scalar
 struct with bool_constant which is true if type can be converted to glsl scalar type More...
struct  vec_traits
 Contains all static functions needed for layout and struct classes to interpret given vec type as glsl vec value. More...
struct  is_glsl_vec
 struct with bool_constant which is true if type can be converted to glsl vec type More...
class  eq_type_visitor
 visitor which checks if value glsl type A is equal to glsl type B More...

Concepts

concept  type_visitor
 glsl type visitor concept
concept  layout_traits
 The primary concept for GLSL layout trait definitions.
concept  glsl_layout
 check if type is glsl layout
concept  glsl_simple
 check if type is glsl simple (is of scalar or vec or mat type)
concept  glsl_struct
 check if type is glsl struct
concept  glsl_type
 check if T is glsl type (not base_type container but derived from base_type container)
concept  glsl_base_type
 check if T is base_type container
concept  glsl_mat
 Concept defining which type can be converted to glsl mat type.
concept  glsl_scalar
 Concept defining which type can be converted to glsl scalar type.
concept  glsl_vec
 Concept defining which type can be converted to glsl vec type.

Typedefs

using std140_parser = base_parser<std140_layout>
 parser for std140 layout
using std430_parser = base_parser<std430_layout>
 parser for std430 layout
using scalar_parser = base_parser<scalar_layout>
 parser for scalar layout
using std140_layout = base_layout<std140_layout_traits>
 std140 layout representation
using std430_layout = base_layout<std430_layout_traits>
 std430 layout representation
using scalar_layout = base_layout<scalar_layout_traits>
 scalar layout representation
using std140_struct = base_struct<std140_layout>
 std140 struct representation
using std430_struct = base_struct<std430_layout>
 std430 struct representation
using scalar_struct = base_struct<scalar_layout>
 scalar struct representation
using base_type_handle = std::shared_ptr<base_type>
 base_type container handle
template<class Derived>
using type_handle = std::shared_ptr<type<Derived> >
 type container handle
using scalar_type_handle = std::shared_ptr<scalar_type>
 scalar_type container handle
using vec_type_handle = std::shared_ptr<vec_type>
 vec_type container handle
using mat_type_handle = std::shared_ptr<mat_type>
 mat_type container handle
using array_type_handle = std::shared_ptr<array_type>
 array_type container handle
using struct_type_handle = std::shared_ptr<struct_type>
 struct_type container handle

Functions

_GLSL_STRUCT_EXPORT size_t ceil_to_nearest_multiple (size_t valueToRoundUp, size_t multipleValue) noexcept
 returns value rounded up to nearest multiple of given value
_GLSL_STRUCT_EXPORT std::string get_array_elem_name (std::string_view arrayName, size_t elemIdx)
 returns array elem name
_GLSL_STRUCT_EXPORT std::string get_struct_elem_name (std::string_view structName, std::string_view elemName)
 returns struct elem name
bool operator== (const array_type &lhs, const array_type &rhs)
 checks if two array types are equal
bool operator!= (const array_type &lhs, const array_type &rhs)
 checks if two array types are not equal
bool operator== (const vec_type &lhs, const vec_type &rhs)
 checks if two vec types are equal
bool operator!= (const vec_type &lhs, const vec_type &rhs)
 checks if two vec types are not equal
_GLSL_STRUCT_EXPORT size_t sizeof_type (const base_type_handle &type) noexcept
 returns size of given type
template<glsl_type T>
_GLSL_STRUCT_CONSTEXPR17 size_t sizeof_type (const std::shared_ptr< T > &type) noexcept
 returns size of given type
_GLSL_STRUCT_EXPORT std::string to_string (const base_type_handle &type) noexcept
 converts type to string
template<glsl_type T>
std::string to_string (const std::shared_ptr< T > &type) noexcept
 converts type to string
template<type_visitor V>
void visit (V &&visitor, const base_type_handle &type)
 visits type
template<glsl_type T, type_visitor V>
void visit (V &&visitor, const std::shared_ptr< T > &type)
 visits type
template<type_visitor V>
void visit (V &&visitor, const base_type &type)
 visits type
template<glsl_type T, type_visitor V>
void visit (V &&visitor, const T &type)
 visits type
template<glsl_type T>
_GLSL_STRUCT_INLINE17 _GLSL_STRUCT_CONSTEXPR20 bool operator== (const base_type &lhs, const T &rhs)
 checks if types are equal
template<glsl_type T>
_GLSL_STRUCT_INLINE17 _GLSL_STRUCT_CONSTEXPR20 bool operator!= (const base_type &lhs, const T &rhs)
 checks if types are not equal
bool operator== (const mat_type &lhs, const mat_type &rhs)
 checks if two mats types are equal
bool operator!= (const mat_type &lhs, const mat_type &rhs)
 checks if two mats types are not equal
bool operator== (const scalar_type &lhs, const scalar_type &rhs)
 checks if two scalar types are equal
bool operator!= (const scalar_type &lhs, const scalar_type &rhs)
 checks if two scalar types are not equal
bool operator== (const struct_type &lhs, const struct_type &rhs)
 checks if two struct types are equal
bool operator!= (const struct_type &lhs, const struct_type &rhs)
 checks if two struct types are not equal
template<glsl_scalar T>
ValueType get_scalar_value_type () noexcept
 returns ValueType of T based on scalar_traits
template<glsl_scalar T>
scalar_data get_scalar_data (const T &value)
 returns scalar_data of T based on scalar_traits
template<glsl_scalar T>
get_scalar_value (const scalar_data &data)
 returns value of type T from scalar_data based on scalar_traits
_GLSL_STRUCT_EXPORT std::string scalar_to_string (ValueType valueType)
 returns glsl scalar type string
template<glsl_scalar T>
std::string scalar_to_string ()
 returns glsl scalar type string from type T based on scalar_traits
template<glsl_mat T>
_GLSL_STRUCT_CONSTEXPR17 size_t get_mat_columns () noexcept
 returns number of columns of T based on mat_traits
template<glsl_mat T>
_GLSL_STRUCT_CONSTEXPR17 size_t get_mat_rows () noexcept
 returns number of rows of T based on mat_traits
template<glsl_mat T>
_GLSL_STRUCT_CONSTEXPR17 ValueType get_mat_value_type () noexcept
 returns ValueType of T based on mat_traits
template<glsl_mat T>
mat_data get_mat_data (const T &value)
 returns mat_data of T based on mat_traits
template<glsl_mat T>
get_mat_value (const mat_data &data)
 returns mat value of type T from mat_data based on mat_traits
_GLSL_STRUCT_EXPORT std::string mat_to_string (ValueType valueType, size_t columns, size_t rows)
 returns glsl mat type string
template<glsl_mat T>
std::string mat_to_string ()
 returns glsl mat type string from type T based on mat_traits
template<glsl_vec T>
_GLSL_STRUCT_CONSTEXPR17 size_t get_vec_length () noexcept
 returns length of T based on vec_traits
template<glsl_vec T>
_GLSL_STRUCT_CONSTEXPR17 ValueType get_vec_value_type () noexcept
 returns ValueType of T based on vec_traits
template<glsl_vec T>
vec_data get_vec_data (const T &value)
 returns vec_data of T based on vec_traits
template<glsl_vec T>
get_vec_value (const vec_data &data)
 returns vec value of type T from vec_data based on vec_traits
std::string vec_to_string (ValueType valueType, size_t length)
 returns glsl vec type string
template<glsl_vec T>
std::string vec_to_string ()
 returns glsl vec type string from type T based on vec_traits
 ENUM_CLASS_BASE (BaseType, uint8_t,(Scalar),(Vec),(Mat),(Struct),(Array)) template< glsl_type T > class is_of_type_visitor
 base_type types in enum values
template<glsl_type T>
_GLSL_STRUCT_INLINE17 _GLSL_STRUCT_CONSTEXPR20 bool is_of_type (const base_type_handle &type)
 requests is_of_type visitor to visit base_type
template<glsl_type T>
_GLSL_STRUCT_INLINE17 _GLSL_STRUCT_CONSTEXPR20 bool is_of_type (const std::shared_ptr< T > &)
 requests is_of_type visitor to visit any glsl type
_GLSL_STRUCT_EXPORT bool is_of_type (const base_type_handle &type, BaseType baseType)
 requests is_of_type visitor to visit base_type
template<glsl_type T>
_GLSL_STRUCT_INLINE17 _GLSL_STRUCT_CONSTEXPR20 bool is_of_type (const std::shared_ptr< T > &, const BaseType baseType)
 requests is_of_type visitor to visit any glsl type
template<glsl_type T>
std::shared_ptr< T > dynamic_type_cast (const base_type_handle &type)
 checks if base_type is of given type and returns handle to this type or nullptr if it is not
template<glsl_type T>
base_type_handle dynamic_type_cast (const std::shared_ptr< T > &type)
 converts any glsl type handle to base_type handle
template<glsl_type T>
_GLSL_STRUCT_INLINE17 _GLSL_STRUCT_CONSTEXPR20 std::shared_ptr< T > static_type_cast (const base_type_handle &type)
 checks if base_type is of given type and returns handle to this type or error if it is not
template<glsl_type T>
base_type_handle static_type_cast (const std::shared_ptr< T > &type)
 converts any glsl type handle to base_type handle
template<class DerivedA, class DerivedB>
_GLSL_STRUCT_EXPORT _GLSL_STRUCT_CONSTEXPR17 bool operator== (const type< DerivedA > &lhs, const type< DerivedB > &rhs)
 equal operator for two intermediate types
template<class DerivedA, class DerivedB>
_GLSL_STRUCT_EXPORT _GLSL_STRUCT_CONSTEXPR17 bool operator!= (const type< DerivedA > &lhs, const type< DerivedB > &rhs)
 not equal operator for two intermediate types
 ENUM_CLASS_BASE (ValueType, uint8_t,(Bool),(Int),(Uint),(Float),(Double)) template< class T > static _GLSL_STRUCT_CONSTEXPR17 ValueType get_value_type() noexcept _GLSL_STRUCT_REQUIRES((mstd
 Value Type Enum.
_GLSL_STRUCT_EXPORT size_t get_value_type_size (ValueType type)
 Returns glsl type size of scalar.

Variables

template<class T>
static _GLSL_STRUCT_CONSTEXPR17 bool is_type_visitor_v = type_visitor<T>
 bool which is true if type T is type visitor
template<class T>
static _GLSL_STRUCT_CONSTEXPR17 bool is_layout_traits_v = layout_traits<T>
 Compile-time constant to check if T is a valid layout trait.
template<class T>
static _GLSL_STRUCT_CONSTEXPR17 bool is_glsl_layout_v = is_glsl_layout<T>::value
 check if type is glsl layout
template<class T>
static _GLSL_STRUCT_CONSTEXPR17 bool is_glsl_simple_v = is_glsl_scalar_v<T> || is_glsl_vec_v<T> || is_glsl_mat_v<T>
 check if type is glsl simple (is of scalar or vec or mat type)
template<class S>
static _GLSL_STRUCT_CONSTEXPR17 bool is_glsl_struct_v = is_glsl_struct<S>::value
 check if type is glsl struct
template<class T>
static _GLSL_STRUCT_CONSTEXPR17 bool is_glsl_type_v
 check if T is glsl type (not base_type container but derived from base_type container)
template<class T>
static _GLSL_STRUCT_CONSTEXPR17 bool is_glsl_base_type_v = std::is_same_v<base_type, mstd::remove_cvref_t<T> >
 check if T is base_type container
template<class T>
static _GLSL_STRUCT_CONSTEXPR17 bool is_glsl_mat_v = glsl_mat<T>
 Bool value which is true if type can be converted to glsl mat type.
template<class T>
static _GLSL_STRUCT_CONSTEXPR17 bool is_glsl_scalar_v = glsl_scalar<T>
 Bool value which is true if type can be converted to glsl scalar type.
template<class T>
static _GLSL_STRUCT_CONSTEXPR17 bool is_glsl_vec_v = glsl_vec<T>
 Bool value which is true if type can be converted to glsl vec type.

Detailed Description

Main namespace of glslstruct library.

Function Documentation

◆ get_mat_columns()

template<glsl_mat T>
_GLSL_STRUCT_CONSTEXPR17 size_t glslstruct::get_mat_columns ( )
noexcept

returns number of columns of T based on mat_traits

◆ get_mat_data()

template<glsl_mat T>
mat_data glslstruct::get_mat_data ( const T & value)
inline

returns mat_data of T based on mat_traits

◆ get_mat_rows()

template<glsl_mat T>
_GLSL_STRUCT_CONSTEXPR17 size_t glslstruct::get_mat_rows ( )
noexcept

returns number of rows of T based on mat_traits

◆ get_mat_value()

template<glsl_mat T>
T glslstruct::get_mat_value ( const mat_data & data)
inline

returns mat value of type T from mat_data based on mat_traits

◆ get_mat_value_type()

template<glsl_mat T>
_GLSL_STRUCT_CONSTEXPR17 ValueType glslstruct::get_mat_value_type ( )
noexcept

returns ValueType of T based on mat_traits

◆ get_scalar_data()

template<glsl_scalar T>
scalar_data glslstruct::get_scalar_data ( const T & value)
inline

returns scalar_data of T based on scalar_traits

◆ get_scalar_value()

template<glsl_scalar T>
T glslstruct::get_scalar_value ( const scalar_data & data)
inline

returns value of type T from scalar_data based on scalar_traits

◆ get_scalar_value_type()

template<glsl_scalar T>
ValueType glslstruct::get_scalar_value_type ( )
inlinenoexcept

returns ValueType of T based on scalar_traits

◆ get_vec_data()

template<glsl_vec T>
vec_data glslstruct::get_vec_data ( const T & value)
inline

returns vec_data of T based on vec_traits

◆ get_vec_length()

template<glsl_vec T>
_GLSL_STRUCT_CONSTEXPR17 size_t glslstruct::get_vec_length ( )
noexcept

returns length of T based on vec_traits

◆ get_vec_value()

template<glsl_vec T>
T glslstruct::get_vec_value ( const vec_data & data)
inline

returns vec value of type T from vec_data based on vec_traits

◆ get_vec_value_type()

template<glsl_vec T>
_GLSL_STRUCT_CONSTEXPR17 ValueType glslstruct::get_vec_value_type ( )
noexcept

returns ValueType of T based on vec_traits

◆ mat_to_string() [1/2]

template<glsl_mat T>
std::string glslstruct::mat_to_string ( )
inline

returns glsl mat type string from type T based on mat_traits

◆ mat_to_string() [2/2]

_GLSL_STRUCT_EXPORT std::string glslstruct::mat_to_string ( ValueType valueType,
size_t columns,
size_t rows )

returns glsl mat type string

◆ scalar_to_string() [1/2]

template<glsl_scalar T>
std::string glslstruct::scalar_to_string ( )
inline

returns glsl scalar type string from type T based on scalar_traits

◆ scalar_to_string() [2/2]

_GLSL_STRUCT_EXPORT std::string glslstruct::scalar_to_string ( ValueType valueType)

returns glsl scalar type string

◆ vec_to_string() [1/2]

template<glsl_vec T>
std::string glslstruct::vec_to_string ( )
inline

returns glsl vec type string from type T based on vec_traits

◆ vec_to_string() [2/2]

std::string glslstruct::vec_to_string ( ValueType valueType,
size_t length )

returns glsl vec type string