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

Public Member Functions

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

Detailed Description

Definition at line 23 of file multi_texture_shader_class.h.

Constructor & Destructor Documentation

◆ multi_texture_shader_class() [1/2]

multi_texture_shader_class::multi_texture_shader_class ( )

Definition at line 7 of file multi_texture_shader_class.cpp.

8{
9 vertex_shader_ = 0;
10 pixel_shader_ = 0;
11 layout_ = 0;
12 matrix_buffer_ = 0;
13 sample_state_ = 0;
14}

◆ multi_texture_shader_class() [2/2]

multi_texture_shader_class::multi_texture_shader_class ( const multi_texture_shader_class & other)

Definition at line 17 of file multi_texture_shader_class.cpp.

18{
19}

◆ ~multi_texture_shader_class()

multi_texture_shader_class::~multi_texture_shader_class ( )

Definition at line 22 of file multi_texture_shader_class.cpp.

23{
24}

Member Function Documentation

◆ initialize()

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

Definition at line 27 of file multi_texture_shader_class.cpp.

28{
29 Logger::Get().Log("Initializing multi_texture_shader_class", __FILE__, __LINE__, Logger::LogLevel::Initialize);
30
31 bool result;
32 wchar_t vsFilename[128];
33 wchar_t psFilename[128];
34 int error;
35
36 // Set the filename of the vertex shader.
37 error = wcscpy_s(vsFilename, 128, L"src/hlsl/multitexture.vs");
38 if (error != 0)
39 {
40 Logger::Get().Log("Failed to set the filename of the vertex shader", __FILE__, __LINE__, Logger::LogLevel::Error);
41 return false;
42 }
43
44 // Set the filename of the pixel shader.
45 error = wcscpy_s(psFilename, 128, L"src/hlsl/multitexture.ps");
46 if (error != 0)
47 {
48 Logger::Get().Log("Failed to set the filename of the pixel shader", __FILE__, __LINE__, Logger::LogLevel::Error);
49 return false;
50 }
51
52 // initialize the vertex and pixel shaders.
53 result = initialize_shader(device, hwnd, vsFilename, psFilename);
54 if (!result)
55 {
56 Logger::Get().Log("Failed to initialize the vertex and pixel shaders", __FILE__, __LINE__, Logger::LogLevel::Error);
57 return false;
58 }
59
60 Logger::Get().Log("multi_texture_shader_class initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
61
62 return true;
63}
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 multi_texture_shader_class::render ( ID3D11DeviceContext * deviceContext,
int indexCount,
XMMATRIX worldMatrix,
XMMATRIX viewMatrix,
XMMATRIX projectionMatrix,
ID3D11ShaderResourceView * texture1,
ID3D11ShaderResourceView * texture2 )

Definition at line 73 of file multi_texture_shader_class.cpp.

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

◆ shutdown()

void multi_texture_shader_class::shutdown ( )

Definition at line 65 of file multi_texture_shader_class.cpp.

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

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