Add matrix buffer

Convert camera to D3D11
Add world, view & projection matrix exposing
This commit is contained in:
2026-11-27 12:17:17 +01:00
parent ead7463b8e
commit c6fdf567b7
8 changed files with 89 additions and 25 deletions
+15
View File
@@ -1,9 +1,12 @@
#pragma once
#include <d3d11.h>
#include <d3dcompiler.h>
#include <DirectXMath.h>
#pragma comment(lib, "d3dcompiler.lib")
using namespace DirectX;
class Material
{
public:
@@ -11,15 +14,27 @@ public:
void render(ID3D11DeviceContext* pD3DDeviceContext);
void deInit();
UINT setMatrices(ID3D11DeviceContext* pD3DDeviceContext,
const XMFLOAT4X4& worldMatrix, const XMFLOAT4X4& viewMatrix, const XMFLOAT4X4& projectionMatrix);
private:
UINT createVertexShader(ID3D11Device* pD3DDevice);
UINT createPixelShader(ID3D11Device* pD3DDevice);
UINT createInputLayout(ID3D11Device* pD3DDevice, ID3DBlob* pVertexShaderCode);
UINT createMatrixBuffer(ID3D11Device* pD3DDevice);
ID3D11VertexShader* _pVertexShader = nullptr;
ID3D11PixelShader* _pPixelShader = nullptr;
ID3D11InputLayout* _pInputLayout = nullptr;
//IDirect3DTexture9* _pTexture = {};
struct MatrixBuffer
{
XMFLOAT4X4 WorldViewProjectionMatrix;
};
ID3D11Buffer* _pMatrixBuffer = nullptr;
};