2022-03-08 21:19:19 +03:30
|
|
|
#pragma once
|
|
|
|
|
2025-07-10 13:29:03 +03:30
|
|
|
|
2022-03-08 21:19:19 +03:30
|
|
|
|
|
|
|
namespace Light {
|
|
|
|
|
|
|
|
class SharedContext;
|
|
|
|
|
|
|
|
enum class ConstantBufferIndex
|
|
|
|
{
|
|
|
|
ViewProjection = 0u
|
|
|
|
};
|
|
|
|
|
|
|
|
class ConstantBuffer
|
|
|
|
{
|
|
|
|
public:
|
2025-07-06 16:52:50 +03:30
|
|
|
virtual ~ConstantBuffer() = default;
|
2025-07-06 14:02:50 +03:30
|
|
|
static auto create(
|
|
|
|
ConstantBufferIndex index,
|
|
|
|
unsigned int size,
|
2025-07-06 16:52:50 +03:30
|
|
|
const Ref<SharedContext>& sharedContext
|
2025-07-06 14:02:50 +03:30
|
|
|
) -> Scope<ConstantBuffer>;
|
|
|
|
|
|
|
|
virtual auto map() -> void * = 0;
|
2022-03-08 21:19:19 +03:30
|
|
|
|
2025-07-05 15:36:53 +03:30
|
|
|
virtual void un_map() = 0;
|
2022-03-08 21:19:19 +03:30
|
|
|
|
2025-07-05 15:36:53 +03:30
|
|
|
virtual void bind() = 0;
|
2022-03-08 21:19:19 +03:30
|
|
|
|
|
|
|
protected:
|
|
|
|
ConstantBuffer() = default;
|
|
|
|
};
|
|
|
|
|
|
|
|
class VertexBuffer
|
|
|
|
{
|
|
|
|
public:
|
2025-07-06 14:02:50 +03:30
|
|
|
static auto create(
|
|
|
|
float *vertices,
|
|
|
|
unsigned int stride,
|
|
|
|
unsigned int count,
|
2025-07-06 16:52:50 +03:30
|
|
|
const Ref<SharedContext>& sharedContext
|
2025-07-06 14:02:50 +03:30
|
|
|
) -> Ref<VertexBuffer>;
|
2022-03-08 21:19:19 +03:30
|
|
|
|
|
|
|
virtual ~VertexBuffer() = default;
|
|
|
|
|
2025-07-06 14:02:50 +03:30
|
|
|
virtual auto map() -> void * = 0;
|
|
|
|
|
2025-07-05 15:36:53 +03:30
|
|
|
virtual void un_map() = 0;
|
2022-03-08 21:19:19 +03:30
|
|
|
|
2025-07-06 14:02:50 +03:30
|
|
|
virtual void bind() = 0;
|
|
|
|
|
2025-07-05 15:36:53 +03:30
|
|
|
virtual void un_bind() = 0;
|
2022-03-08 21:19:19 +03:30
|
|
|
|
|
|
|
protected:
|
|
|
|
VertexBuffer() = default;
|
|
|
|
};
|
|
|
|
|
|
|
|
class IndexBuffer
|
|
|
|
{
|
|
|
|
public:
|
2025-07-06 16:52:50 +03:30
|
|
|
static auto create(unsigned int *indices, unsigned int count, const Ref<SharedContext>& sharedContext)
|
2025-07-06 14:02:50 +03:30
|
|
|
-> Ref<IndexBuffer>;
|
2022-03-08 21:19:19 +03:30
|
|
|
|
|
|
|
virtual ~IndexBuffer() = default;
|
|
|
|
|
2025-07-06 14:02:50 +03:30
|
|
|
virtual void bind() = 0;
|
|
|
|
|
2025-07-05 15:36:53 +03:30
|
|
|
virtual void un_bind() = 0;
|
2022-03-08 21:19:19 +03:30
|
|
|
|
|
|
|
protected:
|
|
|
|
IndexBuffer() = default;
|
|
|
|
};
|
|
|
|
|
2025-07-05 13:28:41 +03:30
|
|
|
} // namespace Light
|