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

Public Member Functions

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

Detailed Description

Definition at line 20 of file translate_shader_class.h.

Constructor & Destructor Documentation

◆ translate_shader_class() [1/2]

translate_shader_class::translate_shader_class ( )

Definition at line 4 of file translate_shader_class.cpp.

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

◆ translate_shader_class() [2/2]

translate_shader_class::translate_shader_class ( const translate_shader_class & other)

Definition at line 15 of file translate_shader_class.cpp.

16{
17}

◆ ~translate_shader_class()

translate_shader_class::~translate_shader_class ( )

Definition at line 20 of file translate_shader_class.cpp.

21{
22}

Member Function Documentation

◆ initialize()

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

Definition at line 25 of file translate_shader_class.cpp.

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

Definition at line 72 of file translate_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, texture, translation);
80 if (!result)
81 {
82 Logger::Get().Log("Failed to set 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 translate_shader_class::shutdown ( )

Definition at line 64 of file translate_shader_class.cpp.

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

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