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

Public Member Functions

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

Detailed Description

Definition at line 23 of file reflection_shader_class.h.

Constructor & Destructor Documentation

◆ reflection_shader_class() [1/2]

reflection_shader_class::reflection_shader_class ( )

Definition at line 3 of file reflection_shader_class.cpp.

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

◆ reflection_shader_class() [2/2]

reflection_shader_class::reflection_shader_class ( const reflection_shader_class & other)

Definition at line 13 of file reflection_shader_class.cpp.

14{
15
16}

◆ ~reflection_shader_class()

reflection_shader_class::~reflection_shader_class ( )

Definition at line 18 of file reflection_shader_class.cpp.

19{
20}

Member Function Documentation

◆ initialize()

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

Definition at line 22 of file reflection_shader_class.cpp.

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

Definition at line 68 of file reflection_shader_class.cpp.

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

◆ shutdown()

void reflection_shader_class::shutdown ( )

Definition at line 60 of file reflection_shader_class.cpp.

61{
62 // shutdown the vertex and pixel shaders as well as the related objects.
63 shutdown_shader();
64
65 return;
66}

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