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

Public Member Functions

 skybox_shader_class (const skybox_shader_class &)
 
bool Initialize (ID3D11Device *, HWND)
 
void Shutdown ()
 
bool Render (ID3D11DeviceContext *, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView *, XMFLOAT4, XMFLOAT4, XMFLOAT3, float)
 

Detailed Description

Definition at line 11 of file skybox_shader_class.h.

Constructor & Destructor Documentation

◆ skybox_shader_class() [1/2]

skybox_shader_class::skybox_shader_class ( )

Definition at line 7 of file skybox_shader_class.cpp.

8{
9 m_vertexShader = 0;
10 m_pixelShader = 0;
11 m_layout = 0;
12 m_sampleState = 0;
13 m_matrixBuffer = 0;
14 m_cameraBuffer = 0;
15 m_sunlightBuffer = 0;
16 m_sunlightColorBuffer = 0;
17 m_sunlightPositionBuffer = 0;
18}

◆ skybox_shader_class() [2/2]

skybox_shader_class::skybox_shader_class ( const skybox_shader_class & other)

Definition at line 21 of file skybox_shader_class.cpp.

22{
23}

◆ ~skybox_shader_class()

skybox_shader_class::~skybox_shader_class ( )

Definition at line 26 of file skybox_shader_class.cpp.

27{
28}

Member Function Documentation

◆ Initialize()

bool skybox_shader_class::Initialize ( ID3D11Device * device,
HWND hwnd )

Definition at line 31 of file skybox_shader_class.cpp.

32{
33 Logger::Get().Log("Initializing LightShaderClass", __FILE__, __LINE__, Logger::LogLevel::Initialize);
34
35 wchar_t vsFilename[128];
36 wchar_t psFilename[128];
37 int error;
38 bool result;
39
40 // Set the filename of the vertex shader.
41 error = wcscpy_s(vsFilename, 128, L"src/hlsl/skybox.vs");
42 if (error != 0)
43 {
44 Logger::Get().Log("Failed to copy string", __FILE__, __LINE__, Logger::LogLevel::Error);
45 return false;
46 }
47
48 // Set the filename of the pixel shader.
49 error = wcscpy_s(psFilename, 128, L"src/hlsl/skybox.ps");
50 if (error != 0)
51 {
52 Logger::Get().Log("Failed to copy string", __FILE__, __LINE__, Logger::LogLevel::Error);
53 return false;
54 }
55 // Initialize the vertex and pixel shaders.
56 result = InitializeShader(device, hwnd, vsFilename, psFilename);
57 if (!result)
58 {
59 Logger::Get().Log("Failed to initialize shader", __FILE__, __LINE__, Logger::LogLevel::Error);
60 return false;
61 }
62
63 Logger::Get().Log("skybox_shader_class initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
64
65 return true;
66}
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 skybox_shader_class::Render ( ID3D11DeviceContext * deviceContext,
int indexCount,
XMMATRIX worldMatrix,
XMMATRIX viewMatrix,
XMMATRIX projectionMatrix,
ID3D11ShaderResourceView * texture,
XMFLOAT4 diffuseColor,
XMFLOAT4 ambientColor,
XMFLOAT3 sunDirection,
float sunIntensity )

Definition at line 77 of file skybox_shader_class.cpp.

79{
80 bool result;
81
82
83 // Set the shader parameters that it will use for rendering.
84 result = SetShaderParameters(deviceContext, worldMatrix, viewMatrix, projectionMatrix, texture, diffuseColor, ambientColor, sunDirection, sunIntensity);
85 if (!result)
86 {
87 Logger::Get().Log("Failed to set shader parameters", __FILE__, __LINE__, Logger::LogLevel::Error);
88 return false;
89 }
90
91 // Now render the prepared buffers with the shader.
92 RenderShader(deviceContext, indexCount);
93
94 return true;
95}

◆ Shutdown()

void skybox_shader_class::Shutdown ( )

Definition at line 69 of file skybox_shader_class.cpp.

70{
71 // Shutdown the vertex and pixel shaders as well as the related objects.
72 ShutdownShader();
73
74 return;
75}

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