1 #pragma once
2 
3 #include "Direct3DBase.h"
4 #include <d3d11.h>
5 
6 
7 struct ModelViewProjectionConstantBuffer
8 {
9     DirectX::XMFLOAT4X4 model;
10     DirectX::XMFLOAT4X4 view;
11     DirectX::XMFLOAT4X4 projection;
12 };
13 
14 struct Vertex	//Overloaded Vertex Structure
15 {
VertexVertex16     Vertex(){}
VertexVertex17     Vertex(float x, float y, float z,
18         float u, float v)
19         : pos(x,y,z), texCoord(u, v){}
20 
21     DirectX::XMFLOAT3 pos;
22     DirectX::XMFLOAT2 texCoord;
23 };
24 
25 // This class renders a simple quad.
26 ref class QuadRenderer sealed : public Direct3DBase
27 {
28 public:
29     QuadRenderer();
30 
31     void Update(float timeTotal = 0.0f, float timeDelta = 0.0f);
32     void CreateTextureFromByte(byte  *  buffer,int width,int height);
33 
34     // Direct3DBase methods.
35     virtual void CreateDeviceResources() override;
36     virtual void CreateWindowSizeDependentResources() override;
37     virtual void Render() override;
38 
39 private:
40     void Render(Microsoft::WRL::ComPtr<ID3D11RenderTargetView> renderTargetView, Microsoft::WRL::ComPtr<ID3D11DepthStencilView> depthStencilView);
41     bool m_loadingComplete;
42     uint32 m_indexCount;
43     ModelViewProjectionConstantBuffer m_constantBufferData;
44     Microsoft::WRL::ComPtr<ID3D11InputLayout>	m_inputLayout;
45     Microsoft::WRL::ComPtr<ID3D11Buffer>		m_vertexBuffer;
46     Microsoft::WRL::ComPtr<ID3D11Buffer>		m_indexBuffer;
47     Microsoft::WRL::ComPtr<ID3D11VertexShader>	m_vertexShader;
48     Microsoft::WRL::ComPtr<ID3D11PixelShader>	m_pixelShader;
49     Microsoft::WRL::ComPtr<ID3D11Buffer>		m_constantBuffer;
50     Microsoft::WRL::ComPtr<ID3D11Texture2D>		 m_Texture;
51     Microsoft::WRL::ComPtr<ID3D11ShaderResourceView> m_SRV;
52     Microsoft::WRL::ComPtr<ID3D11SamplerState> m_QuadsTexSamplerState;
53     Microsoft::WRL::ComPtr<ID3D11BlendState> m_Transparency;
54     Microsoft::WRL::ComPtr<ID3D11RasterizerState> CCWcullMode;
55     Microsoft::WRL::ComPtr<ID3D11RasterizerState> CWcullMode;
56 };
57