Added: D3D11 project
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
#pragma once
|
||||
#include <d3d11.h>
|
||||
#include <d3dcompiler.h>
|
||||
#include <DirectXMath.h>
|
||||
|
||||
using namespace DirectX;
|
||||
|
||||
#pragma comment(lib, "d3dcompiler.lib")
|
||||
|
||||
class Material
|
||||
{
|
||||
public:
|
||||
UINT init(ID3D11Device* pD3DDevice, LPCWSTR textureFileName);
|
||||
void render(ID3D11DeviceContext* pD3DDeviceContext);
|
||||
void deInit();
|
||||
|
||||
void setMatrixBuffer(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* pCompiledVertexShaderCode);
|
||||
UINT createMatrixBuffer(ID3D11Device* pD3DDevice);
|
||||
UINT createTextureAndSamplerState(ID3D11Device* pD3DDevice, LPCWSTR textureFileName);
|
||||
|
||||
ID3D11VertexShader* _pVertexShader = nullptr;
|
||||
ID3D11PixelShader* _pPixelShader = nullptr;
|
||||
ID3D11InputLayout* _pInputLayout = nullptr; // byte structure of vertex
|
||||
|
||||
struct MatrixBuffer
|
||||
{
|
||||
XMFLOAT4X4 WorldViewProjectionMatrix;
|
||||
XMFLOAT4X4 WorldMatrix;
|
||||
};
|
||||
ID3D11Buffer* _pMatrixBuffer = nullptr;
|
||||
|
||||
ID3D11ShaderResourceView* _pTexture = {};
|
||||
ID3D11SamplerState* _pSamplerState = {};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user