Khaotic Engine Reborn
Loading...
Searching...
No Matches
light_map_shader_class Class Reference

Public Member Functions

 light_map_shader_class (const light_map_shader_class &)
 
bool initialize (ID3D11Device *, HWND)
 
void shutdown ()
 
bool render (ID3D11DeviceContext *, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView *, ID3D11ShaderResourceView *)
 

Detailed Description

Definition at line 21 of file light_map_shader_class.h.

Constructor & Destructor Documentation

◆ light_map_shader_class() [1/2]

light_map_shader_class::light_map_shader_class ( )

Definition at line 4 of file light_map_shader_class.cpp.

5{
6 vertex_shader_ = 0;
7 pixel_shader_ = 0;
8 layout_ = 0;
9 matrix_buffer_ = 0;
10 sample_state_ = 0;
11}

◆ light_map_shader_class() [2/2]

light_map_shader_class::light_map_shader_class ( const light_map_shader_class & other)

Definition at line 14 of file light_map_shader_class.cpp.

15{
16}

◆ ~light_map_shader_class()

light_map_shader_class::~light_map_shader_class ( )

Definition at line 19 of file light_map_shader_class.cpp.

20{
21}

Member Function Documentation

◆ initialize()

bool light_map_shader_class::initialize ( ID3D11Device * device,
HWND hwnd )

Definition at line 24 of file light_map_shader_class.cpp.

25{
26 Logger::Get().Log("Initializing light_map_shader_class", __FILE__, __LINE__, Logger::LogLevel::Initialize);
27
28 bool result;
29 wchar_t vsFilename[128];
30 wchar_t psFilename[128];
31 int error;
32
33 // Set the filename of the vertex shader.
34 error = wcscpy_s(vsFilename, 128, L"src/hlsl/lightmap.vs");
35 if (error != 0)
36 {
37 Logger::Get().Log("Error copying string", __FILE__, __LINE__, Logger::LogLevel::Error);
38 return false;
39 }
40
41 // Set the filename of the pixel shader.
42 error = wcscpy_s(psFilename, 128, L"src/hlsl/lightmap.ps");
43 if (error != 0)
44 {
45 Logger::Get().Log("Error copying string", __FILE__, __LINE__, Logger::LogLevel::Error);
46 return false;
47 }
48
49 // initialize the vertex and pixel shaders.
50 result = initialize_shader(device, hwnd, vsFilename, psFilename);
51 if (!result)
52 {
53 Logger::Get().Log("Error initializing shader", __FILE__, __LINE__, Logger::LogLevel::Error);
54 return false;
55 }
56
57 Logger::Get().Log("light_map_shader_class initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
58
59 return true;
60}
static Logger & Get()
Definition Logger.h:20
void Log(const std::string &message, const std::string &fileName, int lineNumber, LogLevel level=LogLevel::Info)
Definition Logger.h:158

◆ render()

bool light_map_shader_class::render ( ID3D11DeviceContext * deviceContext,
int indexCount,
XMMATRIX worldMatrix,
XMMATRIX viewMatrix,
XMMATRIX projectionMatrix,
ID3D11ShaderResourceView * texture1,
ID3D11ShaderResourceView * texture2 )

Definition at line 72 of file light_map_shader_class.cpp.

74{
75 bool result;
76
77
78 // Set the shader parameters that it will use for rendering.
79 result = set_shader_parameters(deviceContext, worldMatrix, viewMatrix, projectionMatrix, texture1, texture2);
80 if (!result)
81 {
82 Logger::Get().Log("Error setting shader parameters", __FILE__, __LINE__, Logger::LogLevel::Error);
83 return false;
84 }
85
86 // Now render the prepared buffers with the shader.
87 render_shader(deviceContext, indexCount);
88
89 return true;
90}

◆ shutdown()

void light_map_shader_class::shutdown ( )

Definition at line 63 of file light_map_shader_class.cpp.

64{
65 // shutdown the vertex and pixel shaders as well as the related objects.
66 shutdown_shader();
67
68 return;
69}

The documentation for this class was generated from the following files: