# Khaotic Engine Reborn: normal_map_shader_class Class Reference

Loading...
Searching...
No Matches
normal_map_shader_class Class Reference

## Public Member Functions

| normal_map_shader_class (const normal_map_shader_class &)
bool | initialize (ID3D11Device *, HWND)
void | shutdown ()
bool | render (ID3D11DeviceContext *, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView *, ID3D11ShaderResourceView *, XMFLOAT3, XMFLOAT4)

## Detailed Description

Definition at line 20 of file normal_map_shader_class.h.

## Constructor & Destructor Documentation

## normal_map_shader_class() [1/2]

normal_map_shader_class::normal_map_shader_class | ( |  | ) |

Definition at line 4 of file normal_map_shader_class.cpp.

{
vertex_shader_ = 0;
pixel_shader_ = 0;
layout_ = 0;
matrix_buffer_ = 0;
sample_state_ = 0;
light_buffer_ = 0;
}

## normal_map_shader_class() [2/2]

normal_map_shader_class::normal_map_shader_class | ( | const normal_map_shader_class & | other | ) |

Definition at line 15 of file normal_map_shader_class.cpp.

{
}

## ~normal_map_shader_class()

normal_map_shader_class::~normal_map_shader_class | ( |  | ) |

Definition at line 20 of file normal_map_shader_class.cpp.

{
}

## Member Function Documentation

## initialize()

bool normal_map_shader_class::initialize | ( | ID3D11Device * | device,
|  | HWND | hwnd )

Definition at line 25 of file normal_map_shader_class.cpp.

{
Logger::Get().Log("Initializing normal map shader", __FILE__, __LINE__, Logger::LogLevel::Initialize);
bool result;
wchar_t vsFilename[128];
wchar_t psFilename[128];
int error;
// Set the filename of the vertex shader.
error = wcscpy_s(vsFilename, 128, L"src/hlsl/normalmap.vs");
if (error != 0)
{
Logger::Get().Log("Failed to set the filename of the vertex shader", __FILE__, __LINE__);
return false;
}
// Set the filename of the pixel shader.
error = wcscpy_s(psFilename, 128, L"src/hlsl/normalmap.ps");
if (error != 0)
{
Logger::Get().Log("Failed to set the filename of the pixel shader", __FILE__, __LINE__);
return false;
}
// initialize the vertex and pixel shaders.
result = initialize_shader(device, hwnd, vsFilename, psFilename);
if (!result)
{
Logger::Get().Log("Failed to initialize the vertex and pixel shaders", __FILE__, __LINE__);
return false;
}
Logger::Get().Log("Successfully initialized normal map shader", __FILE__, __LINE__, Logger::LogLevel::Initialize);
return true;
}

## render()

bool normal_map_shader_class::render | ( | ID3D11DeviceContext * | deviceContext,
|  | int | indexCount,
|  | XMMATRIX | worldMatrix,
|  | XMMATRIX | viewMatrix,
|  | XMMATRIX | projectionMatrix,
|  | ID3D11ShaderResourceView * | texture1,
|  | ID3D11ShaderResourceView * | texture2,
|  | XMFLOAT3 | lightDirection,
|  | XMFLOAT4 | diffuseColor )

Definition at line 72 of file normal_map_shader_class.cpp.

{
bool result;
// Set the shader parameters that it will use for rendering.
result = set_shader_parameters(deviceContext, worldMatrix, viewMatrix, projectionMatrix, texture1, texture2, lightDirection, diffuseColor);
if (!result)
{
Logger::Get().Log("Failed to set the shader parameters that will be used for rendering", __FILE__, __LINE__, Logger::LogLevel::Error);
return false;
}
// Now render the prepared buffers with the shader.
render_shader(deviceContext, indexCount);
return true;
}

## shutdown()

void normal_map_shader_class::shutdown | ( |  | ) |

Definition at line 64 of file normal_map_shader_class.cpp.

{
// shutdown the vertex and pixel shaders as well as the related objects.
shutdown_shader();
return;
}

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

- enginecustom/src/inc/shader/normal_map_shader_class.h
- enginecustom/src/src/shader/normal_map_shader_class.cpp