2022-03-08 21:19:19 +03:30
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <d3d11.h>
|
2025-07-10 13:29:03 +03:30
|
|
|
|
|
|
|
#include <renderer/buffers.hpp>
|
2022-03-08 21:19:19 +03:30
|
|
|
#include <wrl.h>
|
|
|
|
|
|
|
|
namespace Light {
|
|
|
|
|
|
|
|
class dxSharedContext;
|
|
|
|
|
|
|
|
class dxConstantBuffer: public ConstantBuffer
|
|
|
|
{
|
|
|
|
public:
|
2025-07-05 13:28:41 +03:30
|
|
|
dxConstantBuffer(
|
|
|
|
ConstantBufferIndex index,
|
|
|
|
unsigned int size,
|
|
|
|
Ref<dxSharedContext> sharedContext
|
|
|
|
);
|
2022-03-08 21:19:19 +03:30
|
|
|
|
2025-07-05 15:36:53 +03:30
|
|
|
void bind() override;
|
2022-03-08 21:19:19 +03:30
|
|
|
|
2025-07-05 15:36:53 +03:30
|
|
|
void *map() override;
|
2025-07-05 16:07:51 +03:30
|
|
|
|
2025-07-05 15:36:53 +03:30
|
|
|
void un_map() override;
|
2022-03-08 21:19:19 +03:30
|
|
|
|
|
|
|
private:
|
2025-07-05 14:23:01 +03:30
|
|
|
Ref<dxSharedContext> m_context;
|
2022-03-08 21:19:19 +03:30
|
|
|
|
2025-07-05 14:23:01 +03:30
|
|
|
Microsoft::WRL::ComPtr<ID3D11Buffer> m_buffer;
|
2025-07-05 16:07:51 +03:30
|
|
|
|
2025-07-05 14:23:01 +03:30
|
|
|
D3D11_MAPPED_SUBRESOURCE m_map;
|
2022-03-08 21:19:19 +03:30
|
|
|
|
2025-07-05 16:07:51 +03:30
|
|
|
unsigned int m_index;
|
|
|
|
};
|
2022-03-08 21:19:19 +03:30
|
|
|
|
2025-07-05 16:07:51 +03:30
|
|
|
class dxVertexBuffer: public VertexBuffer
|
|
|
|
{
|
2022-03-08 21:19:19 +03:30
|
|
|
public:
|
2025-07-05 13:28:41 +03:30
|
|
|
dxVertexBuffer(
|
|
|
|
float *vertices,
|
|
|
|
unsigned int stride,
|
|
|
|
unsigned int count,
|
|
|
|
Ref<dxSharedContext> sharedContext
|
|
|
|
);
|
2025-07-05 16:07:51 +03:30
|
|
|
|
2022-03-08 21:19:19 +03:30
|
|
|
~dxVertexBuffer();
|
|
|
|
|
2025-07-05 15:36:53 +03:30
|
|
|
void bind() override;
|
2025-07-05 16:07:51 +03:30
|
|
|
|
2025-07-05 15:36:53 +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
|
|
|
|
2025-07-05 15:36:53 +03:30
|
|
|
void un_map() override;
|
2022-03-08 21:19:19 +03:30
|
|
|
|
|
|
|
private:
|
2025-07-05 14:23:01 +03:30
|
|
|
Ref<dxSharedContext> m_context;
|
2022-03-08 21:19:19 +03:30
|
|
|
|
2025-07-05 14:23:01 +03:30
|
|
|
Microsoft::WRL::ComPtr<ID3D11Buffer> m_buffer;
|
2022-03-08 21:19:19 +03:30
|
|
|
|
2025-07-05 16:07:51 +03:30
|
|
|
D3D11_MAPPED_SUBRESOURCE m_map;
|
|
|
|
|
|
|
|
unsigned int m_stride;
|
|
|
|
};
|
|
|
|
|
|
|
|
class dxIndexBuffer: public IndexBuffer
|
|
|
|
{
|
2022-03-08 21:19:19 +03:30
|
|
|
public:
|
2025-07-05 13:28:41 +03:30
|
|
|
dxIndexBuffer(unsigned int *indices, unsigned int count, Ref<dxSharedContext> sharedContext);
|
2025-07-05 16:07:51 +03:30
|
|
|
|
2022-03-08 21:19:19 +03:30
|
|
|
~dxIndexBuffer();
|
|
|
|
|
2025-07-05 15:36:53 +03:30
|
|
|
void bind() override;
|
2025-07-05 16:07:51 +03:30
|
|
|
|
2025-07-05 15:36:53 +03:30
|
|
|
void un_bind() override;
|
2025-07-05 16:07:51 +03:30
|
|
|
|
|
|
|
private:
|
|
|
|
Ref<dxSharedContext> m_context;
|
|
|
|
|
|
|
|
Microsoft::WRL::ComPtr<ID3D11Buffer> m_buffer;
|
2022-03-08 21:19:19 +03:30
|
|
|
};
|
|
|
|
|
2025-07-05 13:28:41 +03:30
|
|
|
} // namespace Light
|