Khaotic Engine Reborn
Loading...
Searching...
No Matches
celshade_class.h
1#pragma once
2
3#include "Logger.h"
4#include <d3d11.h>
5#include <d3dcompiler.h>
6#include <directxmath.h>
7#include <fstream>
8using namespace DirectX;
9using namespace std;
10
12{
13
14 private :
15 struct matrix_buffer_type
16 {
17 XMMATRIX world;
18 XMMATRIX view;
19 XMMATRIX projection;
20 };
21
22 struct camera_buffer_type
23 {
24 XMFLOAT3 cameraPosition;
25 float padding;
26 };
27
28 struct sun_light_buffer_type
29 {
30 XMFLOAT4 diffuse_color;
31 XMFLOAT4 ambient_color;
32 XMFLOAT3 sun_direction;
33 float intensity;
34 };
35
36
37public :
41
42 bool initialize(ID3D11Device*, HWND);
43 void shutdown();
44 bool render(
45 ID3D11DeviceContext* device_context,
46 int index_count,
47 XMMATRIX world_matrix,
48 XMMATRIX view_matrix, XMMATRIX
49 projection_matrix,
50 ID3D11ShaderResourceView* texture,
51 XMFLOAT4 diffuse_color,
52 XMFLOAT4 ambient_color,
53 XMFLOAT3 sun_direction,
54 float intensity
55 );
56
57private:
58 bool initialize_shader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
59 void shutdown_shader();
60 void output_shader_error_message(ID3D10Blob*, HWND, WCHAR*);
61
62 bool set_shader_parameters(
63 ID3D11DeviceContext* device_context,
64 XMMATRIX world_matrix,
65 XMMATRIX view_matrix,
66 XMMATRIX projection_matrix,
67 ID3D11ShaderResourceView* texture,
68 XMFLOAT4 ambient_color,
69 XMFLOAT4 diffuse_color,
70 XMFLOAT3 light_direction,
71 float sun_intensity
72 );
73 void render_shader(ID3D11DeviceContext*, int);
74
75private:
76 ID3D11VertexShader* vertex_shader_;
77 ID3D11PixelShader* pixel_shader_;
78 ID3D11InputLayout* layout_;
79 ID3D11SamplerState* sample_state_;
80 ID3D11Buffer* matrix_buffer_;
81 ID3D11Buffer* camera_buffer_;
82 ID3D11Buffer* sunlight_buffer_;
83 ID3D11Buffer* sunlight_color_buffer_;
84 ID3D11Buffer* sunlight_position_buffer_;
85};