# Khaotic Engine Reborn: texture_shader_class Class Reference

Loading...
Searching...
No Matches
texture_shader_class Class Reference

## Public Member Functions

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

## Detailed Description

Definition at line 20 of file texture_shader_class.h.

## Constructor & Destructor Documentation

## texture_shader_class() [1/2]

texture_shader_class::texture_shader_class | ( |  | ) |

Definition at line 4 of file texture_shader_class.cpp.

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

## texture_shader_class() [2/2]

texture_shader_class::texture_shader_class | ( | const texture_shader_class & | other | ) |

Definition at line 14 of file texture_shader_class.cpp.

{
}

## ~texture_shader_class()

texture_shader_class::~texture_shader_class | ( |  | ) |

Definition at line 19 of file texture_shader_class.cpp.

{
}

## Member Function Documentation

## initialize()

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

Definition at line 24 of file texture_shader_class.cpp.

{
Logger::Get().Log("Initializing texture 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/texture.vs");
if (error != 0)
{
Logger::Get().Log("Error copying stirng", __FILE__, __LINE__, Logger::LogLevel::Error);
return false;
}
// Set the filename of the pixel shader.
error = wcscpy_s(psFilename, 128, L"src/hlsl/texture.ps");
if (error != 0)
{
Logger::Get().Log("Error copying stirng", __FILE__, __LINE__, Logger::LogLevel::Error);
return false;
}
// initialize the vertex and pixel shaders.
result = initialize_shader(device, hwnd, vsFilename, psFilename);
if (!result)
{
Logger::Get().Log("Error initializing shader", __FILE__, __LINE__, Logger::LogLevel::Error);
return false;
}
Logger::Get().Log("Texture shader initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
return true;
}

## render()

bool texture_shader_class::render | ( | ID3D11DeviceContext * | deviceContext,
|  | int | indexCount,
|  | XMMATRIX | worldMatrix,
|  | XMMATRIX | viewMatrix,
|  | XMMATRIX | projectionMatrix,
|  | ID3D11ShaderResourceView * | texture )

Definition at line 69 of file texture_shader_class.cpp.

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

## shutdown()

void texture_shader_class::shutdown | ( |  | ) |

Definition at line 61 of file texture_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/texture_shader_class.h
- enginecustom/src/src/shader/texture_shader_class.cpp