55 ,
type { static_cast<shader_data_type::u_type>(in_type) }
82 std::size_t m_stride {};
93 : m_attributes { attributes }
95 for (
auto& attribute : m_attributes) {
96 attribute.offset = m_stride;
106 [[nodiscard]]
constexpr auto stride() const noexcept -> std::
size_t {
return m_stride; }
113 [[nodiscard]]
constexpr auto stride_elements() const noexcept -> std::
size_t {
return m_stride /
sizeof(float); }
122 return { m_attributes };
constexpr auto stride() const noexcept -> std::size_t
Get the stride of the vertex buffer layout.
vertex_buffer_layout()=default
vertex_buffer_layout(std::initializer_list< vertex_attribute > attributes)
Construct a new vertex buffer layout object.
std::vector< vertex_attribute > m_attributes
constexpr auto stride_elements() const noexcept -> std::size_t
Get the stride of the vertex buffer layout in elements (assuming float-only data).
auto get_attributes() const noexcept -> std::span< const vertex_attribute >
Get the data of the vertex buffer layout as a non-owning view.
auto operator[](std::size_t index) const -> const vertex_attribute &
Get a single attribute from the vertex buffer layout.
u_type
Enumerator that represents a data type.
static constexpr auto size(u_type type) -> std::size_t
Get the size of the shader data type.
shader_array_type
Enumerator that represents an array of a given data type.
Shader data type definitions.
vertex_attribute()=default
~vertex_attribute()=default
vertex_attribute(const vertex_attribute &) noexcept=default
auto operator=(const vertex_attribute &) noexcept -> vertex_attribute &=default
std::size_t element_count
vertex_attribute(vertex_attribute &&) noexcept=default
vertex_attribute(shader_data_type::u_type in_type, std::string_view in_name)
vertex_attribute(shader_data_type::shader_array_type in_type, std::string_view in_name, size_t element_count)
shader_data_type::u_type type