StapleGL
Header-only C++20 OpenGL wrapper
Loading...
Searching...
No Matches
staplegl::shader_data_type Namespace Reference

Enumerations

enum class  shader_array_type : std::uint8_t {
  float32_arr , vec2_arr , vec3_arr , vec4_arr ,
  mat3_arr , mat4_arr
}
 Enumerator that represents an array of a given data type. More...
 
enum class  u_type : std::uint8_t {
  float32 , vec2 , vec3 , vec4 ,
  mat3 , mat4
}
 Enumerator that represents a data type. More...
 

Functions

static constexpr auto size (u_type type) -> std::size_t
 Get the size of the shader data type.
 
static constexpr auto to_opengl_type (u_type type) -> std::uint32_t
 Convert the shader data type to an OpenGL type.
 
static constexpr auto to_opengl_underlying_type (u_type type) -> std::uint32_t
 Obtains the OpenGL type of the underlying type of the shader data type.
 
static constexpr auto component_count (u_type type) -> std::uint16_t
 Get the number of components in the shader data type, useful for vector types.
 

Enumeration Type Documentation

◆ shader_array_type

enum class staplegl::shader_data_type::shader_array_type : std::uint8_t
strong

Enumerator that represents an array of a given data type.

Enumerator that represents an array of a given data type. This is used to define the type of the data that is passed as uniform to the shader, as well as a runtime type to feed as a parameter to other functions.

Enumerator
float32_arr 
vec2_arr 
vec3_arr 
vec4_arr 
mat3_arr 
mat4_arr 

Definition at line 38 of file shader_data_type.hpp.

◆ u_type

enum class staplegl::shader_data_type::u_type : std::uint8_t
strong

Enumerator that represents a data type.

Enumerator that represents a data type. This is used to define the type of the data that is passed as a uniform to the shader, as well as a runtime type to feed as a parameter to other functions in this module.

See also
staplegl::shader_data_type::size
staplegl::shader_data_type::to_opengl_type
staplegl::shader_data_type::component_count
Enumerator
float32 
vec2 
vec3 
vec4 
mat3 
mat4 

Definition at line 59 of file shader_data_type.hpp.

Function Documentation

◆ component_count()

static constexpr auto staplegl::shader_data_type::component_count ( u_type  type) -> std::uint16_t
staticconstexpr

Get the number of components in the shader data type, useful for vector types.

Parameters
typethe type of the shader data.
See also
staplegl::shader_data_type::u_type
Returns
std::uint16_t the number of components in the shader data type.

Definition at line 169 of file shader_data_type.hpp.

◆ size()

static constexpr auto staplegl::shader_data_type::size ( u_type  type) -> std::size_t
staticconstexpr

Get the size of the shader data type.

Parameters
typethe type of the shader data.
See also
staplegl::shader_data_type::u_type
Returns
std::size_t the size of the shader data type in bytes.

Definition at line 76 of file shader_data_type.hpp.

◆ to_opengl_type()

static constexpr auto staplegl::shader_data_type::to_opengl_type ( u_type  type) -> std::uint32_t
staticconstexpr

Convert the shader data type to an OpenGL type.

Parameters
typethe type of the shader data.
See also
staplegl::shader_data_type::u_type
Returns
std::uint32_t the equivalent OpenGL type, as an enum.

Definition at line 107 of file shader_data_type.hpp.

◆ to_opengl_underlying_type()

static constexpr auto staplegl::shader_data_type::to_opengl_underlying_type ( u_type  type) -> std::uint32_t
staticconstexpr

Obtains the OpenGL type of the underlying type of the shader data type.

This function retrieves the OpenGL type of the underlying type of the shader data type. For scalar types, this is the same as to_opengl_type, but for vector types, this is the type of the vector's components.

Parameters
type
Returns
constexpr std::uint32_t

Definition at line 142 of file shader_data_type.hpp.