light/modules/renderer/private/gl/buffers.hpp

62 lines
921 B
C++
Raw Normal View History

2022-03-08 21:19:19 +03:30
#pragma once
#include <renderer/buffers.hpp>
2022-03-08 21:19:19 +03:30
2025-07-11 00:05:48 +03:30
namespace lt {
2022-03-08 21:19:19 +03:30
class glConstantBuffer: public ConstantBuffer
{
public:
glConstantBuffer(ConstantBufferIndex index, unsigned int size);
2025-07-05 16:07:51 +03:30
~glConstantBuffer() override;
2022-03-08 21:19:19 +03:30
void bind() override;
2022-03-08 21:19:19 +03:30
2025-07-06 14:02:50 +03:30
auto map() -> void * override;
2025-07-05 16:07:51 +03:30
void un_map() override;
2022-03-08 21:19:19 +03:30
private:
unsigned int m_buffer_id;
2022-03-08 21:19:19 +03:30
2025-07-05 16:07:51 +03:30
unsigned int m_index;
};
class glVertexBuffer: public VertexBuffer
{
2022-03-08 21:19:19 +03:30
public:
2025-07-05 13:28:41 +03:30
glVertexBuffer(float *vertices, unsigned int stride, unsigned int count);
2025-07-05 16:07:51 +03:30
2025-07-06 16:52:50 +03:30
~glVertexBuffer() override;
2022-03-08 21:19:19 +03:30
void bind() override;
2025-07-05 16:07:51 +03:30
void un_bind() override;
2022-03-08 21:19:19 +03:30
2025-07-06 14:02:50 +03:30
auto map() -> void * override;
2025-07-05 16:07:51 +03:30
void un_map() override;
2022-03-08 21:19:19 +03:30
private:
unsigned int m_buffer_id;
2025-07-05 16:07:51 +03:30
};
2022-03-08 21:19:19 +03:30
2025-07-05 16:07:51 +03:30
class glIndexBuffer: public IndexBuffer
{
2022-03-08 21:19:19 +03:30
public:
2025-07-05 13:28:41 +03:30
glIndexBuffer(unsigned int *indices, unsigned int count);
2025-07-05 16:07:51 +03:30
2025-07-06 16:52:50 +03:30
~glIndexBuffer() override;
2022-03-08 21:19:19 +03:30
void bind() override;
2025-07-05 16:07:51 +03:30
void un_bind() override;
2025-07-05 16:07:51 +03:30
private:
unsigned int m_buffer_id;
2022-03-08 21:19:19 +03:30
};
2025-07-11 00:05:48 +03:30
} // namespace lt