light/Engine/src/Platform/GraphicsAPI/DirectX/dxBuffers.h

71 lines
1.3 KiB
C
Raw Normal View History

2021-06-02 17:20:15 +04:30
#pragma once
#include "Base.h"
#include "Graphics/Buffers.h"
#include <d3d11.h>
#include <wrl.h>
namespace Light {
class dxSharedContext;
//* INDEX_BUFFER *//
class dxConstantBuffer : public ConstantBuffer
{
private:
Ref<dxSharedContext> m_Context;
Microsoft::WRL::ComPtr<ID3D11Buffer> m_Buffer;
D3D11_MAPPED_SUBRESOURCE m_Map;
unsigned int m_Index;
public:
dxConstantBuffer(ConstantBufferIndex index, unsigned int size, Ref<dxSharedContext> sharedContext);
void Bind() override;
void* Map() override;
void UnMap() override;
};
//* VERTEX_BUFFER *//
2021-06-02 17:20:15 +04:30
class dxVertexBuffer : public VertexBuffer
{
private:
Ref<dxSharedContext> m_Context;
2021-06-02 17:20:15 +04:30
Microsoft::WRL::ComPtr<ID3D11Buffer> m_Buffer;
D3D11_MAPPED_SUBRESOURCE m_Map;
2021-06-02 17:20:15 +04:30
unsigned int m_Stride;
2021-06-02 17:20:15 +04:30
public:
dxVertexBuffer(float* vertices, unsigned int stride, unsigned int count, Ref<dxSharedContext> sharedContext);
2021-06-02 17:20:15 +04:30
~dxVertexBuffer();
void* Map() override;
void UnMap() override;
void Bind() override;
void UnBind() override;
};
//* INDEX_BUFFER *//
class dxIndexBuffer : public IndexBuffer
{
private:
Ref<dxSharedContext> m_Context;
Microsoft::WRL::ComPtr<ID3D11Buffer> m_Buffer;
public:
dxIndexBuffer(unsigned int* indices, unsigned int count, Ref<dxSharedContext> sharedContext);
~dxIndexBuffer();
2021-06-02 17:20:15 +04:30
void Bind() override;
void UnBind() override;
};
}