#ifndef _CELSHADINGSHADER_H_ #define _CELSHADINGSHADER_H_ ////////////// // INCLUDES // ////////////// #include "Logger.h" #include #include #include #include using namespace DirectX; using namespace std; //////////////////////////////////////////////////////////////////////////////// // Class name: CelShadingShader //////////////////////////////////////////////////////////////////////////////// class CelShadingShader { private: struct MatrixBufferType { XMMATRIX world; XMMATRIX view; XMMATRIX projection; }; struct LightBufferType { XMFLOAT4 diffuseColor; XMFLOAT3 lightDirection; float padding; // Padding to ensure the structure is a multiple of 16 bytes. XMFLOAT3 lightPosition; // Add light position float padding2; // Padding to ensure the structure is a multiple of 16 bytes. }; public: CelShadingShader(); CelShadingShader(const CelShadingShader&); ~CelShadingShader(); bool Initialize(ID3D11Device*, HWND); void Shutdown(); bool Render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT3, XMFLOAT4, XMFLOAT3); private: bool InitializeShader(ID3D11Device*, HWND, WCHAR*, WCHAR*); void ShutdownShader(); void OutputShaderErrorMessage(ID3D10Blob*, HWND, WCHAR*); bool SetShaderParameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT3, XMFLOAT4, XMFLOAT3); void RenderShader(ID3D11DeviceContext*, int); private: ID3D11VertexShader* m_vertexShader; ID3D11PixelShader* m_pixelShader; ID3D11InputLayout* m_layout; ID3D11Buffer* m_matrixBuffer; ID3D11SamplerState* m_sampleState; ID3D11Buffer* m_lightBuffer; }; #endif