16#include <initializer_list>
33enum class ShaderDataType { None = 0, Float, Float2, Float3, Float4, Mat3, Mat4, Int, Int2, Int3, Int4, Bool };
109 BufferLayout(
const std::initializer_list<BufferElement> &elements);
128 inline const std::vector<BufferElement> &
get_elements()
const {
return m_elements; }
138 std::vector<BufferElement>::iterator
begin();
148 std::vector<BufferElement>::iterator
end();
158 std::vector<BufferElement>::const_iterator
begin()
const;
168 std::vector<BufferElement>::const_iterator
end()
const;
177 void calculate_offsets_and_stride();
180 std::vector<BufferElement> m_elements;
183 unsigned int m_stride = 0;
207 VertexBuffer(
const void *vertices,
unsigned int size,
bool dynamic =
false);
234 void set_data(
const void *data,
unsigned int size);
258 unsigned int m_renderer_id;
261 unsigned int m_count;
286 IndexBuffer(
const unsigned int *indices,
unsigned int count);
312 inline unsigned int get_count()
const {
return m_count; }
316 unsigned int m_renderer_id;
319 unsigned int m_count;
Defines the layout of a buffer, consisting of multiple buffer elements.
Definition buffer.hpp:96
unsigned int get_stride() const
Get the stride of the buffer layout.
Definition buffer.hpp:118
BufferLayout()
Default constructor.
Definition buffer.hpp:99
std::vector< BufferElement >::iterator end()
End iterator for mutable access.
Definition buffer.cpp:62
std::vector< BufferElement >::iterator begin()
Iterator support for the buffer layout elements.
Definition buffer.cpp:60
const std::vector< BufferElement > & get_elements() const
Get the elements of the buffer layout.
Definition buffer.hpp:128
IndexBuffer(const unsigned int *indices, unsigned int count)
Constructor for the IndexBuffer.
Definition buffer.cpp:99
unsigned int get_count() const
Get the count of indices in the buffer.
Definition buffer.hpp:312
void unbind() const
Unbind the index buffer.
Definition buffer.cpp:109
~IndexBuffer()
Destructor for the IndexBuffer.
Definition buffer.cpp:105
void bind() const
Bind the index buffer.
Definition buffer.cpp:107
~VertexBuffer()
Destructor for the VertexBuffer.
Definition buffer.cpp:82
VertexBuffer(const void *vertices, unsigned int size, bool dynamic=false)
Constructor for the VertexBuffer.
Definition buffer.cpp:76
void bind() const
Bind the vertex buffer.
Definition buffer.cpp:84
void set_data(const void *data, unsigned int size)
Set the data of the vertex buffer.
Definition buffer.cpp:88
void unbind() const
Unbind the vertex buffer.
Definition buffer.cpp:86
void set_layout(const BufferLayout &layout)
Set the layout of the vertex buffer.
Definition buffer.cpp:93
const BufferLayout & get_layout() const
Get the layout of the vertex buffer.
Definition buffer.cpp:95
Namespace for rendering-related classes and functions.
Definition buffer.cpp:9
ShaderDataType
Enumerates the various data types used in shaders.
Definition buffer.hpp:33
Forward declarations for Assimp Material structure.
Definition model_loader.cpp:12
size_t offset
Offset of the buffer element within the buffer.
Definition buffer.hpp:56
std::string name
Name of the buffer element.
Definition buffer.hpp:47
ShaderDataType type
Data type of the buffer element.
Definition buffer.hpp:50
bool normalized
Indicates if the data is normalized.
Definition buffer.hpp:59
unsigned int size
Size of the buffer element in bytes.
Definition buffer.hpp:53
BufferElement()=default
Default constructor.
unsigned int get_component_count() const
Get the number of components in the buffer element.
Definition buffer.cpp:33