C++ Game Framework  2013-06-04
CGF is a DirectX 11 game framework, built in C++ and DirectX 11. This is used to contain many to the DirectX functionality and wrap them into a framework to make game development easier.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
ColorShader.h
Go to the documentation of this file.
1 // Filename: ColorShader.h
4 
5 //Preprocessor directive designed to cause the current source file to be included only once in a single compilation
6 #pragma once
7 
8 //Includes
9 #include <d3d11.h>
10 #include <DirectXMath.h>
11 #include <D3Dcompiler.h>
12 #include "CGFInclude.h"
13 
14 using namespace DirectX;
15 
16 namespace CGF
17 {
19  {
20  private:
21  struct MatrixBufferType
22  {
23  XMMATRIX world;
24  XMMATRIX view;
25  XMMATRIX projection;
26  };
27 
28  public:
29  ColorShader();
30  ~ColorShader();
31 
32  bool Initialize(ID3D11Device* device, HWND hwnd);
33  void Shutdown();
34  bool Render(ID3D11DeviceContext* deviceContext, int indexCount, const XMMATRIX &worldMatrix, const XMMATRIX &viewMatrix, const XMMATRIX &projectionMatrix);
35 
36  private:
37  bool InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR* vsFilename, WCHAR* psFilename);
38  void ShutdownShader();
39 
40  bool SetShaderParameters(ID3D11DeviceContext* deviceContext, const XMMATRIX &worldMatrix, const XMMATRIX &viewMatrix, const XMMATRIX &projectionMatrix);
41  void RenderShader(ID3D11DeviceContext* deviceContext, int indexCount);
42 
43  private:
44  ID3D11VertexShader* m_vertexShader;
45  ID3D11PixelShader* m_pixelShader;
46  ID3D11InputLayout* m_layout;
47  ID3D11Buffer* m_matrixBuffer;
48  };
49 }