diff --git a/.gitattributes b/.gitattributes index 614d520..afadc26 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1,3 @@ enginecustom/assets/Model/OBJ/*.obj filter=lfs diff=lfs merge=lfs -text enginecustom/assets/Model/OBJ/*.mtl filter=lfs diff=lfs merge=lfs -text +doxygen_docs/** filter=lfs diff=lfs merge=lfs -text diff --git a/doxygen_docs/html/.stfolder/syncthing-folder-b68556.txt b/doxygen_docs/html/.stfolder/syncthing-folder-b68556.txt index 9c1d71e..3481c25 100644 --- a/doxygen_docs/html/.stfolder/syncthing-folder-b68556.txt +++ b/doxygen_docs/html/.stfolder/syncthing-folder-b68556.txt @@ -1,5 +1,3 @@ -# This directory is a Syncthing folder marker. -# Do not delete. - -folderID: pcxcb-kaux6 -created: 2025-07-28T17:27:51+02:00 +version https://git-lfs.github.com/spec/v1 +oid sha256:76bd993af092418f49230a59fca28618d2422809d0db17b9b82f976603d93ea0 +size 122 diff --git a/doxygen_docs/html/_logger_8h_source.html b/doxygen_docs/html/_logger_8h_source.html index 23a7b87..696cc28 100644 --- a/doxygen_docs/html/_logger_8h_source.html +++ b/doxygen_docs/html/_logger_8h_source.html @@ -1,367 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/inc/system/Logger.h Source File - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
Logger.h
-
-
-
1#pragma once
-
2#include <fstream>
-
3#include <string>
-
4#include <Windows.h>
-
5#include <chrono>
-
6#include <iomanip>
-
7#include <sstream>
-
8#include <filesystem>
-
9#include <deque>
-
10#include <unordered_set>
-
11#include <imgui.h>
-
12
-
-
13class Logger
-
14{
-
15public:
-
-
20 static Logger& Get()
-
21 {
-
22 static Logger instance;
-
23 return instance;
-
24 }
-
-
25
-
29 Logger(Logger const&) = delete;
-
30 void operator=(Logger const&) = delete;
-
31
-
-
37 enum class LogLevel
-
38 {
-
39 Info,
-
40 Warning,
-
41 Error,
-
42 Shutdown,
-
43 Initialize,
-
44 Update,
-
45 Render,
-
46 Input,
-
47 Physics,
-
48 Audio,
-
49 Network,
-
50 Scripting,
-
51 AI,
-
52 Resource,
-
53 Memory,
-
54 Debug,
-
55 Count // Do not use this, it's just to get the number of log levels it must at the end
-
56 };
-
-
57
-
58 // Return the size of the enum class LogLevel as a constant integer
-
59 static constexpr int LogLevelCount = static_cast<int>(LogLevel::Count);
-
60
-
-
65 struct LogEntry
-
66 {
-
67 std::string message;
-
68 LogLevel level;
-
69 };
-
-
70
-
- -
76 {
-
77 const char* name;
-
78 int value;
-
79 ImVec4 color;
-
80 };
-
-
81
-
- -
89 {
-
90 switch (level)
-
91 {
-
92 case LogLevel::Info: return LogLevelInfo{ "Info", 0, ImVec4(0.0f, 1.0f, 0.0f, 1.0f) };
-
93 case LogLevel::Warning: return LogLevelInfo{ "Warning", 1, ImVec4(1.0f, 1.0f, 0.0f, 1.0f) };
-
94 case LogLevel::Error: return LogLevelInfo{ "Error", 2, ImVec4(1.0f, 0.0f, 0.0f, 1.0f) };
-
95 case LogLevel::Shutdown: return LogLevelInfo{ "shutdown", 3, ImVec4(0.5f, 0.0f, 0.0f, 1.0f) };
-
96 case LogLevel::Initialize: return LogLevelInfo{ "initialize", 4, ImVec4(0.0f, 1.0f, 1.0f, 1.0f) };
-
97 case LogLevel::Update: return LogLevelInfo{ "Update", 5, ImVec4(1.0f, 0.0f, 1.0f, 1.0f) };
-
98 case LogLevel::Render: return LogLevelInfo{ "render", 6, ImVec4(1.0f, 1.0f, 1.0f, 1.0f) };
-
99 case LogLevel::Input: return LogLevelInfo{ "Input", 7, ImVec4(0.5f, 0.5f, 0.5f, 1.0f) };
-
100 case LogLevel::Physics: return LogLevelInfo{ "physics", 8, ImVec4(0.5f, 0.5f, 0.5f, 1.0f) };
-
101 case LogLevel::Audio: return LogLevelInfo{ "Audio", 9, ImVec4(0.5f, 0.5f, 0.5f, 1.0f) };
-
102 case LogLevel::Network: return LogLevelInfo{ "Network", 10, ImVec4(0.5f, 0.5f, 0.5f, 1.0f) };
-
103 case LogLevel::Scripting: return LogLevelInfo{ "Scripting", 11, ImVec4(0.5f, 0.5f, 0.5f, 1.0f) };
-
104 case LogLevel::AI: return LogLevelInfo{ "AI", 12, ImVec4(0.5f, 0.5f, 0.5f, 1.0f) };
-
105 case LogLevel::Resource: return LogLevelInfo{ "Resource", 13, ImVec4(0.5f, 0.5f, 0.5f, 1.0f) };
-
106 case LogLevel::Memory: return LogLevelInfo{ "Memory", 14, ImVec4(0.5f, 0.5f, 0.5f, 1.0f) };
-
107 case LogLevel::Debug: return LogLevelInfo{ "Debug", 15, ImVec4(0.5f, 0.5f, 0.5f, 1.0f) };
-
108 default: return LogLevelInfo{ "Unknown", 16, ImVec4(1.0f, 1.0f, 1.0f, 1.0f) };
-
109 }
-
110 }
-
-
111
-
- -
117 {
-
118 char* appdata = nullptr;
-
119 size_t len;
-
120 _dupenv_s(&appdata, &len, "APPDATA");
-
121 if (appdata == nullptr)
-
122 {
-
123 m_appdataPath = "log.log";
-
124 }
-
125 else
-
126 {
-
127 m_appdataPath = appdata;
-
128 }
-
129 free(appdata);
-
130 std::string directoryPath = m_appdataPath + "\\Khaotic Engine";
-
131 CreateDirectoryA(directoryPath.c_str(), NULL);
-
132
-
133 ManageLogFiles(directoryPath);
-
134
-
135 m_logFilePath = directoryPath + "\\" + m_logFileName;
-
136
-
137 // Enable only the Error warning and shutdown log levels
-
138 for (int i = 0; i < LogLevelCount; i++)
-
139 {
-
140 m_disabledLogLevels[i] = true;
-
141
-
142 if (i == static_cast<int>(LogLevel::Error) || i == static_cast<int>(LogLevel::Warning) || i == static_cast<int>(LogLevel::Shutdown))
-
143 {
-
144 m_disabledLogLevels[i] = false;
-
145
-
146 }
-
147 }
-
148
-
149 }
-
-
150
-
-
158 void Log(const std::string& message, const std::string& fileName, int lineNumber, LogLevel level = LogLevel::Info)
-
159 {
-
160
-
161 auto now = std::chrono::system_clock::now();
-
162 auto in_time_t = std::chrono::system_clock::to_time_t(now);
-
163
-
164 std::tm buf;
-
165 localtime_s(&buf, &in_time_t);
-
166
-
167 // Obtenez les millisecondes à partir de maintenant
-
168 auto ms = std::chrono::duration_cast<std::chrono::milliseconds>(now.time_since_epoch()) % 1000;
-
169
-
170 // Utilisez LogLevelToString pour obtenir la chaîne de caractères du niveau de log
-
171 std::string levelStr = GetLogLevelInfo(level).name;
-
172
-
173 std::stringstream ss;
-
174 ss << "[" << std::put_time(&buf, "%Y-%m-%d") << "] "
-
175 << "[" << std::put_time(&buf, "%X") << "." << std::setfill('0') << std::setw(3) << ms.count() << "] "
-
176 << "[" << levelStr << "] "
-
177 << "[" << fileName << ":" << lineNumber << "] "
-
178 << message;
-
179
-
180 Log(ss.str(), level);
-
181
-
182 std::ofstream file(m_logFilePath, std::ios::app);
-
183 if (file.is_open())
-
184 {
-
185 file << ss.str() << std::endl;
-
186 file.close();
-
187 }
-
188 }
-
-
189
-
-
200 void Log(const std::string& message, LogLevel level)
-
201 {
-
202
-
203 // Si le niveau de log est désactivé, ne faites rien
-
204 if (m_disabledLogLevels[GetLogLevelInfo(level).value])
-
205 {
-
206 return;
-
207 }
-
208
-
209 if (logBuffer.size() >= logBufferSize)
-
210 {
-
211 logBuffer.pop_front();
-
212 }
-
213 logBuffer.push_back({ message, level });
-
214 }
-
-
215
-
220 const std::deque<LogEntry>& GetLogBuffer() const { return logBuffer; }
-
221
-
-
230 void ManageLogFiles(const std::string& directoryPath)
-
231 {
-
232 std::vector<std::filesystem::path> logFiles;
-
233
-
234 // Parcourez tous les fichiers dans le dossier
-
235 for (const auto& entry : std::filesystem::directory_iterator(directoryPath))
-
236 {
-
237 // Si le fichier est un fichier de log, ajoutez-le à la liste
-
238 if (entry.path().extension() == ".log")
-
239 {
-
240 logFiles.push_back(entry.path());
-
241 }
-
242 }
-
243
-
244 // Si nous avons plus de trois fichiers de log, supprimez le plus ancien
-
245 while (logFiles.size() >= 3)
-
246 {
-
247 // Triez les fichiers par date de modification, le plus ancien en premier
-
248 std::sort(logFiles.begin(), logFiles.end(), [](const std::filesystem::path& a, const std::filesystem::path& b)
-
249 {
-
250 return std::filesystem::last_write_time(a) < std::filesystem::last_write_time(b);
-
251 });
-
252
-
253 // Supprimez le fichier le plus ancien
-
254 std::filesystem::remove(logFiles[0]);
-
255
-
256 // Supprimez-le de la liste
-
257 logFiles.erase(logFiles.begin());
-
258 }
-
259
-
260 // Créez un nouveau fichier de log pour cette exécution
-
261 auto now = std::chrono::system_clock::now();
-
262 auto in_time_t = std::chrono::system_clock::to_time_t(now);
-
263 std::tm buf;
-
264 localtime_s(&buf, &in_time_t);
-
265
-
266 std::stringstream ss;
-
267 ss << "Khaotic_log_" << std::put_time(&buf, "%Y_%m_%d_%Hh%Mm%Ss") << ".log";
-
268 m_logFileName = ss.str();
-
269 }
-
-
270
-
271 bool m_disabledLogLevels[LogLevelCount];
-
272 std::string m_logFilePath;
-
273
-
274private:
-
275 std::string m_filename;
-
276 std::string m_appdataPath;
-
277 std::string m_logFileName;
-
278
-
279 std::deque<LogEntry> logBuffer;
-
280 const size_t logBufferSize = 100;
-
281
-
282};
-
- -
static Logger & Get()
Definition Logger.h:20
-
Logger(Logger const &)=delete
-
const std::deque< LogEntry > & GetLogBuffer() const
Definition Logger.h:220
-
static const LogLevelInfo GetLogLevelInfo(LogLevel level)
Definition Logger.h:88
-
void ManageLogFiles(const std::string &directoryPath)
Definition Logger.h:230
-
void Log(const std::string &message, const std::string &fileName, int lineNumber, LogLevel level=LogLevel::Info)
Definition Logger.h:158
-
Logger()
Definition Logger.h:116
-
LogLevel
Definition Logger.h:38
-
void Log(const std::string &message, LogLevel level)
Definition Logger.h:200
-
Definition Logger.h:66
- -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:2bdc5cc962e2f703655c93ce7e37fab74dd49507c8b761fc47cbe080839c4541 +size 46992 diff --git a/doxygen_docs/html/_main_8cpp_source.html b/doxygen_docs/html/_main_8cpp_source.html index bb75b5f..471e3d2 100644 --- a/doxygen_docs/html/_main_8cpp_source.html +++ b/doxygen_docs/html/_main_8cpp_source.html @@ -1,152 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/src/system/Main.cpp Source File - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
Main.cpp
-
-
-
1#include "system_class.h"
-
2
-
3
-
4int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR pScmdline, int iCmdshow)
-
5{
-
6 system_class* System;
-
7 bool result;
-
8
-
9 wchar_t path[MAX_PATH];
-
10 HMODULE hmodule = GetModuleHandle(NULL);
-
11 if (hmodule != NULL)
-
12 {
-
13 GetModuleFileName(hmodule, path, (sizeof(path) / sizeof(wchar_t)));
-
14 }
-
15
-
16 std::filesystem::path exePath(path);
-
17 std::filesystem::path WFolder = exePath.parent_path();
-
18
-
19 // Create the system object.
-
20 System = new system_class;
-
21
-
22 // initialize and run the system object.
-
23 result = System->initialize();
-
24 if (result)
-
25 {
-
26 Logger::Get().Log("System initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
27 System->send_path(path,WFolder);
-
28 System->run();
-
29 }
-
30
-
31 // shutdown and release the system object.
-
32 System->shutdown();
-
33 delete System;
-
34 System = 0;
-
35
-
36 return 0;
-
37}
-
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
- -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:6972596982017a4868c58529a3365525afa6c1d60a74b3addf5e0aa249c7b62f +size 10804 diff --git a/doxygen_docs/html/_modellistclass_8cpp_source.html b/doxygen_docs/html/_modellistclass_8cpp_source.html index 5917d86..b2afafe 100644 --- a/doxygen_docs/html/_modellistclass_8cpp_source.html +++ b/doxygen_docs/html/_modellistclass_8cpp_source.html @@ -1,182 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/src/system/Modellistclass.cpp Source File - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
Modellistclass.cpp
-
-
-
1#include "modellistclass.h"
-
2
-
3
-
4ModelListClass::ModelListClass()
-
5{
-
6 m_ModelInfoList = 0;
-
7}
-
8
-
9
-
10ModelListClass::ModelListClass(const ModelListClass& other)
-
11{
-
12}
-
13
-
14
-
15ModelListClass::~ModelListClass()
-
16{
-
17}
-
18
-
19
-
20void ModelListClass::Initialize(int numModels)
-
21{
-
22
-
23 int i;
-
24
-
25 // Store the number of models.
-
26 m_modelCount = numModels;
-
27
-
28 // Create a list array of the model information.
-
29 m_ModelInfoList = new ModelInfoType[m_modelCount];
-
30
-
31 // Seed the random generator with the current time.
-
32 srand((unsigned int)time(NULL));
-
33
-
34 // Go through all the models and randomly generate the position.
-
35 for (i = 0; i < m_modelCount; i++)
-
36 {
-
37 // Generate a random position in front of the viewer for the mode.
-
38 m_ModelInfoList[i].positionX = (((float)rand() - (float)rand()) / RAND_MAX) * 10.0f;
-
39 m_ModelInfoList[i].positionY = (((float)rand() - (float)rand()) / RAND_MAX) * 10.0f;
-
40 m_ModelInfoList[i].positionZ = ((((float)rand() - (float)rand()) / RAND_MAX) * 10.0f) + 5.0f;
-
41 }
-
42
-
43 return;
-
44}
-
45
-
46void ModelListClass::Shutdown()
-
47{
-
48 // Release the model information list.
-
49 if (m_ModelInfoList)
-
50 {
-
51 delete[] m_ModelInfoList;
-
52 m_ModelInfoList = 0;
-
53 }
-
54
-
55 return;
-
56}
-
57
-
58int ModelListClass::GetModelCount()
-
59{
-
60 return m_modelCount;
-
61}
-
62
-
63void ModelListClass::GetData(int index, float& positionX, float& positionY, float& positionZ)
-
64{
-
65 positionX = m_ModelInfoList[index].positionX;
-
66 positionY = m_ModelInfoList[index].positionY;
-
67 positionZ = m_ModelInfoList[index].positionZ;
-
68 return;
-
69}
- -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:6ae43d139e7241da8e09c261dd1d8c494cdd6dc7047a0f9bf00d752ad3d5654e +size 13728 diff --git a/doxygen_docs/html/_modellistclass_8h_source.html b/doxygen_docs/html/_modellistclass_8h_source.html index 2f806cf..42b5d25 100644 --- a/doxygen_docs/html/_modellistclass_8h_source.html +++ b/doxygen_docs/html/_modellistclass_8h_source.html @@ -1,150 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/inc/system/Modellistclass.h Source File - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
Modellistclass.h
-
-
-
1#ifndef _MODELLISTCLASS_H_
-
2#define _MODELLISTCLASS_H_
-
3
-
4
-
6// INCLUDES //
-
8#include <stdlib.h>
-
9#include <time.h>
-
10
-
11
-
13// Class name: ModelListClass
-
- -
16{
-
17private:
-
18 struct ModelInfoType
-
19 {
-
20 float positionX, positionY, positionZ;
-
21 };
-
22
-
23public:
- - - -
27
-
28 void Initialize(int);
-
29 void Shutdown();
-
30
-
31 int GetModelCount();
-
32 void GetData(int, float&, float&, float&);
-
33
-
34private:
-
35 int m_modelCount;
-
36 ModelInfoType* m_ModelInfoList;
-
37};
-
-
38
-
39#endif
- -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:0641cc599a02a97f02801193215bfe93de237f0af433701699b44766f3318913 +size 9891 diff --git a/doxygen_docs/html/_skybox_8cpp_source.html b/doxygen_docs/html/_skybox_8cpp_source.html index dec2fa9..b2fc797 100644 --- a/doxygen_docs/html/_skybox_8cpp_source.html +++ b/doxygen_docs/html/_skybox_8cpp_source.html @@ -1,195 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/src/system/Skybox.cpp Source File - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
Skybox.cpp
-
-
-
1#include "Skybox.h"
-
2
-
- -
4{
-
5}
-
-
6
-
7Skybox::~Skybox()
-
8{
-
9 for (auto& texture : textures)
-
10 {
-
11 if (texture)
-
12 {
-
13 texture->Release();
-
14 texture = nullptr;
-
15 }
-
16 }
-
17 textures.clear();
-
18 translations.clear();
-
19}
-
20
-
- -
22{
-
23 m_d3dClassRef = d3dClassRef;
-
24}
-
-
25
-
- -
27{
-
28 Logger::Get().Log("Construct skybox", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
29
-
30 char modelFilename[128];
-
31 strcpy_s(modelFilename, "assets/Model/OBJ/skysphere.obj");
-
32
-
33 std::vector<std::wstring> skyboxTextures = {
-
34 L"assets/Skybox/skybox.png",
-
35 };
-
36
-
37 TextureContainer SkyboxTextures;
-
38
-
39 // Load the textures
-
40 for (const auto& textureFilename : skyboxTextures)
-
41 {
-
42 ID3D11ShaderResourceView* texture = nullptr;
-
43 HRESULT result = DirectX::CreateWICTextureFromFile(m_d3dClassRef->get_device(), m_d3dClassRef->get_device_context(), textureFilename.c_str(), nullptr, &texture);
-
44 if (FAILED(result))
-
45 {
-
46 Logger::Get().Log("Failed to load texture: " + std::string(textureFilename.begin(), textureFilename.end()), __FILE__, __LINE__, Logger::LogLevel::Error);
-
47 return nullptr;
-
48 }
-
49 SkyboxTextures.diffuse.push_back(texture);
-
50
-
51 }
-
52
-
53 // Create the model object
-
54 m_Skybox = new object(*app);
-
55 HRESULT result = m_Skybox->Initialize(m_d3dClassRef->get_device(), m_d3dClassRef->get_device_context(), modelFilename, SkyboxTextures);
-
56 if (!result)
-
57 {
-
58 Logger::Get().Log("Could not initialize the skybox model object", __FILE__, __LINE__, Logger::LogLevel::Error);
-
59 delete m_Skybox;
-
60 return nullptr;
-
61 }
-
62 m_Skybox->SetTranslateMatrix(XMMatrixTranslation(0.0f, 0.0f, 0.0f)); // Set the initial translation of the skybox
-
63 m_Skybox->SetActiveShader(ShaderType::SKYBOX);
-
64
-
65 return m_Skybox; // Return the constructed skybox object
-
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
-
object * ConstructSkybox(application_class *app)
Definition Skybox.cpp:26
-
Skybox()
Constructor for the Skybox class. Initializes the skybox with a reference to the d_3d_class instance.
Definition Skybox.cpp:3
-
void Initialize(d_3d_class *d3dClassRef)
Definition Skybox.cpp:21
- - -
ID3D11Device * get_device()
Gets the Direct3D device.
-
ID3D11DeviceContext * get_device_context()
Gets the Direct3D device context.
- - -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:cc204508e2c3b57a3af073fc2686477566fe96dc636cfa4247d1f2c53ada77ec +size 19322 diff --git a/doxygen_docs/html/_skybox_8h_source.html b/doxygen_docs/html/_skybox_8h_source.html index 4dc312b..c188453 100644 --- a/doxygen_docs/html/_skybox_8h_source.html +++ b/doxygen_docs/html/_skybox_8h_source.html @@ -1,150 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/inc/system/Skybox.h Source File - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
Skybox.h
-
-
-
1#pragma once
-
2#include <vector>
-
3
-
4#include "d_3d_class.h"
-
5#include "object.h"
-
6
-
-
7class Skybox
-
8{
-
9public:
-
10
-
15 Skybox();
-
16 ~Skybox();
-
17
-
22 void Initialize(d_3d_class* d3dClassRef); // Get all the required references
-
23
- -
30
-
31
-
32 // Variables
-
33
-
34 std::vector<ID3D11ShaderResourceView*> textures;
-
35 std::vector<XMMATRIX> translations;
-
36
-
37private:
-
38
-
39 d_3d_class* m_d3dClassRef; // Reference to the d_3d_class instance
-
40 object* m_Skybox;
-
41
-
42
-
43};
-
-
Definition Skybox.h:8
-
object * ConstructSkybox(application_class *app)
Definition Skybox.cpp:26
-
Skybox()
Constructor for the Skybox class. Initializes the skybox with a reference to the d_3d_class instance.
Definition Skybox.cpp:3
-
void Initialize(d_3d_class *d3dClassRef)
Definition Skybox.cpp:21
- - -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:cbc763f057309fcb72f62f0cf1a6d09d3856a753a37771e663c84d7443badf4c +size 10885 diff --git a/doxygen_docs/html/alpha__map__shader__class_8cpp_source.html b/doxygen_docs/html/alpha__map__shader__class_8cpp_source.html index c31ccd2..aa34550 100644 --- a/doxygen_docs/html/alpha__map__shader__class_8cpp_source.html +++ b/doxygen_docs/html/alpha__map__shader__class_8cpp_source.html @@ -1,525 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/src/shader/alpha_map_shader_class.cpp Source File - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
alpha_map_shader_class.cpp
-
-
-
1#include "alpha_map_shader_class.h"
-
2
-
3
-
4alpha_map_shader_class::alpha_map_shader_class()
-
5{
-
6 vertex_shader_ = 0;
-
7 pixel_shader_ = 0;
-
8 layout_ = 0;
-
9 matrix_buffer_ = 0;
-
10 sample_state_ = 0;
-
11}
-
12
-
13
-
14alpha_map_shader_class::alpha_map_shader_class(const alpha_map_shader_class& other)
-
15{
-
16}
-
17
-
18
-
19alpha_map_shader_class::~alpha_map_shader_class()
-
20{
-
21}
-
22
-
23
-
24bool alpha_map_shader_class::initialize(ID3D11Device* device, HWND hwnd)
-
25{
-
26 Logger::Get().Log("Initializing alpha_map_shader_class", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
27
-
28 bool result;
-
29 wchar_t vsFilename[128];
-
30 wchar_t psFilename[128];
-
31 int error;
-
32
-
33 // Set the filename of the vertex shader.
-
34 error = wcscpy_s(vsFilename, 128, L"src/hlsl/alphamap.vs");
-
35 if (error != 0)
-
36 {
-
37 Logger::Get().Log("Error copying string ", __FILE__, __LINE__, Logger::LogLevel::Error);
-
38 return false;
-
39 }
-
40
-
41 // Set the filename of the pixel shader.
-
42 error = wcscpy_s(psFilename, 128, L"src/hlsl/alphamap.ps");
-
43 if (error != 0)
-
44 {
-
45 Logger::Get().Log("Error copying string", __FILE__, __LINE__, Logger::LogLevel::Error);
-
46 return false;
-
47 }
-
48
-
49 // initialize the vertex and pixel shaders.
-
50 result = initialize_shader(device, hwnd, vsFilename, psFilename);
-
51 if (!result)
-
52 {
-
53 Logger::Get().Log("Error initializing shader", __FILE__, __LINE__, Logger::LogLevel::Error);
-
54 return false;
-
55 }
-
56
-
57 return true;
-
58}
-
59
-
60
-
61void alpha_map_shader_class::shutdown()
-
62{
-
63 // shutdown the vertex and pixel shaders as well as the related objects.
-
64 shutdown_shader();
-
65
-
66 return;
-
67}
-
68
-
69
-
70bool alpha_map_shader_class::render(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix,
-
71 ID3D11ShaderResourceView* texture1, ID3D11ShaderResourceView* texture2, ID3D11ShaderResourceView* texture3)
-
72{
-
73 bool result;
-
74
-
75
-
76 // Set the shader parameters that it will use for rendering.
-
77 result = set_shader_parameters(deviceContext, worldMatrix, viewMatrix, projectionMatrix, texture1, texture2, texture3);
-
78 if (!result)
-
79 {
-
80 Logger::Get().Log("Error setting shader parameters", __FILE__, __LINE__, Logger::LogLevel::Error);
-
81 return false;
-
82 }
-
83
-
84 // Now render the prepared buffers with the shader.
-
85 render_shader(deviceContext, indexCount);
-
86
-
87 return true;
-
88}
-
89
-
90
-
91bool alpha_map_shader_class::initialize_shader(ID3D11Device* device, HWND hwnd, WCHAR* vsFilename, WCHAR* psFilename)
-
92{
-
93 Logger::Get().Log("Initializing shader", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
94
-
95 HRESULT result;
-
96 ID3D10Blob* errorMessage;
-
97 ID3D10Blob* vertexShaderBuffer;
-
98 ID3D10Blob* pixelShaderBuffer;
-
99 D3D11_INPUT_ELEMENT_DESC polygonLayout[3];
-
100 unsigned int numElements;
-
101 D3D11_BUFFER_DESC matrixBufferDesc;
-
102 D3D11_SAMPLER_DESC samplerDesc;
-
103
-
104
-
105 // initialize the pointers this function will use to null.
-
106 errorMessage = 0;
-
107 vertexShaderBuffer = 0;
-
108 pixelShaderBuffer = 0;
-
109
-
110 // Compile the vertex shader code.
-
111 result = D3DCompileFromFile(vsFilename, NULL, NULL, "AlphaMapVertexShader", "vs_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0,
-
112 &vertexShaderBuffer, &errorMessage);
-
113 if (FAILED(result))
-
114 {
-
115 // If the shader failed to compile it should have writen something to the error message.
-
116 if (errorMessage)
-
117 {
-
118 output_shader_error_message(errorMessage, hwnd, vsFilename);
-
119 }
-
120 // If there was nothing in the error message then it simply could not find the shader file itself.
-
121 else
-
122 {
-
123 Logger::Get().Log("Error compiling shader", __FILE__, __LINE__, Logger::LogLevel::Error);
-
124 }
-
125
-
126 return false;
-
127 }
-
128
-
129 // Compile the pixel shader code.
-
130 result = D3DCompileFromFile(psFilename, NULL, NULL, "AlphaMapPixelShader", "ps_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0,
-
131 &pixelShaderBuffer, &errorMessage);
-
132 if (FAILED(result))
-
133 {
-
134 // If the shader failed to compile it should have writen something to the error message.
-
135 if (errorMessage)
-
136 {
-
137 output_shader_error_message(errorMessage, hwnd, psFilename);
-
138 }
-
139 // If there was nothing in the error message then it simply could not find the file itself.
-
140 else
-
141 {
-
142 Logger::Get().Log("Error compiling shader", __FILE__, __LINE__, Logger::LogLevel::Error);
-
143 }
-
144
-
145 return false;
-
146 }
-
147
-
148 // Create the vertex shader from the buffer.
-
149 result = device->CreateVertexShader(vertexShaderBuffer->GetBufferPointer(), vertexShaderBuffer->GetBufferSize(), NULL, &vertex_shader_);
-
150 if (FAILED(result))
-
151 {
-
152 Logger::Get().Log("Error creating vertex shader", __FILE__, __LINE__, Logger::LogLevel::Error);
-
153 return false;
-
154 }
-
155
-
156 // Create the pixel shader from the buffer.
-
157 result = device->CreatePixelShader(pixelShaderBuffer->GetBufferPointer(), pixelShaderBuffer->GetBufferSize(), NULL, &pixel_shader_);
-
158 if (FAILED(result))
-
159 {
-
160 Logger::Get().Log("Error creating pixel shader", __FILE__, __LINE__, Logger::LogLevel::Error);
-
161 return false;
-
162 }
-
163
-
164 // Create the vertex input layout description.
-
165 polygonLayout[0].SemanticName = "POSITION";
-
166 polygonLayout[0].SemanticIndex = 0;
-
167 polygonLayout[0].Format = DXGI_FORMAT_R32G32B32_FLOAT;
-
168 polygonLayout[0].InputSlot = 0;
-
169 polygonLayout[0].AlignedByteOffset = 0;
-
170 polygonLayout[0].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
-
171 polygonLayout[0].InstanceDataStepRate = 0;
-
172
-
173 polygonLayout[1].SemanticName = "TEXCOORD";
-
174 polygonLayout[1].SemanticIndex = 0;
-
175 polygonLayout[1].Format = DXGI_FORMAT_R32G32_FLOAT;
-
176 polygonLayout[1].InputSlot = 0;
-
177 polygonLayout[1].AlignedByteOffset = D3D11_APPEND_ALIGNED_ELEMENT;
-
178 polygonLayout[1].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
-
179 polygonLayout[1].InstanceDataStepRate = 0;
-
180
-
181 polygonLayout[2].SemanticName = "NORMAL";
-
182 polygonLayout[2].SemanticIndex = 0;
-
183 polygonLayout[2].Format = DXGI_FORMAT_R32G32B32_FLOAT;
-
184 polygonLayout[2].InputSlot = 0;
-
185 polygonLayout[2].AlignedByteOffset = D3D11_APPEND_ALIGNED_ELEMENT;
-
186 polygonLayout[2].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
-
187 polygonLayout[2].InstanceDataStepRate = 0;
-
188
-
189 // Get a count of the elements in the layout.
-
190 numElements = sizeof(polygonLayout) / sizeof(polygonLayout[0]);
-
191
-
192 // Create the vertex input layout.
-
193 result = device->CreateInputLayout(polygonLayout, numElements, vertexShaderBuffer->GetBufferPointer(),
-
194 vertexShaderBuffer->GetBufferSize(), &layout_);
-
195 if (FAILED(result))
-
196 {
-
197 Logger::Get().Log("Error creating input layout", __FILE__, __LINE__, Logger::LogLevel::Error);
-
198 return false;
-
199 }
-
200
-
201 // Release the vertex shader buffer and pixel shader buffer since they are no longer needed.
-
202 vertexShaderBuffer->Release();
-
203 vertexShaderBuffer = 0;
-
204
-
205 pixelShaderBuffer->Release();
-
206 pixelShaderBuffer = 0;
-
207
-
208 // Setup the description of the dynamic matrix constant buffer that is in the vertex shader.
-
209 matrixBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
-
210 matrixBufferDesc.ByteWidth = sizeof(matrix_buffer_type);
-
211 matrixBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
-
212 matrixBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
-
213 matrixBufferDesc.MiscFlags = 0;
-
214 matrixBufferDesc.StructureByteStride = 0;
-
215
-
216 // Create the constant buffer pointer so we can access the vertex shader constant buffer from within this class.
-
217 result = device->CreateBuffer(&matrixBufferDesc, NULL, &matrix_buffer_);
-
218 if (FAILED(result))
-
219 {
-
220 Logger::Get().Log("Error creating constant buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
-
221 return false;
-
222 }
-
223
-
224 // Create a texture sampler state description.
-
225 samplerDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR;
-
226 samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP;
-
227 samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP;
-
228 samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_WRAP;
-
229 samplerDesc.MipLODBias = 0.0f;
-
230 samplerDesc.MaxAnisotropy = 1;
-
231 samplerDesc.ComparisonFunc = D3D11_COMPARISON_ALWAYS;
-
232 samplerDesc.BorderColor[0] = 0;
-
233 samplerDesc.BorderColor[1] = 0;
-
234 samplerDesc.BorderColor[2] = 0;
-
235 samplerDesc.BorderColor[3] = 0;
-
236 samplerDesc.MinLOD = 0;
-
237 samplerDesc.MaxLOD = D3D11_FLOAT32_MAX;
-
238
-
239 // Create the texture sampler state.
-
240 result = device->CreateSamplerState(&samplerDesc, &sample_state_);
-
241 if (FAILED(result))
-
242 {
-
243 Logger::Get().Log("Error creating sampler state", __FILE__, __LINE__, Logger::LogLevel::Error);
-
244 return false;
-
245 }
-
246
-
247 Logger::Get().Log("Shader initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
248
-
249 return true;
-
250}
-
251
-
252
-
253void alpha_map_shader_class::shutdown_shader()
-
254{
-
255
-
256 Logger::Get().Log("Shutting down shader", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
257
-
258 // Release the sampler state.
-
259 if (sample_state_)
-
260 {
-
261 Logger::Get().Log("Releasing sampler state", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
262 sample_state_->Release();
-
263 sample_state_ = 0;
-
264 Logger::Get().Log("Sampler state released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
265 }
-
266
-
267 // Release the matrix constant buffer.
-
268 if (matrix_buffer_)
-
269 {
-
270 Logger::Get().Log("Releasing constant buffer", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
271 matrix_buffer_->Release();
-
272 matrix_buffer_ = 0;
-
273 Logger::Get().Log("Constant buffer released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
274 }
-
275
-
276 // Release the layout.
-
277 if (layout_)
-
278 {
-
279 Logger::Get().Log("Releasing layout", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
280 layout_->Release();
-
281 layout_ = 0;
-
282 Logger::Get().Log("Layout released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
283 }
-
284
-
285 // Release the pixel shader.
-
286 if (pixel_shader_)
-
287 {
-
288 Logger::Get().Log("Releasing pixel shader", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
289 pixel_shader_->Release();
-
290 pixel_shader_ = 0;
-
291 Logger::Get().Log("Pixel shader released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
292 }
-
293
-
294 // Release the vertex shader.
-
295 if (vertex_shader_)
-
296 {
-
297 Logger::Get().Log("Releasing vertex shader", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
298 vertex_shader_->Release();
-
299 vertex_shader_ = 0;
-
300 Logger::Get().Log("Vertex shader released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
301 }
-
302
-
303 Logger::Get().Log("Shader shutdown complete", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
304
-
305 return;
-
306}
-
307
-
308
-
309void alpha_map_shader_class::output_shader_error_message(ID3D10Blob* errorMessage, HWND hwnd, WCHAR* shaderFilename)
-
310{
-
311 char* compileErrors;
-
312 unsigned long long bufferSize, i;
-
313 ofstream fout;
-
314
-
315
-
316 // Get a pointer to the error message text buffer.
-
317 compileErrors = (char*)(errorMessage->GetBufferPointer());
-
318
-
319 // Get the length of the message.
-
320 bufferSize = errorMessage->GetBufferSize();
-
321
-
322 // Open a file to write the error message to.
-
323 fout.open("shader-error.txt");
-
324
-
325 // Write out the error message.
-
326 for (i = 0; i < bufferSize; i++)
-
327 {
-
328 fout << compileErrors[i];
-
329 }
-
330
-
331 // Close the file.
-
332 fout.close();
-
333
-
334 // Release the error message.
-
335 errorMessage->Release();
-
336 errorMessage = 0;
-
337
-
338 // Pop a message up on the screen to notify the user to check the text file for compile errors.
-
339 MessageBox(hwnd, L"Error compiling shader. Check shader-error.txt for message.", shaderFilename, MB_OK);
-
340
-
341 return;
-
342}
-
343
-
344
-
345bool alpha_map_shader_class::set_shader_parameters(ID3D11DeviceContext* deviceContext, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix,
-
346 ID3D11ShaderResourceView* texture1, ID3D11ShaderResourceView* texture2, ID3D11ShaderResourceView* texture3)
-
347{
-
348 HRESULT result;
-
349 D3D11_MAPPED_SUBRESOURCE mappedResource;
-
350 matrix_buffer_type* dataPtr;
-
351 unsigned int bufferNumber;
-
352
-
353
-
354 // Transpose the matrices to prepare them for the shader.
-
355 worldMatrix = XMMatrixTranspose(worldMatrix);
-
356 viewMatrix = XMMatrixTranspose(viewMatrix);
-
357 projectionMatrix = XMMatrixTranspose(projectionMatrix);
-
358
-
359 // Lock the constant buffer so it can be written to.
-
360 result = deviceContext->Map(matrix_buffer_, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
-
361 if (FAILED(result))
-
362 {
-
363 Logger::Get().Log("Error mapping constant buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
-
364 return false;
-
365 }
-
366
-
367 // Get a pointer to the data in the constant buffer.
-
368 dataPtr = (matrix_buffer_type*)mappedResource.pData;
-
369
-
370 // Copy the matrices into the constant buffer.
-
371 dataPtr->world = worldMatrix;
-
372 dataPtr->view = viewMatrix;
-
373 dataPtr->projection = projectionMatrix;
-
374
-
375 // Unlock the constant buffer.
-
376 deviceContext->Unmap(matrix_buffer_, 0);
-
377
-
378 // Set the position of the constant buffer in the vertex shader.
-
379 bufferNumber = 0;
-
380
-
381 // Finally set the constant buffer in the vertex shader with the updated values.
-
382 deviceContext->VSSetConstantBuffers(bufferNumber, 1, &matrix_buffer_);
-
383
-
384 // Set shader texture resources in the pixel shader.
-
385 deviceContext->PSSetShaderResources(0, 1, &texture1);
-
386 deviceContext->PSSetShaderResources(1, 1, &texture2);
-
387 deviceContext->PSSetShaderResources(2, 1, &texture3);
-
388
-
389 return true;
-
390}
-
391
-
392
-
393void alpha_map_shader_class::render_shader(ID3D11DeviceContext* deviceContext, int indexCount)
-
394{
-
395
-
396 // Set the vertex input layout.
-
397 deviceContext->IASetInputLayout(layout_);
-
398
-
399 // Set the vertex and pixel shaders that will be used to render this triangle.
-
400 deviceContext->VSSetShader(vertex_shader_, NULL, 0);
-
401 deviceContext->PSSetShader(pixel_shader_, NULL, 0);
-
402
-
403 // Set the sampler state in the pixel shader.
-
404 deviceContext->PSSetSamplers(0, 1, &sample_state_);
-
405
-
406 // render the triangle.
-
407 deviceContext->DrawIndexed(indexCount, 0, 0);
-
408
-
409 return;
-
410}
-
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
- -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:4a526030b51b379ce380283848e02847299a32ac6e9b445ea6b14fe10db29d80 +size 67863 diff --git a/doxygen_docs/html/alpha__map__shader__class_8h_source.html b/doxygen_docs/html/alpha__map__shader__class_8h_source.html index 4653e81..5c42445 100644 --- a/doxygen_docs/html/alpha__map__shader__class_8h_source.html +++ b/doxygen_docs/html/alpha__map__shader__class_8h_source.html @@ -1,166 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/inc/shader/alpha_map_shader_class.h Source File - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
alpha_map_shader_class.h
-
-
-
1#ifndef _ALPHAMAPSHADERCLASS_H_
-
2#define _ALPHAMAPSHADERCLASS_H_
-
3
-
4
-
6// INCLUDES //
-
8#include "Logger.h"
-
9#include <d3d11.h>
-
10#include <d3dcompiler.h>
-
11#include <directxmath.h>
-
12#include <fstream>
-
13using namespace DirectX;
-
14using namespace std;
-
15
-
16
-
18// Class name: alpha_map_shader_class
-
- -
21{
-
22private:
-
23 struct matrix_buffer_type
-
24 {
-
25 XMMATRIX world;
-
26 XMMATRIX view;
-
27 XMMATRIX projection;
-
28 };
-
29
-
30public:
- - - -
34
-
35 bool initialize(ID3D11Device*, HWND);
-
36 void shutdown();
-
37 bool render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*);
-
38
-
39private:
-
40 bool initialize_shader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
-
41 void shutdown_shader();
-
42 void output_shader_error_message(ID3D10Blob*, HWND, WCHAR*);
-
43
-
44 bool set_shader_parameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*);
-
45 void render_shader(ID3D11DeviceContext*, int);
-
46
-
47private:
-
48 ID3D11VertexShader* vertex_shader_;
-
49 ID3D11PixelShader* pixel_shader_;
-
50 ID3D11InputLayout* layout_;
-
51 ID3D11Buffer* matrix_buffer_;
-
52 ID3D11SamplerState* sample_state_;
-
53};
-
-
54
-
55#endif
- -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:fc99c412ebccecb744a44604c41433592f353d6f5bbdc3d184337ddb08154b24 +size 12431 diff --git a/doxygen_docs/html/annotated.html b/doxygen_docs/html/annotated.html index 6f4638a..6741059 100644 --- a/doxygen_docs/html/annotated.html +++ b/doxygen_docs/html/annotated.html @@ -1,189 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Class List - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
Class List
-
-
-
Here are the classes, structs, unions and interfaces with brief descriptions:
-
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:09b702351d617753372600d6c8c2c4790d4ecbd132319d0764a2b8196a5f72f4 +size 25298 diff --git a/doxygen_docs/html/annotated_dup.js b/doxygen_docs/html/annotated_dup.js index ca92173..e77dee7 100644 --- a/doxygen_docs/html/annotated_dup.js +++ b/doxygen_docs/html/annotated_dup.js @@ -1,68 +1,3 @@ -var annotated_dup = -[ - [ "ecs", "namespaceecs.html", [ - [ "Component", "classecs_1_1_component.html", "classecs_1_1_component" ], - [ "Entity", "classecs_1_1_entity.html", "classecs_1_1_entity" ], - [ "EntityManager", "classecs_1_1_entity_manager.html", "classecs_1_1_entity_manager" ], - [ "IdentityComponent", "classecs_1_1_identity_component.html", "classecs_1_1_identity_component" ], - [ "ModelPathComponent", "classecs_1_1_model_path_component.html", "classecs_1_1_model_path_component" ], - [ "PhysicsComponent", "classecs_1_1_physics_component.html", "classecs_1_1_physics_component" ], - [ "RenderComponent", "classecs_1_1_render_component.html", "classecs_1_1_render_component" ], - [ "RenderSystem", "classecs_1_1_render_system.html", "classecs_1_1_render_system" ], - [ "ShaderComponent", "classecs_1_1_shader_component.html", "classecs_1_1_shader_component" ], - [ "TransformComponent", "classecs_1_1_transform_component.html", "classecs_1_1_transform_component" ] - ] ], - [ "alpha_map_shader_class", "classalpha__map__shader__class.html", null ], - [ "application_class", "classapplication__class.html", "classapplication__class" ], - [ "bitmap_class", "classbitmap__class.html", null ], - [ "camera_class", "classcamera__class.html", "classcamera__class" ], - [ "celshade_class", "classcelshade__class.html", null ], - [ "color_shader_class", "classcolor__shader__class.html", null ], - [ "d_3d_class", "classd__3d__class.html", "classd__3d__class" ], - [ "depth_shader_class", "classdepth__shader__class.html", null ], - [ "display_plane_class", "classdisplay__plane__class.html", null ], - [ "font_class", "classfont__class.html", null ], - [ "font_shader_class", "classfont__shader__class.html", null ], - [ "fps_class", "classfps__class.html", null ], - [ "fps_limiter", "classfps__limiter.html", "classfps__limiter" ], - [ "frustum", "classfrustum.html", "classfrustum" ], - [ "FrustumClass", "class_frustum_class.html", null ], - [ "imguiManager", "classimgui_manager.html", "classimgui_manager" ], - [ "input", "structinput.html", null ], - [ "input_class", "classinput__class.html", null ], - [ "light_class", "classlight__class.html", null ], - [ "light_map_shader_class", "classlight__map__shader__class.html", null ], - [ "light_shader_class", "classlight__shader__class.html", null ], - [ "Logger", "class_logger.html", "class_logger" ], - [ "master_shader", "classmaster__shader.html", null ], - [ "model_class", "classmodel__class.html", "classmodel__class" ], - [ "ModelListClass", "class_model_list_class.html", null ], - [ "multi_texture_shader_class", "classmulti__texture__shader__class.html", null ], - [ "normal_map_shader_class", "classnormal__map__shader__class.html", null ], - [ "object", "classobject.html", null ], - [ "physics", "classphysics.html", null ], - [ "position_class", "classposition__class.html", null ], - [ "reflection_shader_class", "classreflection__shader__class.html", null ], - [ "refraction_shader_class", "classrefraction__shader__class.html", null ], - [ "render_texture_class", "classrender__texture__class.html", null ], - [ "scene_manager", "classscene__manager.html", "classscene__manager" ], - [ "sceneManager", "classscene_manager.html", null ], - [ "shader_manager_class", "classshader__manager__class.html", null ], - [ "shadow_map", "classshadow__map.html", null ], - [ "Skybox", "class_skybox.html", "class_skybox" ], - [ "skybox_shader_class", "classskybox__shader__class.html", null ], - [ "spec_map_shader_class", "classspec__map__shader__class.html", null ], - [ "sprite_class", "classsprite__class.html", null ], - [ "stats", "classstats.html", null ], - [ "sunlight_shader_class", "classsunlight__shader__class.html", null ], - [ "system_class", "classsystem__class.html", null ], - [ "text_class", "classtext__class.html", null ], - [ "texture_class", "classtexture__class.html", null ], - [ "texture_shader_class", "classtexture__shader__class.html", null ], - [ "TextureContainer", "struct_texture_container.html", null ], - [ "timer_class", "classtimer__class.html", null ], - [ "translate_shader_class", "classtranslate__shader__class.html", null ], - [ "transparent_shader_class", "classtransparent__shader__class.html", null ], - [ "water_shader_class", "classwater__shader__class.html", null ], - [ "widget_entry", "structwidget__entry.html", null ] -]; \ No newline at end of file +version https://git-lfs.github.com/spec/v1 +oid sha256:377dece568677ecb17769d820d07ef2fc1353ec450b8f672800a269f336d6e7b +size 4494 diff --git a/doxygen_docs/html/application__class_8cpp_source.html b/doxygen_docs/html/application__class_8cpp_source.html index 0f62b64..92c1034 100644 --- a/doxygen_docs/html/application__class_8cpp_source.html +++ b/doxygen_docs/html/application__class_8cpp_source.html @@ -1,2329 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/src/system/application_class.cpp Source File - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
application_class.cpp
-
-
-
1#include "application_class.h"
-
2
-
3#include "depth_shader_class.h"
-
4#include "system_class.h"
-
5
-
- -
7{
-
8 direct_3d_ = nullptr;
-
9 camera_ = nullptr;
-
10 model_ = nullptr;
-
11 bitmap_ = nullptr;
-
12 sprite_ = nullptr;
-
13 timer_ = nullptr;
-
14 mouse_strings_ = nullptr;
-
15 font_shader_ = nullptr;
-
16 font_ = nullptr;
-
17 fps_ = nullptr;
-
18 fps_string_ = nullptr;
-
19 shader_manager_ = nullptr;
-
20 render_count_string_ = nullptr;
-
21 model_list_ = nullptr;
-
22 position_ = nullptr;
-
23 display_plane_ = nullptr;
-
24 bath_model_ = nullptr;
-
25 water_model_ = nullptr;
-
26 m_light_ = nullptr;
-
27 refraction_texture_ = nullptr;
-
28 reflection_texture_ = nullptr;
-
29 scene_texture_ = nullptr;
-
30 physics_ = nullptr;
-
31 skybox_.clear();
-
32 lights_.clear();
-
33 sun_light_ = nullptr;
-
34 swap_chain_ = nullptr;
-
35 ground_model_ = nullptr;
-
36 wall_model_ = nullptr;
-
37 hwnd_ = nullptr;
-
38 base_view_matrix_ = XMMatrixIdentity();
-
39 render_texture_ = nullptr;
-
40 screen_width_ = 0;
-
41 screen_height_ = 0;
-
42 num_lights_ = 0;
-
43 water_height_ = 0.0f;
-
44 water_translation_ = 0.0f;
-
45 true_light_position_ = XMFLOAT3(0.0f, 0.0f, 0.0f);
-
46 light_model_ = nullptr;
-
47 render_count_ = 0;
-
48 tab_was_pressed_ = false;
-
49}
-
-
50
-
51application_class::~application_class()
-
52{
-
53 should_quit_ = true;
-
54 culling_active_ = false;
-
55
-
56 // Joindre les threads pour s'assurer qu'ils se terminent correctement
-
57 if (physics_thread_.joinable())
-
58 {
-
59 physics_thread_.join();
-
60 }
-
61
-
62 if (culling_thread_.joinable())
-
63 {
-
64 culling_thread_.join();
-
65 }
-
66
-
67}
-
68
-
69
-
-
70bool application_class::initialize(int screenWidth, int screenHeight, HWND hwnd, bool is_vulkan)
-
71{
-
72
-
73 Logger::Get().Log("Initializing application class", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
74
-
75 try
-
76 {
-
77 char mouseString1[32], mouseString2[32], mouseString3[32];
-
78 char modelFilename[128], renderString[32];
-
79 char bitmapFilename[128];
-
80 char spriteFilename[128];
-
81 char fpsString[32];
-
82 bool result;
-
83 HRESULT Hresult;
-
84
-
85 // create entity manager
-
86 entity_manager_ = std::make_unique<ecs::EntityManager>();
-
87
-
88 screen_width_ = screenWidth;
-
89 screen_height_ = screenHeight;
-
90
-
91 set_hwnd(hwnd);
-
92 set_windowed(full_screen);
-
93 set_screen_height(screenHeight);
-
94 set_screen_width(screenWidth);
-
95
-
96 // Create the Direct3D object.
-
97 direct_3d_ = new d_3d_class;
-
98 if (!direct_3d_)
-
99 {
-
100 Logger::Get().Log("Could not create the Direct3D object", __FILE__, __LINE__, Logger::LogLevel::Error);
-
101 return false;
-
102 }
-
103
-
104 result = direct_3d_->initialize(screen_width_, screen_height_, vsync_enabled_, hwnd, full_screen, screen_depth, screen_near);
-
105 if (!result)
-
106 {
-
107 Logger::Get().Log("Could not initialize Direct3D", __FILE__, __LINE__, Logger::LogLevel::Error);
-
108 return false;
-
109 }
-
110
-
111 // Create the camera object.
-
112 camera_ = new camera_class;
-
113 if (!camera_)
-
114 {
-
115 Logger::Get().Log("Could not create the camera object", __FILE__, __LINE__, Logger::LogLevel::Error);
-
116 return false;
-
117 }
-
118
-
119 sun_camera_ = new camera_class;
-
120 if (!sun_camera_)
-
121 {
-
122 Logger::Get().Log("Could not create the sun camera object", __FILE__, __LINE__, Logger::LogLevel::Error);
-
123 return false;
-
124 }
-
125
-
126 sun_camera_->set_position(0.0f,0.0f,0.0f);
-
127 sun_camera_->set_rotation(0.0f, 0.0f, 0.0f);
-
128 sun_camera_->render();
-
129 sun_camera_->get_view_matrix(base_view_matrix_);
-
130
-
131 // Set the initial position of the camera.
-
132 camera_->set_position(0.0f, 0.0f, -12.0f);
-
133 camera_->set_rotation(0.0f, 0.0f, 0.0f);
-
134 camera_->render();
-
135 camera_->get_view_matrix(base_view_matrix_);
-
136
-
137 active_camera_ = camera_;
-
138
-
139 // Create and initialize the font shader object.
-
140 font_shader_ = new font_shader_class;
-
141
-
142 result = font_shader_->initialize(direct_3d_->get_device(), hwnd);
-
143 if (!result)
-
144 {
-
145 Logger::Get().Log("Could not initialize the font shader object", __FILE__, __LINE__, Logger::LogLevel::Error);
-
146 return false;
-
147 }
-
148
-
149 // Create and initialize the font object.
-
150 font_ = new font_class;
-
151
-
152 result = font_->Initialize(direct_3d_->get_device(), direct_3d_->get_device_context(), 0);
-
153 if (!result)
-
154 {
-
155 Logger::Get().Log("Could not initialize the font object", __FILE__, __LINE__, Logger::LogLevel::Error);
-
156 return false;
-
157 }
-
158
-
159 // Create and initialize the render to texture object.
-
160 render_texture_ = new render_texture_class;
-
161
-
162 result = render_texture_->Initialize(direct_3d_->get_device(), 256, 256, screen_depth, screen_near, 1);
-
163 if (!result)
-
164 {
-
165 Logger::Get().Log("Could not initialize the render texture object", __FILE__, __LINE__, Logger::LogLevel::Error);
-
166 return false;
-
167 }
-
168
-
169 //ImVec2 availableSize = ImGui::GetContentRegionAvail();
-
170
-
171 // Create and initialize the scene render to texture object.
-
172 scene_texture_ = new render_texture_class();
-
173 result = scene_texture_->Initialize(direct_3d_->get_device(), 256, 256, screen_depth, screen_near, 1);
-
174 if (!result)
-
175 {
-
176 Logger::Get().Log("Could not initialize the render texture object", __FILE__, __LINE__, Logger::LogLevel::Error);
-
177 return false;
-
178 }
-
179
-
180 // Create and initialize the display plane object.
-
181 display_plane_ = new display_plane_class;
-
182
-
183 result = display_plane_->Initialize(direct_3d_->get_device(), 1.0f, 1.0f);
-
184 if (!result)
-
185 {
-
186 Logger::Get().Log("Could not initialize the display plane object", __FILE__, __LINE__, Logger::LogLevel::Error);
-
187 return false;
-
188 }
-
189
-
190
-
191 // Set the sprite info file we will be using.
-
192 //
-
193 strcpy_s(spriteFilename, "sprite_data_01.txt");
-
194
-
195 // Create and initialize the sprite object.
-
196 sprite_ = new sprite_class;
-
197
-
198 result = sprite_->Initialize(direct_3d_->get_device(), direct_3d_->get_device_context(), screenWidth, screenHeight, spriteFilename, 50, 50);
-
199 if (!result)
-
200 {
-
201 Logger::Get().Log("Could not initialize the sprite object", __FILE__, __LINE__, Logger::LogLevel::Error);
-
202 return false;
-
203 }
-
204
-
205 // Set the initial mouse strings.
-
206 strcpy_s(mouseString1, "Mouse X: 0");
-
207 strcpy_s(mouseString2, "Mouse Y: 0");
-
208 strcpy_s(mouseString3, "Mouse Button: No");
-
209
-
210 // Create and initialize the text objects for the mouse strings.
-
211 mouse_strings_ = new text_class[3];
-
212
-
213 for (int i = 0; i < 3; i++)
-
214 {
-
215 int y = 10 + (i * 25);
-
216 result = mouse_strings_[i].Initialize(direct_3d_->get_device(), direct_3d_->get_device_context(), screenWidth, screenHeight, 32, font_, mouseString1, 10, y, 1.0f, 1.0f, 1.0f);
-
217 if (!result)
-
218 {
-
219 Logger::Get().Log("Could not initialize the mouse strings", __FILE__, __LINE__, Logger::LogLevel::Error);
-
220 return false;
-
221 }
-
222 }
-
223
-
224 // Set the file name of the bitmap file.
-
225 strcpy_s(bitmapFilename, "assets/Texture/stone01.tga");
-
226
-
227 // Create and initialize the bitmap object.
-
228 bitmap_ = new bitmap_class;
-
229
-
230 result = bitmap_->initialize(direct_3d_->get_device(), direct_3d_->get_device_context(), screenWidth, screenHeight, bitmapFilename, 50, 50);
-
231 if (!result)
-
232 {
-
233 Logger::Get().Log("Could not initialize the bitmap object", __FILE__, __LINE__, Logger::LogLevel::Error);
-
234 return false;
-
235 }
-
236
-
237 // Set the file name of the model.
-
238 strcpy_s(modelFilename, "assets/Model/TXT/cube.txt");
-
239
-
240 // Charger les textures_
-
241 std::vector<std::wstring> textureFilenames = {
-
242 L"assets/Texture/stone01.png"
-
243 };
-
244
-
245 TextureContainer CubeTextures;
-
246
-
247 for (const auto& textureFilename : textureFilenames)
-
248 {
-
249 ID3D11ShaderResourceView* texture = nullptr;
-
250 Hresult = DirectX::CreateWICTextureFromFile(direct_3d_->get_device(), direct_3d_->get_device_context(), textureFilename.c_str(), nullptr, &texture);
-
251 if (FAILED(Hresult))
-
252 {
-
253 Logger::Get().Log("Failed to load texture: " + std::string(textureFilename.begin(), textureFilename.end()), __FILE__, __LINE__, Logger::LogLevel::Error);
-
254 return false;
-
255 }
-
256 CubeTextures.diffuse.push_back(texture);
-
257 }
-
258
-
259 // Create and initialize the model object.
-
260 model_ = new model_class;
-
261
-
262
-
263 result = model_->Initialize(direct_3d_->get_device(), direct_3d_->get_device_context(), modelFilename, CubeTextures);
-
264 if (!result)
-
265 {
-
266 Logger::Get().Log("Could not initialize the model object", __FILE__, __LINE__, Logger::LogLevel::Error);
-
267 return false;
-
268 }
-
269
-
270 // Create and initialize the light object.
-
271 m_light_ = new light_class;
-
272
-
273 m_light_->SetDiffuseColor(1.0f, 1.0f, 1.0f, 1.0f);
-
274 m_light_->SetDirection(0.0f, 0.0f, -1.0f);
-
275 m_light_->SetAmbientColor(0.15f, 0.15f, 0.15f, 1.0f);
-
276 m_light_->SetSpecularColor(1.0f, 1.0f, 1.0f, 1.0f);
-
277 m_light_->SetSpecularPower(16.0f);
-
278
-
279 // Set the number of lights we will use.
-
280 num_lights_ = 4;
-
281 // Create and initialize the light objects array.
-
282 lights_.resize(num_lights_);
-
283
-
284 lights_[0] = new light_class;
-
285 lights_[0]->SetDiffuseColor(1.0f, 1.0f, 1.0f, 1.0f); // White
-
286 lights_[0]->SetDirection(0.0f, 0.0f, -1.0f);
-
287 lights_[0]->SetAmbientColor(0.15f, 0.15f, 0.15f, 1.0f);
-
288 lights_[0]->SetSpecularColor(1.0f, 1.0f, 1.0f, 1.0f);
-
289 lights_[0]->SetSpecularPower(16.0f);
-
290 lights_[0]->SetPosition(10.0f, 7.0f, -5.0f);
-
291
-
292 lights_[1] = new light_class;
-
293 lights_[1]->SetDiffuseColor(1.0f, 0.0f, 0.0f, 1.0f); // Red
-
294 lights_[1]->SetDirection(0.0f, 0.0f, -1.0f);
-
295 lights_[1]->SetAmbientColor(0.15f, 0.15f, 0.15f, 1.0f);
-
296 lights_[1]->SetSpecularColor(1.0f, 0.0f, 0.0f, 1.0f);
-
297 lights_[1]->SetSpecularPower(16.0f);
-
298 lights_[1]->SetPosition(-10.0f, 7.0f, -5.0f);
-
299
-
300 lights_[2] = new light_class;
-
301 lights_[2]->SetDiffuseColor(0.0f, 1.0f, 0.0f, 1.0f); // Green
-
302 lights_[2]->SetDirection(0.0f, 0.0f, -1.0f);
-
303 lights_[2]->SetAmbientColor(0.15f, 0.15f, 0.15f, 1.0f);
-
304 lights_[2]->SetSpecularColor(0.0f, 1.0f, 0.0f, 1.0f);
-
305 lights_[2]->SetSpecularPower(16.0f);
-
306 lights_[2]->SetPosition(10.0f, 7.0f, 5.0f);
-
307
-
308 lights_[3] = new light_class;
-
309 lights_[3]->SetDiffuseColor(0.0f, 0.0f, 1.0f, 1.0f); // Blue
-
310 lights_[3]->SetDirection(0.0f, 0.0f, -1.0f);
-
311 lights_[3]->SetAmbientColor(0.15f, 0.15f, 0.15f, 1.0f);
-
312 lights_[3]->SetSpecularColor(0.0f, 0.0f, 1.0f, 1.0f);
-
313 lights_[3]->SetSpecularPower(16.0f);
-
314 lights_[3]->SetPosition(-10.0f, 7.0f, 5.0f);
-
315
-
316 // ------------------------------------------------------------- //
-
317 // ----------------------- || THE SUN || ----------------------- //
-
318 // ------------------------------------------------------------- //
-
319
-
320 sun_light_ = new light_class;
-
321 sun_light_->SetDiffuseColor(1.0f, 1.0f, 1.0f, 1.0f); // White
-
322 sun_light_->SetDirection(0.0f, -1.0f, 0.0f);
-
323 sun_light_->SetAmbientColor(0.15f, 0.15f, 0.15f, 1.0f);
-
324 sun_light_->SetPosition(0.0f, 100.0f, 0.0f);
-
325 sun_light_->SetIntensity(1.0f);
-
326
-
327 sun_camera_->set_position(sun_light_->GetPosition().x, sun_light_->GetPosition().y, sun_light_->GetPosition().z);
-
328 sun_camera_->set_rotation(0.0f, 0.0f, 0.0f);
-
329 sun_camera_->render();
-
330
-
331 // Create and initialize the normal map shader object.
-
332 shader_manager_ = new shader_manager_class;
-
333
-
334 result = shader_manager_->initialize(direct_3d_->get_device(), hwnd);
-
335 if (!result)
-
336 {
-
337 Logger::Get().Log("Could not initialize the shader manager object", __FILE__, __LINE__, Logger::LogLevel::Error);
-
338 return false;
-
339 }
-
340
-
341 // Set the initial render count string.
-
342 strcpy_s(renderString, "render Count: 0");
-
343
-
344 // Create and initialize the text object for the render count string.
-
345 render_count_string_ = new text_class;
-
346
-
347 result = render_count_string_->Initialize(direct_3d_->get_device(), direct_3d_->get_device_context(), screenWidth, screenHeight, 32, font_, renderString, 10, 10, 1.0f, 1.0f, 1.0f);
-
348 if (!result)
-
349 {
-
350 Logger::Get().Log("Could not initialize the render count string", __FILE__, __LINE__, Logger::LogLevel::Error);
-
351 return false;
-
352 }
-
353
-
354 // Create and initialize the model list object.
-
355 model_list_ = new ModelListClass;
-
356 model_list_->Initialize(25);
-
357
-
358 // Charger les textures_ initiales pour bath_model_
-
359 std::vector<std::wstring> bathTextures = {
-
360 L"assets/Texture/marble01.png"
-
361 };
-
362
-
363 TextureContainer BathTextures;
-
364
-
365 textures.clear();
-
366 for (const auto& textureFilename : bathTextures)
-
367 {
-
368 ID3D11ShaderResourceView* texture = nullptr;
-
369 Hresult = DirectX::CreateWICTextureFromFile(direct_3d_->get_device(), direct_3d_->get_device_context(), textureFilename.c_str(), nullptr, &texture);
-
370 if (FAILED(Hresult))
-
371 {
-
372 Logger::Get().Log("Failed to load texture: " + std::string(textureFilename.begin(), textureFilename.end()), __FILE__, __LINE__, Logger::LogLevel::Error);
-
373 return false;
-
374 }
-
375 BathTextures.diffuse.push_back(texture);
-
376 }
-
377
-
378 // Set the file name of the bath model.
-
379 strcpy_s(modelFilename, "assets/Model/TXT/bath.txt");
-
380
-
381 // Create and initialize the bath model object.
-
382 bath_model_ = new model_class;
-
383
-
384 result = bath_model_->Initialize(direct_3d_->get_device(), direct_3d_->get_device_context(), modelFilename, BathTextures);
-
385 if (!result)
-
386 {
-
387 MessageBox(hwnd, L"Could not initialize the bath model object.", L"Error", MB_OK);
-
388 return false;
-
389 }
-
390
-
391 // Set the file names of the water model.
-
392 strcpy_s(modelFilename, "assets/Model/TXT/water.txt");
-
393 // replace first element with the new filename
-
394 std::vector<std::wstring> waterTextures = {
-
395 L"assets/Texture/water01.png"
-
396 };
-
397
-
398 TextureContainer WaterTextures;
-
399
-
400 textures.clear();
-
401 for (const auto& textureFilename : waterTextures)
-
402 {
-
403 ID3D11ShaderResourceView* texture = nullptr;
-
404 Hresult = DirectX::CreateWICTextureFromFile(direct_3d_->get_device(), direct_3d_->get_device_context(), textureFilename.c_str(), nullptr, &texture);
-
405 if (FAILED(Hresult))
-
406 {
-
407 Logger::Get().Log("Failed to load texture: " + std::string(textureFilename.begin(), textureFilename.end()), __FILE__, __LINE__, Logger::LogLevel::Error);
-
408 return false;
-
409 }
-
410 WaterTextures.diffuse.push_back(texture);
-
411 }
-
412
-
413 // Create and initialize the water model object.
-
414 water_model_ = new model_class;
-
415
-
416 result = water_model_->Initialize(direct_3d_->get_device(), direct_3d_->get_device_context(), modelFilename, WaterTextures);
-
417 if (!result)
-
418 {
-
419 MessageBox(hwnd, L"Could not initialize the water model object.", L"Error", MB_OK);
-
420 return false;
-
421 }
-
422
-
423 // Create and initialize the refraction render to texture object.
-
424 refraction_texture_ = new render_texture_class;
-
425
-
426 result = refraction_texture_->Initialize(direct_3d_->get_device(), screenWidth, screenHeight, screen_depth, screen_near, 1);
-
427 if (!result)
-
428 {
-
429 MessageBox(hwnd, L"Could not initialize the refraction render texture object.", L"Error", MB_OK);
-
430 return false;
-
431 }
-
432
-
433 // Create and initialize the reflection render to texture object.
-
434 reflection_texture_ = new render_texture_class;
-
435
-
436 result = reflection_texture_->Initialize(direct_3d_->get_device(), screenWidth, screenHeight, screen_depth, screen_near, 1);
-
437 if (!result)
-
438 {
-
439 MessageBox(hwnd, L"Could not initialize the reflection render texture object.", L"Error", MB_OK);
-
440 return false;
-
441 }
-
442
-
443 // Set the height of the water.
-
444 water_height_ = -9.25f;
-
445
-
446 // initialize the position of the water.
-
447 water_translation_ = 100.0f;
-
448
-
449 // Create and initialize the timer object.
-
450 timer_ = new timer_class;
-
451
-
452 result = timer_->Initialize();
-
453 if (!result)
-
454 {
-
455 Logger::Get().Log("Could not initialize the timer object", __FILE__, __LINE__, Logger::LogLevel::Error);
-
456 return false;
-
457 }
-
458
-
459 // Create the position class object.
-
460 position_ = new position_class;
-
461
-
462 // Create and initialize the fps object.
-
463 fps_ = new fps_class();
-
464
-
465 fps_->Initialize();
-
466
-
467 // Set the initial fps and fps string.
-
468 previous_fps_ = -1;
-
469 strcpy_s(fpsString, "Fps: 0");
-
470
-
471 // Create and initialize the text object for the fps string.
-
472 fps_string_ = new text_class;
-
473
-
474 result = fps_string_->Initialize(direct_3d_->get_device(), direct_3d_->get_device_context(), screenWidth, screenHeight, 32, font_, fpsString, 10, 10, 0.0f, 1.0f, 0.0f);
-
475 if (!result)
-
476 {
-
477 Logger::Get().Log("Could not initialize the fps string", __FILE__, __LINE__, Logger::LogLevel::Error);
-
478 return false;
-
479 }
-
480
-
481 shadow_map_ = new shadow_map();
-
482 if (!shadow_map_->initialize(direct_3d_->get_device(), 2048, 2048))
-
483 {
-
484 Logger::Get().Log("Could not initialize the shadow map object", __FILE__, __LINE__, Logger::LogLevel::Error);
-
485 return false;
-
486 }
-
487
-
488 stats_ = new stats();
-
489 if (!stats_->initialize(this))
-
490 {
-
491 Logger::Get().Log("Could not initialize the stats object", __FILE__, __LINE__, Logger::LogLevel::Error);
-
492 return false;
-
493 }
-
494
-
495 physics_ = new physics;
-
496
-
497 physics_thread_ = std::thread(&application_class::physics_thread_function, this);
-
498
-
499 //ConstructSkyboxWithPlanes();
-
500 Skybox* skybox = new Skybox;
-
501 skybox->Initialize(direct_3d_);
-
502 skybox_.push_back(skybox->ConstructSkybox(this));
-
503
-
504 culling_active_ = true;
-
505 culling_thread_ = std::thread(&application_class::culling_thread_function, this);
-
506
-
507 }
-
508 catch (const std::exception& e)
-
509 {
-
510 Logger::Get().Log(std::string("Exception caught during initialization: ") + e.what(), __FILE__, __LINE__, Logger::LogLevel::Error);
-
511 return false;
-
512 }
-
513 Logger::Get().Log("Application class initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
514
-
515
-
516
-
517 return true;
-
518}
-
-
519
-
- -
521{
-
522 Logger::Get().Log("Shutting down application class", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
523
-
524 // Release the shader manager object.
-
525 if (shader_manager_)
-
526 {
-
527 Logger::Get().Log("Releasing the shader manager object", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
528
-
529 shader_manager_->shutdown();
-
530 delete shader_manager_;
-
531 shader_manager_ = 0;
-
532
-
533 Logger::Get().Log("Shader manager object released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
534 }
-
535
-
536 // Release the reflection render texture object.
-
537 if (reflection_texture_)
-
538 {
-
539 reflection_texture_->Shutdown();
-
540 delete reflection_texture_;
-
541 reflection_texture_ = 0;
-
542 }
-
543
-
544 // Release the refraction render texture object.
-
545 if (refraction_texture_)
-
546 {
-
547 refraction_texture_->Shutdown();
-
548 delete refraction_texture_;
-
549 refraction_texture_ = 0;
-
550 }
-
551
-
552 // Release the water model object.
-
553 if (water_model_)
-
554 {
-
555 water_model_->Shutdown();
-
556 delete water_model_;
-
557 water_model_ = 0;
-
558 }
-
559
-
560 // Release the bath model object.
-
561 if (bath_model_)
-
562 {
-
563 bath_model_->Shutdown();
-
564 delete bath_model_;
-
565 bath_model_ = 0;
-
566 }
-
567 // Release the physics object.
-
568 if (physics_)
-
569 {
-
570 delete physics_;
-
571 physics_ = 0;
-
572 }
-
573
-
574 // Release the display plane object.
-
575 if (display_plane_)
-
576 {
-
577 Logger::Get().Log("Releasing the display plane object", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
578
-
579 display_plane_->Shutdown();
-
580 delete display_plane_;
-
581 display_plane_ = 0;
-
582
-
583 Logger::Get().Log("Display plane object released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
584 }
-
585
-
586 // Release the position object.
-
587 if (position_)
-
588 {
-
589 Logger::Get().Log("Releasing the position object", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
590
-
591 delete position_;
-
592 position_ = 0;
-
593
-
594 Logger::Get().Log("Position object released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
595 }
-
596
-
597 // Release the model list object.
-
598 if (model_list_)
-
599 {
-
600 Logger::Get().Log("Releasing the model list object", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
601
-
602 model_list_->Shutdown();
-
603 delete model_list_;
-
604 model_list_ = 0;
-
605
-
606 Logger::Get().Log("Model list object released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
607 }
-
608
-
609 // Release the text objects for the render count string.
-
610 if (render_count_string_)
-
611 {
-
612 Logger::Get().Log("Releasing the render count string object", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
613
-
614 render_count_string_->Shutdown();
-
615 delete render_count_string_;
-
616 render_count_string_ = 0;
-
617
-
618 Logger::Get().Log("render count string object released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
619 }
-
620
-
621 // Release the text objects for the mouse strings.
-
622 if (mouse_strings_)
-
623 {
-
624 Logger::Get().Log("Releasing the mouse strings", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
625
-
626 mouse_strings_[0].Shutdown();
-
627 mouse_strings_[1].Shutdown();
-
628 mouse_strings_[2].Shutdown();
-
629
-
630 delete[] mouse_strings_;
-
631 mouse_strings_ = 0;
-
632
-
633 Logger::Get().Log("Mouse strings released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
634 }
-
635
-
636 // Release the text object for the fps string.
-
637 if (fps_string_)
-
638 {
-
639 Logger::Get().Log("Releasing the fps string object", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
640
-
641 fps_string_->Shutdown();
-
642 delete fps_string_;
-
643 fps_string_ = 0;
-
644
-
645 Logger::Get().Log("Fps string object released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
646 }
-
647
-
648 // Release the fps object.
-
649 if (fps_)
-
650 {
-
651 Logger::Get().Log("Releasing the fps object", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
652
-
653 delete fps_;
-
654 fps_ = 0;
-
655
-
656 Logger::Get().Log("Fps object released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
657 }
-
658
-
659 // Release the font object.
-
660 if (font_)
-
661 {
-
662 Logger::Get().Log("Releasing the font object", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
663
-
664 font_->Shutdown();
-
665 delete font_;
-
666 font_ = 0;
-
667
-
668 Logger::Get().Log("Font object released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
669 }
-
670
-
671 // Release the font shader object.
-
672 if (font_shader_)
-
673 {
-
674 Logger::Get().Log("Releasing the font shader object", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
675
-
676 font_shader_->shutdown();
-
677 delete font_shader_;
-
678 font_shader_ = 0;
-
679
-
680 Logger::Get().Log("Font shader object released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
681 }
-
682
-
683 // Release the timer object.
-
684 if (timer_)
-
685 {
-
686 Logger::Get().Log("Releasing the timer object", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
687
-
688 delete timer_;
-
689 timer_ = 0;
-
690
-
691 Logger::Get().Log("Timer object released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
692 }
-
693
-
694 // Release the sprite object.
-
695 if (sprite_)
-
696 {
-
697 Logger::Get().Log("Releasing the sprite object", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
698
-
699 sprite_->Shutdown();
-
700 delete sprite_;
-
701 sprite_ = 0;
-
702
-
703 Logger::Get().Log("Sprite object released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
704 }
-
705
-
706 for (auto light : lights_)
-
707 {
-
708 Logger::Get().Log("Releasing the light object", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
709 if (light)
-
710 {
-
711 delete light;
-
712 light = 0;
-
713 }
-
714 Logger::Get().Log("Light object released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
715 }
-
716
-
717 // Release the light object.
-
718 if (m_light_)
-
719 {
-
720 Logger::Get().Log("Releasing the light object", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
721 delete m_light_;
-
722 m_light_ = 0;
-
723 Logger::Get().Log("Light object released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
724 }
-
725
-
726 // Release the model object.
-
727 if (model_)
-
728 {
-
729 Logger::Get().Log("Releasing the model object", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
730 model_->Shutdown();
-
731 delete model_;
-
732 model_ = 0;
-
733 Logger::Get().Log("Model object released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
734 }
-
735
-
736 if (scene_texture_)
-
737 {
-
738 scene_texture_->Shutdown();
-
739 delete scene_texture_;
-
740 scene_texture_ = nullptr;
-
741 }
-
742
-
743 if (sun_camera_)
-
744 {
-
745 Logger::Get().Log("Releasing the sun camera object", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
746 delete sun_camera_;
-
747 sun_camera_ = nullptr;
-
748 Logger::Get().Log("Sun camera object released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
749 }
-
750
-
751 if (shadow_map_) {
-
752 shadow_map_->shutdown();
-
753 delete shadow_map_;
-
754 shadow_map_ = nullptr;
-
755 }
-
756
-
757 Logger::Get().Log("Application class shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
758}
-
-
759
-
- -
761{
-
762 stats_->reset_draw_call_count();
-
763
-
764 int mouseX, mouseY, currentMouseX, currentMouseY;
-
765 bool result, leftMouseDown, rightMouseDown, buttonQ, buttonD, buttonZ, buttonS, buttonA, buttonE, scrollUp, scrollDown;
-
766 float rotationY, rotationX, positionX, positionY, positionZ;
-
767 static float textureTranslation = 0.0f;
-
768
-
769 float frameTime;
-
770
-
771 static int lastMouseX = 0, lastMouseY = 0;
-
772
-
773 static float rotation = 360.0f;
-
774 static float x = 0.0f;
-
775 static float y = 3.0f;
-
776 static float z = 0.0f;
-
777
-
778 // Update the system stats.
-
779 timer_->Frame();
-
780
-
781 // Get the current frame time.
-
782 frameTime = timer_->GetTime();
-
783
-
784 // Check if the user pressed escape and wants to exit the application.
-
785 if (Input->IsEscapePressed())
-
786 {
-
787 Logger::Get().Log("User pressed escape, exiting application", __FILE__, __LINE__, Logger::LogLevel::Input);
-
788 should_quit_ = true;
-
789 }
-
790
-
791 // Get the location of the mouse from the input object,
-
792 Input->GetMouseLocation(mouseX, mouseY);
-
793
-
794 // Check if the mouse has been pressed.
-
795 leftMouseDown = Input->IsLeftMousePressed();
-
796 rightMouseDown = Input->IsRightMousePressed();
-
797
-
798 currentMouseX = mouseX;
-
799
-
800 int deltaX = currentMouseX - lastMouseX; // Calculate the mouse movement.
-
801 lastMouseX = currentMouseX; // Update the last mouse position for the next frame
-
802
-
803 currentMouseY = mouseY;
-
804
-
805 int deltaY = currentMouseY - lastMouseY; // Calculate the mouse movement.
-
806 lastMouseY = currentMouseY; // Update the last mouse position for the next frame
-
807
-
808 // Set the frame time for calculating the updated position.
-
809 position_->SetFrameTime(timer_->GetTime());
-
810
-
811 position_->TurnMouse((float)deltaX, (float)deltaY, 0.1f, rightMouseDown);
-
812
-
813 // Get the current view point rotation.
-
814 position_->GetRotation(rotationY, rotationX);
-
815
-
816 scrollUp = Input->IsScrollUp();
-
817 scrollDown = Input->IsScrollDown();
-
818
-
819 // Check if the a(q), d, w(z), s, q(a), e have been pressed, if so move the camera accordingly.
-
820 buttonQ = Input->IsAPressed();
-
821 buttonD = Input->IsDPressed();
-
822 buttonZ = Input->IsWPressed();
-
823 buttonS = Input->IsSPressed();
-
824 buttonA = Input->IsQPressed();
-
825 buttonE = Input->IsEPressed();
-
826 position_->MoveCamera(buttonZ, buttonS, buttonQ, buttonD, buttonE, buttonA, scrollUp, scrollDown, rightMouseDown);
-
827 position_->GetPosition(positionX, positionY, positionZ);
-
828
-
829 XMFLOAT3 dir = sun_light_->GetDirection();
-
830 float pitch = asinf(-dir.y) * (180.0f / XM_PI); // en degrés
-
831 float yaw = atan2f(dir.x, dir.z) * (180.0f / XM_PI); // en degrés
-
832 float roll = 0.0f;
-
833
-
834 if (Input->is_key_pressed(DIK_TAB)) {
-
835 if (!tab_was_pressed_) {
-
836 // Alterner la caméra active
-
837 if (active_camera_ == camera_)
-
838 active_camera_ = sun_camera_;
-
839 else
-
840 active_camera_ = camera_;
-
841 tab_was_pressed_ = true;
-
842 }
-
843 } else {
-
844 tab_was_pressed_ = false;
-
845 }
-
846
-
847 if (active_camera_ == camera_) {
-
848 // Update the camera position and rotation based on the position class.
-
849 camera_->set_position(positionX, positionY, positionZ);
-
850 camera_->set_rotation(rotationX, rotationY, 0.0f);
-
851 } else {
-
852 // Update the sun camera position and rotation based on the light position.
-
853 sun_camera_->set_position(sun_light_->GetPosition().x, sun_light_->GetPosition().y, sun_light_->GetPosition().z);
-
854 sun_camera_->set_rotation(pitch, yaw, roll);
-
855
-
856 // sun_camera_->set_position(positionX, positionY, positionZ);
-
857 // sun_camera_->set_rotation(rotationX, rotationY, 0.0f);
-
858 }
-
859
-
860 active_camera_->render();
-
861
-
862 // render the static graphics scene.
-
863 result = render(rotation, x, y, z, textureTranslation);
-
864 if (!result)
-
865 {
-
866 Logger::Get().Log("Could not render the graphics scene", __FILE__, __LINE__, Logger::LogLevel::Error);
-
867 return false;
-
868 }
-
869
-
870 // Update the frames per second each frame.
-
871 result = update_fps();
-
872 if (!result)
-
873 {
-
874 Logger::Get().Log("Could not update the frames per second", __FILE__, __LINE__, Logger::LogLevel::Error);
-
875 return false;
-
876 }
-
877
-
878 // Update the rotation variable each frame.
-
879 rotation -= 0.0174532925f * speed_;
-
880 if (rotation < 0.0f)
-
881 {
-
882 rotation += 360.0f;
-
883 }
-
884
-
885 // Update the position of the water to simulate motion.
-
886 water_translation_ += 0.001f;
-
887 if (water_translation_ > 1.0f)
-
888 {
-
889 water_translation_ -= 1.0f;
-
890 }
-
891
-
892 // render the refraction of the scene to a texture.
-
893 result = render_refraction_to_texture();
-
894 if (!result)
-
895 {
-
896 return false;
-
897 }
-
898
-
899 // render the reflection of the scene to a texture.
-
900 result = render_reflection_to_texture();
-
901 if (!result)
-
902 {
-
903 return false;
-
904 }
-
905
-
906 inputs_.key_left = Input->IsLeftArrowPressed();
-
907 inputs_.key_right = Input->IsRightArrowPressed();
-
908 inputs_.key_up = Input->IsUpArrowPressed();
-
909 inputs_.key_down = Input->IsDownArrowPressed();
-
910
-
911 // render the scene to a render texture.
-
912 result = render_scene_to_texture(rotation);
-
913 if (!result)
-
914 {
-
915 Logger::Get().Log("Could not render the scene to the render texture", __FILE__, __LINE__, Logger::LogLevel::Error);
-
916 return false;
-
917 }
-
918
-
919 // Update the mouse strings each frame.
-
920 result = update_mouse_strings(mouseX, mouseY, leftMouseDown);
-
921 if (!result)
-
922 {
-
923 Logger::Get().Log("Could not update the mouse strings", __FILE__, __LINE__, Logger::LogLevel::Error);
-
924 return false;
-
925 }
-
926
-
927 // Update the sprite object using the frame time.
-
928 sprite_->Update(frameTime);
-
929
-
930 // Increment the texture translation.
-
931 textureTranslation += 0.01f;
-
932 if (textureTranslation > 1.0f)
-
933 {
-
934 textureTranslation -= 1.0f;
-
935 }
-
936
-
937 return true;
-
938}
-
-
939
-
940bool application_class::render_refraction_to_texture()
-
941{
-
942 XMMATRIX worldMatrix, viewMatrix, projectionMatrix;
-
943 XMFLOAT4 diffuseColor[4], lightPosition[4], ambientColor[4];
-
944 XMFLOAT4 clipPlane;
-
945 int i;
-
946 bool result;
-
947
-
948 // Setup a clipping plane based on the height of the water to clip everything above it.
-
949 clipPlane = XMFLOAT4(0.0f, -1.0f, 0.0f, water_height_ + 0.1f);
-
950
-
951 // Set the render target to be the refraction render to texture and clear it.
-
952 refraction_texture_->SetRenderTarget(direct_3d_->get_device_context());
-
953 refraction_texture_->ClearRenderTarget(direct_3d_->get_device_context(), 0.0f, 0.0f, 0.0f, 1.0f);
-
954
-
955 // Generate the view matrix based on the camera's position.
-
956 camera_->render();
-
957 camera_->get_view_matrix(viewMatrix);
-
958 projectionMatrix = direct_3d_->get_projection_matrix();
-
959
-
960 // Get the light properties.
-
961 for (i = 0; i < num_lights_; i++)
-
962 {
-
963 // Create the diffuse color array from the four light colors.
-
964 diffuseColor[i] = lights_[i]->GetDiffuseColor();
-
965
-
966 // Create the light position array from the four light positions.
-
967 lightPosition[i] = lights_[i]->GetPosition();
-
968
-
969 // Create the light position array from the four light positions.
-
970 ambientColor[i] = lights_[i]->GetAmbientColor();
-
971 }
-
972
-
973 // Translate to where the bath model will be rendered.
-
974 worldMatrix = XMMatrixTranslation(0.0f, -10.0f, 0.0f);
-
975
-
976 // render the bath model using the refraction shader.
-
977 bath_model_->Render(direct_3d_->get_device_context());
-
978
-
979 result = shader_manager_->render_refraction_shader(direct_3d_->get_device_context(), bath_model_->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix,
-
980 bath_model_->GetTexture(TextureType::Diffuse,0), lights_[0]->GetDirection(), ambientColor, diffuseColor, lightPosition, clipPlane);
-
981 if (!result)
-
982 {
-
983 return false;
-
984 }
-
985
-
986 // Reset the render target back to the original back buffer and not the render to texture anymore. And reset the viewport back to the original.
-
987 direct_3d_->set_back_buffer_render_target();
-
988 direct_3d_->reset_viewport();
-
989
-
990 return true;
-
991}
-
992
-
993bool application_class::render_reflection_to_texture()
-
994{
-
995 XMMATRIX reflectionViewMatrix;
-
996
-
997 // Set the render target to be the reflection render to texture and clear it.
-
998 reflection_texture_->SetRenderTarget(direct_3d_->get_device_context());
-
999 reflection_texture_->ClearRenderTarget(direct_3d_->get_device_context(), 0.0f, 0.0f, 0.0f, 1.0f);
-
1000
-
1001 // Use the camera to render the reflection and create a reflection view matrix.
-
1002 camera_->render_reflection(water_height_);
-
1003
-
1004 // Get the camera reflection view matrix instead of the normal view matrix.
-
1005 camera_->get_reflection_view_matrix(reflectionViewMatrix);
-
1006
-
1007 // Reset the render target back to the original back buffer and not the render to texture anymore. And reset the viewport back to the original.
-
1008 direct_3d_->set_back_buffer_render_target();
-
1009 direct_3d_->reset_viewport();
-
1010
-
1011 return true;
-
1012}
-
1013
-
1014bool application_class::render_scene_to_texture(float rotation)
-
1015{
-
1016 XMMATRIX worldMatrix, viewMatrix, projectionMatrix;
-
1017 bool result;
-
1018
-
1019 // Set the render target to be the render texture and clear it.
-
1020 render_texture_->SetRenderTarget(direct_3d_->get_device_context());
-
1021 render_texture_->ClearRenderTarget(direct_3d_->get_device_context(), 0.0f, 0.5f, 1.0f, 1.0f);
-
1022
-
1023 // Set the position of the camera for viewing the cube.
-
1024 camera_->render();
-
1025
-
1026 camera_->get_view_matrix(viewMatrix);
-
1027 render_texture_->GetProjectionMatrix(projectionMatrix);
-
1028
-
1029 // Rotate the world matrix by the rotation value so that the cube will spin.
-
1030 worldMatrix = XMMatrixRotationY(rotation);
-
1031
-
1032 // render the model using the texture shader.
-
1033 model_->Render(direct_3d_->get_device_context());
-
1034
-
1035 result = shader_manager_->render_texture_shader(direct_3d_->get_device_context(), model_->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix,
-
1036 model_->GetTexture(TextureType::Diffuse,0));
-
1037 if (!result)
-
1038 {
-
1039 return false;
-
1040 }
-
1041
-
1042 // Reset the render target back to the original back buffer and not the render to texture anymore. And reset the viewport back to the original.
-
1043 direct_3d_->set_back_buffer_render_target();
-
1044 direct_3d_->reset_viewport();
-
1045
-
1046 return true;
-
1047}
-
1048
-
1049bool application_class::render(float rotation, float x, float y, float z, float textureTranslation)
-
1050{
-
1051 XMMATRIX worldMatrix, viewMatrix, orthoMatrix, projectionMatrix, rotateMatrix, translateMatrix, scaleMatrix, srMatrix, reflectionMatrix;
-
1052 XMFLOAT4 diffuseColor[4], lightPosition[4], ambientColor[4];
-
1053 int i;
-
1054 bool result;
-
1055 float blendAmount;
-
1056
-
1057 // Set the blending amount to 10%.
-
1058 blendAmount = 0.1f;
-
1059
-
1060 // Generate the view matrix based on the camera's position.
-
1061 active_camera_->render();
-
1062
-
1063 // Get the world, view, and projection matrices from the camera and d3d objects.
-
1064 worldMatrix = direct_3d_->get_world_matrix();
-
1065 active_camera_->get_view_matrix(viewMatrix);
-
1066 projectionMatrix = direct_3d_->get_projection_matrix();
-
1067 orthoMatrix = direct_3d_->get_ortho_matrix();
-
1068
-
1069 //render Sky box
-
1070 //RenderSkybox(viewMatrix, projectionMatrix);
-
1071
-
1072 // Get the light properties.
-
1073 for (i = 0; i < num_lights_; i++)
-
1074 {
-
1075 // Create the diffuse color array from the four light colors.
-
1076 diffuseColor[i] = lights_[i]->GetDiffuseColor();
-
1077
-
1078 // Create the light position array from the four light positions.
-
1079 lightPosition[i] = lights_[i]->GetPosition();
-
1080
-
1081 // Create the light position array from the four light positions.
-
1082 ambientColor[i] = lights_[i]->GetPosition();
-
1083 }
-
1084
-
1085 // Redimensionner la texture de rendu si nécessaire
-
1086 if (DEBUG_MODE)
-
1087 {
-
1088 if ((float)scene_texture_->GetTextureWidth() != window_size_.x || (float)scene_texture_->GetTextureHeight() != window_size_.y)
-
1089 {
-
1090 scene_texture_->Shutdown();
-
1091 scene_texture_->Initialize(direct_3d_->get_device(), (int)window_size_.x, (int)window_size_.y, screen_depth, screen_near, 1);
-
1092 }
-
1093
-
1094 direct_3d_->set_back_buffer_render_target();
-
1095 direct_3d_->reset_viewport();
-
1096 }
-
1097
-
1099
-
1100
-
1101 //scene_texture_->SetRenderTarget(direct_3d_->get_device_context());
-
1102 //scene_texture_->ClearRenderTarget(direct_3d_->get_device_context(), 0.0f, 0.0f, 0.0f, 0.0f);
-
1103
-
1104 scaleMatrix = XMMatrixScaling(0.5f, 0.5f, 0.5f); // Build the scaling matrix.
-
1105 rotateMatrix = XMMatrixRotationY(rotation); // Build the rotation matrix.
-
1106 translateMatrix = XMMatrixTranslation(x, y, z); // Build the translation matrix.
-
1107
-
1108 // Multiply the scale, rotation, and translation matrices together to create the final world transformation matrix.
-
1109 srMatrix = XMMatrixMultiply(scaleMatrix, rotateMatrix);
-
1110 worldMatrix = XMMatrixMultiply(srMatrix, translateMatrix);
-
1111
-
1112 // Put the model vertex and index buffers on the graphics pipeline to prepare them for drawing.
-
1113 model_->Render(direct_3d_->get_device_context());
-
1114
-
1115 // render the model using the light shader.
-
1116 result = shader_manager_->renderlight_shader(direct_3d_->get_device_context(), model_->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix, model_->GetTexture(TextureType::Diffuse,0),
-
1117 diffuseColor, lightPosition, ambientColor);
-
1118
-
1119 update_skybox_position(); // Update the position of the skybox to match the camera position.
-
1120
-
1121 direct_3d_->turn_z_buffer_on(); // Enable the Z buffer after rendering the skybox.
-
1122
-
1123 // -------------------------------------------------------- //
-
1124 // ------------ render the object in the queue ------------ //
-
1125 // -------------------------------------------------------- //
-
1126
-
1127 // set the active camera to the sun camera for rendering the shadow map.
-
1128 // active_camera_ = sun_camera_;
-
1129 // active_camera_->render();
-
1130 // // Render the objects in the render queues. with depth only pass.
-
1131 // active_camera_->get_view_matrix(viewMatrix);
-
1132 result = render_pass(diffuseColor, lightPosition, ambientColor, viewMatrix, projectionMatrix);
-
1133 if (!result)
-
1134 {
-
1135 Logger::Get().Log("Could not render the model using any shader", __FILE__, __LINE__, Logger::LogLevel::Error);
-
1136 return false;
-
1137 }
-
1138
-
1139 // Reset the active camera to the main camera.
-
1140 // active_camera_ = camera_;
-
1141 // active_camera_->render();
-
1142 // active_camera_->get_view_matrix(viewMatrix);
-
1143 //
-
1144 // // render the objects in the render queues. with standard pass.
-
1145 // result = render_pass(render_queues_, diffuseColor, lightPosition, ambientColor, viewMatrix, projectionMatrix);
-
1146 // if (!result)
-
1147 // {
-
1148 // Logger::Get().Log("Could not render the model using any shader", __FILE__, __LINE__, Logger::LogLevel::Error);
-
1149 // return false;
-
1150 // }
-
1151
-
1152 // stats_->update_geometric_stats();
-
1153
-
1154 // Update the render count text.
-
1155 result = update_render_count_string(get_render_count());
-
1156 if (!result)
-
1157 {
-
1158 Logger::Get().Log("Could not update the render count string", __FILE__, __LINE__, Logger::LogLevel::Error);
-
1159 return false;
-
1160 }
-
1161
-
1162
-
1163 // Translate to where the bath model will be rendered.
-
1164 worldMatrix = XMMatrixTranslation(0.0f, -10.0f, 0.0f);
-
1165
-
1166 // Put the bath model vertex and index buffers on the graphics pipeline to prepare them for drawing.
-
1167 bath_model_->Render(direct_3d_->get_device_context());
-
1168
-
1169 // render the bath model using the light shader.
-
1170 result = shader_manager_->renderlight_shader(direct_3d_->get_device_context(), bath_model_->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix,
-
1171 bath_model_->GetTexture(TextureType::Diffuse,0), diffuseColor, lightPosition, ambientColor);
-
1172 if (!result)
-
1173 {
-
1174 return false;
-
1175 }
-
1176
-
1177 // Reset the world matrix.
-
1178 worldMatrix = direct_3d_->get_world_matrix();
-
1179
-
1180 // Get the camera reflection view matrix.
-
1181 camera_->get_reflection_view_matrix(reflectionMatrix);
-
1182
-
1183 // Translate to where the water model will be rendered.
-
1184 worldMatrix = XMMatrixTranslation(0.0f, water_height_, 0.0f);
-
1185
-
1186 // Put the water model vertex and index buffers on the graphics pipeline to prepare them for drawing.
-
1187 water_model_->Render(direct_3d_->get_device_context());
-
1188
-
1189 // render the water model using the water shader.
-
1190 result = shader_manager_->render_water_shader(direct_3d_->get_device_context(), water_model_->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix, reflectionMatrix,
-
1191 reflection_texture_->GetShaderResourceView(), refraction_texture_->GetShaderResourceView(), water_model_->GetTexture(TextureType::Diffuse,0),
-
1192 water_translation_, 0.01f);
-
1193 if (!result)
-
1194 {
-
1195 return false;
-
1196 }
-
1197
-
1198 // Disable the Z buffer and enable alpha blending for 2D rendering.
-
1199 direct_3d_->turn_z_buffer_off();
-
1200 direct_3d_->enable_alpha_blending();
-
1201
-
1202 // Reset the world matrix.
-
1203 worldMatrix = direct_3d_->get_world_matrix();
-
1204
-
1205 // render the render count text string using the font shader.
-
1206 render_count_string_->Render(direct_3d_->get_device_context());
-
1207
-
1208 result = font_shader_->render(direct_3d_->get_device_context(), render_count_string_->GetIndexCount(), worldMatrix, base_view_matrix_, orthoMatrix,
-
1209 font_->GetTexture(), render_count_string_->GetPixelColor());
-
1210 if (!result)
-
1211 {
-
1212 Logger::Get().Log("Could not render the render count text string using the font shader", __FILE__, __LINE__, Logger::LogLevel::Error);
-
1213 return false;
-
1214 }
-
1215
-
1216 // render the fps text string using the font shader.
-
1217 fps_string_->Render(direct_3d_->get_device_context());
-
1218
-
1219 result = font_shader_->render(direct_3d_->get_device_context(), fps_string_->GetIndexCount(), worldMatrix, base_view_matrix_, orthoMatrix,
-
1220 font_->GetTexture(), fps_string_->GetPixelColor());
-
1221 if (!result)
-
1222 {
-
1223 Logger::Get().Log("Could not render the fps text string using the font shader", __FILE__, __LINE__, Logger::LogLevel::Error);
-
1224 return false;
-
1225 }
-
1226
-
1227 // render the mouse text strings using the font shader.
-
1228 for (i = 0; i < 3; i++)
-
1229 {
-
1230 mouse_strings_[i].Render(direct_3d_->get_device_context());
-
1231
-
1232 result = font_shader_->render(direct_3d_->get_device_context(), mouse_strings_[i].GetIndexCount(), worldMatrix, base_view_matrix_, orthoMatrix,
-
1233 font_->GetTexture(), mouse_strings_[i].GetPixelColor());
-
1234 if (!result)
-
1235 {
-
1236 Logger::Get().Log("Could not render the mouse text strings using the font shader", __FILE__, __LINE__, Logger::LogLevel::Error);
-
1237 return false;
-
1238 }
-
1239 }
-
1240
-
1241 // Put the sprite vertex and index buffers on the graphics pipeline to prepare them for drawing.
-
1242 result = sprite_->Render(direct_3d_->get_device_context());
-
1243 if (!result)
-
1244 {
-
1245 return false;
-
1246 }
-
1247
-
1248 // render the sprite with the texture shader.
-
1249 result = shader_manager_->render_texture_shader(direct_3d_->get_device_context(), model_->GetIndexCount(), worldMatrix, viewMatrix, orthoMatrix,
-
1250 sprite_->GetTexture());
-
1251 if (!result)
-
1252 {
-
1253 Logger::Get().Log("Could not render the sprite using the texture shader", __FILE__, __LINE__, Logger::LogLevel::Error);
-
1254 return false;
-
1255 }
-
1256
-
1257 // Turn off alpha blending after rendering the 2D text.
-
1258 direct_3d_->disable_alpha_blending();
-
1259
-
1260 // turn on the Z buffer
-
1261 direct_3d_->turn_z_buffer_on();
-
1262
-
1263 // Get the light properties.
-
1264 for (i = 0; i < num_lights_; i++)
-
1265 {
-
1266 // Create the diffuse color array from the four light colors.
-
1267 diffuseColor[i] = lights_[i]->GetDiffuseColor();
-
1268
-
1269 // Create the light position array from the four light positions.
-
1270 lightPosition[i] = lights_[i]->GetPosition();
-
1271 }
-
1272 // Réinitialiser la cible de rendu au back buffer.
-
1273 direct_3d_->set_back_buffer_render_target();
-
1274
-
1275 return true;
-
1276}
-
1277
-
1278d_3d_class* application_class::get_direct_3d()
-
1279{
-
1280 return direct_3d_;
-
1281}
-
1282
-
- -
1284{
-
1285 return GetSystemMetrics(SM_CXSCREEN);
-
1286}
-
-
1287
-
- -
1289{
-
1290 return GetSystemMetrics(SM_CYSCREEN);
-
1291}
-
-
1292
-
- -
1294{
-
1295 Logger::Get().Log("Génération du terrain avec ECS", __FILE__, __LINE__, Logger::LogLevel::Info);
-
1296
-
1297 // delete previous terrain if it exists
- -
1299
-
1300 // Dimensions du terrain
-
1301 float scaleX = 10.0f;
-
1302 float scaleY = 1.0f;
-
1303 float scaleZ = 10.0f;
-
1304 int gridSizeX = 20;
-
1305 int gridSizeZ = 20;
-
1306
-
1307 // Vérifier si le modèle existe déjà dans le cache
-
1308 std::string modelName = "assets/Model/OBJ/plane.obj";
-
1309 std::shared_ptr<model_class> sharedModel;
-
1310
-
1311 auto it = g_model_cache.find(modelName);
-
1312 if (it != g_model_cache.end()) {
-
1313 // Utiliser le modèle existant du cache
-
1314 Logger::Get().Log("Using cached model for terrain: " + modelName, __FILE__, __LINE__);
-
1315 sharedModel = it->second;
-
1316 }
-
1317 else {
-
1318 // Créer un conteneur de textures partagé
-
1319 TextureContainer textureContainer;
-
1320 textureContainer.diffusePaths.push_back(L"assets/Texture/Bricks2K.png");
-
1321 textureContainer.normalPaths.push_back(L"assets/Texture/BricksNRM2K.png");
-
1322 textureContainer.specularPaths.push_back(L"assets/Texture/BricksGLOSS2K.png");
-
1323
-
1324 // Créer et initialiser le modèle si non trouvé
-
1325 char modelFilename[128];
-
1326 strcpy_s(modelFilename, modelName.c_str());
-
1327
-
1328 auto newModel = std::make_shared<model_class>();
-
1329 newModel->PreloadTextures(direct_3d_->get_device(), direct_3d_->get_device_context(), textureContainer);
-
1330
-
1331 if (!newModel->Initialize(direct_3d_->get_device(), direct_3d_->get_device_context(), modelFilename, textureContainer)) {
-
1332 Logger::Get().Log("Impossible d'initialiser le modèle du terrain", __FILE__, __LINE__, Logger::LogLevel::Error);
-
1333 return;
-
1334 }
-
1335
-
1336 // Ajouter le modèle au cache
-
1337 g_model_cache[modelName] = newModel;
-
1338 sharedModel = newModel;
-
1339 Logger::Get().Log("Added terrain model to cache: " + modelName, __FILE__, __LINE__);
-
1340 }
-
1341
-
1342 // Vérifier si l'entity manager est disponible
-
1343 if (entity_manager_) {
-
1344 // Générer les tuiles de terrain avec le système ECS
-
1345 for (int i = 0; i < gridSizeX; i++) {
-
1346 for (int j = 0; j < gridSizeZ; j++) {
-
1347 // Créer une entité
-
1348 auto entity = entity_manager_->CreateEntity();
-
1349
-
1350 // Ajouter un composant d'identité
-
1351 auto identity = entity->AddComponent<ecs::IdentityComponent>(object_id_++);
-
1352 identity->SetName("TerrainTile_" + std::to_string(i) + "_" + std::to_string(j));
-
1353 identity->SetType(ecs::ObjectType::Terrain);
-
1354
-
1355 // Ajouter un composant de transformation
-
1356 auto transform = entity->AddComponent<ecs::TransformComponent>();
-
1357 transform->SetPosition(XMVectorSet(i * scaleX, -12.0f, j * scaleZ, 0.0f));
-
1358 transform->SetScale(XMVectorSet(scaleX, scaleY, scaleZ, 0.0f));
-
1359 transform->UpdateWorldMatrix();
-
1360
-
1361 // Ajouter un composant de rendu
-
1362 auto render = entity->AddComponent<ecs::RenderComponent>();
-
1363 render->InitializeWithModel(sharedModel);
-
1364
-
1365 // Ajouter un composant de shader
-
1366 auto shader = entity->AddComponent<ecs::ShaderComponent>();
-
1367 shader->SetActiveShader(ecs::ShaderType::SUNLIGHT);
-
1368 }
-
1369 }
-
1370 }
-
1371
- -
1373
-
1374 int totalTiles = gridSizeX * gridSizeZ;
-
1375 Logger::Get().Log("Terrain généré avec " + std::to_string(totalTiles) + " tuiles", __FILE__, __LINE__, Logger::LogLevel::Info);
-
1376}
-
-
1377
-
-
1378void application_class::add_kobject(std::wstring& filepath)
-
1379{
-
1380 std::lock_guard<std::mutex> lock(objects_mutex_);
-
1381 Logger::Get().Log("Adding object", __FILE__, __LINE__);
-
1382
-
1383 char modelFilename[128];
-
1384 TextureContainer KobjectsTextures;
-
1385 filesystem::path p(filepath);
-
1386 string filename = p.stem().string();
-
1387
-
1388 size_t convertedChars = 0;
-
1389 (void)wcstombs_s(&convertedChars, modelFilename, sizeof(modelFilename), filepath.c_str(), _TRUNCATE);
-
1390
-
1391 filesystem::current_path(w_folder_);
-
1392
-
1393 // Liste des fichiers de texture
-
1394 std::vector<std::wstring> kobjTexture = {
-
1395 L"assets/Texture/Bricks2K.png",
-
1396 L"assets/Texture/BricksNRM2K.png",
-
1397 L"assets/Texture/BricksGLOSS2K.png"
-
1398 };
-
1399
-
1400 // Configurer les chemins des textures dans le conteneur
-
1401 KobjectsTextures.diffusePaths.push_back(kobjTexture[0]);
-
1402 if (kobjTexture.size() > 1) KobjectsTextures.normalPaths.push_back(kobjTexture[1]);
-
1403 if (kobjTexture.size() > 2) KobjectsTextures.specularPaths.push_back(kobjTexture[2]);
-
1404
-
1405 // Vérifier si le modèle existe déjà dans le cache
-
1406 std::string modelKey = std::string(modelFilename);
-
1407 std::shared_ptr<model_class> sharedModel;
-
1408
-
1409 auto it = g_model_cache.find(modelKey);
-
1410 if (it != g_model_cache.end()) {
-
1411 // Utiliser le modèle existant du cache
-
1412 Logger::Get().Log("Using cached model for " + modelKey, __FILE__, __LINE__);
-
1413 sharedModel = it->second;
-
1414 }
-
1415 else {
-
1416 // Créer un nouveau modèle
-
1417 sharedModel = std::make_shared<model_class>();
-
1418
-
1419 // Précharger les textures
-
1420 sharedModel->PreloadTextures(direct_3d_->get_device(), direct_3d_->get_device_context(), KobjectsTextures);
-
1421
-
1422 // Initialiser le modèle
-
1423 if (!sharedModel->Initialize(direct_3d_->get_device(), direct_3d_->get_device_context(), modelFilename, KobjectsTextures)) {
-
1424 Logger::Get().Log("Failed to initialize model for object: " + modelKey, __FILE__, __LINE__, Logger::LogLevel::Error);
-
1425 return;
-
1426 }
-
1427
-
1428 // Ajouter le modèle au cache
-
1429 g_model_cache[modelKey] = sharedModel;
-
1430 Logger::Get().Log("Added model to cache: " + modelKey, __FILE__, __LINE__);
-
1431 }
-
1432
-
1433 // Créer une nouvelle entité
-
1434 auto entity = entity_manager_->CreateEntity();
-
1435
-
1436 // Ajouter un composant d'identité
-
1437 auto identity = entity->AddComponent<ecs::IdentityComponent>(object_id_++);
-
1438 identity->SetName(filename);
-
1439 identity->SetType(ecs::ObjectType::Unknown);
-
1440
-
1441 // Ajouter un composant de transformation
-
1442 auto transform = entity->AddComponent<ecs::TransformComponent>();
-
1443 transform->SetPosition(XMVectorSet(0.0f, 50.0f, 0.0f, 0.0f));
-
1444 transform->SetScale(XMVectorSet(1.0f, 1.0f, 1.0f, 0.0f));
-
1445 transform->UpdateWorldMatrix();
-
1446
-
1447 // Ajouter un composant de rendu avec le modèle partagé
-
1448 auto render = entity->AddComponent<ecs::RenderComponent>();
-
1449 render->InitializeWithModel(sharedModel);
-
1450
-
1451 // Ajouter un composant de shader
-
1452 auto shader = entity->AddComponent<ecs::ShaderComponent>();
-
1453 shader->SetActiveShader(ecs::ShaderType::LIGHTING);
-
1454
-
1455 // Stocker le chemin du modèle
-
1456 auto modelPath = entity->AddComponent<ecs::ModelPathComponent>();
-
1457 modelPath->SetPath(filepath);
-
1458
-
1459 Logger::Get().Log("ECS entity created with ID: " + std::to_string(identity->GetId()), __FILE__, __LINE__);
-
1460
- -
1462}
-
-
1463
-
- -
1465{
-
1466 std::lock_guard<std::mutex> lock(objects_mutex_);
-
1467 Logger::Get().Log("Adding cube", __FILE__, __LINE__);
-
1468
-
1469 std::string model_name = "assets/Model/TXT/cube.txt";
-
1470 std::shared_ptr<model_class> sharedModel;
-
1471
-
1472 auto it = g_model_cache.find(model_name);
-
1473 if (it != g_model_cache.end())
-
1474 {
-
1475 Logger::Get().Log("Using cached model: " + model_name, __FILE__, __LINE__);
-
1476 sharedModel = it->second;
-
1477 }
-
1478 else
-
1479 {
-
1480 TextureContainer cube_textures;
-
1481 cube_textures.diffusePaths.push_back(L"assets/Texture/Bricks2K.png");
-
1482 cube_textures.normalPaths.push_back(L"assets/Texture/BricksNRM2K.png");
-
1483 cube_textures.specularPaths.push_back(L"assets/Texture/BricksGLOSS2K.png");
-
1484
-
1485 char model_filename[128];
-
1486 strcpy_s(model_filename, model_name.c_str());
-
1487
-
1488 auto newModel = std::make_shared<model_class>();
-
1489 newModel->PreloadTextures(direct_3d_->get_device(), direct_3d_->get_device_context(), cube_textures);
-
1490 if (!newModel->Initialize(direct_3d_->get_device(), direct_3d_->get_device_context(), model_filename, cube_textures)) {
-
1491 Logger::Get().Log("Failed to initialize cube model", __FILE__, __LINE__, Logger::LogLevel::Error);
-
1492 return;
-
1493 }
-
1494
-
1495 g_model_cache[model_name] = newModel;
-
1496 sharedModel = newModel;
-
1497 Logger::Get().Log("Added cube model to cache: " + model_name, __FILE__, __LINE__);
-
1498
-
1499
-
1500 if (entity_manager_)
-
1501 {
-
1502 auto entity = entity_manager_->CreateEntity();
-
1503
-
1504 auto identity = entity->AddComponent<ecs::IdentityComponent>(object_id_++);
-
1505 identity->SetName("Cube");
-
1506 identity->SetType(ecs::ObjectType::Cube);
-
1507
-
1508 auto transform = entity->AddComponent<ecs::TransformComponent>();
-
1509 transform->SetPosition(XMVectorSet(0.0f, 10.0f, 0.0f, 0.0f));
-
1510 transform->SetScale(XMVectorSet(1.0f, 1.0f, 1.0f, 0.0f));
-
1511 transform->UpdateWorldMatrix();
-
1512
-
1513 auto render = entity->AddComponent<ecs::RenderComponent>();
-
1514 render->InitializeWithModel(sharedModel);
-
1515
-
1516 auto shader = entity->AddComponent<ecs::ShaderComponent>();
-
1517 shader->SetActiveShader(ecs::ShaderType::TEXTURE);
-
1518 }
-
1519 }
-
1520
- -
1522 Logger::Get().Log("Cube added successfully", __FILE__, __LINE__, Logger::LogLevel::Info);
-
1523
-
1524}
-
-
1525
-
- -
1527{
-
1528 std::lock_guard<std::mutex> lock(objects_mutex_);
-
1529 Logger::Get().Log("Deleting entity with ID: " + std::to_string(entity_id), __FILE__, __LINE__, Logger::LogLevel::Info);
-
1530
-
1531 if (entity_manager_) {
-
1532 // Rechercher l'entité avec l'ID spécifié via le composant IdentityComponent
-
1533 auto entities_with_identity = entity_manager_->GetEntitiesWithComponent<ecs::IdentityComponent>();
-
1534 for (auto& entity : entities_with_identity) {
-
1535 auto identity = entity->GetComponent<ecs::IdentityComponent>();
-
1536 if (identity && identity->GetId() == entity_id) {
-
1537 // Supprimer l'entité
-
1538 entity_manager_->DestroyEntity(entity->GetID());
-
1539 Logger::Get().Log("Entity with ID " + std::to_string(entity_id) + " successfully deleted", __FILE__, __LINE__, Logger::LogLevel::Info);
-
1540 break;
-
1541 }
-
1542 }
-
1543 }
-
1544
- -
1546}
-
-
1547
-
- -
1549{
-
1550 std::lock_guard<std::mutex> lock(objects_mutex_);
-
1551 Logger::Get().Log("Deleting terrain", __FILE__, __LINE__, Logger::LogLevel::Info);
-
1552
-
1553 // Get all entities with the Terrain type
-
1554 auto entities_with_terrain = entity_manager_->GetEntitiesWithComponent<ecs::IdentityComponent>();
-
1555 for (auto& entity : entities_with_terrain) {
-
1556 auto identity = entity->GetComponent<ecs::IdentityComponent>();
-
1557 if (identity && identity->GetType() == ecs::ObjectType::Terrain) {
-
1558 // Destroy the entity
-
1559 entity_manager_->DestroyEntity(entity->GetID());
-
1560 Logger::Get().Log("Terrain entity with ID " + std::to_string(identity->GetId()) + " successfully deleted", __FILE__, __LINE__, Logger::LogLevel::Info);
-
1561 }
-
1562 }
-
1563
- -
1565}
-
-
1566
-
1567bool application_class::update_mouse_strings(int mouseX, int mouseY, bool mouseDown)
-
1568{
-
1569 char tempString[16], finalString[32];
-
1570 bool result;
-
1571
-
1572
-
1573 // Convert the mouse X integer to string format.
-
1574 sprintf_s(tempString, "%d", mouseX);
-
1575
-
1576 // Setup the mouse X string.
-
1577 strcpy_s(finalString, "Mouse X: ");
-
1578 strcat_s(finalString, tempString);
-
1579
-
1580 // Update the sentence vertex buffer with the new string information.
-
1581 result = mouse_strings_[0].UpdateText(direct_3d_->get_device_context(), font_, finalString, 10, 50, 1.0f, 1.0f, 1.0f);
-
1582 if (!result)
-
1583 {
-
1584 Logger::Get().Log("Could not update the mouse X string", __FILE__, __LINE__, Logger::LogLevel::Error);
-
1585 return false;
-
1586 }
-
1587
-
1588 // Convert the mouse Y integer to string format.
-
1589 sprintf_s(tempString, "%d", mouseY);
-
1590
-
1591 // Setup the mouse Y string.
-
1592 strcpy_s(finalString, "Mouse Y: ");
-
1593 strcat_s(finalString, tempString);
-
1594
-
1595 // Update the sentence vertex buffer with the new string information.
-
1596 result = mouse_strings_[1].UpdateText(direct_3d_->get_device_context(), font_, finalString, 10, 75, 1.0f, 1.0f, 1.0f);
-
1597 if (!result)
-
1598 {
-
1599 Logger::Get().Log("Could not update the mouse Y string", __FILE__, __LINE__, Logger::LogLevel::Error);
-
1600 return false;
-
1601 }
-
1602
-
1603 // Setup the mouse button string.
-
1604 if (mouseDown)
-
1605 {
-
1606 strcpy_s(finalString, "Mouse Button: Yes");
-
1607 }
-
1608 else
-
1609 {
-
1610 strcpy_s(finalString, "Mouse Button: No");
-
1611 }
-
1612
-
1613 // Update the sentence vertex buffer with the new string information.
-
1614 result = mouse_strings_[2].UpdateText(direct_3d_->get_device_context(), font_, finalString, 10, 100, 1.0f, 1.0f, 1.0f);
-
1615
-
1616 if (!result)
-
1617 {
-
1618 Logger::Get().Log("Could not update the mouse button string", __FILE__, __LINE__, Logger::LogLevel::Error);
-
1619 return false;
-
1620 }
-
1621
-
1622 return true;
-
1623}
-
1624
-
1625bool application_class::update_fps()
-
1626{
-
1627 int fps;
-
1628 char tempString[16], finalString[16];
-
1629 float red, green, blue;
-
1630 bool result;
-
1631
-
1632
-
1633 // Update the fps each frame.
-
1634 fps_->Frame();
-
1635
-
1636 stats_->update_display_stats(); // Update the stats display with the latest information from fps class.
-
1637
-
1638 // Get the current fps.
-
1639 fps = fps_->GetFps();
-
1640
-
1641 // Check if the fps from the previous frame was the same, if so don't need to update the text string.
-
1642 if (previous_fps_ == fps)
-
1643 {
-
1644 return true;
-
1645 }
-
1646
-
1647 // Store the fps for checking next frame.
-
1648 previous_fps_ = fps;
-
1649
-
1650 // Truncate the fps to below 100,000.
-
1651 if (fps > 99999)
-
1652 {
-
1653 fps = 99999;
-
1654 }
-
1655
-
1656 // Convert the fps integer to string format.
-
1657 sprintf_s(tempString, "%d", fps);
-
1658
-
1659 // Setup the fps string.
-
1660 strcpy_s(finalString, "Fps: ");
-
1661 strcat_s(finalString, tempString);
-
1662
-
1663 // If fps is 60 or above set the fps color to green.
-
1664 if (fps >= 60)
-
1665 {
-
1666 red = 0.0f;
-
1667 green = 1.0f;
-
1668 blue = 0.0f;
-
1669 }
-
1670
-
1671 // If fps is below 60 set the fps color to yellow.
-
1672 if (fps < 60)
-
1673 {
-
1674 red = 1.0f;
-
1675 green = 1.0f;
-
1676 blue = 0.0f;
-
1677 }
-
1678
-
1679 // If fps is below 30 set the fps color to red.
-
1680 if (fps < 30)
-
1681 {
-
1682 red = 1.0f;
-
1683 green = 0.0f;
-
1684 blue = 0.0f;
-
1685 }
-
1686
-
1687 // Update the sentence vertex buffer with the new string information.
-
1688 result = fps_string_->UpdateText(direct_3d_->get_device_context(), font_, finalString, 10, 10, red, green, blue);
-
1689 if (!result)
-
1690 {
-
1691 Logger::Get().Log("Could not update the fps string", __FILE__, __LINE__, Logger::LogLevel::Error);
-
1692 return false;
-
1693 }
-
1694
-
1695 return true;
-
1696}
-
1697
-
1698bool application_class::update_render_count_string(int renderCount)
-
1699{
-
1700 char tempString[16], finalString[32];
-
1701 bool result;
-
1702
-
1703
-
1704 // Convert the render count integer to string format.
-
1705 sprintf_s(tempString, "%d", renderCount);
-
1706
-
1707 // Setup the render count string.
-
1708 strcpy_s(finalString, "render Count: ");
-
1709 strcat_s(finalString, tempString);
-
1710
-
1711 // Update the sentence vertex buffer with the new string information.
-
1712 result = render_count_string_->UpdateText(direct_3d_->get_device_context(), font_, finalString, 10, 30, 1.0f, 1.0f, 1.0f);
-
1713 if (!result)
-
1714 {
-
1715 Logger::Get().Log("Could not update the render count string", __FILE__, __LINE__, Logger::LogLevel::Error);
-
1716 return false;
-
1717 }
-
1718
-
1719 return true;
-
1720}
-
1721
-
- -
1723{
-
1724 //convert to XMVECTOR
-
1725 XMVECTOR lightColor = XMVectorSet(lights_[index]->GetDiffuseColor().x, lights_[index]->GetDiffuseColor().y, lights_[index]->GetDiffuseColor().z, 1.0f);
-
1726
-
1727 return lightColor;
-
1728}
-
-
1729
-
- -
1731{
-
1732 //convert to XMVECTOR
-
1733 XMVECTOR lightPosition = XMVectorSet(lights_[index]->GetPosition().x, lights_[index]->GetPosition().y, lights_[index]->GetPosition().z, 1.0f);
-
1734
-
1735 return lightPosition;
-
1736}
-
-
1737
-
-
1738void application_class::set_light_color(int index, XMVECTOR color)
-
1739{
-
1740 //convert to XMFLOAT4
-
1741 XMFLOAT4 lightColor;
-
1742 XMStoreFloat4(&lightColor, color);
-
1743
-
1744 //set the color
-
1745 lights_[index]->SetDiffuseColor(lightColor.x, lightColor.y, lightColor.z, 1.0f);
-
1746}
-
-
1747
-
-
1748void application_class::set_light_position(int index, XMVECTOR position)
-
1749{
-
1750 //convert to XMFLOAT4
-
1751 XMFLOAT4 lightPosition;
-
1752 XMStoreFloat4(&lightPosition, position);
-
1753
-
1754 //set the position
-
1755 lights_[index]->SetPosition(lightPosition.x, lightPosition.y, lightPosition.z);
-
1756}
-
-
1757
-
- -
1759{
-
1760 // log the new screen height
-
1761 Logger::Get().Log("Setting screen height to " + std::to_string(height), __FILE__, __LINE__);
-
1762 screen_height_ = height;
-
1763}
-
-
1764
-
- -
1766{
-
1767 // log the new screen width
-
1768 Logger::Get().Log("Setting screen width to " + std::to_string(width), __FILE__, __LINE__);
-
1769 screen_width_ = width;
-
1770}
-
-
1771
-
1772void application_class::culling_thread_function()
-
1773{
-
1774 Logger::Get().Log("Thread de culling démarré", __FILE__, __LINE__, Logger::LogLevel::Info);
-
1775
-
1776 while (culling_active_)
-
1777 {
-
1778 // Construction du frustum une fois par cycle de culling
- -
1780
-
1781 // S'assurer que la skybox est toujours visible
-
1782 {
-
1783 std::lock_guard<std::mutex> lock(objects_mutex_);
-
1784 for (auto* skyboxObject : skybox_)
-
1785 {
-
1786 if (skyboxObject)
-
1787 {
-
1788 skyboxObject->SetVisible(true);
-
1789 }
-
1790 }
-
1791 }
-
1792
-
1793 // Traitement des files d'objets normaux (sans la skybox)
-
1794 auto all_entity = entity_manager_->GetAllEntities();
-
1795
-
1796 for (auto& entity : all_entity)
-
1797 {
-
1798 std::lock_guard<std::mutex> lock(objects_mutex_);
-
1799 auto renderComponent = entity->GetComponent<ecs::RenderComponent>();
-
1800 if (renderComponent && renderComponent->GetModel())
-
1801 {
-
1802 // Extraction des données de position via le composant TransformComponent
-
1803 auto transformComponent = entity->GetComponent<ecs::TransformComponent>();
-
1804 if (transformComponent)
-
1805 {
-
1806 XMVECTOR transformPosition = transformComponent->GetPosition();
-
1807 float x = XMVectorGetX(transformPosition);
-
1808 float y = XMVectorGetY(transformPosition);
-
1809 float z = XMVectorGetZ(transformPosition);
-
1810
-
1811 // Calcul du rayon approximatif
-
1812 XMVECTOR scale = transformComponent->GetScale();
-
1813 float radius = max(max(XMVectorGetX(scale), XMVectorGetY(scale)), XMVectorGetZ(scale));
-
1814
-
1815 // verification du frustum
-
1816 bool visible = frustum_culling_.CheckCube(x, y, z, radius, get_frustum_tolerance());
-
1817 renderComponent->SetVisible(visible);
-
1818 }
-
1819
-
1820 }
-
1821 }
-
1822
-
1823 // Pause pour éviter de surcharger le CPU
-
1824 std::this_thread::sleep_for(std::chrono::milliseconds(16)); // ~60 Hz
-
1825 }
-
1826
-
1827 Logger::Get().Log("Thread de culling terminé", __FILE__, __LINE__, Logger::LogLevel::Info);
-
1828}
-
1829
-
1830
-
1831
-
1832bool application_class::render_pass(XMFLOAT4* diffuse, XMFLOAT4* position, XMFLOAT4* ambient, XMMATRIX view, XMMATRIX projection)
-
1833{
-
1834 std::lock_guard<std::mutex> lock(objects_mutex_);
-
1835 XMMATRIX scaleMatrix, rotateMatrix, translateMatrix;
-
1836 bool result;
-
1837
-
1838 int renderCount = 0;
-
1839 int i;
-
1840
-
1841 // render skybox
-
1842 for (auto& skyboxObject : skybox_)
-
1843 {
-
1844 if (skyboxObject == nullptr)
-
1845 {
-
1846 Logger::Get().Log("skyboxObject is null", __FILE__, __LINE__, Logger::LogLevel::Error);
-
1847 return false;
-
1848 }
-
1849
-
1850 if (!skyboxObject->IsVisible())
-
1851 {
-
1852 continue;
-
1853 }
-
1854
-
1855 direct_3d_->turn_z_buffer_off();
-
1856
-
1857 scaleMatrix = skyboxObject->GetScaleMatrix();
-
1858 rotateMatrix = skyboxObject->GetRotateMatrix();
-
1859 translateMatrix = skyboxObject->GetTranslateMatrix();
-
1860
-
1861 XMMATRIX worldMatrix = XMMatrixMultiply(
-
1862 XMMatrixMultiply(scaleMatrix, rotateMatrix),
-
1863 translateMatrix
-
1864 );
-
1865
-
1866 renderCount++;
-
1867
-
1868 skyboxObject->get_model()->Render(direct_3d_->get_device_context());
-
1869
-
1870 result = shader_manager_->render_skybox_shader(
-
1871 direct_3d_->get_device_context(),
-
1872 skyboxObject->get_model()->GetIndexCount(),
-
1873 worldMatrix,
-
1874 view,
-
1875 projection,
-
1876 skyboxObject->get_model()->GetTexture(TextureType::Diffuse,0),
-
1877 sun_light_->GetDiffuseColor(),
-
1878 sun_light_->GetAmbientColor(),
-
1879 sun_light_->GetDirection(),
-
1880 sun_light_->GetIntensity()
-
1881 );
-
1882 if (!result)
-
1883 {
-
1884 Logger::Get().Log("Could not render the object model using the skybox shader", __FILE__, __LINE__, Logger::LogLevel::Error);
-
1885 return false;
-
1886 }
-
1887 direct_3d_->turn_z_buffer_on(); // Réactiver le Z-buffer après le rendu de la skybox
-
1888
-
1889 break;
-
1890
-
1891 }
-
1892
-
1893 // Rendu des entités du système ECS s'il est disponible
-
1894 if (entity_manager_) {
-
1895 // Créer le système de rendu pour les entités
-
1896 ecs::RenderSystem renderSystem(direct_3d_->get_device_context(), shader_manager_);
-
1897
-
1898 // Données pour le système de rendu
-
1899 XMFLOAT4 sunlightDiffuse = sun_light_->GetDiffuseColor();
-
1900 XMFLOAT4 sunlightAmbient = sun_light_->GetAmbientColor();
-
1901 XMFLOAT3 sunlightDirection = sun_light_->GetDirection();
-
1902 float sunlightIntensity = sun_light_->GetIntensity();
-
1903
-
1904 // Effectuer le rendu de toutes les entités
-
1905 int entitiesRendered = renderSystem.RenderAllEntities(
-
1906 entity_manager_.get(),
-
1907 view,
-
1908 projection,
-
1909 diffuse,
-
1910 position,
-
1911 ambient,
-
1912 camera_->get_position(),
-
1913 sunlightDiffuse,
-
1914 sunlightAmbient,
-
1915 sunlightDirection,
-
1916 sunlightIntensity
-
1917 );
-
1918
-
1919 renderCount += entitiesRendered;
-
1920 }
-
1921
-
1922 // Rendu des objets traditionnels comme avant
-
1923 // if (active_camera_ == sun_camera_)
-
1924 // {
-
1925 // shadow_map_->set_render_target(direct_3d_->get_device_context());
-
1926 // shadow_map_->clear_render_target(direct_3d_->get_device_context());
-
1927 // }
-
1928
-
1929 // if (active_camera_ == sun_camera_)
-
1930 // {
-
1931 // direct_3d_->set_back_buffer_render_target();
-
1932 // direct_3d_->reset_viewport();
-
1933 // }
-
1934
-
1935 set_render_count(renderCount);
-
1936
-
1937 return true;
-
1938}
-
1939
-
- -
1941{
-
1942 XMMATRIX projectionMatrix = direct_3d_->get_projection_matrix();
-
1943 XMMATRIX viewMatrix;
-
1944 active_camera_->get_view_matrix(viewMatrix);
-
1945
-
1946 frustum_culling_.ConstructFrustum(screen_depth, projectionMatrix, viewMatrix);
-
1947}
-
-
1948
-
1949// Update the position of the skybox based on the camera position
-
1950void application_class::update_skybox_position()
-
1951{
-
1952
-
1953 if (skybox_.empty())
-
1954 {
-
1955 Logger::Get().Log("Skybox is empty", __FILE__, __LINE__, Logger::LogLevel::Error);
-
1956 return;
-
1957 }
-
1958
-
1959 skybox_[0]->SetTranslateMatrix(XMMatrixTranslation(active_camera_->get_position().x, active_camera_->get_position().y, active_camera_->get_position().z));
-
1960
-
1961}
-
1962
-
1963bool application_class::render_physics(float delta_time) {
-
1964
-
1965 // update the physical entity if they have the physics component
-
1966 auto entities_with_physics = entity_manager_->GetEntitiesWithComponent<ecs::PhysicsComponent>();
-
1967 for (auto& entity : entities_with_physics) {
-
1968 auto physicsComponent = entity->GetComponent<ecs::PhysicsComponent>();
-
1969 if (physicsComponent) {
-
1970 // Update the physics component with the input keys and delta time
-
1971 physicsComponent->Update(delta_time);
-
1972 }
-
1973 }
-
1974
-
1975 return true;
-
1976}
-
1977
-
- -
1979{
-
1980 auto fixedUpdateInterval = std::chrono::milliseconds(1000 / physics_tick_rate_);
-
1981 auto lastTime = std::chrono::steady_clock::now();
-
1982
-
1983 while (!should_quit_)
-
1984 {
-
1985 auto now = std::chrono::steady_clock::now();
-
1986 if (now - lastTime >= fixedUpdateInterval)
-
1987 {
-
1988 lastTime = now;
-
1989
-
1990 float deltaTime = 1.0f / static_cast<float>(physics_tick_rate_);
-
1991 bool result = render_physics(deltaTime);
-
1992 if (!result)
-
1993 {
-
1994 Logger::Get().Log("Could not render the physics scene", __FILE__, __LINE__, Logger::LogLevel::Error);
-
1995 return;
-
1996 }
-
1997 }
-
1998 // Attendre un peu pour éviter de surcharger le CPU
-
1999 std::this_thread::sleep_for(std::chrono::milliseconds(1));
-
2000 }
-
2001}
-
-
2002
-
- -
2004{
-
2005 std::string modelName = "assets/Model/TXT/cube.txt";
-
2006 std::shared_ptr<model_class> sharedModel;
-
2007
-
2008 // Vérifier si le modèle existe déjà
-
2009 auto it = g_model_cache.find(modelName);
-
2010 if (it != g_model_cache.end()) {
-
2011 sharedModel = it->second;
-
2012 } else {
-
2013 // copy le string en char*
-
2014 char model_file[128];
-
2015 size_t convertedChars = 0;
-
2016 (void)wcstombs_s(&convertedChars, model_file, sizeof(model_file), std::wstring(modelName.begin(), modelName.end()).c_str(), _TRUNCATE);
-
2017
-
2018 // Créer et initialiser le modèle si non trouvé
-
2019 auto newModel = std::make_shared<model_class>();
-
2020 TextureContainer textures;
-
2021 textures.diffusePaths.push_back(L"assets/Texture/Bricks2K.png");
-
2022 textures.normalPaths.push_back(L"assets/Texture/BricksNRM2K.png");
-
2023 textures.specularPaths.push_back(L"assets/Texture/BricksGLOSS2K.png");
-
2024 newModel->PreloadTextures(direct_3d_->get_device(), direct_3d_->get_device_context(), textures);
-
2025 if (!newModel->Initialize(direct_3d_->get_device(), direct_3d_->get_device_context(),model_file, textures)) {
-
2026 Logger::Get().Log("Impossible d'initialiser le modèle du gros cube", __FILE__, __LINE__, Logger::LogLevel::Error);
-
2027 return false;
-
2028 }
-
2029 g_model_cache[modelName] = newModel;
-
2030 sharedModel = newModel;
-
2031 }
-
2032
-
2033 for (int x = 0; x < side_count; x++) {
-
2034 for (int y = 0; y < side_count; y++) {
-
2035 for (int z = 0; z < side_count; z++) {
-
2036 // Créer une entité
-
2037 auto entity = entity_manager_->CreateEntity();
-
2038
-
2039 // Ajouter un composant d'identité
-
2040 auto identity = entity->AddComponent<ecs::IdentityComponent>(object_id_++);
-
2041 identity->SetName("CubePart_" + std::to_string(x) + "_" + std::to_string(y) + "_" + std::to_string(z));
-
2042 identity->SetType(ecs::ObjectType::Terrain);
-
2043
-
2044 // Ajouter un composant de transformation
-
2045 auto transform = entity->AddComponent<ecs::TransformComponent>();
-
2046 transform->SetPosition(XMVectorSet(static_cast<float>(x), static_cast<float>(y), static_cast<float>(z), 0.0f));
-
2047 transform->SetScale(XMVectorSet(1.0f, 1.0f, 1.0f, 0.0f));
-
2048 transform->UpdateWorldMatrix();
-
2049
-
2050 // Ajouter un composant de rendu
-
2051 auto render = entity->AddComponent<ecs::RenderComponent>();
-
2052 render->InitializeWithModel(sharedModel);
-
2053
-
2054 // Ajouter un composant de shader
-
2055 auto shader = entity->AddComponent<ecs::ShaderComponent>();
-
2056 shader->SetActiveShader(ecs::ShaderType::LIGHTING);
-
2057 }
-
2058 }
-
2059 }
-
2060
- -
2062
-
2063 return true;
-
2064}
-
-
2065
-
- -
2067{
-
2068 if (stats_)
-
2069 {
-
2070 stats_ -> update_geometric_stats();
-
2071 }
-
2072}
-
-
2073
-
- -
2075{
-
2076 std::lock_guard<std::mutex> lock(objects_mutex_);
-
2077 int terrainCount = 0;
-
2078
-
2079 // Get all entities with the Terrain type
-
2080 auto entities_with_terrain = entity_manager_->GetEntitiesWithComponent<ecs::IdentityComponent>();
-
2081 for (auto& entity : entities_with_terrain) {
-
2082 auto identity = entity->GetComponent<ecs::IdentityComponent>();
-
2083 if (identity && identity->GetType() == ecs::ObjectType::Terrain) {
-
2084 terrainCount++;
-
2085 }
-
2086 }
-
2087
-
2088 return terrainCount;
-
2089}
-
-
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
- -
Definition Skybox.h:8
-
object * ConstructSkybox(application_class *app)
Definition Skybox.cpp:26
-
void Initialize(d_3d_class *d3dClassRef)
Definition Skybox.cpp:21
-
virtual bool frame(input_class *)
Run the main loop of the application. This function will handle the main loop, including rendering an...
-
void set_light_position(int index, XMVECTOR position)
-
void set_render_count(const int render_count)
-
virtual bool initialize(int screen_width, int screen_height, HWND hwdn, bool is_vulkan)
-
void set_hwnd(HWND hwnd)
- -
XMVECTOR get_light_position(int index)
-
void delete_entity_by_id(int entity_id)
- -
void set_light_color(int index, XMVECTOR color)
-
bool create_big_cube(int side_count)
Create a big cube with a specified number of little cube per sides.
- -
void set_windowed(bool windowed)
-
XMVECTOR get_light_color(int index)
-
void add_kobject(std::wstring &filepath)
-
float get_frustum_tolerance() const
- -
void physics_thread_function()
Thread function for handling physics updates. this function will run in a separate thread to handle p...
- -
application_class()
Constructor for the application class. Initializes member variables and sets up the application.
- -
void set_screen_width(int screen_width)
-
int get_render_count() const
- -
void set_screen_height(int screen_height)
- - - - -
void render()
Updates the camera's view matrix based on its position and rotation. This method recalculates the vie...
-
void set_rotation(float, float, float)
Sets the rotation of the camera in 3D space.
-
void set_position(float, float, float)
Sets the position of the camera in 3D space.
-
void render_reflection(float)
Renders the reflection of the scene from the camera's perspective.
-
XMMATRIX get_view_matrix(XMMATRIX &view_matrix) const
Retrieves the current view matrix of the camera.
-
void get_reflection_view_matrix(XMMATRIX &) const
Retrieves the reflection view matrix of the camera.
-
XMFLOAT3 get_position()
Gets the current position of the camera.
- -
void turn_z_buffer_on()
-
ID3D11Device * get_device()
Gets the Direct3D device.
-
XMMATRIX get_world_matrix() const
Definition d_3d_class.h:115
-
void set_back_buffer_render_target()
-
ID3D11DeviceContext * get_device_context()
Gets the Direct3D device context.
-
void reset_viewport()
-
XMMATRIX get_projection_matrix() const
Definition d_3d_class.h:109
-
void enable_alpha_blending()
-
void disable_alpha_blending()
-
XMMATRIX get_ortho_matrix() const
Definition d_3d_class.h:121
-
virtual bool initialize(int, int, bool, HWND, bool, float, float)
Initializes the Direct3D device and related resources.
-
void turn_z_buffer_off()
- - -
void SetName(const std::string &name)
- -
void SetPath(const std::wstring &path)
- - - - -
void SetActiveShader(ShaderType shader)
- -
void SetPosition(XMVECTOR position)
- - - -
void ConstructFrustum(float screenDepth, XMMATRIX projectionMatrix, XMMATRIX viewMatrix)
Definition frustum.cpp:3
-
bool CheckCube(float xCenter, float yCenter, float zCenter, float radius, float tolerance)
Definition frustum.cpp:59
- - - - - - - - - -
Definition stats.h:13
- - - -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:f447df8f6368892dc7eac399c570e25afd0499eab516d47d949e3dda1ec7a16c +size 380448 diff --git a/doxygen_docs/html/application__class_8h_source.html b/doxygen_docs/html/application__class_8h_source.html index a83d547..627296f 100644 --- a/doxygen_docs/html/application__class_8h_source.html +++ b/doxygen_docs/html/application__class_8h_source.html @@ -1,530 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/inc/system/application_class.h Source File - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
application_class.h
-
-
-
1#ifndef _APPLICATIONCLASS_H_
-
2#define _APPLICATIONCLASS_H_
-
3
-
4
-
6// MY CLASS INCLUDES //
-
8#include "d_3d_class.h"
-
9#include "camera_class.h"
-
10#include "light_class.h"
-
11
-
12#include "bitmap_class.h"
-
13#include "sprite_class.h"
-
14#include "timer_class.h"
-
15#include "font_shader_class.h"
-
16#include "font_class.h"
-
17#include "text_class.h"
-
18#include "fps_class.h"
-
19#include "input_class.h"
-
20#include "shader_manager_class.h"
-
21#include "modellistclass.h"
-
22#include "position_class.h"
-
23#include "frustumclass.h"
-
24#include "render_texture_class.h"
-
25#include "display_plane_class.h"
-
26#include "translate_shader_class.h"
-
27#include "reflection_shader_class.h"
-
28#include "physics.h"
-
29#include "frustum.h"
-
30#include "skybox.h"
-
31#include "shadow_map.h"
-
32#include "stats.h"
-
33
-
34#include "ecs/components/identity_component.h"
-
35#include "ecs/components/render_component.h"
-
36#include "ecs/components/transform_component.h"
-
37#include "ecs/components/physics_component.h"
-
38#include "ecs/components/shader_component.h"
-
39#include "ecs/systems/render_system.h"
-
40#include "ecs/components/model_path_component.h"
-
41
-
42#include <fstream>
-
43#include <WICTextureLoader.h>
-
44#include <comdef.h> // Pour _com_error
-
45#include <chrono>
-
46#include <thread>
-
47#include <map>
-
48#include <algorithm>
-
49#include <DirectXMath.h>
-
50#include <mutex>
-
51#include <memory>
-
52#include <vector>
-
53#include <filesystem>
-
54
-
55#include "ecs/entity_manager.h"
-
56
-
57
-
59// GLOBALS //
-
61constexpr bool full_screen = false;
-
62constexpr float screen_depth = 1000.0f;
-
63constexpr float screen_near = 0.3f;
-
64
-
65static std::map<std::string, std::shared_ptr<model_class>> g_model_cache;
-
66
-
-
67struct input
-
68{
-
69 bool key_left = false;
-
70 bool key_right = false;
-
71 bool key_up = false;
-
72 bool key_down = false;
-
73};
-
-
74
-
76// Class name: application_class
-
- -
79{
-
80public:
- - -
87 virtual d_3d_class* get_direct_3d();
-
88 void set_direct_3d(d_3d_class* direct_3d) { direct_3d_ = direct_3d; };
-
89
-
94 render_texture_class* get_scene_texture() const { return scene_texture_; };
-
99 render_texture_class* get_render_texture() const { return render_texture_; };
-
104 render_texture_class* get_refraction_texture() const { return refraction_texture_; };
-
109 render_texture_class* get_reflection_texture() const { return reflection_texture_; };
-
110
-
116 bool create_big_cube(int side_count);
-
126 virtual bool initialize(int screen_width, int screen_height, HWND hwdn, bool is_vulkan);
-
130 void shutdown();
-
136 virtual bool frame(input_class*);
- -
146 int get_physics_tick_rate() const { return physics_tick_rate_; };
-
151 void set_physics_tick_rate(int physics_tick_rate) { physics_tick_rate_ = physics_tick_rate; };
-
152
-
157 int get_screen_width() const;
-
162 void set_screen_width(int screen_width);
-
167 int get_screen_height() const;
-
172 void set_screen_height(int screen_height);
-
173
-
180 float get_speed() const { return speed_; };
-
187 void set_speed(const float speed) { this->speed_ = speed; };
-
188
-
192 void add_cube();
-
197 void delete_entity_by_id(int entity_id);
-
202 void add_kobject(std::wstring& filepath);
-
207 void set_path(WCHAR* path) { path_ = path; };
-
211 void set_w_folder(const std::filesystem::path& w_folder) { w_folder_ = w_folder; };
-
216 std::filesystem::path get_w_folder() const { return w_folder_; };
- -
222
-
227 int get_object_id() const { return object_id_; };
-
232 void set_object_id(int object_id) { object_id_ = object_id; };
-
233
-
237 void generate_terrain();
-
241 void delete_terrain();
-
242
-
248 XMVECTOR get_light_position(int index);
-
254 XMVECTOR get_light_color(int index);
-
260 void set_light_position(int index, XMVECTOR position);
-
266 void set_light_color(int index, XMVECTOR color);
-
271 std::vector<light_class*> get_lights() const { return lights_; };
-
276 light_class* get_sun_light() const { return sun_light_; };
-
277
-
283 bool get_should_quit() const { return should_quit_; };
-
289 void set_should_quit(const bool should_quit) { should_quit_ = should_quit; };
-
290
-
297 void set_cel_shading(const bool enable) { enable_cel_shading_ = enable; };
-
298
-
-
303 void set_vsync(bool vsync) {
-
304 vsync_enabled_ = vsync;
-
305 if (direct_3d_) {
-
306 direct_3d_->set_vsync(vsync);
-
307 Logger::Get().Log("Setting Vsync to " + std::to_string(vsync), __FILE__, __LINE__);
-
308 }
-
309 };
-
-
310
-
315 bool get_vsync() const { return vsync_enabled_; };
-
316
-
321 HWND get_hwnd() const { return hwnd_; };
-
326 void set_hwnd(HWND hwnd) { hwnd_ = hwnd; };
-
327
-
332 bool is_windowed() const { return windowed_; };
-
337 void set_windowed(bool windowed) { windowed_ = windowed; };
-
338
-
344 void set_window_size(const ImVec2 size) { window_size_ = size; };
-
350 ImVec2 get_window_size() const { return window_size_; };
-
355 float get_aspect_ratio() const { return static_cast<float>(screen_width_) / static_cast<float>(screen_height_); };
-
356
-
361 physics* get_physics() const { return physics_; };
-
362
-
363 // ----------------------------------- //
-
364 // ------------- Culling ------------- //
-
365 // ----------------------------------- //
-
366
-
371 frustum get_frustum() const { return frustum_culling_; };
-
376 void set_frustum(const frustum& frustum) { frustum_culling_ = frustum; };
-
377
-
382 void construct_frustum();
-
383
-
388 int get_render_count() const { return render_count_; };
-
393 void set_render_count(const int render_count) { render_count_ = render_count; };
-
399 float get_frustum_tolerance() const { return frustum_culling_tolerance_; };
-
405 void set_frustum_tolerance(const float frustum_tolerance) { frustum_culling_tolerance_ = frustum_tolerance; };
-
406
-
411 bool get_can_fixed_update() const { return can_fixed_update_; };
-
416 void set_can_fixed_update(bool can_fixed_update) { can_fixed_update_ = can_fixed_update; };
-
417
-
422 ID3D11ShaderResourceView* get_back_buffer_srv() const {return back_buffer_srv_;};
-
423
-
428 stats* get_stats() const { return stats_; };
-
433 fps_class* get_fps() const { return fps_; };
-
434
-
439 ecs::EntityManager* get_entity_manager() const { return entity_manager_.get(); };
- -
450 std::map<std::string, std::shared_ptr<model_class>>& get_model_cache() { return g_model_cache; }
-
451
-
452private:
-
462 bool render(float, float, float, float, float);
-
468 bool render_physics(float delta_time);
-
476 bool update_mouse_strings(int, int, bool);
-
481 bool update_fps();
-
487 bool update_render_count_string(int);
-
494 bool render_scene_to_texture(float);
-
500 bool render_refraction_to_texture();
-
506 bool render_reflection_to_texture();
-
519 bool render_pass(XMFLOAT4* diffuse, XMFLOAT4* position, XMFLOAT4* ambient, XMMATRIX view, XMMATRIX projection);
-
520
-
526 void update_skybox_position();
-
530 void culling_thread_function();
-
531
-
532public :
-
533 std::vector<ID3D11ShaderResourceView*> textures;
-
534
-
535private :
-
536
-
537 // Thread de culling
-
538 std::thread culling_thread_;
-
539 std::atomic<bool> culling_active_;
-
540 std::mutex objects_mutex_;
-
541
-
542 std::mutex terrain_mutex_;
-
543 std::vector<std::tuple<float, float, float, std::string, int>> terrain_generation_data_;
-
544 bool terrain_generation_ready_;
-
545 int next_terrain_object_id_;
-
546
-
547 // ------------------------------------- //
-
548 // ------------- DIRECT3D -------------- //
-
549 // ------------------------------------- //
-
550
-
551 d_3d_class* direct_3d_;
-
552 IDXGISwapChain* swap_chain_;
-
553 model_class* model_,* ground_model_, * wall_model_, * bath_model_, * water_model_;
-
554 ModelListClass* model_list_;
-
555 bool vsync_enabled_ = true;
-
556
-
557 HWND hwnd_;
-
558 bool windowed_;
-
559
-
560 // ------------------------------------- //
-
561 // ------------- RENDERING ------------- //
-
562 // ------------------------------------- //
-
563
-
564 XMMATRIX base_view_matrix_;
-
565 render_texture_class* render_texture_, * refraction_texture_, * reflection_texture_;
-
566 render_texture_class* scene_texture_;
-
567 display_plane_class* display_plane_;
-
568 int screen_width_, screen_height_;
-
569 camera_class* camera_;
-
570 camera_class* sun_camera_;
-
571 camera_class* active_camera_;
-
572 position_class* position_;
-
573
-
574 shadow_map* shadow_map_;
-
575 ID3D11ShaderResourceView* shadow_map_srv_;
-
576
-
577 // ------------------------------------ //
-
578 // ------------- OBJECTS -------------- //
-
579 // ------------------------------------ //
-
580
-
581 std::unique_ptr<ecs::EntityManager> entity_manager_;
-
582
-
583 object* selected_object_;
-
584
-
585 float speed_ = 0.1f; // speed for the demo spinning object
-
586 std::vector<object*> imported_object_;
-
587 int object_id_ = 0;
-
588 std::vector<object*> skybox_;
-
589
-
590 // ----------------------------------- //
-
591 // ------------- LIGHTS -------------- //
-
592 // ----------------------------------- //
-
593
-
594 light_class* m_light_;
-
595 std::vector<light_class*> lights_;
-
596 int num_lights_;
-
597 light_class* sun_light_;
-
598 XMFLOAT3 true_light_position_;
-
599 model_class* light_model_;
-
600
-
601 // ----------------------------------- //
-
602 // ------------- SHADERS ------------- //
-
603 // ----------------------------------- //
-
604
-
605 shader_manager_class* shader_manager_;
-
606 font_shader_class* font_shader_;
-
607 bitmap_class* bitmap_;
-
608 sprite_class* sprite_;
-
609 bool enable_cel_shading_;
-
610
-
611 // ----------------------------------- //
-
612 // ------------ VARIABLES ------------ //
-
613 // ----------------------------------- //
-
614
-
615 float water_height_, water_translation_;
-
616 wchar_t* path_;
-
617 std::filesystem::path w_folder_;
-
618
-
619 // ------------------------------------------------- //
-
620 // ------------- FPS AND INFO ON SCREEN ------------ //
-
621 // ------------------------------------------------- //
-
622
-
623 timer_class* timer_;
-
624 text_class* mouse_strings_;
-
625 text_class* render_count_string_;
-
626 font_class* font_;
-
627 fps_class* fps_;
-
628 text_class* fps_string_;
-
629 int previous_fps_;
-
630
-
631 // ------------------------------------------------- //
-
632 // ------------------- OTHER ----------------------- //
-
633 // ------------------------------------------------- //
-
634
-
635 bool should_quit_;
-
636 physics* physics_;
-
637 float gravity_;
-
638 XMVECTOR previous_position_;
-
639 ImVec2 window_size_;
-
640 int physics_tick_rate_ = 50;
-
641 bool can_fixed_update_ = false;
-
642 std::thread physics_thread_;
-
643
-
644 ID3D11Texture2D* back_buffer_texture_;
-
645 ID3D11ShaderResourceView* back_buffer_srv_;
-
646
-
647 stats* stats_;
-
648
-
649 // ------------------------------------------------- //
-
650 // ------------------- Culling --------------------- //
-
651 // ------------------------------------------------- //
-
652
-
653 frustum frustum_culling_;
-
654 int render_count_;
-
655 float frustum_culling_tolerance_ = 5.f;
-
656
-
657 // ------------------------------------------------- //
-
658 // -------------------- Input ---------------------- //
-
659 // ------------------------------------------------- //
-
660
-
661 input inputs_;
-
662 bool tab_was_pressed_;
-
663};
-
-
664
-
665#endif
-
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
- - -
virtual bool frame(input_class *)
Run the main loop of the application. This function will handle the main loop, including rendering an...
-
ID3D11ShaderResourceView * get_back_buffer_srv() const
-
int get_physics_tick_rate() const
-
void set_light_position(int index, XMVECTOR position)
-
float get_aspect_ratio() const
-
void set_cel_shading(const bool enable)
-
void set_render_count(const int render_count)
-
render_texture_class * get_reflection_texture() const
-
frustum get_frustum() const
-
void set_frustum_tolerance(const float frustum_tolerance)
-
std::filesystem::path get_w_folder() const
- -
virtual bool initialize(int screen_width, int screen_height, HWND hwdn, bool is_vulkan)
-
ImVec2 get_window_size() const
-
render_texture_class * get_render_texture() const
-
void set_hwnd(HWND hwnd)
- -
void set_path(WCHAR *path)
-
XMVECTOR get_light_position(int index)
-
void delete_entity_by_id(int entity_id)
-
void set_w_folder(const std::filesystem::path &w_folder)
-
void set_vsync(bool vsync)
- -
render_texture_class * get_scene_texture() const
- -
std::map< std::string, std::shared_ptr< model_class > > & get_model_cache()
-
void set_light_color(int index, XMVECTOR color)
-
bool create_big_cube(int side_count)
Create a big cube with a specified number of little cube per sides.
-
void set_speed(const float speed)
- -
void set_windowed(bool windowed)
-
XMVECTOR get_light_color(int index)
-
fps_class * get_fps() const
-
void set_physics_tick_rate(int physics_tick_rate)
-
render_texture_class * get_refraction_texture() const
-
void set_should_quit(const bool should_quit)
-
void add_kobject(std::wstring &filepath)
-
std::vector< light_class * > get_lights() const
-
void set_can_fixed_update(bool can_fixed_update)
-
float get_frustum_tolerance() const
- -
void physics_thread_function()
Thread function for handling physics updates. this function will run in a separate thread to handle p...
- - - -
void set_window_size(const ImVec2 size)
-
physics * get_physics() const
-
application_class()
Constructor for the application class. Initializes member variables and sets up the application.
-
ecs::EntityManager * get_entity_manager() const
-
void set_frustum(const frustum &frustum)
-
bool get_can_fixed_update() const
- -
void set_screen_width(int screen_width)
-
int get_render_count() const
-
float get_speed() const
-
light_class * get_sun_light() const
-
stats * get_stats() const
- -
void set_object_id(int object_id)
-
void set_screen_height(int screen_height)
- - -
bool get_should_quit() const
- - - -
void set_vsync(bool vsync)
Sets the vertical sync state.
- - - - - - - - - - - - - - - -
Definition stats.h:13
- - - -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:ad7203a8c81774165e3b95934724f94da0e8c7aa6b1abf3144d142f672e7009a +size 99893 diff --git a/doxygen_docs/html/bc_s.png b/doxygen_docs/html/bc_s.png index 224b29a..2eba412 100644 Binary files a/doxygen_docs/html/bc_s.png and b/doxygen_docs/html/bc_s.png differ diff --git a/doxygen_docs/html/bc_sd.png b/doxygen_docs/html/bc_sd.png index 31ca888..b259ca9 100644 Binary files a/doxygen_docs/html/bc_sd.png and b/doxygen_docs/html/bc_sd.png differ diff --git a/doxygen_docs/html/bitmap__class_8cpp_source.html b/doxygen_docs/html/bitmap__class_8cpp_source.html index f4e1d1b..310faf3 100644 --- a/doxygen_docs/html/bitmap__class_8cpp_source.html +++ b/doxygen_docs/html/bitmap__class_8cpp_source.html @@ -1,477 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/src/system/bitmap_class.cpp Source File - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
bitmap_class.cpp
-
-
-
1#include "bitmap_class.h"
-
2
-
3bitmap_class::bitmap_class()
-
4{
-
5 vertex_buffer_ = 0;
-
6 index_buffer_ = 0;
-
7 texture_ = 0;
-
8}
-
9
-
10
-
11bitmap_class::bitmap_class(const bitmap_class& other)
-
12{
-
13}
-
14
-
15
-
16bitmap_class::~bitmap_class()
-
17{
-
18}
-
19
-
20
-
21bool bitmap_class::initialize(ID3D11Device* device, ID3D11DeviceContext* deviceContext, int screenWidth, int screenHeight, char* textureFilename, int renderX, int renderY)
-
22{
-
23 Logger::Get().Log("Initializing bitmap class", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
24
-
25 bool result;
-
26
-
27 // Store the screen size.
-
28 screen_width_ = screenWidth;
-
29 screen_height_ = screenHeight;
-
30
-
31 // Store where the bitmap should be rendered to.
-
32 render_x_ = renderX;
-
33 render_y_ = renderY;
-
34
-
35 // initialize the vertex and index buffer that hold the geometry for the bitmap quad.
-
36 result = initialize_buffers(device);
-
37 if (!result)
-
38 {
-
39 Logger::Get().Log("Failed to initialize buffers", __FILE__, __LINE__, Logger::LogLevel::Error);
-
40 return false;
-
41 }
-
42
-
43 // Load the texture for this bitmap.
-
44 result = load_texture(device, deviceContext, textureFilename);
-
45 if (!result)
-
46 {
-
47 Logger::Get().Log("Failed to load texture", __FILE__, __LINE__, Logger::LogLevel::Error);
-
48 return false;
-
49 }
-
50
-
51 Logger::Get().Log("Bitmap class initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
52
-
53 return true;
-
54}
-
55
-
56void bitmap_class::shutdown()
-
57{
-
58 // Release the bitmap texture.
-
59 release_texture();
-
60
-
61 // Release the vertex and index buffers.
-
62 shutdown_buffers();
-
63
-
64 return;
-
65}
-
66
-
67bool bitmap_class::render(ID3D11DeviceContext* deviceContext)
-
68{
-
69 bool result;
-
70
-
71
-
72 // Update the buffers if the position of the bitmap has changed from its original position.
-
73 result = update_buffers(deviceContext);
-
74 if (!result)
-
75 {
-
76 Logger::Get().Log("Failed to update buffers", __FILE__, __LINE__, Logger::LogLevel::Error);
-
77 return false;
-
78 }
-
79
-
80 // Put the vertex and index buffers on the graphics pipeline to prepare them for drawing.
-
81 render_buffers(deviceContext);
-
82
-
83 return true;
-
84}
-
85
-
86int bitmap_class::get_index_count()
-
87{
-
88 return index_count_;
-
89}
-
90
-
91ID3D11ShaderResourceView* bitmap_class::get_texture()
-
92{
-
93 return texture_->GetTexture();
-
94}
-
95
-
96bool bitmap_class::initialize_buffers(ID3D11Device* device)
-
97{
-
98 Logger::Get().Log("Initializing buffers", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
99
-
100 vertex_type* vertices;
-
101 unsigned long* indices;
-
102 D3D11_BUFFER_DESC vertexBufferDesc, indexBufferDesc;
-
103 D3D11_SUBRESOURCE_DATA vertexData, indexData;
-
104 HRESULT result;
-
105 int i;
-
106
-
107 // initialize the previous rendering position to negative one.
-
108 prev_pos_x_ = -1;
-
109 prev_pos_y_ = -1;
-
110
-
111 // Set the number of vertices in the vertex array.
-
112 vertex_count_ = 6;
-
113
-
114 // Set the number of indices in the index array.
-
115 index_count_ = vertex_count_;
-
116
-
117 // Create the vertex array.
-
118 vertices = new vertex_type[vertex_count_];
-
119
-
120 // Create the index array.
-
121 indices = new unsigned long[index_count_];
-
122
-
123 // initialize vertex array to zeros at first.
-
124 memset(vertices, 0, (sizeof(vertex_type) * vertex_count_));
-
125
-
126 // Load the index array with data.
-
127 for (i = 0; i < index_count_; i++)
-
128 {
-
129 indices[i] = i;
-
130 }
-
131
-
132 // Set up the description of the dynamic vertex buffer.
-
133 vertexBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
-
134 vertexBufferDesc.ByteWidth = sizeof(vertex_type) * vertex_count_;
-
135 vertexBufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
-
136 vertexBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
-
137 vertexBufferDesc.MiscFlags = 0;
-
138 vertexBufferDesc.StructureByteStride = 0;
-
139
-
140 // Give the subresource structure a pointer to the vertex data.
-
141 vertexData.pSysMem = vertices;
-
142 vertexData.SysMemPitch = 0;
-
143 vertexData.SysMemSlicePitch = 0;
-
144
-
145 // Now finally create the vertex buffer.
-
146 result = device->CreateBuffer(&vertexBufferDesc, &vertexData, &vertex_buffer_);
-
147 if (FAILED(result))
-
148 {
-
149 Logger::Get().Log("Failed to create vertex buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
-
150 return false;
-
151 }
-
152
-
153 // Set up the description of the index buffer.
-
154 indexBufferDesc.Usage = D3D11_USAGE_DEFAULT;
-
155 indexBufferDesc.ByteWidth = sizeof(unsigned long) * index_count_;
-
156 indexBufferDesc.BindFlags = D3D11_BIND_INDEX_BUFFER;
-
157 indexBufferDesc.CPUAccessFlags = 0;
-
158 indexBufferDesc.MiscFlags = 0;
-
159 indexBufferDesc.StructureByteStride = 0;
-
160
-
161 // Give the subresource structure a pointer to the index data.
-
162 indexData.pSysMem = indices;
-
163 indexData.SysMemPitch = 0;
-
164 indexData.SysMemSlicePitch = 0;
-
165
-
166 // Create the index buffer.
-
167 result = device->CreateBuffer(&indexBufferDesc, &indexData, &index_buffer_);
-
168 if (FAILED(result))
-
169 {
-
170 Logger::Get().Log("Failed to create index buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
-
171 return false;
-
172 }
-
173
-
174 // Release the arrays now that the vertex and index buffers have been created and loaded.
-
175 delete[] vertices;
-
176 vertices = 0;
-
177
-
178 delete[] indices;
-
179 indices = 0;
-
180
-
181 Logger::Get().Log("Buffers initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
182
-
183 return true;
-
184}
-
185
-
186void bitmap_class::shutdown_buffers()
-
187{
-
188 Logger::Get().Log("Shutting down buffers", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
189
-
190 // Release the index buffer.
-
191 if (index_buffer_)
-
192 {
-
193 Logger::Get().Log("Releasing index buffer", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
194 index_buffer_->Release();
-
195 index_buffer_ = 0;
-
196 Logger::Get().Log("Index buffer released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
197 }
-
198
-
199 // Release the vertex buffer.
-
200 if (vertex_buffer_)
-
201 {
-
202 Logger::Get().Log("Releasing vertex buffer", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
203 vertex_buffer_->Release();
-
204 vertex_buffer_ = 0;
-
205 Logger::Get().Log("Vertex buffer released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
206 }
-
207
-
208 Logger::Get().Log("Buffers shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
209
-
210 return;
-
211}
-
212
-
213bool bitmap_class::update_buffers(ID3D11DeviceContext* deviceContent)
-
214{
-
215 float left, right, top, bottom;
-
216 vertex_type* vertices;
-
217 D3D11_MAPPED_SUBRESOURCE mappedResource;
-
218 vertex_type* dataPtr;
-
219 HRESULT result;
-
220
-
221 // If the position we are rendering this bitmap to hasn't changed then don't update the vertex buffer.
-
222 if ((prev_pos_x_ == render_x_) && (prev_pos_y_ == render_y_))
-
223 {
-
224 return true;
-
225 }
-
226
-
227 // If the rendering location has changed then store the new position and update the vertex buffer.
-
228 prev_pos_x_ = render_x_;
-
229 prev_pos_y_ = render_y_;
-
230
-
231 // Create the vertex array.
-
232 vertices = new vertex_type[vertex_count_];
-
233
-
234 // Calculate the screen coordinates of the left side of the bitmap.
-
235 left = (float)((screen_width_ / 2) * -1) + (float)render_x_;
-
236
-
237 // Calculate the screen coordinates of the right side of the bitmap.
-
238 right = left + (float)bitmap_width_;
-
239
-
240 // Calculate the screen coordinates of the top of the bitmap.
-
241 top = (float)(screen_height_ / 2) - (float)render_y_;
-
242
-
243 // Calculate the screen coordinates of the bottom of the bitmap.
-
244 bottom = top - (float)bitmap_height_;
-
245
-
246 // Load the vertex array with data.
-
247// First triangle.
-
248 vertices[0].position = XMFLOAT3(left, top, 0.0f); // Top left.
-
249 vertices[0].texture = XMFLOAT2(0.0f, 0.0f);
-
250
-
251 vertices[1].position = XMFLOAT3(right, bottom, 0.0f); // Bottom right.
-
252 vertices[1].texture = XMFLOAT2(1.0f, 1.0f);
-
253
-
254 vertices[2].position = XMFLOAT3(left, bottom, 0.0f); // Bottom left.
-
255 vertices[2].texture = XMFLOAT2(0.0f, 1.0f);
-
256
-
257 // Second triangle.
-
258 vertices[3].position = XMFLOAT3(left, top, 0.0f); // Top left.
-
259 vertices[3].texture = XMFLOAT2(0.0f, 0.0f);
-
260
-
261 vertices[4].position = XMFLOAT3(right, top, 0.0f); // Top right.
-
262 vertices[4].texture = XMFLOAT2(1.0f, 0.0f);
-
263
-
264 vertices[5].position = XMFLOAT3(right, bottom, 0.0f); // Bottom right.
-
265 vertices[5].texture = XMFLOAT2(1.0f, 1.0f);
-
266
-
267 // Lock the vertex buffer.
-
268 result = deviceContent->Map(vertex_buffer_, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
-
269 if (FAILED(result))
-
270 {
-
271 Logger::Get().Log("Failed to map vertex buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
-
272 return false;
-
273 }
-
274
-
275 // Get a pointer to the data in the constant buffer.
-
276 dataPtr = (vertex_type*)mappedResource.pData;
-
277
-
278 // Copy the data into the vertex buffer.
-
279 memcpy(dataPtr, (void*)vertices, (sizeof(vertex_type) * vertex_count_));
-
280
-
281 // Unlock the vertex buffer.
-
282 deviceContent->Unmap(vertex_buffer_, 0);
-
283
-
284 // Release the pointer reference.
-
285 dataPtr = 0;
-
286
-
287 // Release the vertex array as it is no longer needed.
-
288 delete[] vertices;
-
289 vertices = 0;
-
290
-
291 return true;
-
292}
-
293
-
294void bitmap_class::render_buffers(ID3D11DeviceContext* deviceContext)
-
295{
-
296 unsigned int stride;
-
297 unsigned int offset;
-
298
-
299
-
300 // Set vertex buffer stride and offset.
-
301 stride = sizeof(vertex_type);
-
302 offset = 0;
-
303
-
304 // Set the vertex buffer to active in the input assembler so it can be rendered.
-
305 deviceContext->IASetVertexBuffers(0, 1, &vertex_buffer_, &stride, &offset);
-
306
-
307 // Set the index buffer to active in the input assembler so it can be rendered.
-
308 deviceContext->IASetIndexBuffer(index_buffer_, DXGI_FORMAT_R32_UINT, 0);
-
309
-
310 // Set the type of primitive that should be rendered from this vertex buffer, in this case triangles.
-
311 deviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
-
312
-
313 return;
-
314}
-
315
-
316bool bitmap_class::load_texture(ID3D11Device* device, ID3D11DeviceContext* deviceContext, char* filename)
-
317{
-
318 bool result;
-
319
-
320
-
321 // Create and initialize the texture object.
-
322 texture_ = new texture_class;
-
323
-
324 result = texture_->Initialize(device, deviceContext, filename);
-
325 if (!result)
-
326 {
-
327 Logger::Get().Log("Failed to initialize texture object", __FILE__, __LINE__, Logger::LogLevel::Error);
-
328 return false;
-
329 }
-
330
-
331 // Store the size in pixels that this bitmap should be rendered at.
-
332 bitmap_width_ = texture_->GetWidth();
-
333 bitmap_height_ = texture_->GetHeight();
-
334
-
335 return true;
-
336}
-
337
-
338void bitmap_class::release_texture()
-
339{
-
340 Logger::Get().Log("Releasing texture", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
341 // Release the texture object.
-
342 if (texture_)
-
343 {
-
344 Logger::Get().Log("Releasing texture object", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
345 texture_->Shutdown();
-
346 delete texture_;
-
347 texture_ = 0;
-
348 Logger::Get().Log("Texture object released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
349 }
-
350
-
351 Logger::Get().Log("Texture released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
352
-
353 return;
-
354}
-
355
-
356void bitmap_class::set_render_location(int x, int y)
-
357{
-
358 render_x_ = x;
-
359 render_y_ = y;
-
360 return;
-
361}
-
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
- - -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:911ee0b90c7d0eeb7b8a68cdd4b20b192d2810720877c68ebec982ef38341f96 +size 59005 diff --git a/doxygen_docs/html/bitmap__class_8h_source.html b/doxygen_docs/html/bitmap__class_8h_source.html index ed4bcab..ec2da3d 100644 --- a/doxygen_docs/html/bitmap__class_8h_source.html +++ b/doxygen_docs/html/bitmap__class_8h_source.html @@ -1,169 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/inc/system/bitmap_class.h Source File - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
bitmap_class.h
-
-
-
1#ifndef _BITMAPCLASS_H_
-
2#define _BITMAPCLASS_H_
-
3
-
4
-
6// INCLUDES //
-
8#include <directxmath.h>
-
9using namespace DirectX;
-
10
-
11
-
13// MY CLASS INCLUDES //
-
15#include "texture_class.h"
-
16
-
17
-
19// Class name: bitmap_class
-
- -
22{
-
23private:
-
24 struct vertex_type
-
25 {
-
26 XMFLOAT3 position;
-
27 XMFLOAT2 texture;
-
28 };
-
29
-
30public:
- - - -
34
-
35 bool initialize(ID3D11Device*, ID3D11DeviceContext*, int, int, char*, int, int);
-
36 void shutdown();
-
37 bool render(ID3D11DeviceContext*);
-
38
-
39 int get_index_count();
-
40 ID3D11ShaderResourceView* get_texture();
-
41
-
42 void set_render_location(int, int);
-
43
-
44private:
-
45 bool initialize_buffers(ID3D11Device*);
-
46 void shutdown_buffers();
-
47 bool update_buffers(ID3D11DeviceContext*);
-
48 void render_buffers(ID3D11DeviceContext*);
-
49
-
50 bool load_texture(ID3D11Device*, ID3D11DeviceContext*, char*);
-
51 void release_texture();
-
52private:
-
53 ID3D11Buffer* vertex_buffer_, * index_buffer_;
-
54 int vertex_count_, index_count_, screen_width_, screen_height_, bitmap_width_, bitmap_height_, render_x_, render_y_, prev_pos_x_, prev_pos_y_;
-
55 texture_class* texture_;
-
56
-
57};
-
-
58
-
59#endif
- - -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:6fdf6e643f38d73528f89e19c0ccadc901e1366c3184e533699cda0f2110dcde +size 12786 diff --git a/doxygen_docs/html/camera__class_8cpp_source.html b/doxygen_docs/html/camera__class_8cpp_source.html index 632e9a1..93a6464 100644 --- a/doxygen_docs/html/camera__class_8cpp_source.html +++ b/doxygen_docs/html/camera__class_8cpp_source.html @@ -1,310 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/src/system/camera_class.cpp Source File - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
camera_class.cpp
-
-
-
1
-
2// Filename: cameraclass.cpp
-
4#include "camera_class.h"
-
5
-
- -
7{
-
8 position_x_ = 0.0f;
-
9 position_y_ = 0.0f;
-
10 position_z_ = 0.0f;
-
11
-
12 rotation_x_ = 0.0f;
-
13 rotation_y_ = 0.0f;
-
14 rotation_z_ = 0.0f;
-
15}
-
-
16
-
17
- -
19{
-
20}
-
21
-
22
-
23camera_class::~camera_class()
-
24{
-
25}
-
26
-
-
27void camera_class::set_position(float x, float y, float z)
-
28{
-
29 position_x_ = x;
-
30 position_y_ = y;
-
31 position_z_ = z;
-
32 return;
-
33}
-
-
34
-
35
-
-
36void camera_class::set_rotation(float x, float y, float z)
-
37{
-
38 rotation_x_ = x;
-
39 rotation_y_ = y;
-
40 rotation_z_ = z;
-
41 return;
-
42}
-
-
43
-
- -
45{
-
46 return XMFLOAT3(position_x_, position_y_, position_z_);
-
47}
-
-
48
-
49
-
- -
51{
-
52 return XMFLOAT3(rotation_x_, rotation_y_, rotation_z_);
-
53}
-
-
54
-
- -
56{
-
57 XMFLOAT3 up, position, lookAt;
-
58 XMVECTOR upVector, positionVector, lookAtVector;
-
59 float yaw, pitch, roll;
-
60 XMMATRIX rotationMatrix;
-
61
-
62
-
63 // Setup the vector that points upwards.
-
64 up.x = 0.0f;
-
65 up.y = 1.0f;
-
66 up.z = 0.0f;
-
67
-
68 // Load it into a XMVECTOR structure.
-
69 upVector = XMLoadFloat3(&up);
-
70
-
71 // Setup the position of the camera in the world.
-
72 position.x = position_x_;
-
73 position.y = position_y_;
-
74 position.z = position_z_;
-
75
-
76 // Load it into a XMVECTOR structure.
-
77 positionVector = XMLoadFloat3(&position);
-
78
-
79 // Setup where the camera is looking by default.
-
80 lookAt.x = 0.0f;
-
81 lookAt.y = 0.0f;
-
82 lookAt.z = 1.0f;
-
83
-
84 // Load it into a XMVECTOR structure.
-
85 lookAtVector = XMLoadFloat3(&lookAt);
-
86
-
87 // Set the yaw (Y axis), pitch (X axis), and roll (Z axis) rotations in radians.
-
88 pitch = rotation_x_ * 0.0174532925f;
-
89 yaw = rotation_y_ * 0.0174532925f;
-
90 roll = rotation_z_ * 0.0174532925f;
-
91
-
92 // Create the rotation matrix from the yaw, pitch, and roll values.
-
93 rotationMatrix = XMMatrixRotationRollPitchYaw(pitch, yaw, roll);
-
94
-
95 // Transform the lookAt and up vector by the rotation matrix so the view is correctly rotated at the origin.
-
96 lookAtVector = XMVector3TransformCoord(lookAtVector, rotationMatrix);
-
97 upVector = XMVector3TransformCoord(upVector, rotationMatrix);
-
98
-
99 // Translate the rotated camera position to the location of the viewer.
-
100 lookAtVector = XMVectorAdd(positionVector, lookAtVector);
-
101
-
102 // Finally create the view matrix from the three updated vectors.
-
103 view_matrix_ = XMMatrixLookAtLH(positionVector, lookAtVector, upVector);
-
104
-
105 return;
-
106}
-
-
107
-
-
108XMMATRIX camera_class::get_view_matrix(XMMATRIX& view_matrix) const
-
109{
-
110 view_matrix = view_matrix_;
-
111 return view_matrix;
-
112}
-
-
113
-
- -
115{
-
116 XMFLOAT3 up, position, lookAt;
-
117 XMVECTOR upVector, positionVector, lookAtVector;
-
118 float yaw, pitch, roll;
-
119 XMMATRIX rotationMatrix;
-
120
-
121
-
122 // Setup the vector that points upwards.
-
123 up.x = 0.0f;
-
124 up.y = 1.0f;
-
125 up.z = 0.0f;
-
126
-
127 // Load it into a XMVECTOR structure.
-
128 upVector = XMLoadFloat3(&up);
-
129
-
130 // Setup the position of the camera in the world.
-
131 position.x = position_x_;
-
132 position.y = -position_y_ + (height * 2.0f);
-
133 position.z = position_z_;
-
134
-
135 // Load it into a XMVECTOR structure.
-
136 positionVector = XMLoadFloat3(&position);
-
137
-
138 // Setup where the camera is looking by default.
-
139 lookAt.x = 0.0f;
-
140 lookAt.y = 0.0f;
-
141 lookAt.z = 1.0f;
-
142
-
143 // Load it into a XMVECTOR structure.
-
144 lookAtVector = XMLoadFloat3(&lookAt);
-
145
-
146 // Set the yaw (Y axis), pitch (X axis), and roll (Z axis) rotations in radians.
-
147 pitch = (-1.0f * rotation_x_) * 0.0174532925f; // Invert for reflection
-
148 yaw = rotation_y_ * 0.0174532925f;
-
149 roll = rotation_z_ * 0.0174532925f;
-
150
-
151 // Create the rotation matrix from the yaw, pitch, and roll values.
-
152 rotationMatrix = XMMatrixRotationRollPitchYaw(pitch, yaw, roll);
-
153
-
154 // Transform the lookAt and up vector by the rotation matrix so the view is correctly rotated at the origin.
-
155 lookAtVector = XMVector3TransformCoord(lookAtVector, rotationMatrix);
-
156 upVector = XMVector3TransformCoord(upVector, rotationMatrix);
-
157
-
158 // Translate the rotated camera position to the location of the viewer.
-
159 lookAtVector = XMVectorAdd(positionVector, lookAtVector);
-
160
-
161 // Finally create the view matrix from the three updated vectors.
-
162 reflection_view_matrix_ = XMMatrixLookAtLH(positionVector, lookAtVector, upVector);
-
163
-
164 return;
-
165}
-
-
166
-
-
167void camera_class::get_reflection_view_matrix(XMMATRIX& reflectionViewMatrix) const
-
168{
-
169 reflectionViewMatrix = reflection_view_matrix_;
-
170 return;
-
171}
-
- -
void render()
Updates the camera's view matrix based on its position and rotation. This method recalculates the vie...
-
void set_rotation(float, float, float)
Sets the rotation of the camera in 3D space.
-
void set_position(float, float, float)
Sets the position of the camera in 3D space.
-
void render_reflection(float)
Renders the reflection of the scene from the camera's perspective.
-
XMFLOAT3 get_rotation()
Gets the current rotation of the camera.
-
XMMATRIX get_view_matrix(XMMATRIX &view_matrix) const
Retrieves the current view matrix of the camera.
-
camera_class()
Default constructor for camera_class. Initializes the camera position and rotation to zero.
-
void get_reflection_view_matrix(XMMATRIX &) const
Retrieves the reflection view matrix of the camera.
-
XMFLOAT3 get_position()
Gets the current position of the camera.
-
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:d0c5398a929cbb2deb990d32878ad2c00b4882e21b1b990af6629007e8277a19 +size 32952 diff --git a/doxygen_docs/html/camera__class_8h_source.html b/doxygen_docs/html/camera__class_8h_source.html index 27efebe..c94edf3 100644 --- a/doxygen_docs/html/camera__class_8h_source.html +++ b/doxygen_docs/html/camera__class_8h_source.html @@ -1,165 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/inc/system/camera_class.h Source File - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
camera_class.h
-
-
-
1
-
2// Filename: cameraclass.h
-
4#ifndef _CAMERACLASS_H_
-
5#define _CAMERACLASS_H_
-
6
-
7
-
9// INCLUDES //
-
11#include <directxmath.h>
-
12using namespace DirectX;
-
13
-
14
-
16// Class name: camera_class
-
- -
19{
-
20public:
- - - -
28
-
36 void set_position(float, float, float);
-
44 void set_rotation(float, float, float);
-
45
-
51 XMFLOAT3 get_position();
-
57 XMFLOAT3 get_rotation();
-
58
-
59
-
64 void render();
-
70 XMMATRIX get_view_matrix(XMMATRIX& view_matrix) const;
-
71
-
77 void render_reflection(float);
-
83 void get_reflection_view_matrix(XMMATRIX&) const;
-
84
-
85private:
-
86 float position_x_, position_y_, position_z_;
-
87 float rotation_x_, rotation_y_, rotation_z_;
-
88 XMMATRIX view_matrix_;
-
89 XMMATRIX reflection_view_matrix_;
-
90
-
91};
-
-
92
-
93#endif
- -
void render()
Updates the camera's view matrix based on its position and rotation. This method recalculates the vie...
-
void set_rotation(float, float, float)
Sets the rotation of the camera in 3D space.
-
void set_position(float, float, float)
Sets the position of the camera in 3D space.
-
void render_reflection(float)
Renders the reflection of the scene from the camera's perspective.
-
XMFLOAT3 get_rotation()
Gets the current rotation of the camera.
-
XMMATRIX get_view_matrix(XMMATRIX &view_matrix) const
Retrieves the current view matrix of the camera.
-
camera_class()
Default constructor for camera_class. Initializes the camera position and rotation to zero.
-
void get_reflection_view_matrix(XMMATRIX &) const
Retrieves the reflection view matrix of the camera.
-
XMFLOAT3 get_position()
Gets the current position of the camera.
-
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:b887ea3d83c524301acc3df06710e41f6d8712398fdbf7bdb7e8bc2b07b9a36e +size 15811 diff --git a/doxygen_docs/html/celshade__class_8cpp_source.html b/doxygen_docs/html/celshade__class_8cpp_source.html index bc8bea0..3be0d17 100644 --- a/doxygen_docs/html/celshade__class_8cpp_source.html +++ b/doxygen_docs/html/celshade__class_8cpp_source.html @@ -1,586 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/src/shader/celshade_class.cpp Source File - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
celshade_class.cpp
-
-
-
1
-
2// Filename: lightshaderclass.cpp
-
4#include "celshade_class.h"
-
5
-
6
-
7celshade_class::celshade_class()
-
8{
-
9 vertex_shader_ = 0;
-
10 pixel_shader_ = 0;
-
11 layout_ = 0;
-
12 sample_state_ = 0;
-
13 matrix_buffer_ = 0;
-
14 camera_buffer_ = 0;
-
15 sunlight_buffer_ = 0;
-
16 sunlight_color_buffer_ = 0;
-
17 sunlight_position_buffer_ = 0;
-
18}
-
19
-
20
-
21celshade_class::celshade_class(const celshade_class& other)
-
22{
-
23}
-
24
-
25
-
26celshade_class::~celshade_class()
-
27{
-
28}
-
29
-
30
-
31bool celshade_class::initialize(ID3D11Device* device, HWND hwnd)
-
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/celshading.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/celshading.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 = initialize_shader(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("SunLightShaderClass initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
64
-
65 return true;
-
66}
-
67
-
68
-
69void celshade_class::shutdown()
-
70{
-
71 // shutdown the vertex and pixel shaders as well as the related objects.
-
72 shutdown_shader();
-
73
-
74 return;
-
75}
-
76
-
77bool celshade_class::render(ID3D11DeviceContext* deviceContext, int index_count, XMMATRIX world_matrix, XMMATRIX view_matrix, XMMATRIX projection_matrix,
-
78 ID3D11ShaderResourceView* texture, XMFLOAT4 diffuse_color, XMFLOAT4 ambient_color, XMFLOAT3 sun_direction, float sunIntensity)
-
79{
-
80 bool result;
-
81
-
82
-
83 // Set the shader parameters that it will use for rendering.
-
84 result = set_shader_parameters(deviceContext, world_matrix, view_matrix, projection_matrix, texture, diffuse_color, ambient_color, sun_direction, 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 render_shader(deviceContext, index_count);
-
93
-
94 return true;
-
95}
-
96
-
97
-
98bool celshade_class::initialize_shader(ID3D11Device* device, HWND hwnd, WCHAR* vsFilename, WCHAR* psFilename)
-
99{
-
100 Logger::Get().Log("Initializing shader", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
101
-
102 HRESULT result;
-
103 ID3D10Blob* errorMessage;
-
104 ID3D10Blob* vertexShaderBuffer;
-
105 ID3D10Blob* pixelShaderBuffer;
-
106 D3D11_INPUT_ELEMENT_DESC polygonLayout[3];
-
107 unsigned int numElements;
-
108 D3D11_SAMPLER_DESC samplerDesc;
-
109 D3D11_BUFFER_DESC matrixBufferDesc;
-
110 D3D11_BUFFER_DESC sunlightBufferDesc;
-
111
-
112 // initialize the pointers this function will use to null.
-
113 errorMessage = 0;
-
114 vertexShaderBuffer = 0;
-
115 pixelShaderBuffer = 0;
-
116
-
117 // Compile the vertex shader code.
-
118 result = D3DCompileFromFile(vsFilename, NULL, NULL, "SunLightVertexShader", "vs_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0, &vertexShaderBuffer, &errorMessage);
-
119 if (FAILED(result))
-
120 {
-
121 if (errorMessage)
-
122 {
-
123 output_shader_error_message(errorMessage, hwnd, vsFilename);
-
124 }
-
125 else
-
126 {
-
127 Logger::Get().Log("Failed to compile shader", __FILE__, __LINE__, Logger::LogLevel::Error);
-
128 }
-
129 return false;
-
130 }
-
131
-
132 // Compile the pixel shader code.
-
133 result = D3DCompileFromFile(psFilename, NULL, NULL, "SunLightPixelShader", "ps_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0, &pixelShaderBuffer, &errorMessage);
-
134 if (FAILED(result))
-
135 {
-
136 if (errorMessage)
-
137 {
-
138 output_shader_error_message(errorMessage, hwnd, psFilename);
-
139 }
-
140 else
-
141 {
-
142 Logger::Get().Log("Failed to compile shader", __FILE__, __LINE__, Logger::LogLevel::Error);
-
143 }
-
144 return false;
-
145 }
-
146
-
147 // Create the vertex shader from the buffer.
-
148 result = device->CreateVertexShader(vertexShaderBuffer->GetBufferPointer(), vertexShaderBuffer->GetBufferSize(), NULL, &vertex_shader_);
-
149 if (FAILED(result))
-
150 {
-
151 Logger::Get().Log("Failed to create vertex shader", __FILE__, __LINE__, Logger::LogLevel::Error);
-
152 return false;
-
153 }
-
154
-
155 // Create the pixel shader from the buffer.
-
156 result = device->CreatePixelShader(pixelShaderBuffer->GetBufferPointer(), pixelShaderBuffer->GetBufferSize(), NULL, &pixel_shader_);
-
157 if (FAILED(result))
-
158 {
-
159 Logger::Get().Log("Failed to create pixel shader", __FILE__, __LINE__, Logger::LogLevel::Error);
-
160 return false;
-
161 }
-
162
-
163 // Create the vertex input layout description.
-
164 polygonLayout[0].SemanticName = "POSITION";
-
165 polygonLayout[0].SemanticIndex = 0;
-
166 polygonLayout[0].Format = DXGI_FORMAT_R32G32B32_FLOAT;
-
167 polygonLayout[0].InputSlot = 0;
-
168 polygonLayout[0].AlignedByteOffset = 0;
-
169 polygonLayout[0].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
-
170 polygonLayout[0].InstanceDataStepRate = 0;
-
171
-
172 polygonLayout[1].SemanticName = "TEXCOORD";
-
173 polygonLayout[1].SemanticIndex = 0;
-
174 polygonLayout[1].Format = DXGI_FORMAT_R32G32_FLOAT;
-
175 polygonLayout[1].InputSlot = 0;
-
176 polygonLayout[1].AlignedByteOffset = D3D11_APPEND_ALIGNED_ELEMENT;
-
177 polygonLayout[1].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
-
178 polygonLayout[1].InstanceDataStepRate = 0;
-
179
-
180 polygonLayout[2].SemanticName = "NORMAL";
-
181 polygonLayout[2].SemanticIndex = 0;
-
182 polygonLayout[2].Format = DXGI_FORMAT_R32G32B32_FLOAT;
-
183 polygonLayout[2].InputSlot = 0;
-
184 polygonLayout[2].AlignedByteOffset = D3D11_APPEND_ALIGNED_ELEMENT;
-
185 polygonLayout[2].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
-
186 polygonLayout[2].InstanceDataStepRate = 0;
-
187
-
188 // Get a count of the elements in the layout.
-
189 numElements = sizeof(polygonLayout) / sizeof(polygonLayout[0]);
-
190
-
191 // Create the vertex input layout.
-
192 result = device->CreateInputLayout(polygonLayout, numElements, vertexShaderBuffer->GetBufferPointer(), vertexShaderBuffer->GetBufferSize(), &layout_);
-
193 if (FAILED(result))
-
194 {
-
195 Logger::Get().Log("Failed to create input layout", __FILE__, __LINE__, Logger::LogLevel::Error);
-
196 return false;
-
197 }
-
198
-
199 // Release the vertex shader buffer and pixel shader buffer since they are no longer needed.
-
200 vertexShaderBuffer->Release();
-
201 vertexShaderBuffer = 0;
-
202
-
203 pixelShaderBuffer->Release();
-
204 pixelShaderBuffer = 0;
-
205
-
206 // Create a texture sampler state description.
-
207 samplerDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR;
-
208 samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP;
-
209 samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP;
-
210 samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_WRAP;
-
211 samplerDesc.MipLODBias = 0.0f;
-
212 samplerDesc.MaxAnisotropy = 1;
-
213 samplerDesc.ComparisonFunc = D3D11_COMPARISON_ALWAYS;
-
214 samplerDesc.BorderColor[0] = 0;
-
215 samplerDesc.BorderColor[1] = 0;
-
216 samplerDesc.BorderColor[2] = 0;
-
217 samplerDesc.BorderColor[3] = 0;
-
218 samplerDesc.MinLOD = 0;
-
219 samplerDesc.MaxLOD = D3D11_FLOAT32_MAX;
-
220
-
221 // Create the texture sampler state.
-
222 result = device->CreateSamplerState(&samplerDesc, &sample_state_);
-
223 if (FAILED(result))
-
224 {
-
225 Logger::Get().Log("Failed to create sampler state", __FILE__, __LINE__, Logger::LogLevel::Error);
-
226 return false;
-
227 }
-
228
-
229 // Setup the description of the dynamic matrix constant buffer that is in the vertex shader.
-
230 matrixBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
-
231 matrixBufferDesc.ByteWidth = sizeof(matrix_buffer_type);
-
232 matrixBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
-
233 matrixBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
-
234 matrixBufferDesc.MiscFlags = 0;
-
235 matrixBufferDesc.StructureByteStride = 0;
-
236
-
237 // Create the constant buffer pointer so we can access the vertex shader constant buffer from within this class.
-
238 result = device->CreateBuffer(&matrixBufferDesc, NULL, &matrix_buffer_);
-
239 if (FAILED(result))
-
240 {
-
241 Logger::Get().Log("Failed to create matrix buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
-
242 return false;
-
243 }
-
244
-
245 // Setup the description of the dynamic sunlight constant buffer that is in the pixel shader.
-
246 sunlightBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
-
247 sunlightBufferDesc.ByteWidth = sizeof(sun_light_buffer_type);
-
248 sunlightBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
-
249 sunlightBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
-
250 sunlightBufferDesc.MiscFlags = 0;
-
251 sunlightBufferDesc.StructureByteStride = 0;
-
252
-
253 // Create the constant buffer pointer so we can access the pixel shader constant buffer from within this class.
-
254 result = device->CreateBuffer(&sunlightBufferDesc, NULL, &sunlight_buffer_);
-
255 if (FAILED(result))
-
256 {
-
257 Logger::Get().Log("Failed to create sunlight buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
-
258 return false;
-
259 }
-
260
-
261 Logger::Get().Log("Shader initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
262
-
263 return true;
-
264}
-
265
-
266
-
267
-
268
-
269void celshade_class::shutdown_shader()
-
270{
-
271 Logger::Get().Log("Shutting down SunLightShaderClass", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
272
-
273 // Release the light constant buffers.
-
274 if (sunlight_color_buffer_)
-
275 {
-
276 sunlight_color_buffer_->Release();
-
277 sunlight_color_buffer_ = 0;
-
278 }
-
279
-
280 if (sunlight_position_buffer_)
-
281 {
-
282 sunlight_position_buffer_->Release();
-
283 sunlight_position_buffer_ = 0;
-
284 }
-
285
-
286 // Release the light constant buffer.
-
287 if (sunlight_buffer_)
-
288 {
-
289 sunlight_buffer_->Release();
-
290 sunlight_buffer_ = 0;
-
291 }
-
292
-
293 // Release the camera constant buffer.
-
294 if (camera_buffer_)
-
295 {
-
296 camera_buffer_->Release();
-
297 camera_buffer_ = 0;
-
298 }
-
299
-
300 // Release the matrix constant buffer.
-
301 if (matrix_buffer_)
-
302 {
-
303 matrix_buffer_->Release();
-
304 matrix_buffer_ = 0;
-
305 }
-
306
-
307 // Release the sampler state.
-
308 if (sample_state_)
-
309 {
-
310 sample_state_->Release();
-
311 sample_state_ = 0;
-
312 }
-
313
-
314 // Release the layout.
-
315 if (layout_)
-
316 {
-
317 layout_->Release();
-
318 layout_ = 0;
-
319 }
-
320
-
321 // Release the pixel shader.
-
322 if (pixel_shader_)
-
323 {
-
324 pixel_shader_->Release();
-
325 pixel_shader_ = 0;
-
326 }
-
327
-
328 // Release the vertex shader.
-
329 if (vertex_shader_)
-
330 {
-
331 vertex_shader_->Release();
-
332 vertex_shader_ = 0;
-
333 }
-
334
-
335 Logger::Get().Log("SunLightShaderClass shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
336
-
337 return;
-
338}
-
339
-
340
-
341void celshade_class::output_shader_error_message(ID3D10Blob* errorMessage, HWND hwnd, WCHAR* shaderFilename)
-
342{
-
343 char* compileErrors;
-
344 unsigned __int64 bufferSize, i;
-
345 ofstream fout;
-
346
-
347
-
348 // Get a pointer to the error message text buffer.
-
349 compileErrors = (char*)(errorMessage->GetBufferPointer());
-
350
-
351 // Get the length of the message.
-
352 bufferSize = errorMessage->GetBufferSize();
-
353
-
354 // Open a file to write the error message to.
-
355 fout.open("shader-error.txt");
-
356
-
357 // Write out the error message.
-
358 for (i = 0; i < bufferSize; i++)
-
359 {
-
360 fout << compileErrors[i];
-
361 }
-
362
-
363 // Close the file.
-
364 fout.close();
-
365
-
366 // Release the error message.
-
367 errorMessage->Release();
-
368 errorMessage = 0;
-
369
-
370 // Pop a message up on the screen to notify the user to check the text file for compile errors.
-
371 MessageBox(hwnd, L"Error compiling shader. Check shader-error.txt for message.", shaderFilename, MB_OK);
-
372
-
373 return;
-
374}
-
375
-
376
-
377bool celshade_class::set_shader_parameters(
-
378 ID3D11DeviceContext* device_context,
-
379 XMMATRIX world_matrix,
-
380 XMMATRIX view_matrix,
-
381 XMMATRIX projection_matrix,
-
382 ID3D11ShaderResourceView* texture,
-
383 XMFLOAT4 ambient_color,
-
384 XMFLOAT4 diffuse_color,
-
385 XMFLOAT3 light_direction,
-
386 float sun_intensity
-
387 )
-
388{
-
389 HRESULT result;
-
390 D3D11_MAPPED_SUBRESOURCE mappedResource;
-
391 matrix_buffer_type* dataPtr;
-
392 camera_buffer_type* dataPtr2;
-
393 sun_light_buffer_type* dataPtr3;
-
394 unsigned int bufferNumber;
-
395
-
396 // Transpose the matrices to prepare them for the shader.
-
397 world_matrix = XMMatrixTranspose(world_matrix);
-
398 view_matrix = XMMatrixTranspose(view_matrix);
-
399 projection_matrix = XMMatrixTranspose(projection_matrix);
-
400
-
401 // Lock the constant buffer so it can be written to.
-
402 result = device_context->Map(matrix_buffer_, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
-
403 if (FAILED(result))
-
404 {
-
405 return false;
-
406 }
-
407
-
408 // Get a pointer to the data in the constant buffer.
-
409 dataPtr = (matrix_buffer_type*)mappedResource.pData;
-
410
-
411 // Copy the matrices into the constant buffer.
-
412 dataPtr->world = world_matrix;
-
413 dataPtr->view = view_matrix;
-
414 dataPtr->projection = projection_matrix;
-
415
-
416 // Unlock the constant buffer.
-
417 device_context->Unmap(matrix_buffer_, 0);
-
418
-
419 // Set the position of the constant buffer in the vertex shader.
-
420 bufferNumber = 0;
-
421
-
422 // Finally set the constant buffer in the vertex shader with the updated values.
-
423 device_context->VSSetConstantBuffers(bufferNumber, 1, &matrix_buffer_);
-
424
-
425 // Lock the sunlight constant buffer so it can be written to.
-
426 result = device_context->Map(sunlight_buffer_, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
-
427 if (FAILED(result))
-
428 {
-
429 return false;
-
430 }
-
431
-
432 // Get a pointer to the data in the constant buffer.
-
433 dataPtr3 = (sun_light_buffer_type*)mappedResource.pData;
-
434
-
435 // Copy the lighting variables into the constant buffer.
-
436 dataPtr3->ambient_color = ambient_color;
-
437 dataPtr3->diffuse_color = diffuse_color;
-
438 dataPtr3->sun_direction = light_direction;
-
439 dataPtr3->intensity = sun_intensity;
-
440
-
441 // Unlock the constant buffer.
-
442 device_context->Unmap(sunlight_buffer_, 0);
-
443
-
444 // Set the position of the sunlight constant buffer in the pixel shader.
-
445 bufferNumber = 0;
-
446
-
447 // Finally set the sunlight constant buffer in the pixel shader with the updated values.
-
448 device_context->PSSetConstantBuffers(bufferNumber, 1, &sunlight_buffer_);
-
449
-
450 // Set shader texture resource in the pixel shader.
-
451 device_context->PSSetShaderResources(0, 1, &texture);
-
452
-
453 return true;
-
454}
-
455
-
456void celshade_class::render_shader(ID3D11DeviceContext* deviceContext, int indexCount)
-
457{
-
458 // Set the vertex input layout.
-
459 deviceContext->IASetInputLayout(layout_);
-
460
-
461 // Set the vertex and pixel shaders that will be used to render this triangle.
-
462 deviceContext->VSSetShader(vertex_shader_, NULL, 0);
-
463 deviceContext->PSSetShader(pixel_shader_, NULL, 0);
-
464
-
465 // Set the sampler state in the pixel shader.
-
466 deviceContext->PSSetSamplers(0, 1, &sample_state_);
-
467
-
468 // render the triangle.
-
469 deviceContext->DrawIndexed(indexCount, 0, 0);
-
470
-
471 return;
-
472}
-
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
- -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:e58dad616a69c96d9d4f267450b77ba2fad9e234219e99ea6af059b4d6e16213 +size 72935 diff --git a/doxygen_docs/html/celshade__class_8h_source.html b/doxygen_docs/html/celshade__class_8h_source.html index e7c59b5..8d54f2d 100644 --- a/doxygen_docs/html/celshade__class_8h_source.html +++ b/doxygen_docs/html/celshade__class_8h_source.html @@ -1,200 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/inc/shader/celshade_class.h Source File - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
celshade_class.h
-
-
-
1#pragma once
-
2
-
3#include "Logger.h"
-
4#include <d3d11.h>
-
5#include <d3dcompiler.h>
-
6#include <directxmath.h>
-
7#include <fstream>
-
8using namespace DirectX;
-
9using namespace std;
-
10
-
- -
12{
-
13
-
14 private :
-
15 struct matrix_buffer_type
-
16 {
-
17 XMMATRIX world;
-
18 XMMATRIX view;
-
19 XMMATRIX projection;
-
20 };
-
21
-
22 struct camera_buffer_type
-
23 {
-
24 XMFLOAT3 cameraPosition;
-
25 float padding;
-
26 };
-
27
-
28 struct sun_light_buffer_type
-
29 {
-
30 XMFLOAT4 diffuse_color;
-
31 XMFLOAT4 ambient_color;
-
32 XMFLOAT3 sun_direction;
-
33 float intensity;
-
34 };
-
35
-
36
-
37public :
- - - -
41
-
42 bool initialize(ID3D11Device*, HWND);
-
43 void shutdown();
-
44 bool render(
-
45 ID3D11DeviceContext* device_context,
-
46 int index_count,
-
47 XMMATRIX world_matrix,
-
48 XMMATRIX view_matrix, XMMATRIX
-
49 projection_matrix,
-
50 ID3D11ShaderResourceView* texture,
-
51 XMFLOAT4 diffuse_color,
-
52 XMFLOAT4 ambient_color,
-
53 XMFLOAT3 sun_direction,
-
54 float intensity
-
55 );
-
56
-
57private:
-
58 bool initialize_shader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
-
59 void shutdown_shader();
-
60 void output_shader_error_message(ID3D10Blob*, HWND, WCHAR*);
-
61
-
62 bool set_shader_parameters(
-
63 ID3D11DeviceContext* device_context,
-
64 XMMATRIX world_matrix,
-
65 XMMATRIX view_matrix,
-
66 XMMATRIX projection_matrix,
-
67 ID3D11ShaderResourceView* texture,
-
68 XMFLOAT4 ambient_color,
-
69 XMFLOAT4 diffuse_color,
-
70 XMFLOAT3 light_direction,
-
71 float sun_intensity
-
72 );
-
73 void render_shader(ID3D11DeviceContext*, int);
-
74
-
75private:
-
76 ID3D11VertexShader* vertex_shader_;
-
77 ID3D11PixelShader* pixel_shader_;
-
78 ID3D11InputLayout* layout_;
-
79 ID3D11SamplerState* sample_state_;
-
80 ID3D11Buffer* matrix_buffer_;
-
81 ID3D11Buffer* camera_buffer_;
-
82 ID3D11Buffer* sunlight_buffer_;
-
83 ID3D11Buffer* sunlight_color_buffer_;
-
84 ID3D11Buffer* sunlight_position_buffer_;
-
85};
-
- -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:033ada096f8e1755db8dfa7426aa51f9cce3075878dd593bf4051a055020b20e +size 16043 diff --git a/doxygen_docs/html/class_frustum_class-members.html b/doxygen_docs/html/class_frustum_class-members.html index c9fac46..59cd2c7 100644 --- a/doxygen_docs/html/class_frustum_class-members.html +++ b/doxygen_docs/html/class_frustum_class-members.html @@ -1,122 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
FrustumClass Member List
-
-
- -

This is the complete list of members for FrustumClass, including all inherited members.

- - - - - - - - - -
CheckCube(float, float, float, float) (defined in FrustumClass)FrustumClass
CheckPoint(float, float, float) (defined in FrustumClass)FrustumClass
CheckRectangle(float, float, float, float, float, float) (defined in FrustumClass)FrustumClass
CheckSphere(float, float, float, float) (defined in FrustumClass)FrustumClass
ConstructFrustum(XMMATRIX, XMMATRIX, float) (defined in FrustumClass)FrustumClass
FrustumClass() (defined in FrustumClass)FrustumClass
FrustumClass(const FrustumClass &) (defined in FrustumClass)FrustumClass
~FrustumClass() (defined in FrustumClass)FrustumClass
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:90c4538b6c88ba4c519cbdbad67af003ec46721c5bebe086812c2d93a9f172bf +size 6679 diff --git a/doxygen_docs/html/class_frustum_class.html b/doxygen_docs/html/class_frustum_class.html index 3c9fa3f..917b2af 100644 --- a/doxygen_docs/html/class_frustum_class.html +++ b/doxygen_docs/html/class_frustum_class.html @@ -1,637 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: FrustumClass Class Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
- -
FrustumClass Class Reference
-
-
- - - - - - - - - - - - - - -

-Public Member Functions

 FrustumClass (const FrustumClass &)
 
void ConstructFrustum (XMMATRIX, XMMATRIX, float)
 
bool CheckPoint (float, float, float)
 
bool CheckCube (float, float, float, float)
 
bool CheckSphere (float, float, float, float)
 
bool CheckRectangle (float, float, float, float, float, float)
 
-

Detailed Description

-
-

Definition at line 15 of file frustumclass.h.

-

Constructor & Destructor Documentation

- -

◆ FrustumClass() [1/2]

- -
-
- - - - - - - -
FrustumClass::FrustumClass ()
-
- -

Definition at line 4 of file frustumclass.cpp.

-
5{
-
6}
-
-
-
- -

◆ FrustumClass() [2/2]

- -
-
- - - - - - - -
FrustumClass::FrustumClass (const FrustumClass & other)
-
- -

Definition at line 9 of file frustumclass.cpp.

-
10{
-
11}
-
-
-
- -

◆ ~FrustumClass()

- -
-
- - - - - - - -
FrustumClass::~FrustumClass ()
-
- -

Definition at line 14 of file frustumclass.cpp.

-
15{
-
16}
-
-
-
-

Member Function Documentation

- -

◆ CheckCube()

- -
-
- - - - - - - - - - - - - - - - - - - - - -
bool FrustumClass::CheckCube (float xCenter,
float yCenter,
float zCenter,
float radius )
-
- -

Definition at line 140 of file frustumclass.cpp.

-
141{
-
142 int i;
-
143
-
144
-
145 // Check if any one point of the cube is in the view frustum.
-
146 for (i = 0; i < 6; i++)
-
147 {
-
148 if (m_planes[i].x * (xCenter - radius) +
-
149 m_planes[i].y * (yCenter - radius) +
-
150 m_planes[i].z * (zCenter - radius) + m_planes[i].w >= 0.0f)
-
151 {
-
152 continue;
-
153 }
-
154
-
155 if (m_planes[i].x * (xCenter + radius) +
-
156 m_planes[i].y * (yCenter - radius) +
-
157 m_planes[i].z * (zCenter - radius) + m_planes[i].w >= 0.0f)
-
158 {
-
159 continue;
-
160 }
-
161
-
162 if (m_planes[i].x * (xCenter - radius) +
-
163 m_planes[i].y * (yCenter + radius) +
-
164 m_planes[i].z * (zCenter - radius) + m_planes[i].w >= 0.0f)
-
165 {
-
166 continue;
-
167 }
-
168
-
169 if (m_planes[i].x * (xCenter + radius) +
-
170 m_planes[i].y * (yCenter + radius) +
-
171 m_planes[i].z * (zCenter - radius) + m_planes[i].w >= 0.0f)
-
172 {
-
173 continue;
-
174 }
-
175
-
176 if (m_planes[i].x * (xCenter - radius) +
-
177 m_planes[i].y * (yCenter - radius) +
-
178 m_planes[i].z * (zCenter + radius) + m_planes[i].w >= 0.0f)
-
179 {
-
180 continue;
-
181 }
-
182
-
183 if (m_planes[i].x * (xCenter + radius) +
-
184 m_planes[i].y * (yCenter - radius) +
-
185 m_planes[i].z * (zCenter + radius) + m_planes[i].w >= 0.0f)
-
186 {
-
187 continue;
-
188 }
-
189
-
190 if (m_planes[i].x * (xCenter - radius) +
-
191 m_planes[i].y * (yCenter + radius) +
-
192 m_planes[i].z * (zCenter + radius) + m_planes[i].w >= 0.0f)
-
193 {
-
194 continue;
-
195 }
-
196
-
197 if (m_planes[i].x * (xCenter + radius) +
-
198 m_planes[i].y * (yCenter + radius) +
-
199 m_planes[i].z * (zCenter + radius) + m_planes[i].w >= 0.0f)
-
200 {
-
201 continue;
-
202 }
-
203
-
204 return false;
-
205 }
-
206
-
207 return true;
-
208}
-
-
-
- -

◆ CheckPoint()

- -
-
- - - - - - - - - - - - - - - - -
bool FrustumClass::CheckPoint (float x,
float y,
float z )
-
- -

Definition at line 123 of file frustumclass.cpp.

-
124{
-
125 int i;
-
126
-
127
-
128 // Check if the point is inside all six planes of the view frustum.
-
129 for (i = 0; i < 6; i++)
-
130 {
-
131 if (((m_planes[i].x * x) + (m_planes[i].y * y) + (m_planes[i].z * z) + m_planes[i].w) < 0.0f)
-
132 {
-
133 return false;
-
134 }
-
135 }
-
136
-
137 return true;
-
138}
-
-
-
- -

◆ CheckRectangle()

- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FrustumClass::CheckRectangle (float xCenter,
float yCenter,
float zCenter,
float xSize,
float ySize,
float zSize )
-
- -

Definition at line 227 of file frustumclass.cpp.

-
228{
-
229 int i;
-
230
-
231
-
232 // Check if any of the 6 planes of the rectangle are inside the view frustum.
-
233 for (i = 0; i < 6; i++)
-
234 {
-
235 if (m_planes[i].x * (xCenter - xSize) +
-
236 m_planes[i].y * (yCenter - ySize) +
-
237 m_planes[i].z * (zCenter - zSize) + m_planes[i].w >= 0.0f)
-
238 {
-
239 continue;
-
240 }
-
241
-
242 if (m_planes[i].x * (xCenter + xSize) +
-
243 m_planes[i].y * (yCenter - ySize) +
-
244 m_planes[i].z * (zCenter - zSize) + m_planes[i].w >= 0.0f)
-
245 {
-
246 continue;
-
247 }
-
248
-
249 if (m_planes[i].x * (xCenter - xSize) +
-
250 m_planes[i].y * (yCenter + ySize) +
-
251 m_planes[i].z * (zCenter - zSize) + m_planes[i].w >= 0.0f)
-
252 {
-
253 continue;
-
254 }
-
255
-
256 if (m_planes[i].x * (xCenter - xSize) +
-
257 m_planes[i].y * (yCenter - ySize) +
-
258 m_planes[i].z * (zCenter + zSize) + m_planes[i].w >= 0.0f)
-
259 {
-
260 continue;
-
261 }
-
262
-
263 if (m_planes[i].x * (xCenter + xSize) +
-
264 m_planes[i].y * (yCenter + ySize) +
-
265 m_planes[i].z * (zCenter - zSize) + m_planes[i].w >= 0.0f)
-
266 {
-
267 continue;
-
268 }
-
269
-
270 if (m_planes[i].x * (xCenter + xSize) +
-
271 m_planes[i].y * (yCenter - ySize) +
-
272 m_planes[i].z * (zCenter + zSize) + m_planes[i].w >= 0.0f)
-
273 {
-
274 continue;
-
275 }
-
276
-
277 if (m_planes[i].x * (xCenter - xSize) +
-
278 m_planes[i].y * (yCenter + ySize) +
-
279 m_planes[i].z * (zCenter + zSize) + m_planes[i].w >= 0.0f)
-
280 {
-
281 continue;
-
282 }
-
283
-
284 if (m_planes[i].x * (xCenter + xSize) +
-
285 m_planes[i].y * (yCenter + ySize) +
-
286 m_planes[i].z * (zCenter + zSize) + m_planes[i].w >= 0.0f)
-
287 {
-
288 continue;
-
289 }
-
290
-
291 return false;
-
292 }
-
293
-
294 return true;
-
295}
-
-
-
- -

◆ CheckSphere()

- -
-
- - - - - - - - - - - - - - - - - - - - - -
bool FrustumClass::CheckSphere (float xCenter,
float yCenter,
float zCenter,
float radius )
-
- -

Definition at line 210 of file frustumclass.cpp.

-
211{
-
212 int i;
-
213
-
214
-
215 // Check if the radius of the sphere is inside the view frustum.
-
216 for (i = 0; i < 6; i++)
-
217 {
-
218 if (((m_planes[i].x * xCenter) + (m_planes[i].y * yCenter) + (m_planes[i].z * zCenter) + m_planes[i].w) < -radius)
-
219 {
-
220 return false;
-
221 }
-
222 }
-
223
-
224 return true;
-
225}
-
-
-
- -

◆ ConstructFrustum()

- -
-
- - - - - - - - - - - - - - - - -
void FrustumClass::ConstructFrustum (XMMATRIX viewMatrix,
XMMATRIX projectionMatrix,
float screenDepth )
-
- -

Definition at line 18 of file frustumclass.cpp.

-
19{
-
20 XMMATRIX finalMatrix;
-
21 XMFLOAT4X4 projMatrix, matrix;
-
22 float zMinimum, r, t;
-
23
-
24 // Load the projection matrix into a XMFLOAT4X4 structure.
-
25 XMStoreFloat4x4(&projMatrix, projectionMatrix);
-
26
-
27 // Calculate the minimum Z distance in the frustum.
-
28 zMinimum = -projMatrix._43 / projMatrix._33;
-
29 r = screenDepth / (screenDepth - zMinimum);
-
30 projMatrix._33 = r;
-
31 projMatrix._43 = -r * zMinimum;
-
32
-
33 // Load the updated XMFLOAT4X4 back into the original projection matrix.
-
34 projectionMatrix = XMLoadFloat4x4(&projMatrix);
-
35
-
36 // Create the frustum matrix from the view matrix and updated projection matrix.
-
37 finalMatrix = XMMatrixMultiply(viewMatrix, projectionMatrix);
-
38
-
39 // Load the final matrix into a XMFLOAT4X4 structure.
-
40 XMStoreFloat4x4(&matrix, finalMatrix);
-
41
-
42 // Get the near plane of the frustum.
-
43 m_planes[0].x = matrix._13;
-
44 m_planes[0].y = matrix._23;
-
45 m_planes[0].z = matrix._33;
-
46 m_planes[0].w = matrix._43;
-
47
-
48 // Normalize it.
-
49 t = (float)sqrt((m_planes[0].x * m_planes[0].x) + (m_planes[0].y * m_planes[0].y) + (m_planes[0].z * m_planes[0].z));
-
50 m_planes[0].x /= t;
-
51 m_planes[0].y /= t;
-
52 m_planes[0].z /= t;
-
53 m_planes[0].w /= t;
-
54
-
55 // Calculate the far plane of frustum.
-
56 m_planes[1].x = matrix._14 - matrix._13;
-
57 m_planes[1].y = matrix._24 - matrix._23;
-
58 m_planes[1].z = matrix._34 - matrix._33;
-
59 m_planes[1].w = matrix._44 - matrix._43;
-
60
-
61 // Normalize it.
-
62 t = (float)sqrt((m_planes[1].x * m_planes[1].x) + (m_planes[1].y * m_planes[1].y) + (m_planes[1].z * m_planes[1].z));
-
63 m_planes[1].x /= t;
-
64 m_planes[1].y /= t;
-
65 m_planes[1].z /= t;
-
66 m_planes[1].w /= t;
-
67
-
68 // Calculate the left plane of frustum.
-
69 m_planes[2].x = matrix._14 + matrix._11;
-
70 m_planes[2].y = matrix._24 + matrix._21;
-
71 m_planes[2].z = matrix._34 + matrix._31;
-
72 m_planes[2].w = matrix._44 + matrix._41;
-
73
-
74 // Normalize it.
-
75 t = (float)sqrt((m_planes[2].x * m_planes[2].x) + (m_planes[2].y * m_planes[2].y) + (m_planes[2].z * m_planes[2].z));
-
76 m_planes[2].x /= t;
-
77 m_planes[2].y /= t;
-
78 m_planes[2].z /= t;
-
79 m_planes[2].w /= t;
-
80
-
81 // Calculate the right plane of frustum.
-
82 m_planes[3].x = matrix._14 - matrix._11;
-
83 m_planes[3].y = matrix._24 - matrix._21;
-
84 m_planes[3].z = matrix._34 - matrix._31;
-
85 m_planes[3].w = matrix._44 - matrix._41;
-
86
-
87 // Normalize it.
-
88 t = (float)sqrt((m_planes[3].x * m_planes[3].x) + (m_planes[3].y * m_planes[3].y) + (m_planes[3].z * m_planes[3].z));
-
89 m_planes[3].x /= t;
-
90 m_planes[3].y /= t;
-
91 m_planes[3].z /= t;
-
92 m_planes[3].w /= t;
-
93
-
94 // Calculate the top plane of frustum.
-
95 m_planes[4].x = matrix._14 - matrix._12;
-
96 m_planes[4].y = matrix._24 - matrix._22;
-
97 m_planes[4].z = matrix._34 - matrix._32;
-
98 m_planes[4].w = matrix._44 - matrix._42;
-
99
-
100 // Normalize it.
-
101 t = (float)sqrt((m_planes[4].x * m_planes[4].x) + (m_planes[4].y * m_planes[4].y) + (m_planes[4].z * m_planes[4].z));
-
102 m_planes[4].x /= t;
-
103 m_planes[4].y /= t;
-
104 m_planes[4].z /= t;
-
105 m_planes[4].w /= t;
-
106
-
107 // Calculate the bottom plane of frustum.
-
108 m_planes[5].x = matrix._14 + matrix._12;
-
109 m_planes[5].y = matrix._24 + matrix._22;
-
110 m_planes[5].z = matrix._34 + matrix._32;
-
111 m_planes[5].w = matrix._44 + matrix._42;
-
112
-
113 // Normalize it.
-
114 t = (float)sqrt((m_planes[5].x * m_planes[5].x) + (m_planes[5].y * m_planes[5].y) + (m_planes[5].z * m_planes[5].z));
-
115 m_planes[5].x /= t;
-
116 m_planes[5].y /= t;
-
117 m_planes[5].z /= t;
-
118 m_planes[5].w /= t;
-
119
-
120 return;
-
121}
-
-
-
-
The documentation for this class was generated from the following files: -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:f7e8f6545104f1883fc62ebdd53a8e70eacdcbc41c5157209ef927d661c973c4 +size 44234 diff --git a/doxygen_docs/html/class_logger-members.html b/doxygen_docs/html/class_logger-members.html index 55e881b..2020c3d 100644 --- a/doxygen_docs/html/class_logger-members.html +++ b/doxygen_docs/html/class_logger-members.html @@ -1,127 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
Logger Member List
-
-
- -

This is the complete list of members for Logger, including all inherited members.

- - - - - - - - - - - - - - -
Get()Loggerinlinestatic
GetLogBuffer() constLoggerinline
GetLogLevelInfo(LogLevel level)Loggerinlinestatic
Log(const std::string &message, const std::string &fileName, int lineNumber, LogLevel level=LogLevel::Info)Loggerinline
Log(const std::string &message, LogLevel level)Loggerinline
Logger(Logger const &)=deleteLogger
Logger()Loggerinline
LogLevel enum nameLogger
LogLevelCount (defined in Logger)Loggerstatic
m_disabledLogLevels (defined in Logger)Logger
m_logFilePath (defined in Logger)Logger
ManageLogFiles(const std::string &directoryPath)Loggerinline
operator=(Logger const &)=delete (defined in Logger)Logger
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:1f87d8972f5fe924c0f1aeb1f9df485523a375591f56d341bbade383bc285f19 +size 7980 diff --git a/doxygen_docs/html/class_logger.html b/doxygen_docs/html/class_logger.html index 59bb4ab..12f0897 100644 --- a/doxygen_docs/html/class_logger.html +++ b/doxygen_docs/html/class_logger.html @@ -1,715 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Logger Class Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
- -
Logger Class Reference
-
-
- - - - - - -

-Classes

struct  LogEntry
 
struct  LogLevelInfo
 
- - - -

-Public Types

enum class  LogLevel {
-  Info -, Warning -, Error -, Shutdown -,
-  Initialize -, Update -, Render -, Input -,
-  Physics -, Audio -, Network -, Scripting -,
-  AI -, Resource -, Memory -, Debug -,
-  Count -
- }
 
- - - - - - - - - - - - - - - -

-Public Member Functions

 Logger (Logger const &)=delete
 
-void operator= (Logger const &)=delete
 
 Logger ()
 
void Log (const std::string &message, const std::string &fileName, int lineNumber, LogLevel level=LogLevel::Info)
 
void Log (const std::string &message, LogLevel level)
 
const std::deque< LogEntry > & GetLogBuffer () const
 
void ManageLogFiles (const std::string &directoryPath)
 
- - - - - -

-Static Public Member Functions

static LoggerGet ()
 
static const LogLevelInfo GetLogLevelInfo (LogLevel level)
 
- - - - - -

-Public Attributes

bool m_disabledLogLevels [LogLevelCount]
 
std::string m_logFilePath
 
- - - -

-Static Public Attributes

static constexpr int LogLevelCount = static_cast<int>(LogLevel::Count)
 
-

Detailed Description

-
-

Definition at line 13 of file Logger.h.

-

Member Enumeration Documentation

- -

◆ LogLevel

- -
-
- - - - - -
- - - - -
enum class Logger::LogLevel
-
-strong
-
-

Enum class representing different log levels. Each log level has a corresponding color for display purposes. The last entry, Count, is used to determine the number of log levels.

- -

Definition at line 37 of file Logger.h.

-
38 {
-
39 Info,
-
40 Warning,
-
41 Error,
-
42 Shutdown,
-
43 Initialize,
-
44 Update,
-
45 Render,
-
46 Input,
-
47 Physics,
-
48 Audio,
-
49 Network,
-
50 Scripting,
-
51 AI,
-
52 Resource,
-
53 Memory,
-
54 Debug,
-
55 Count // Do not use this, it's just to get the number of log levels it must at the end
-
56 };
-
-
-
-

Constructor & Destructor Documentation

- -

◆ Logger() [1/2]

- -
-
- - - - - -
- - - - - - - -
Logger::Logger (Logger const & )
-
-delete
-
-

Delete the copy constructor and assignment operator to prevent copying.

- -
-
- -

◆ Logger() [2/2]

- -
-
- - - - - -
- - - - - - - -
Logger::Logger ()
-
-inline
-
-

Constructor for the Logger class. Initializes the logger, sets up the log file path, and manages log files.

- -

Definition at line 116 of file Logger.h.

-
117 {
-
118 char* appdata = nullptr;
-
119 size_t len;
-
120 _dupenv_s(&appdata, &len, "APPDATA");
-
121 if (appdata == nullptr)
-
122 {
-
123 m_appdataPath = "log.log";
-
124 }
-
125 else
-
126 {
-
127 m_appdataPath = appdata;
-
128 }
-
129 free(appdata);
-
130 std::string directoryPath = m_appdataPath + "\\Khaotic Engine";
-
131 CreateDirectoryA(directoryPath.c_str(), NULL);
-
132
-
133 ManageLogFiles(directoryPath);
-
134
-
135 m_logFilePath = directoryPath + "\\" + m_logFileName;
-
136
-
137 // Enable only the Error warning and shutdown log levels
-
138 for (int i = 0; i < LogLevelCount; i++)
-
139 {
-
140 m_disabledLogLevels[i] = true;
-
141
-
142 if (i == static_cast<int>(LogLevel::Error) || i == static_cast<int>(LogLevel::Warning) || i == static_cast<int>(LogLevel::Shutdown))
-
143 {
-
144 m_disabledLogLevels[i] = false;
-
145
-
146 }
-
147 }
-
148
-
149 }
-
void ManageLogFiles(const std::string &directoryPath)
Definition Logger.h:230
-
-
-
-

Member Function Documentation

- -

◆ Get()

- -
-
- - - - - -
- - - - - - - -
static Logger & Logger::Get ()
-
-inlinestatic
-
-

Get the singleton instance of the Logger class.

Returns
A reference to the Logger instance.
- -

Definition at line 20 of file Logger.h.

-
21 {
-
22 static Logger instance;
-
23 return instance;
-
24 }
- -
-
-
- -

◆ GetLogBuffer()

- -
-
- - - - - -
- - - - - - - -
const std::deque< LogEntry > & Logger::GetLogBuffer () const
-
-inline
-
-

Get the loggBuffer deque.

Returns
A constant reference to the logBuffer deque containing log entries.
- -

Definition at line 220 of file Logger.h.

-
220{ return logBuffer; }
-
-
-
- -

◆ GetLogLevelInfo()

- -
-
- - - - - -
- - - - - - - -
static const LogLevelInfo Logger::GetLogLevelInfo (LogLevel level)
-
-inlinestatic
-
-

Get the LogLevelInfo for a given log level. This function returns a LogLevelInfo struct containing the name, value, and color of the log level.

Parameters
- - -
levelThe log level for which to get the information.
-
-
-
Returns
A LogLevelInfo struct containing the information for the specified log level.
- -

Definition at line 88 of file Logger.h.

-
89 {
-
90 switch (level)
-
91 {
-
92 case LogLevel::Info: return LogLevelInfo{ "Info", 0, ImVec4(0.0f, 1.0f, 0.0f, 1.0f) };
-
93 case LogLevel::Warning: return LogLevelInfo{ "Warning", 1, ImVec4(1.0f, 1.0f, 0.0f, 1.0f) };
-
94 case LogLevel::Error: return LogLevelInfo{ "Error", 2, ImVec4(1.0f, 0.0f, 0.0f, 1.0f) };
-
95 case LogLevel::Shutdown: return LogLevelInfo{ "shutdown", 3, ImVec4(0.5f, 0.0f, 0.0f, 1.0f) };
-
96 case LogLevel::Initialize: return LogLevelInfo{ "initialize", 4, ImVec4(0.0f, 1.0f, 1.0f, 1.0f) };
-
97 case LogLevel::Update: return LogLevelInfo{ "Update", 5, ImVec4(1.0f, 0.0f, 1.0f, 1.0f) };
-
98 case LogLevel::Render: return LogLevelInfo{ "render", 6, ImVec4(1.0f, 1.0f, 1.0f, 1.0f) };
-
99 case LogLevel::Input: return LogLevelInfo{ "Input", 7, ImVec4(0.5f, 0.5f, 0.5f, 1.0f) };
-
100 case LogLevel::Physics: return LogLevelInfo{ "physics", 8, ImVec4(0.5f, 0.5f, 0.5f, 1.0f) };
-
101 case LogLevel::Audio: return LogLevelInfo{ "Audio", 9, ImVec4(0.5f, 0.5f, 0.5f, 1.0f) };
-
102 case LogLevel::Network: return LogLevelInfo{ "Network", 10, ImVec4(0.5f, 0.5f, 0.5f, 1.0f) };
-
103 case LogLevel::Scripting: return LogLevelInfo{ "Scripting", 11, ImVec4(0.5f, 0.5f, 0.5f, 1.0f) };
-
104 case LogLevel::AI: return LogLevelInfo{ "AI", 12, ImVec4(0.5f, 0.5f, 0.5f, 1.0f) };
-
105 case LogLevel::Resource: return LogLevelInfo{ "Resource", 13, ImVec4(0.5f, 0.5f, 0.5f, 1.0f) };
-
106 case LogLevel::Memory: return LogLevelInfo{ "Memory", 14, ImVec4(0.5f, 0.5f, 0.5f, 1.0f) };
-
107 case LogLevel::Debug: return LogLevelInfo{ "Debug", 15, ImVec4(0.5f, 0.5f, 0.5f, 1.0f) };
-
108 default: return LogLevelInfo{ "Unknown", 16, ImVec4(1.0f, 1.0f, 1.0f, 1.0f) };
-
109 }
-
110 }
-
-
-
- -

◆ Log() [1/2]

- -
-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - -
void Logger::Log (const std::string & message,
const std::string & fileName,
int lineNumber,
LogLevel level = LogLevel::Info )
-
-inline
-
-

Write a log message to the log file and console.

Parameters
- - - - - -
message
fileName
lineNumber
level
-
-
- -

Definition at line 158 of file Logger.h.

-
159 {
-
160
-
161 auto now = std::chrono::system_clock::now();
-
162 auto in_time_t = std::chrono::system_clock::to_time_t(now);
-
163
-
164 std::tm buf;
-
165 localtime_s(&buf, &in_time_t);
-
166
-
167 // Obtenez les millisecondes à partir de maintenant
-
168 auto ms = std::chrono::duration_cast<std::chrono::milliseconds>(now.time_since_epoch()) % 1000;
-
169
-
170 // Utilisez LogLevelToString pour obtenir la chaîne de caractères du niveau de log
-
171 std::string levelStr = GetLogLevelInfo(level).name;
-
172
-
173 std::stringstream ss;
-
174 ss << "[" << std::put_time(&buf, "%Y-%m-%d") << "] "
-
175 << "[" << std::put_time(&buf, "%X") << "." << std::setfill('0') << std::setw(3) << ms.count() << "] "
-
176 << "[" << levelStr << "] "
-
177 << "[" << fileName << ":" << lineNumber << "] "
-
178 << message;
-
179
-
180 Log(ss.str(), level);
-
181
-
182 std::ofstream file(m_logFilePath, std::ios::app);
-
183 if (file.is_open())
-
184 {
-
185 file << ss.str() << std::endl;
-
186 file.close();
-
187 }
-
188 }
-
static const LogLevelInfo GetLogLevelInfo(LogLevel level)
Definition Logger.h:88
-
void Log(const std::string &message, const std::string &fileName, int lineNumber, LogLevel level=LogLevel::Info)
Definition Logger.h:158
-
-
-
- -

◆ Log() [2/2]

- -
-
- - - - - -
- - - - - - - - - - - -
void Logger::Log (const std::string & message,
LogLevel level )
-
-inline
-
-

Write a log message to the log buffer. This is the fonction wich is used to send log messages to the gui. It's using a buffer to store the log messages with a maximum size. The buffer default size is 100 messages. This limit can be changed by changing the logBufferSize variable. But it is not recommended to change it because it can cause performance issues.

Parameters
- - - -
messageThe log message to write.
levelThe log level for the message.
-
-
- -

Definition at line 200 of file Logger.h.

-
201 {
-
202
-
203 // Si le niveau de log est désactivé, ne faites rien
-
204 if (m_disabledLogLevels[GetLogLevelInfo(level).value])
-
205 {
-
206 return;
-
207 }
-
208
-
209 if (logBuffer.size() >= logBufferSize)
-
210 {
-
211 logBuffer.pop_front();
-
212 }
-
213 logBuffer.push_back({ message, level });
-
214 }
-
-
-
- -

◆ ManageLogFiles()

- -
-
- - - - - -
- - - - - - - -
void Logger::ManageLogFiles (const std::string & directoryPath)
-
-inline
-
-

This function manages log files in the specified directory. It checks for log files with the ".log" extension, Then it keeps only the three most recent log files, deleting the oldest ones if there are more than three. It also creates a new log file for the current execution with a timestamp in its name.

Parameters
- - -
directoryPath
-
-
- -

Definition at line 230 of file Logger.h.

-
231 {
-
232 std::vector<std::filesystem::path> logFiles;
-
233
-
234 // Parcourez tous les fichiers dans le dossier
-
235 for (const auto& entry : std::filesystem::directory_iterator(directoryPath))
-
236 {
-
237 // Si le fichier est un fichier de log, ajoutez-le à la liste
-
238 if (entry.path().extension() == ".log")
-
239 {
-
240 logFiles.push_back(entry.path());
-
241 }
-
242 }
-
243
-
244 // Si nous avons plus de trois fichiers de log, supprimez le plus ancien
-
245 while (logFiles.size() >= 3)
-
246 {
-
247 // Triez les fichiers par date de modification, le plus ancien en premier
-
248 std::sort(logFiles.begin(), logFiles.end(), [](const std::filesystem::path& a, const std::filesystem::path& b)
-
249 {
-
250 return std::filesystem::last_write_time(a) < std::filesystem::last_write_time(b);
-
251 });
-
252
-
253 // Supprimez le fichier le plus ancien
-
254 std::filesystem::remove(logFiles[0]);
-
255
-
256 // Supprimez-le de la liste
-
257 logFiles.erase(logFiles.begin());
-
258 }
-
259
-
260 // Créez un nouveau fichier de log pour cette exécution
-
261 auto now = std::chrono::system_clock::now();
-
262 auto in_time_t = std::chrono::system_clock::to_time_t(now);
-
263 std::tm buf;
-
264 localtime_s(&buf, &in_time_t);
-
265
-
266 std::stringstream ss;
-
267 ss << "Khaotic_log_" << std::put_time(&buf, "%Y_%m_%d_%Hh%Mm%Ss") << ".log";
-
268 m_logFileName = ss.str();
-
269 }
-
-
-
-

Member Data Documentation

- -

◆ LogLevelCount

- -
-
- - - - - -
- - - - -
int Logger::LogLevelCount = static_cast<int>(LogLevel::Count)
-
-staticconstexpr
-
- -

Definition at line 59 of file Logger.h.

- -
-
- -

◆ m_disabledLogLevels

- -
-
- - - - -
bool Logger::m_disabledLogLevels[LogLevelCount]
-
- -

Definition at line 271 of file Logger.h.

- -
-
- -

◆ m_logFilePath

- -
-
- - - - -
std::string Logger::m_logFilePath
-
- -

Definition at line 272 of file Logger.h.

- -
-
-
The documentation for this class was generated from the following file: -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:21155566b628f466d292c886bbe38f6c8bab56e7191519d5a0a8b0a791a74922 +size 50446 diff --git a/doxygen_docs/html/class_logger.js b/doxygen_docs/html/class_logger.js index 7a2dc48..ef2568e 100644 --- a/doxygen_docs/html/class_logger.js +++ b/doxygen_docs/html/class_logger.js @@ -1,30 +1,3 @@ -var class_logger = -[ - [ "LogEntry", "struct_logger_1_1_log_entry.html", null ], - [ "LogLevelInfo", "struct_logger_1_1_log_level_info.html", null ], - [ "LogLevel", "class_logger.html#ac744681e23720966b5f430ec2060da36", [ - [ "Info", "class_logger.html#ac744681e23720966b5f430ec2060da36a4059b0251f66a18cb56f544728796875", null ], - [ "Warning", "class_logger.html#ac744681e23720966b5f430ec2060da36a0eaadb4fcb48a0a0ed7bc9868be9fbaa", null ], - [ "Error", "class_logger.html#ac744681e23720966b5f430ec2060da36a902b0d55fddef6f8d651fe1035b7d4bd", null ], - [ "Shutdown", "class_logger.html#ac744681e23720966b5f430ec2060da36a1a4ebb180ba59b067782515ffee6e975", null ], - [ "Initialize", "class_logger.html#ac744681e23720966b5f430ec2060da36a223e06f5cb15fc701ea1e686f7934f4f", null ], - [ "Update", "class_logger.html#ac744681e23720966b5f430ec2060da36a06933067aafd48425d67bcb01bba5cb6", null ], - [ "Render", "class_logger.html#ac744681e23720966b5f430ec2060da36a5e520da5341f2fec6d3bbfe7ef357922", null ], - [ "Input", "class_logger.html#ac744681e23720966b5f430ec2060da36a324118a6721dd6b8a9b9f4e327df2bf5", null ], - [ "Physics", "class_logger.html#ac744681e23720966b5f430ec2060da36a50ae99e9c35446c2580e4b540b0fd104", null ], - [ "Audio", "class_logger.html#ac744681e23720966b5f430ec2060da36ab22f0418e8ac915eb66f829d262d14a2", null ], - [ "Network", "class_logger.html#ac744681e23720966b5f430ec2060da36aeec89088ee408b80387155272b113256", null ], - [ "Scripting", "class_logger.html#ac744681e23720966b5f430ec2060da36a66f1aed235ade25269a561e81cbbb43a", null ], - [ "AI", "class_logger.html#ac744681e23720966b5f430ec2060da36a0a40e3c91a3a55c9a37428c6d194d0e5", null ], - [ "Resource", "class_logger.html#ac744681e23720966b5f430ec2060da36abe8545ae7ab0276e15898aae7acfbd7a", null ], - [ "Memory", "class_logger.html#ac744681e23720966b5f430ec2060da36a4789f23283b3a61f858b641a1bef19a3", null ], - [ "Debug", "class_logger.html#ac744681e23720966b5f430ec2060da36aa603905470e2a5b8c13e96b579ef0dba", null ], - [ "Count", "class_logger.html#ac744681e23720966b5f430ec2060da36ae93f994f01c537c4e2f7d8528c3eb5e9", null ] - ] ], - [ "Logger", "class_logger.html#a0d21ab21689125fbb5e91584e4f37baa", null ], - [ "Logger", "class_logger.html#abc41bfb031d896170c7675fa96a6b30c", null ], - [ "GetLogBuffer", "class_logger.html#a0fc50378d880b648733da39e61fa51e3", null ], - [ "Log", "class_logger.html#a94f47ba0ef38ea7bcf1056f64d2645e4", null ], - [ "Log", "class_logger.html#ac9b431db882705fe2f33687938874676", null ], - [ "ManageLogFiles", "class_logger.html#a62b3e15fa3c170e5090a846fd0e9283e", null ] -]; \ No newline at end of file +version https://git-lfs.github.com/spec/v1 +oid sha256:540c9a5b83598cff3d5c76f1a24362017cd83a1a83a764d940b2a25945a3ca0a +size 2661 diff --git a/doxygen_docs/html/class_model_list_class-members.html b/doxygen_docs/html/class_model_list_class-members.html index 59f0840..3a0d7dc 100644 --- a/doxygen_docs/html/class_model_list_class-members.html +++ b/doxygen_docs/html/class_model_list_class-members.html @@ -1,121 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
ModelListClass Member List
-
-
- -

This is the complete list of members for ModelListClass, including all inherited members.

- - - - - - - - -
GetData(int, float &, float &, float &) (defined in ModelListClass)ModelListClass
GetModelCount() (defined in ModelListClass)ModelListClass
Initialize(int) (defined in ModelListClass)ModelListClass
ModelListClass() (defined in ModelListClass)ModelListClass
ModelListClass(const ModelListClass &) (defined in ModelListClass)ModelListClass
Shutdown() (defined in ModelListClass)ModelListClass
~ModelListClass() (defined in ModelListClass)ModelListClass
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:8c8982aa0ee5a95d18feb8e4524c3221f4a8386872790d435796667bb7a027c7 +size 6396 diff --git a/doxygen_docs/html/class_model_list_class.html b/doxygen_docs/html/class_model_list_class.html index 3376ca6..76d63d5 100644 --- a/doxygen_docs/html/class_model_list_class.html +++ b/doxygen_docs/html/class_model_list_class.html @@ -1,335 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: ModelListClass Class Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
- -
ModelListClass Class Reference
-
-
- - - - - - - - - - - - -

-Public Member Functions

 ModelListClass (const ModelListClass &)
 
void Initialize (int)
 
void Shutdown ()
 
int GetModelCount ()
 
void GetData (int, float &, float &, float &)
 
-

Detailed Description

-
-

Definition at line 15 of file Modellistclass.h.

-

Constructor & Destructor Documentation

- -

◆ ModelListClass() [1/2]

- -
-
- - - - - - - -
ModelListClass::ModelListClass ()
-
- -

Definition at line 4 of file Modellistclass.cpp.

-
5{
-
6 m_ModelInfoList = 0;
-
7}
-
-
-
- -

◆ ModelListClass() [2/2]

- -
-
- - - - - - - -
ModelListClass::ModelListClass (const ModelListClass & other)
-
- -

Definition at line 10 of file Modellistclass.cpp.

-
11{
-
12}
-
-
-
- -

◆ ~ModelListClass()

- -
-
- - - - - - - -
ModelListClass::~ModelListClass ()
-
- -

Definition at line 15 of file Modellistclass.cpp.

-
16{
-
17}
-
-
-
-

Member Function Documentation

- -

◆ GetData()

- -
-
- - - - - - - - - - - - - - - - - - - - - -
void ModelListClass::GetData (int index,
float & positionX,
float & positionY,
float & positionZ )
-
- -

Definition at line 63 of file Modellistclass.cpp.

-
64{
-
65 positionX = m_ModelInfoList[index].positionX;
-
66 positionY = m_ModelInfoList[index].positionY;
-
67 positionZ = m_ModelInfoList[index].positionZ;
-
68 return;
-
69}
-
-
-
- -

◆ GetModelCount()

- -
-
- - - - - - - -
int ModelListClass::GetModelCount ()
-
- -

Definition at line 58 of file Modellistclass.cpp.

-
59{
-
60 return m_modelCount;
-
61}
-
-
-
- -

◆ Initialize()

- -
-
- - - - - - - -
void ModelListClass::Initialize (int numModels)
-
- -

Definition at line 20 of file Modellistclass.cpp.

-
21{
-
22
-
23 int i;
-
24
-
25 // Store the number of models.
-
26 m_modelCount = numModels;
-
27
-
28 // Create a list array of the model information.
-
29 m_ModelInfoList = new ModelInfoType[m_modelCount];
-
30
-
31 // Seed the random generator with the current time.
-
32 srand((unsigned int)time(NULL));
-
33
-
34 // Go through all the models and randomly generate the position.
-
35 for (i = 0; i < m_modelCount; i++)
-
36 {
-
37 // Generate a random position in front of the viewer for the mode.
-
38 m_ModelInfoList[i].positionX = (((float)rand() - (float)rand()) / RAND_MAX) * 10.0f;
-
39 m_ModelInfoList[i].positionY = (((float)rand() - (float)rand()) / RAND_MAX) * 10.0f;
-
40 m_ModelInfoList[i].positionZ = ((((float)rand() - (float)rand()) / RAND_MAX) * 10.0f) + 5.0f;
-
41 }
-
42
-
43 return;
-
44}
-
-
-
- -

◆ Shutdown()

- -
-
- - - - - - - -
void ModelListClass::Shutdown ()
-
- -

Definition at line 46 of file Modellistclass.cpp.

-
47{
-
48 // Release the model information list.
-
49 if (m_ModelInfoList)
-
50 {
-
51 delete[] m_ModelInfoList;
-
52 m_ModelInfoList = 0;
-
53 }
-
54
-
55 return;
-
56}
-
-
-
-
The documentation for this class was generated from the following files: -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:a6fdf688ddff770ca54b26d6557e335d67fb0f10b659b5e37709bb8b245cff6d +size 18740 diff --git a/doxygen_docs/html/class_skybox-members.html b/doxygen_docs/html/class_skybox-members.html index eec0188..5ec0a8c 100644 --- a/doxygen_docs/html/class_skybox-members.html +++ b/doxygen_docs/html/class_skybox-members.html @@ -1,120 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
Skybox Member List
-
-
- -

This is the complete list of members for Skybox, including all inherited members.

- - - - - - - -
ConstructSkybox(application_class *app)Skybox
Initialize(d_3d_class *d3dClassRef)Skybox
Skybox()Skybox
textures (defined in Skybox)Skybox
translations (defined in Skybox)Skybox
~Skybox() (defined in Skybox)Skybox
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:e9e93fcb74be04b9ea829e46d719d0ea525218f46d0beadb11c71d9ec31d8b6c +size 5789 diff --git a/doxygen_docs/html/class_skybox.html b/doxygen_docs/html/class_skybox.html index ac32119..fba964f 100644 --- a/doxygen_docs/html/class_skybox.html +++ b/doxygen_docs/html/class_skybox.html @@ -1,330 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Skybox Class Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
- -
Skybox Class Reference
-
-
- - - - - - - - - -

-Public Member Functions

 Skybox ()
 Constructor for the Skybox class. Initializes the skybox with a reference to the d_3d_class instance.
 
void Initialize (d_3d_class *d3dClassRef)
 
objectConstructSkybox (application_class *app)
 
- - - - - -

-Public Attributes

std::vector< ID3D11ShaderResourceView * > textures
 
std::vector< XMMATRIX > translations
 
-

Detailed Description

-
-

Definition at line 7 of file Skybox.h.

-

Constructor & Destructor Documentation

- -

◆ Skybox()

- -
-
- - - - - - - -
Skybox::Skybox ()
-
- -

Constructor for the Skybox class. Initializes the skybox with a reference to the d_3d_class instance.

- -

Definition at line 3 of file Skybox.cpp.

-
4{
-
5}
-
-
-
- -

◆ ~Skybox()

- -
-
- - - - - - - -
Skybox::~Skybox ()
-
- -

Definition at line 7 of file Skybox.cpp.

-
8{
-
9 for (auto& texture : textures)
-
10 {
-
11 if (texture)
-
12 {
-
13 texture->Release();
-
14 texture = nullptr;
-
15 }
-
16 }
-
17 textures.clear();
-
18 translations.clear();
-
19}
-
-
-
-

Member Function Documentation

- -

◆ ConstructSkybox()

- -
-
- - - - - - - -
object * Skybox::ConstructSkybox (application_class * app)
-
-

Create the skybox object.

Parameters
- - -
app
-
-
-
Returns
Pointer to the created skybox object.
- -

Definition at line 26 of file Skybox.cpp.

-
27{
-
28 Logger::Get().Log("Construct skybox", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
29
-
30 char modelFilename[128];
-
31 strcpy_s(modelFilename, "assets/Model/OBJ/skysphere.obj");
-
32
-
33 std::vector<std::wstring> skyboxTextures = {
-
34 L"assets/Skybox/skybox.png",
-
35 };
-
36
-
37 TextureContainer SkyboxTextures;
-
38
-
39 // Load the textures
-
40 for (const auto& textureFilename : skyboxTextures)
-
41 {
-
42 ID3D11ShaderResourceView* texture = nullptr;
-
43 HRESULT result = DirectX::CreateWICTextureFromFile(m_d3dClassRef->get_device(), m_d3dClassRef->get_device_context(), textureFilename.c_str(), nullptr, &texture);
-
44 if (FAILED(result))
-
45 {
-
46 Logger::Get().Log("Failed to load texture: " + std::string(textureFilename.begin(), textureFilename.end()), __FILE__, __LINE__, Logger::LogLevel::Error);
-
47 return nullptr;
-
48 }
-
49 SkyboxTextures.diffuse.push_back(texture);
-
50
-
51 }
-
52
-
53 // Create the model object
-
54 m_Skybox = new object(*app);
-
55 HRESULT result = m_Skybox->Initialize(m_d3dClassRef->get_device(), m_d3dClassRef->get_device_context(), modelFilename, SkyboxTextures);
-
56 if (!result)
-
57 {
-
58 Logger::Get().Log("Could not initialize the skybox model object", __FILE__, __LINE__, Logger::LogLevel::Error);
-
59 delete m_Skybox;
-
60 return nullptr;
-
61 }
-
62 m_Skybox->SetTranslateMatrix(XMMatrixTranslation(0.0f, 0.0f, 0.0f)); // Set the initial translation of the skybox
-
63 m_Skybox->SetActiveShader(ShaderType::SKYBOX);
-
64
-
65 return m_Skybox; // Return the constructed skybox object
-
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
-
ID3D11Device * get_device()
Gets the Direct3D device.
-
ID3D11DeviceContext * get_device_context()
Gets the Direct3D device context.
- - -
-
-
- -

◆ Initialize()

- -
-
- - - - - - - -
void Skybox::Initialize (d_3d_class * d3dClassRef)
-
-

Initializes the Skybox with the given d_3d_class reference.

Parameters
- - -
d3dClassRef
-
-
- -

Definition at line 21 of file Skybox.cpp.

-
22{
-
23 m_d3dClassRef = d3dClassRef;
-
24}
-
-
-
-

Member Data Documentation

- -

◆ textures

- -
-
- - - - -
std::vector<ID3D11ShaderResourceView*> Skybox::textures
-
- -

Definition at line 34 of file Skybox.h.

- -
-
- -

◆ translations

- -
-
- - - - -
std::vector<XMMATRIX> Skybox::translations
-
- -

Definition at line 35 of file Skybox.h.

- -
-
-
The documentation for this class was generated from the following files: -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:a4a2d40ea160686a1b8814d9c4f8f600515878d081ed97a9027d9f6e884fa611 +size 22786 diff --git a/doxygen_docs/html/class_skybox.js b/doxygen_docs/html/class_skybox.js index 3730685..d2694df 100644 --- a/doxygen_docs/html/class_skybox.js +++ b/doxygen_docs/html/class_skybox.js @@ -1,6 +1,3 @@ -var class_skybox = -[ - [ "Skybox", "class_skybox.html#a77a92db4492ed94ed4bd101b05ffb1f4", null ], - [ "ConstructSkybox", "class_skybox.html#a583a0753edede891759ecb62cf82a86f", null ], - [ "Initialize", "class_skybox.html#af048306ba3fc893e485393452e8af429", null ] -]; \ No newline at end of file +version https://git-lfs.github.com/spec/v1 +oid sha256:14c8223fadd4fd09a26888c25ef358f826187fd9462d41bc9e40d2a096806382 +size 272 diff --git a/doxygen_docs/html/classalpha__map__shader__class-members.html b/doxygen_docs/html/classalpha__map__shader__class-members.html index 0dcb42e..1b02ee8 100644 --- a/doxygen_docs/html/classalpha__map__shader__class-members.html +++ b/doxygen_docs/html/classalpha__map__shader__class-members.html @@ -1,120 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
alpha_map_shader_class Member List
-
-
- -

This is the complete list of members for alpha_map_shader_class, including all inherited members.

- - - - - - - -
alpha_map_shader_class() (defined in alpha_map_shader_class)alpha_map_shader_class
alpha_map_shader_class(const alpha_map_shader_class &) (defined in alpha_map_shader_class)alpha_map_shader_class
initialize(ID3D11Device *, HWND) (defined in alpha_map_shader_class)alpha_map_shader_class
render(ID3D11DeviceContext *, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView *, ID3D11ShaderResourceView *, ID3D11ShaderResourceView *) (defined in alpha_map_shader_class)alpha_map_shader_class
shutdown() (defined in alpha_map_shader_class)alpha_map_shader_class
~alpha_map_shader_class() (defined in alpha_map_shader_class)alpha_map_shader_class
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:6d11db8e970dbe07cf8b5428dc95342cb89bbe2a1e6ff63cd017ae9c75dc5762 +size 6484 diff --git a/doxygen_docs/html/classalpha__map__shader__class.html b/doxygen_docs/html/classalpha__map__shader__class.html index b600cd2..3b8c8fd 100644 --- a/doxygen_docs/html/classalpha__map__shader__class.html +++ b/doxygen_docs/html/classalpha__map__shader__class.html @@ -1,358 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: alpha_map_shader_class Class Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
- -
alpha_map_shader_class Class Reference
-
-
- - - - - - - - - - -

-Public Member Functions

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

Detailed Description

-
-

Definition at line 20 of file alpha_map_shader_class.h.

-

Constructor & Destructor Documentation

- -

◆ alpha_map_shader_class() [1/2]

- -
-
- - - - - - - -
alpha_map_shader_class::alpha_map_shader_class ()
-
- -

Definition at line 4 of file alpha_map_shader_class.cpp.

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

◆ alpha_map_shader_class() [2/2]

- -
-
- - - - - - - -
alpha_map_shader_class::alpha_map_shader_class (const alpha_map_shader_class & other)
-
- -

Definition at line 14 of file alpha_map_shader_class.cpp.

-
15{
-
16}
-
-
-
- -

◆ ~alpha_map_shader_class()

- -
-
- - - - - - - -
alpha_map_shader_class::~alpha_map_shader_class ()
-
- -

Definition at line 19 of file alpha_map_shader_class.cpp.

-
20{
-
21}
-
-
-
-

Member Function Documentation

- -

◆ initialize()

- -
-
- - - - - - - - - - - -
bool alpha_map_shader_class::initialize (ID3D11Device * device,
HWND hwnd )
-
- -

Definition at line 24 of file alpha_map_shader_class.cpp.

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

Definition at line 70 of file alpha_map_shader_class.cpp.

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

◆ shutdown()

- -
-
- - - - - - - -
void alpha_map_shader_class::shutdown ()
-
- -

Definition at line 61 of file alpha_map_shader_class.cpp.

-
62{
-
63 // shutdown the vertex and pixel shaders as well as the related objects.
-
64 shutdown_shader();
-
65
-
66 return;
-
67}
-
-
-
-
The documentation for this class was generated from the following files: -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:593d2554ad3928083da47316c31fa2195182d43d43af3e0c1f442fd4b71de8fa +size 23120 diff --git a/doxygen_docs/html/classapplication__class-members.html b/doxygen_docs/html/classapplication__class-members.html index 4e4911f..3140431 100644 --- a/doxygen_docs/html/classapplication__class-members.html +++ b/doxygen_docs/html/classapplication__class-members.html @@ -1,181 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
application_class Member List
-
-
- -

This is the complete list of members for application_class, including all inherited members.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
add_cube()application_class
add_kobject(std::wstring &filepath)application_class
application_class()application_class
construct_frustum()application_class
create_big_cube(int side_count)application_class
delete_entity_by_id(int entity_id)application_class
delete_terrain()application_class
frame(input_class *)application_classvirtual
generate_terrain()application_class
get_aspect_ratio() constapplication_classinline
get_back_buffer_srv() constapplication_classinline
get_can_fixed_update() constapplication_classinline
get_direct_3d() (defined in application_class)application_classvirtual
get_entity_manager() constapplication_classinline
get_fps() constapplication_classinline
get_frustum() constapplication_classinline
get_frustum_tolerance() constapplication_classinline
get_hwnd() constapplication_classinline
get_light_color(int index)application_class
get_light_position(int index)application_class
get_lights() constapplication_classinline
get_model_cache()application_classinline
get_object_id() constapplication_classinline
get_physics() constapplication_classinline
get_physics_tick_rate() constapplication_classinline
get_reflection_texture() constapplication_classinline
get_refraction_texture() constapplication_classinline
get_render_count() constapplication_classinline
get_render_texture() constapplication_classinline
get_scene_texture() constapplication_classinline
get_screen_height() constapplication_class
get_screen_width() constapplication_class
get_should_quit() constapplication_classinline
get_speed() constapplication_classinline
get_stats() constapplication_classinline
get_sun_light() constapplication_classinline
get_terrain_entity_count()application_class
get_vsync() constapplication_classinline
get_w_folder() constapplication_classinline
get_window_size() constapplication_classinline
initialize(int screen_width, int screen_height, HWND hwdn, bool is_vulkan)application_classvirtual
is_windowed() constapplication_classinline
physics_thread_function()application_class
set_can_fixed_update(bool can_fixed_update)application_classinline
set_cel_shading(const bool enable)application_classinline
set_direct_3d(d_3d_class *direct_3d) (defined in application_class)application_classinline
set_frustum(const frustum &frustum)application_classinline
set_frustum_tolerance(const float frustum_tolerance)application_classinline
set_hwnd(HWND hwnd)application_classinline
set_light_color(int index, XMVECTOR color)application_class
set_light_position(int index, XMVECTOR position)application_class
set_object_id(int object_id)application_classinline
set_path(WCHAR *path)application_classinline
set_physics_tick_rate(int physics_tick_rate)application_classinline
set_render_count(const int render_count)application_classinline
set_screen_height(int screen_height)application_class
set_screen_width(int screen_width)application_class
set_should_quit(const bool should_quit)application_classinline
set_speed(const float speed)application_classinline
set_vsync(bool vsync)application_classinline
set_w_folder(const std::filesystem::path &w_folder)application_classinline
set_window_size(const ImVec2 size)application_classinline
set_windowed(bool windowed)application_classinline
shutdown()application_class
textures (defined in application_class)application_class
update_stats_after_modification()application_class
~application_class() (defined in application_class)application_class
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:ac83da9a98b8b9932985c88c8f71a66afcc2b6e7cb05a1adf88408b3d88c2543 +size 24732 diff --git a/doxygen_docs/html/classapplication__class.html b/doxygen_docs/html/classapplication__class.html index 65c6c7e..6c963c8 100644 --- a/doxygen_docs/html/classapplication__class.html +++ b/doxygen_docs/html/classapplication__class.html @@ -1,3567 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: application_class Class Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
- -
application_class Class Reference
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

-Public Member Functions

 application_class ()
 Constructor for the application class. Initializes member variables and sets up the application.
 
virtual d_3d_classget_direct_3d ()
 
void set_direct_3d (d_3d_class *direct_3d)
 
render_texture_classget_scene_texture () const
 
render_texture_classget_render_texture () const
 
render_texture_classget_refraction_texture () const
 
render_texture_classget_reflection_texture () const
 
bool create_big_cube (int side_count)
 Create a big cube with a specified number of little cube per sides.
 
virtual bool initialize (int screen_width, int screen_height, HWND hwdn, bool is_vulkan)
 
void shutdown ()
 
virtual bool frame (input_class *)
 Run the main loop of the application. This function will handle the main loop, including rendering and updating the application.
 
void physics_thread_function ()
 Thread function for handling physics updates. this function will run in a separate thread to handle physics updates at a fixed rate (50 fps by default).
 
int get_physics_tick_rate () const
 
void set_physics_tick_rate (int physics_tick_rate)
 
int get_screen_width () const
 
void set_screen_width (int screen_width)
 
int get_screen_height () const
 
void set_screen_height (int screen_height)
 
float get_speed () const
 
void set_speed (const float speed)
 
void add_cube ()
 
void delete_entity_by_id (int entity_id)
 
void add_kobject (std::wstring &filepath)
 
void set_path (WCHAR *path)
 
void set_w_folder (const std::filesystem::path &w_folder)
 
std::filesystem::path get_w_folder () const
 
int get_terrain_entity_count ()
 
int get_object_id () const
 
void set_object_id (int object_id)
 
void generate_terrain ()
 
void delete_terrain ()
 
XMVECTOR get_light_position (int index)
 
XMVECTOR get_light_color (int index)
 
void set_light_position (int index, XMVECTOR position)
 
void set_light_color (int index, XMVECTOR color)
 
std::vector< light_class * > get_lights () const
 
light_classget_sun_light () const
 
bool get_should_quit () const
 
void set_should_quit (const bool should_quit)
 
void set_cel_shading (const bool enable)
 
void set_vsync (bool vsync)
 
bool get_vsync () const
 
HWND get_hwnd () const
 
void set_hwnd (HWND hwnd)
 
bool is_windowed () const
 
void set_windowed (bool windowed)
 
void set_window_size (const ImVec2 size)
 
ImVec2 get_window_size () const
 
float get_aspect_ratio () const
 
physicsget_physics () const
 
frustum get_frustum () const
 
void set_frustum (const frustum &frustum)
 
void construct_frustum ()
 
int get_render_count () const
 
void set_render_count (const int render_count)
 
float get_frustum_tolerance () const
 
void set_frustum_tolerance (const float frustum_tolerance)
 
bool get_can_fixed_update () const
 
void set_can_fixed_update (bool can_fixed_update)
 
ID3D11ShaderResourceView * get_back_buffer_srv () const
 
statsget_stats () const
 
fps_classget_fps () const
 
ecs::EntityManagerget_entity_manager () const
 
void update_stats_after_modification ()
 
std::map< std::string, std::shared_ptr< model_class > > & get_model_cache ()
 
- - - -

-Public Attributes

std::vector< ID3D11ShaderResourceView * > textures
 
-

Detailed Description

-
-

Definition at line 78 of file application_class.h.

-

Constructor & Destructor Documentation

- -

◆ application_class()

- -
-
- - - - - - - -
application_class::application_class ()
-
- -

Constructor for the application class. Initializes member variables and sets up the application.

- -

Definition at line 6 of file application_class.cpp.

-
6 : should_quit_(false)
-
7{
-
8 direct_3d_ = nullptr;
-
9 camera_ = nullptr;
-
10 model_ = nullptr;
-
11 bitmap_ = nullptr;
-
12 sprite_ = nullptr;
-
13 timer_ = nullptr;
-
14 mouse_strings_ = nullptr;
-
15 font_shader_ = nullptr;
-
16 font_ = nullptr;
-
17 fps_ = nullptr;
-
18 fps_string_ = nullptr;
-
19 shader_manager_ = nullptr;
-
20 render_count_string_ = nullptr;
-
21 model_list_ = nullptr;
-
22 position_ = nullptr;
-
23 display_plane_ = nullptr;
-
24 bath_model_ = nullptr;
-
25 water_model_ = nullptr;
-
26 m_light_ = nullptr;
-
27 refraction_texture_ = nullptr;
-
28 reflection_texture_ = nullptr;
-
29 scene_texture_ = nullptr;
-
30 physics_ = nullptr;
-
31 skybox_.clear();
-
32 lights_.clear();
-
33 sun_light_ = nullptr;
-
34 swap_chain_ = nullptr;
-
35 ground_model_ = nullptr;
-
36 wall_model_ = nullptr;
-
37 hwnd_ = nullptr;
-
38 base_view_matrix_ = XMMatrixIdentity();
-
39 render_texture_ = nullptr;
-
40 screen_width_ = 0;
-
41 screen_height_ = 0;
-
42 num_lights_ = 0;
-
43 water_height_ = 0.0f;
-
44 water_translation_ = 0.0f;
-
45 true_light_position_ = XMFLOAT3(0.0f, 0.0f, 0.0f);
-
46 light_model_ = nullptr;
-
47 render_count_ = 0;
-
48 tab_was_pressed_ = false;
-
49}
-
-
-
- -

◆ ~application_class()

- -
-
- - - - - - - -
application_class::~application_class ()
-
- -

Definition at line 51 of file application_class.cpp.

-
52{
-
53 should_quit_ = true;
-
54 culling_active_ = false;
-
55
-
56 // Joindre les threads pour s'assurer qu'ils se terminent correctement
-
57 if (physics_thread_.joinable())
-
58 {
-
59 physics_thread_.join();
-
60 }
-
61
-
62 if (culling_thread_.joinable())
-
63 {
-
64 culling_thread_.join();
-
65 }
-
66
-
67}
-
-
-
-

Member Function Documentation

- -

◆ add_cube()

- -
-
- - - - - - - -
void application_class::add_cube ()
-
-

Add a basic cube to the scene.

- -

Definition at line 1464 of file application_class.cpp.

-
1465{
-
1466 std::lock_guard<std::mutex> lock(objects_mutex_);
-
1467 Logger::Get().Log("Adding cube", __FILE__, __LINE__);
-
1468
-
1469 std::string model_name = "assets/Model/TXT/cube.txt";
-
1470 std::shared_ptr<model_class> sharedModel;
-
1471
-
1472 auto it = g_model_cache.find(model_name);
-
1473 if (it != g_model_cache.end())
-
1474 {
-
1475 Logger::Get().Log("Using cached model: " + model_name, __FILE__, __LINE__);
-
1476 sharedModel = it->second;
-
1477 }
-
1478 else
-
1479 {
-
1480 TextureContainer cube_textures;
-
1481 cube_textures.diffusePaths.push_back(L"assets/Texture/Bricks2K.png");
-
1482 cube_textures.normalPaths.push_back(L"assets/Texture/BricksNRM2K.png");
-
1483 cube_textures.specularPaths.push_back(L"assets/Texture/BricksGLOSS2K.png");
-
1484
-
1485 char model_filename[128];
-
1486 strcpy_s(model_filename, model_name.c_str());
-
1487
-
1488 auto newModel = std::make_shared<model_class>();
-
1489 newModel->PreloadTextures(direct_3d_->get_device(), direct_3d_->get_device_context(), cube_textures);
-
1490 if (!newModel->Initialize(direct_3d_->get_device(), direct_3d_->get_device_context(), model_filename, cube_textures)) {
-
1491 Logger::Get().Log("Failed to initialize cube model", __FILE__, __LINE__, Logger::LogLevel::Error);
-
1492 return;
-
1493 }
-
1494
-
1495 g_model_cache[model_name] = newModel;
-
1496 sharedModel = newModel;
-
1497 Logger::Get().Log("Added cube model to cache: " + model_name, __FILE__, __LINE__);
-
1498
-
1499
-
1500 if (entity_manager_)
-
1501 {
-
1502 auto entity = entity_manager_->CreateEntity();
-
1503
-
1504 auto identity = entity->AddComponent<ecs::IdentityComponent>(object_id_++);
-
1505 identity->SetName("Cube");
-
1506 identity->SetType(ecs::ObjectType::Cube);
-
1507
-
1508 auto transform = entity->AddComponent<ecs::TransformComponent>();
-
1509 transform->SetPosition(XMVectorSet(0.0f, 10.0f, 0.0f, 0.0f));
-
1510 transform->SetScale(XMVectorSet(1.0f, 1.0f, 1.0f, 0.0f));
-
1511 transform->UpdateWorldMatrix();
-
1512
-
1513 auto render = entity->AddComponent<ecs::RenderComponent>();
-
1514 render->InitializeWithModel(sharedModel);
-
1515
-
1516 auto shader = entity->AddComponent<ecs::ShaderComponent>();
-
1517 shader->SetActiveShader(ecs::ShaderType::TEXTURE);
-
1518 }
-
1519 }
-
1520
- -
1522 Logger::Get().Log("Cube added successfully", __FILE__, __LINE__, Logger::LogLevel::Info);
-
1523
-
1524}
-
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
- -
ID3D11Device * get_device()
Gets the Direct3D device.
-
ID3D11DeviceContext * get_device_context()
Gets the Direct3D device context.
- -
void SetName(const std::string &name)
- - -
void SetActiveShader(ShaderType shader)
- -
void SetPosition(XMVECTOR position)
- -
-
-
- -

◆ add_kobject()

- -
-
- - - - - - - -
void application_class::add_kobject (std::wstring & filepath)
-
-

Create a new entity with the specified model path.

Parameters
- - -
filepath
-
-
- -

Definition at line 1378 of file application_class.cpp.

-
1379{
-
1380 std::lock_guard<std::mutex> lock(objects_mutex_);
-
1381 Logger::Get().Log("Adding object", __FILE__, __LINE__);
-
1382
-
1383 char modelFilename[128];
-
1384 TextureContainer KobjectsTextures;
-
1385 filesystem::path p(filepath);
-
1386 string filename = p.stem().string();
-
1387
-
1388 size_t convertedChars = 0;
-
1389 (void)wcstombs_s(&convertedChars, modelFilename, sizeof(modelFilename), filepath.c_str(), _TRUNCATE);
-
1390
-
1391 filesystem::current_path(w_folder_);
-
1392
-
1393 // Liste des fichiers de texture
-
1394 std::vector<std::wstring> kobjTexture = {
-
1395 L"assets/Texture/Bricks2K.png",
-
1396 L"assets/Texture/BricksNRM2K.png",
-
1397 L"assets/Texture/BricksGLOSS2K.png"
-
1398 };
-
1399
-
1400 // Configurer les chemins des textures dans le conteneur
-
1401 KobjectsTextures.diffusePaths.push_back(kobjTexture[0]);
-
1402 if (kobjTexture.size() > 1) KobjectsTextures.normalPaths.push_back(kobjTexture[1]);
-
1403 if (kobjTexture.size() > 2) KobjectsTextures.specularPaths.push_back(kobjTexture[2]);
-
1404
-
1405 // Vérifier si le modèle existe déjà dans le cache
-
1406 std::string modelKey = std::string(modelFilename);
-
1407 std::shared_ptr<model_class> sharedModel;
-
1408
-
1409 auto it = g_model_cache.find(modelKey);
-
1410 if (it != g_model_cache.end()) {
-
1411 // Utiliser le modèle existant du cache
-
1412 Logger::Get().Log("Using cached model for " + modelKey, __FILE__, __LINE__);
-
1413 sharedModel = it->second;
-
1414 }
-
1415 else {
-
1416 // Créer un nouveau modèle
-
1417 sharedModel = std::make_shared<model_class>();
-
1418
-
1419 // Précharger les textures
-
1420 sharedModel->PreloadTextures(direct_3d_->get_device(), direct_3d_->get_device_context(), KobjectsTextures);
-
1421
-
1422 // Initialiser le modèle
-
1423 if (!sharedModel->Initialize(direct_3d_->get_device(), direct_3d_->get_device_context(), modelFilename, KobjectsTextures)) {
-
1424 Logger::Get().Log("Failed to initialize model for object: " + modelKey, __FILE__, __LINE__, Logger::LogLevel::Error);
-
1425 return;
-
1426 }
-
1427
-
1428 // Ajouter le modèle au cache
-
1429 g_model_cache[modelKey] = sharedModel;
-
1430 Logger::Get().Log("Added model to cache: " + modelKey, __FILE__, __LINE__);
-
1431 }
-
1432
-
1433 // Créer une nouvelle entité
-
1434 auto entity = entity_manager_->CreateEntity();
-
1435
-
1436 // Ajouter un composant d'identité
-
1437 auto identity = entity->AddComponent<ecs::IdentityComponent>(object_id_++);
-
1438 identity->SetName(filename);
-
1439 identity->SetType(ecs::ObjectType::Unknown);
-
1440
-
1441 // Ajouter un composant de transformation
-
1442 auto transform = entity->AddComponent<ecs::TransformComponent>();
-
1443 transform->SetPosition(XMVectorSet(0.0f, 50.0f, 0.0f, 0.0f));
-
1444 transform->SetScale(XMVectorSet(1.0f, 1.0f, 1.0f, 0.0f));
-
1445 transform->UpdateWorldMatrix();
-
1446
-
1447 // Ajouter un composant de rendu avec le modèle partagé
-
1448 auto render = entity->AddComponent<ecs::RenderComponent>();
-
1449 render->InitializeWithModel(sharedModel);
-
1450
-
1451 // Ajouter un composant de shader
-
1452 auto shader = entity->AddComponent<ecs::ShaderComponent>();
-
1453 shader->SetActiveShader(ecs::ShaderType::LIGHTING);
-
1454
-
1455 // Stocker le chemin du modèle
-
1456 auto modelPath = entity->AddComponent<ecs::ModelPathComponent>();
-
1457 modelPath->SetPath(filepath);
-
1458
-
1459 Logger::Get().Log("ECS entity created with ID: " + std::to_string(identity->GetId()), __FILE__, __LINE__);
-
1460
- -
1462}
- -
void SetPath(const std::wstring &path)
-
-
-
- -

◆ construct_frustum()

- -
-
- - - - - - - -
void application_class::construct_frustum ()
-
-

Construct the frustum for culling. This function will calculate the frustum based on the current camera view and projection matrices.

- -

Definition at line 1940 of file application_class.cpp.

-
1941{
-
1942 XMMATRIX projectionMatrix = direct_3d_->get_projection_matrix();
-
1943 XMMATRIX viewMatrix;
-
1944 active_camera_->get_view_matrix(viewMatrix);
-
1945
-
1946 frustum_culling_.ConstructFrustum(screen_depth, projectionMatrix, viewMatrix);
-
1947}
-
XMMATRIX get_view_matrix(XMMATRIX &view_matrix) const
Retrieves the current view matrix of the camera.
-
XMMATRIX get_projection_matrix() const
Definition d_3d_class.h:109
-
void ConstructFrustum(float screenDepth, XMMATRIX projectionMatrix, XMMATRIX viewMatrix)
Definition frustum.cpp:3
-
-
-
- -

◆ create_big_cube()

- -
-
- - - - - - - -
bool application_class::create_big_cube (int side_count)
-
- -

Create a big cube with a specified number of little cube per sides.

-
Parameters
- - -
side_countThe number of cubes per sides for the big cube.
-
-
-
Returns
True if the cube was created successfully, false otherwise.
- -

Definition at line 2003 of file application_class.cpp.

-
2004{
-
2005 std::string modelName = "assets/Model/TXT/cube.txt";
-
2006 std::shared_ptr<model_class> sharedModel;
-
2007
-
2008 // Vérifier si le modèle existe déjà
-
2009 auto it = g_model_cache.find(modelName);
-
2010 if (it != g_model_cache.end()) {
-
2011 sharedModel = it->second;
-
2012 } else {
-
2013 // copy le string en char*
-
2014 char model_file[128];
-
2015 size_t convertedChars = 0;
-
2016 (void)wcstombs_s(&convertedChars, model_file, sizeof(model_file), std::wstring(modelName.begin(), modelName.end()).c_str(), _TRUNCATE);
-
2017
-
2018 // Créer et initialiser le modèle si non trouvé
-
2019 auto newModel = std::make_shared<model_class>();
-
2020 TextureContainer textures;
-
2021 textures.diffusePaths.push_back(L"assets/Texture/Bricks2K.png");
-
2022 textures.normalPaths.push_back(L"assets/Texture/BricksNRM2K.png");
-
2023 textures.specularPaths.push_back(L"assets/Texture/BricksGLOSS2K.png");
-
2024 newModel->PreloadTextures(direct_3d_->get_device(), direct_3d_->get_device_context(), textures);
-
2025 if (!newModel->Initialize(direct_3d_->get_device(), direct_3d_->get_device_context(),model_file, textures)) {
-
2026 Logger::Get().Log("Impossible d'initialiser le modèle du gros cube", __FILE__, __LINE__, Logger::LogLevel::Error);
-
2027 return false;
-
2028 }
-
2029 g_model_cache[modelName] = newModel;
-
2030 sharedModel = newModel;
-
2031 }
-
2032
-
2033 for (int x = 0; x < side_count; x++) {
-
2034 for (int y = 0; y < side_count; y++) {
-
2035 for (int z = 0; z < side_count; z++) {
-
2036 // Créer une entité
-
2037 auto entity = entity_manager_->CreateEntity();
-
2038
-
2039 // Ajouter un composant d'identité
-
2040 auto identity = entity->AddComponent<ecs::IdentityComponent>(object_id_++);
-
2041 identity->SetName("CubePart_" + std::to_string(x) + "_" + std::to_string(y) + "_" + std::to_string(z));
-
2042 identity->SetType(ecs::ObjectType::Terrain);
-
2043
-
2044 // Ajouter un composant de transformation
-
2045 auto transform = entity->AddComponent<ecs::TransformComponent>();
-
2046 transform->SetPosition(XMVectorSet(static_cast<float>(x), static_cast<float>(y), static_cast<float>(z), 0.0f));
-
2047 transform->SetScale(XMVectorSet(1.0f, 1.0f, 1.0f, 0.0f));
-
2048 transform->UpdateWorldMatrix();
-
2049
-
2050 // Ajouter un composant de rendu
-
2051 auto render = entity->AddComponent<ecs::RenderComponent>();
-
2052 render->InitializeWithModel(sharedModel);
-
2053
-
2054 // Ajouter un composant de shader
-
2055 auto shader = entity->AddComponent<ecs::ShaderComponent>();
-
2056 shader->SetActiveShader(ecs::ShaderType::LIGHTING);
-
2057 }
-
2058 }
-
2059 }
-
2060
- -
2062
-
2063 return true;
-
2064}
-
-
-
- -

◆ delete_entity_by_id()

- -
-
- - - - - - - -
void application_class::delete_entity_by_id (int entity_id)
-
-

Delete an entity by its ID.

Parameters
- - -
entity_idThe ID of the entity to delete.
-
-
- -

Definition at line 1526 of file application_class.cpp.

-
1527{
-
1528 std::lock_guard<std::mutex> lock(objects_mutex_);
-
1529 Logger::Get().Log("Deleting entity with ID: " + std::to_string(entity_id), __FILE__, __LINE__, Logger::LogLevel::Info);
-
1530
-
1531 if (entity_manager_) {
-
1532 // Rechercher l'entité avec l'ID spécifié via le composant IdentityComponent
-
1533 auto entities_with_identity = entity_manager_->GetEntitiesWithComponent<ecs::IdentityComponent>();
-
1534 for (auto& entity : entities_with_identity) {
-
1535 auto identity = entity->GetComponent<ecs::IdentityComponent>();
-
1536 if (identity && identity->GetId() == entity_id) {
-
1537 // Supprimer l'entité
-
1538 entity_manager_->DestroyEntity(entity->GetID());
-
1539 Logger::Get().Log("Entity with ID " + std::to_string(entity_id) + " successfully deleted", __FILE__, __LINE__, Logger::LogLevel::Info);
-
1540 break;
-
1541 }
-
1542 }
-
1543 }
-
1544
- -
1546}
-
-
-
- -

◆ delete_terrain()

- -
-
- - - - - - - -
void application_class::delete_terrain ()
-
-

Delete the flat terrain/Big Cubes from the scene.

- -

Definition at line 1548 of file application_class.cpp.

-
1549{
-
1550 std::lock_guard<std::mutex> lock(objects_mutex_);
-
1551 Logger::Get().Log("Deleting terrain", __FILE__, __LINE__, Logger::LogLevel::Info);
-
1552
-
1553 // Get all entities with the Terrain type
-
1554 auto entities_with_terrain = entity_manager_->GetEntitiesWithComponent<ecs::IdentityComponent>();
-
1555 for (auto& entity : entities_with_terrain) {
-
1556 auto identity = entity->GetComponent<ecs::IdentityComponent>();
-
1557 if (identity && identity->GetType() == ecs::ObjectType::Terrain) {
-
1558 // Destroy the entity
-
1559 entity_manager_->DestroyEntity(entity->GetID());
-
1560 Logger::Get().Log("Terrain entity with ID " + std::to_string(identity->GetId()) + " successfully deleted", __FILE__, __LINE__, Logger::LogLevel::Info);
-
1561 }
-
1562 }
-
1563
- -
1565}
-
-
-
- -

◆ frame()

- -
-
- - - - - -
- - - - - - - -
bool application_class::frame (input_class * Input)
-
-virtual
-
- -

Run the main loop of the application. This function will handle the main loop, including rendering and updating the application.

-
Returns
True if the application should continue running, false if it should quit.
- -

Definition at line 760 of file application_class.cpp.

-
761{
-
762 stats_->reset_draw_call_count();
-
763
-
764 int mouseX, mouseY, currentMouseX, currentMouseY;
-
765 bool result, leftMouseDown, rightMouseDown, buttonQ, buttonD, buttonZ, buttonS, buttonA, buttonE, scrollUp, scrollDown;
-
766 float rotationY, rotationX, positionX, positionY, positionZ;
-
767 static float textureTranslation = 0.0f;
-
768
-
769 float frameTime;
-
770
-
771 static int lastMouseX = 0, lastMouseY = 0;
-
772
-
773 static float rotation = 360.0f;
-
774 static float x = 0.0f;
-
775 static float y = 3.0f;
-
776 static float z = 0.0f;
-
777
-
778 // Update the system stats.
-
779 timer_->Frame();
-
780
-
781 // Get the current frame time.
-
782 frameTime = timer_->GetTime();
-
783
-
784 // Check if the user pressed escape and wants to exit the application.
-
785 if (Input->IsEscapePressed())
-
786 {
-
787 Logger::Get().Log("User pressed escape, exiting application", __FILE__, __LINE__, Logger::LogLevel::Input);
-
788 should_quit_ = true;
-
789 }
-
790
-
791 // Get the location of the mouse from the input object,
-
792 Input->GetMouseLocation(mouseX, mouseY);
-
793
-
794 // Check if the mouse has been pressed.
-
795 leftMouseDown = Input->IsLeftMousePressed();
-
796 rightMouseDown = Input->IsRightMousePressed();
-
797
-
798 currentMouseX = mouseX;
-
799
-
800 int deltaX = currentMouseX - lastMouseX; // Calculate the mouse movement.
-
801 lastMouseX = currentMouseX; // Update the last mouse position for the next frame
-
802
-
803 currentMouseY = mouseY;
-
804
-
805 int deltaY = currentMouseY - lastMouseY; // Calculate the mouse movement.
-
806 lastMouseY = currentMouseY; // Update the last mouse position for the next frame
-
807
-
808 // Set the frame time for calculating the updated position.
-
809 position_->SetFrameTime(timer_->GetTime());
-
810
-
811 position_->TurnMouse((float)deltaX, (float)deltaY, 0.1f, rightMouseDown);
-
812
-
813 // Get the current view point rotation.
-
814 position_->GetRotation(rotationY, rotationX);
-
815
-
816 scrollUp = Input->IsScrollUp();
-
817 scrollDown = Input->IsScrollDown();
-
818
-
819 // Check if the a(q), d, w(z), s, q(a), e have been pressed, if so move the camera accordingly.
-
820 buttonQ = Input->IsAPressed();
-
821 buttonD = Input->IsDPressed();
-
822 buttonZ = Input->IsWPressed();
-
823 buttonS = Input->IsSPressed();
-
824 buttonA = Input->IsQPressed();
-
825 buttonE = Input->IsEPressed();
-
826 position_->MoveCamera(buttonZ, buttonS, buttonQ, buttonD, buttonE, buttonA, scrollUp, scrollDown, rightMouseDown);
-
827 position_->GetPosition(positionX, positionY, positionZ);
-
828
-
829 XMFLOAT3 dir = sun_light_->GetDirection();
-
830 float pitch = asinf(-dir.y) * (180.0f / XM_PI); // en degrés
-
831 float yaw = atan2f(dir.x, dir.z) * (180.0f / XM_PI); // en degrés
-
832 float roll = 0.0f;
-
833
-
834 if (Input->is_key_pressed(DIK_TAB)) {
-
835 if (!tab_was_pressed_) {
-
836 // Alterner la caméra active
-
837 if (active_camera_ == camera_)
-
838 active_camera_ = sun_camera_;
-
839 else
-
840 active_camera_ = camera_;
-
841 tab_was_pressed_ = true;
-
842 }
-
843 } else {
-
844 tab_was_pressed_ = false;
-
845 }
-
846
-
847 if (active_camera_ == camera_) {
-
848 // Update the camera position and rotation based on the position class.
-
849 camera_->set_position(positionX, positionY, positionZ);
-
850 camera_->set_rotation(rotationX, rotationY, 0.0f);
-
851 } else {
-
852 // Update the sun camera position and rotation based on the light position.
-
853 sun_camera_->set_position(sun_light_->GetPosition().x, sun_light_->GetPosition().y, sun_light_->GetPosition().z);
-
854 sun_camera_->set_rotation(pitch, yaw, roll);
-
855
-
856 // sun_camera_->set_position(positionX, positionY, positionZ);
-
857 // sun_camera_->set_rotation(rotationX, rotationY, 0.0f);
-
858 }
-
859
-
860 active_camera_->render();
-
861
-
862 // render the static graphics scene.
-
863 result = render(rotation, x, y, z, textureTranslation);
-
864 if (!result)
-
865 {
-
866 Logger::Get().Log("Could not render the graphics scene", __FILE__, __LINE__, Logger::LogLevel::Error);
-
867 return false;
-
868 }
-
869
-
870 // Update the frames per second each frame.
-
871 result = update_fps();
-
872 if (!result)
-
873 {
-
874 Logger::Get().Log("Could not update the frames per second", __FILE__, __LINE__, Logger::LogLevel::Error);
-
875 return false;
-
876 }
-
877
-
878 // Update the rotation variable each frame.
-
879 rotation -= 0.0174532925f * speed_;
-
880 if (rotation < 0.0f)
-
881 {
-
882 rotation += 360.0f;
-
883 }
-
884
-
885 // Update the position of the water to simulate motion.
-
886 water_translation_ += 0.001f;
-
887 if (water_translation_ > 1.0f)
-
888 {
-
889 water_translation_ -= 1.0f;
-
890 }
-
891
-
892 // render the refraction of the scene to a texture.
-
893 result = render_refraction_to_texture();
-
894 if (!result)
-
895 {
-
896 return false;
-
897 }
-
898
-
899 // render the reflection of the scene to a texture.
-
900 result = render_reflection_to_texture();
-
901 if (!result)
-
902 {
-
903 return false;
-
904 }
-
905
-
906 inputs_.key_left = Input->IsLeftArrowPressed();
-
907 inputs_.key_right = Input->IsRightArrowPressed();
-
908 inputs_.key_up = Input->IsUpArrowPressed();
-
909 inputs_.key_down = Input->IsDownArrowPressed();
-
910
-
911 // render the scene to a render texture.
-
912 result = render_scene_to_texture(rotation);
-
913 if (!result)
-
914 {
-
915 Logger::Get().Log("Could not render the scene to the render texture", __FILE__, __LINE__, Logger::LogLevel::Error);
-
916 return false;
-
917 }
-
918
-
919 // Update the mouse strings each frame.
-
920 result = update_mouse_strings(mouseX, mouseY, leftMouseDown);
-
921 if (!result)
-
922 {
-
923 Logger::Get().Log("Could not update the mouse strings", __FILE__, __LINE__, Logger::LogLevel::Error);
-
924 return false;
-
925 }
-
926
-
927 // Update the sprite object using the frame time.
-
928 sprite_->Update(frameTime);
-
929
-
930 // Increment the texture translation.
-
931 textureTranslation += 0.01f;
-
932 if (textureTranslation > 1.0f)
-
933 {
-
934 textureTranslation -= 1.0f;
-
935 }
-
936
-
937 return true;
-
938}
-
void render()
Updates the camera's view matrix based on its position and rotation. This method recalculates the vie...
-
void set_rotation(float, float, float)
Sets the rotation of the camera in 3D space.
-
void set_position(float, float, float)
Sets the position of the camera in 3D space.
-
-
-
- -

◆ generate_terrain()

- -
-
- - - - - - - -
void application_class::generate_terrain ()
-
-

Generate a flat terrain for test purposes using plane entities.

- -

Definition at line 1293 of file application_class.cpp.

-
1294{
-
1295 Logger::Get().Log("Génération du terrain avec ECS", __FILE__, __LINE__, Logger::LogLevel::Info);
-
1296
-
1297 // delete previous terrain if it exists
- -
1299
-
1300 // Dimensions du terrain
-
1301 float scaleX = 10.0f;
-
1302 float scaleY = 1.0f;
-
1303 float scaleZ = 10.0f;
-
1304 int gridSizeX = 20;
-
1305 int gridSizeZ = 20;
-
1306
-
1307 // Vérifier si le modèle existe déjà dans le cache
-
1308 std::string modelName = "assets/Model/OBJ/plane.obj";
-
1309 std::shared_ptr<model_class> sharedModel;
-
1310
-
1311 auto it = g_model_cache.find(modelName);
-
1312 if (it != g_model_cache.end()) {
-
1313 // Utiliser le modèle existant du cache
-
1314 Logger::Get().Log("Using cached model for terrain: " + modelName, __FILE__, __LINE__);
-
1315 sharedModel = it->second;
-
1316 }
-
1317 else {
-
1318 // Créer un conteneur de textures partagé
-
1319 TextureContainer textureContainer;
-
1320 textureContainer.diffusePaths.push_back(L"assets/Texture/Bricks2K.png");
-
1321 textureContainer.normalPaths.push_back(L"assets/Texture/BricksNRM2K.png");
-
1322 textureContainer.specularPaths.push_back(L"assets/Texture/BricksGLOSS2K.png");
-
1323
-
1324 // Créer et initialiser le modèle si non trouvé
-
1325 char modelFilename[128];
-
1326 strcpy_s(modelFilename, modelName.c_str());
-
1327
-
1328 auto newModel = std::make_shared<model_class>();
-
1329 newModel->PreloadTextures(direct_3d_->get_device(), direct_3d_->get_device_context(), textureContainer);
-
1330
-
1331 if (!newModel->Initialize(direct_3d_->get_device(), direct_3d_->get_device_context(), modelFilename, textureContainer)) {
-
1332 Logger::Get().Log("Impossible d'initialiser le modèle du terrain", __FILE__, __LINE__, Logger::LogLevel::Error);
-
1333 return;
-
1334 }
-
1335
-
1336 // Ajouter le modèle au cache
-
1337 g_model_cache[modelName] = newModel;
-
1338 sharedModel = newModel;
-
1339 Logger::Get().Log("Added terrain model to cache: " + modelName, __FILE__, __LINE__);
-
1340 }
-
1341
-
1342 // Vérifier si l'entity manager est disponible
-
1343 if (entity_manager_) {
-
1344 // Générer les tuiles de terrain avec le système ECS
-
1345 for (int i = 0; i < gridSizeX; i++) {
-
1346 for (int j = 0; j < gridSizeZ; j++) {
-
1347 // Créer une entité
-
1348 auto entity = entity_manager_->CreateEntity();
-
1349
-
1350 // Ajouter un composant d'identité
-
1351 auto identity = entity->AddComponent<ecs::IdentityComponent>(object_id_++);
-
1352 identity->SetName("TerrainTile_" + std::to_string(i) + "_" + std::to_string(j));
-
1353 identity->SetType(ecs::ObjectType::Terrain);
-
1354
-
1355 // Ajouter un composant de transformation
-
1356 auto transform = entity->AddComponent<ecs::TransformComponent>();
-
1357 transform->SetPosition(XMVectorSet(i * scaleX, -12.0f, j * scaleZ, 0.0f));
-
1358 transform->SetScale(XMVectorSet(scaleX, scaleY, scaleZ, 0.0f));
-
1359 transform->UpdateWorldMatrix();
-
1360
-
1361 // Ajouter un composant de rendu
-
1362 auto render = entity->AddComponent<ecs::RenderComponent>();
-
1363 render->InitializeWithModel(sharedModel);
-
1364
-
1365 // Ajouter un composant de shader
-
1366 auto shader = entity->AddComponent<ecs::ShaderComponent>();
-
1367 shader->SetActiveShader(ecs::ShaderType::SUNLIGHT);
-
1368 }
-
1369 }
-
1370 }
-
1371
- -
1373
-
1374 int totalTiles = gridSizeX * gridSizeZ;
-
1375 Logger::Get().Log("Terrain généré avec " + std::to_string(totalTiles) + " tuiles", __FILE__, __LINE__, Logger::LogLevel::Info);
-
1376}
- -
-
-
- -

◆ get_aspect_ratio()

- -
-
- - - - - -
- - - - - - - -
float application_class::get_aspect_ratio () const
-
-inline
-
-

Get the aspect ratio of the screen.

Returns
The aspect ratio as a float.
- -

Definition at line 355 of file application_class.h.

-
355{ return static_cast<float>(screen_width_) / static_cast<float>(screen_height_); };
-
-
-
- -

◆ get_back_buffer_srv()

- -
-
- - - - - -
- - - - - - - -
ID3D11ShaderResourceView * application_class::get_back_buffer_srv () const
-
-inline
-
-

Get the Direct3D back buffer texture.

Returns
Pointer to the Direct3D back buffer texture.
- -

Definition at line 422 of file application_class.h.

-
422{return back_buffer_srv_;};
-
-
-
- -

◆ get_can_fixed_update()

- -
-
- - - - - -
- - - - - - - -
bool application_class::get_can_fixed_update () const
-
-inline
-
-

Get the flag indicating whether the application can perform fixed updates.

Returns
True if fixed updates are allowed, false otherwise.
- -

Definition at line 411 of file application_class.h.

-
411{ return can_fixed_update_; };
-
-
-
- -

◆ get_direct_3d()

- -
-
- - - - - -
- - - - - - - -
d_3d_class * application_class::get_direct_3d ()
-
-virtual
-
- -

Definition at line 1278 of file application_class.cpp.

-
1279{
-
1280 return direct_3d_;
-
1281}
-
-
-
- -

◆ get_entity_manager()

- -
-
- - - - - -
- - - - - - - -
ecs::EntityManager * application_class::get_entity_manager () const
-
-inline
-
-

Get the entity manager instance.

Returns
Pointer to the entity manager instance.
- -

Definition at line 439 of file application_class.h.

-
439{ return entity_manager_.get(); };
-
-
-
- -

◆ get_fps()

- -
-
- - - - - -
- - - - - - - -
fps_class * application_class::get_fps () const
-
-inline
-
-

Get the FPS manager instance.

Returns
Pointer to the FPS manager instance.
- -

Definition at line 433 of file application_class.h.

-
433{ return fps_; };
-
-
-
- -

◆ get_frustum()

- -
-
- - - - - -
- - - - - - - -
frustum application_class::get_frustum () const
-
-inline
-
-

Get the frustum used for culling.

Returns
The frustum used for culling as a frustum object.
- -

Definition at line 371 of file application_class.h.

-
371{ return frustum_culling_; };
-
-
-
- -

◆ get_frustum_tolerance()

- -
-
- - - - - -
- - - - - - - -
float application_class::get_frustum_tolerance () const
-
-inline
-
-

Get the frustum culling tolerance. This value is used to determine how much an object must be outside the frustum to be culled.

Returns
The frustum culling tolerance as a float.
- -

Definition at line 399 of file application_class.h.

-
399{ return frustum_culling_tolerance_; };
-
-
-
- -

◆ get_hwnd()

- -
-
- - - - - -
- - - - - - - -
HWND application_class::get_hwnd () const
-
-inline
-
-

Get the handle to the window.

Returns
The handle to the window as an HWND.
- -

Definition at line 321 of file application_class.h.

-
321{ return hwnd_; };
-
-
-
- -

◆ get_light_color()

- -
-
- - - - - - - -
XMVECTOR application_class::get_light_color (int index)
-
-

Get the color for a specific light index.

Parameters
- - -
index
-
-
-
Returns
The color of the light as an XMVECTOR.
- -

Definition at line 1722 of file application_class.cpp.

-
1723{
-
1724 //convert to XMVECTOR
-
1725 XMVECTOR lightColor = XMVectorSet(lights_[index]->GetDiffuseColor().x, lights_[index]->GetDiffuseColor().y, lights_[index]->GetDiffuseColor().z, 1.0f);
-
1726
-
1727 return lightColor;
-
1728}
-
-
-
- -

◆ get_light_position()

- -
-
- - - - - - - -
XMVECTOR application_class::get_light_position (int index)
-
-

Get the position for a specific light index.

Parameters
- - -
index
-
-
-
Returns
The position of the light as an XMVECTOR.
- -

Definition at line 1730 of file application_class.cpp.

-
1731{
-
1732 //convert to XMVECTOR
-
1733 XMVECTOR lightPosition = XMVectorSet(lights_[index]->GetPosition().x, lights_[index]->GetPosition().y, lights_[index]->GetPosition().z, 1.0f);
-
1734
-
1735 return lightPosition;
-
1736}
-
-
-
- -

◆ get_lights()

- -
-
- - - - - -
- - - - - - - -
std::vector< light_class * > application_class::get_lights () const
-
-inline
-
-

Get all the lights in the scene.

Returns
A vector of pointers to light_class objects representing the lights in the scene.
- -

Definition at line 271 of file application_class.h.

-
271{ return lights_; };
-
-
-
- -

◆ get_model_cache()

- -
-
- - - - - -
- - - - - - - -
std::map< std::string, std::shared_ptr< model_class > > & application_class::get_model_cache ()
-
-inline
-
-

Get the global model cache. The model cache is a static map that stores shared pointers to model_class objects. This cache is used to avoid loading the same model multiple times.

Returns
A reference to the global model cache as a map of strings to shared pointers of model_class.
- -

Definition at line 450 of file application_class.h.

-
450{ return g_model_cache; }
-
-
-
- -

◆ get_object_id()

- -
-
- - - - - -
- - - - - - - -
int application_class::get_object_id () const
-
-inline
-
-

Get the object ID.

Returns
The object ID as an integer.
- -

Definition at line 227 of file application_class.h.

-
227{ return object_id_; };
-
-
-
- -

◆ get_physics()

- -
-
- - - - - -
- - - - - - - -
physics * application_class::get_physics () const
-
-inline
-
-

Get the physics engine instance.

Returns
Pointer to the physics engine instance.
- -

Definition at line 361 of file application_class.h.

-
361{ return physics_; };
-
-
-
- -

◆ get_physics_tick_rate()

- -
-
- - - - - -
- - - - - - - -
int application_class::get_physics_tick_rate () const
-
-inline
-
-

Get the physics tick rate.

Returns
The physics tick rate in frames per second as an integer.
- -

Definition at line 146 of file application_class.h.

-
146{ return physics_tick_rate_; };
-
-
-
- -

◆ get_reflection_texture()

- -
-
- - - - - -
- - - - - - - -
render_texture_class * application_class::get_reflection_texture () const
-
-inline
-
-

Get the reflection texture used for rendering reflections.

Returns
Pointer to the reflection texture.
- -

Definition at line 109 of file application_class.h.

-
109{ return reflection_texture_; };
-
-
-
- -

◆ get_refraction_texture()

- -
-
- - - - - -
- - - - - - - -
render_texture_class * application_class::get_refraction_texture () const
-
-inline
-
-

Get the refraction texture used for rendering water effects.

Returns
Pointer to the refraction texture.
- -

Definition at line 104 of file application_class.h.

-
104{ return refraction_texture_; };
-
-
-
- -

◆ get_render_count()

- -
-
- - - - - -
- - - - - - - -
int application_class::get_render_count () const
-
-inline
-
-

Get the number of objects rendered in the current frame.

Returns
- -

Definition at line 388 of file application_class.h.

-
388{ return render_count_; };
-
-
-
- -

◆ get_render_texture()

- -
-
- - - - - -
- - - - - - - -
render_texture_class * application_class::get_render_texture () const
-
-inline
-
-

Get the display plane used for rendering.

Returns
Pointer to the display plane.
- -

Definition at line 99 of file application_class.h.

-
99{ return render_texture_; };
-
-
-
- -

◆ get_scene_texture()

- -
-
- - - - - -
- - - - - - - -
render_texture_class * application_class::get_scene_texture () const
-
-inline
-
-

Get the scene texture, which is used for rendering the scene.

Returns
Pointer to the scene texture.
- -

Definition at line 94 of file application_class.h.

-
94{ return scene_texture_; };
-
-
-
- -

◆ get_screen_height()

- -
-
- - - - - - - -
int application_class::get_screen_height () const
-
-

Get the screen height.

Returns
The height of the screen in pixels as an integer.
- -

Definition at line 1288 of file application_class.cpp.

-
1289{
-
1290 return GetSystemMetrics(SM_CYSCREEN);
-
1291}
-
-
-
- -

◆ get_screen_width()

- -
-
- - - - - - - -
int application_class::get_screen_width () const
-
-

Get the screen width.

Returns
The width of the screen in pixels as an integer.
- -

Definition at line 1283 of file application_class.cpp.

-
1284{
-
1285 return GetSystemMetrics(SM_CXSCREEN);
-
1286}
-
-
-
- -

◆ get_should_quit()

- -
-
- - - - - -
- - - - - - - -
bool application_class::get_should_quit () const
-
-inline
-
-

Get the should_quit flag. This flag indicates whether the application should quit.

Returns
The should_quit flag as a boolean.
- -

Definition at line 283 of file application_class.h.

-
283{ return should_quit_; };
-
-
-
- -

◆ get_speed()

- -
-
- - - - - -
- - - - - - - -
float application_class::get_speed () const
-
-inline
-
-

Get the speed value. An old value used for the demo spinning object. This value is not used in the current implementation.

Returns
The speed value as a float.
- -

Definition at line 180 of file application_class.h.

-
180{ return speed_; };
-
-
-
- -

◆ get_stats()

- -
-
- - - - - -
- - - - - - - -
stats * application_class::get_stats () const
-
-inline
-
-

Get the Stats manager instance.

Returns
Pointer to the Stats manager instance.
- -

Definition at line 428 of file application_class.h.

-
428{ return stats_; };
-
-
-
- -

◆ get_sun_light()

- -
-
- - - - - -
- - - - - - - -
light_class * application_class::get_sun_light () const
-
-inline
-
-

Get the sun light in the scene.

Returns
The sun light as a pointer to a light_class object.
- -

Definition at line 276 of file application_class.h.

-
276{ return sun_light_; };
-
-
-
- -

◆ get_terrain_entity_count()

- -
-
- - - - - - - -
int application_class::get_terrain_entity_count ()
-
-

Get the number of entities with the ObjectType set as Terrain in the scene.

Returns
The count of terrain entities as an integer.
- -

Definition at line 2074 of file application_class.cpp.

-
2075{
-
2076 std::lock_guard<std::mutex> lock(objects_mutex_);
-
2077 int terrainCount = 0;
-
2078
-
2079 // Get all entities with the Terrain type
-
2080 auto entities_with_terrain = entity_manager_->GetEntitiesWithComponent<ecs::IdentityComponent>();
-
2081 for (auto& entity : entities_with_terrain) {
-
2082 auto identity = entity->GetComponent<ecs::IdentityComponent>();
-
2083 if (identity && identity->GetType() == ecs::ObjectType::Terrain) {
-
2084 terrainCount++;
-
2085 }
-
2086 }
-
2087
-
2088 return terrainCount;
-
2089}
-
-
-
- -

◆ get_vsync()

- -
-
- - - - - -
- - - - - - - -
bool application_class::get_vsync () const
-
-inline
-
-

Get the V-sync state.

Returns
The V-sync state as a boolean.
- -

Definition at line 315 of file application_class.h.

-
315{ return vsync_enabled_; };
-
-
-
- -

◆ get_w_folder()

- -
-
- - - - - -
- - - - - - - -
std::filesystem::path application_class::get_w_folder () const
-
-inline
-
-

Get the working folder of the engine.

Returns
The working folder as a std::filesystem::path.
- -

Definition at line 216 of file application_class.h.

-
216{ return w_folder_; };
-
-
-
- -

◆ get_window_size()

- -
-
- - - - - -
- - - - - - - -
ImVec2 application_class::get_window_size () const
-
-inline
-
-

Get the window size for an ImGui window. This isn't used in the current implementation.

Returns
The window size as an ImVec2.
- -

Definition at line 350 of file application_class.h.

-
350{ return window_size_; };
-
-
-
- -

◆ initialize()

- -
-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - -
bool application_class::initialize (int screen_width,
int screen_height,
HWND hwdn,
bool is_vulkan )
-
-virtual
-
-

initialize the application with the given parameters.

-
Parameters
- - - - - -
screen_widthThe width of the screen.
screen_heightThe height of the screen.
hwdnThe handle to the window.
is_vulkanWhether to use Vulkan for rendering.
-
-
-
Returns
True if the initialization was successful, false otherwise.
- -

Definition at line 70 of file application_class.cpp.

-
71{
-
72
-
73 Logger::Get().Log("Initializing application class", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
74
-
75 try
-
76 {
-
77 char mouseString1[32], mouseString2[32], mouseString3[32];
-
78 char modelFilename[128], renderString[32];
-
79 char bitmapFilename[128];
-
80 char spriteFilename[128];
-
81 char fpsString[32];
-
82 bool result;
-
83 HRESULT Hresult;
-
84
-
85 // create entity manager
-
86 entity_manager_ = std::make_unique<ecs::EntityManager>();
-
87
-
88 screen_width_ = screenWidth;
-
89 screen_height_ = screenHeight;
-
90
-
91 set_hwnd(hwnd);
-
92 set_windowed(full_screen);
-
93 set_screen_height(screenHeight);
-
94 set_screen_width(screenWidth);
-
95
-
96 // Create the Direct3D object.
-
97 direct_3d_ = new d_3d_class;
-
98 if (!direct_3d_)
-
99 {
-
100 Logger::Get().Log("Could not create the Direct3D object", __FILE__, __LINE__, Logger::LogLevel::Error);
-
101 return false;
-
102 }
-
103
-
104 result = direct_3d_->initialize(screen_width_, screen_height_, vsync_enabled_, hwnd, full_screen, screen_depth, screen_near);
-
105 if (!result)
-
106 {
-
107 Logger::Get().Log("Could not initialize Direct3D", __FILE__, __LINE__, Logger::LogLevel::Error);
-
108 return false;
-
109 }
-
110
-
111 // Create the camera object.
-
112 camera_ = new camera_class;
-
113 if (!camera_)
-
114 {
-
115 Logger::Get().Log("Could not create the camera object", __FILE__, __LINE__, Logger::LogLevel::Error);
-
116 return false;
-
117 }
-
118
-
119 sun_camera_ = new camera_class;
-
120 if (!sun_camera_)
-
121 {
-
122 Logger::Get().Log("Could not create the sun camera object", __FILE__, __LINE__, Logger::LogLevel::Error);
-
123 return false;
-
124 }
-
125
-
126 sun_camera_->set_position(0.0f,0.0f,0.0f);
-
127 sun_camera_->set_rotation(0.0f, 0.0f, 0.0f);
-
128 sun_camera_->render();
-
129 sun_camera_->get_view_matrix(base_view_matrix_);
-
130
-
131 // Set the initial position of the camera.
-
132 camera_->set_position(0.0f, 0.0f, -12.0f);
-
133 camera_->set_rotation(0.0f, 0.0f, 0.0f);
-
134 camera_->render();
-
135 camera_->get_view_matrix(base_view_matrix_);
-
136
-
137 active_camera_ = camera_;
-
138
-
139 // Create and initialize the font shader object.
-
140 font_shader_ = new font_shader_class;
-
141
-
142 result = font_shader_->initialize(direct_3d_->get_device(), hwnd);
-
143 if (!result)
-
144 {
-
145 Logger::Get().Log("Could not initialize the font shader object", __FILE__, __LINE__, Logger::LogLevel::Error);
-
146 return false;
-
147 }
-
148
-
149 // Create and initialize the font object.
-
150 font_ = new font_class;
-
151
-
152 result = font_->Initialize(direct_3d_->get_device(), direct_3d_->get_device_context(), 0);
-
153 if (!result)
-
154 {
-
155 Logger::Get().Log("Could not initialize the font object", __FILE__, __LINE__, Logger::LogLevel::Error);
-
156 return false;
-
157 }
-
158
-
159 // Create and initialize the render to texture object.
-
160 render_texture_ = new render_texture_class;
-
161
-
162 result = render_texture_->Initialize(direct_3d_->get_device(), 256, 256, screen_depth, screen_near, 1);
-
163 if (!result)
-
164 {
-
165 Logger::Get().Log("Could not initialize the render texture object", __FILE__, __LINE__, Logger::LogLevel::Error);
-
166 return false;
-
167 }
-
168
-
169 //ImVec2 availableSize = ImGui::GetContentRegionAvail();
-
170
-
171 // Create and initialize the scene render to texture object.
-
172 scene_texture_ = new render_texture_class();
-
173 result = scene_texture_->Initialize(direct_3d_->get_device(), 256, 256, screen_depth, screen_near, 1);
-
174 if (!result)
-
175 {
-
176 Logger::Get().Log("Could not initialize the render texture object", __FILE__, __LINE__, Logger::LogLevel::Error);
-
177 return false;
-
178 }
-
179
-
180 // Create and initialize the display plane object.
-
181 display_plane_ = new display_plane_class;
-
182
-
183 result = display_plane_->Initialize(direct_3d_->get_device(), 1.0f, 1.0f);
-
184 if (!result)
-
185 {
-
186 Logger::Get().Log("Could not initialize the display plane object", __FILE__, __LINE__, Logger::LogLevel::Error);
-
187 return false;
-
188 }
-
189
-
190
-
191 // Set the sprite info file we will be using.
-
192 //
-
193 strcpy_s(spriteFilename, "sprite_data_01.txt");
-
194
-
195 // Create and initialize the sprite object.
-
196 sprite_ = new sprite_class;
-
197
-
198 result = sprite_->Initialize(direct_3d_->get_device(), direct_3d_->get_device_context(), screenWidth, screenHeight, spriteFilename, 50, 50);
-
199 if (!result)
-
200 {
-
201 Logger::Get().Log("Could not initialize the sprite object", __FILE__, __LINE__, Logger::LogLevel::Error);
-
202 return false;
-
203 }
-
204
-
205 // Set the initial mouse strings.
-
206 strcpy_s(mouseString1, "Mouse X: 0");
-
207 strcpy_s(mouseString2, "Mouse Y: 0");
-
208 strcpy_s(mouseString3, "Mouse Button: No");
-
209
-
210 // Create and initialize the text objects for the mouse strings.
-
211 mouse_strings_ = new text_class[3];
-
212
-
213 for (int i = 0; i < 3; i++)
-
214 {
-
215 int y = 10 + (i * 25);
-
216 result = mouse_strings_[i].Initialize(direct_3d_->get_device(), direct_3d_->get_device_context(), screenWidth, screenHeight, 32, font_, mouseString1, 10, y, 1.0f, 1.0f, 1.0f);
-
217 if (!result)
-
218 {
-
219 Logger::Get().Log("Could not initialize the mouse strings", __FILE__, __LINE__, Logger::LogLevel::Error);
-
220 return false;
-
221 }
-
222 }
-
223
-
224 // Set the file name of the bitmap file.
-
225 strcpy_s(bitmapFilename, "assets/Texture/stone01.tga");
-
226
-
227 // Create and initialize the bitmap object.
-
228 bitmap_ = new bitmap_class;
-
229
-
230 result = bitmap_->initialize(direct_3d_->get_device(), direct_3d_->get_device_context(), screenWidth, screenHeight, bitmapFilename, 50, 50);
-
231 if (!result)
-
232 {
-
233 Logger::Get().Log("Could not initialize the bitmap object", __FILE__, __LINE__, Logger::LogLevel::Error);
-
234 return false;
-
235 }
-
236
-
237 // Set the file name of the model.
-
238 strcpy_s(modelFilename, "assets/Model/TXT/cube.txt");
-
239
-
240 // Charger les textures_
-
241 std::vector<std::wstring> textureFilenames = {
-
242 L"assets/Texture/stone01.png"
-
243 };
-
244
-
245 TextureContainer CubeTextures;
-
246
-
247 for (const auto& textureFilename : textureFilenames)
-
248 {
-
249 ID3D11ShaderResourceView* texture = nullptr;
-
250 Hresult = DirectX::CreateWICTextureFromFile(direct_3d_->get_device(), direct_3d_->get_device_context(), textureFilename.c_str(), nullptr, &texture);
-
251 if (FAILED(Hresult))
-
252 {
-
253 Logger::Get().Log("Failed to load texture: " + std::string(textureFilename.begin(), textureFilename.end()), __FILE__, __LINE__, Logger::LogLevel::Error);
-
254 return false;
-
255 }
-
256 CubeTextures.diffuse.push_back(texture);
-
257 }
-
258
-
259 // Create and initialize the model object.
-
260 model_ = new model_class;
-
261
-
262
-
263 result = model_->Initialize(direct_3d_->get_device(), direct_3d_->get_device_context(), modelFilename, CubeTextures);
-
264 if (!result)
-
265 {
-
266 Logger::Get().Log("Could not initialize the model object", __FILE__, __LINE__, Logger::LogLevel::Error);
-
267 return false;
-
268 }
-
269
-
270 // Create and initialize the light object.
-
271 m_light_ = new light_class;
-
272
-
273 m_light_->SetDiffuseColor(1.0f, 1.0f, 1.0f, 1.0f);
-
274 m_light_->SetDirection(0.0f, 0.0f, -1.0f);
-
275 m_light_->SetAmbientColor(0.15f, 0.15f, 0.15f, 1.0f);
-
276 m_light_->SetSpecularColor(1.0f, 1.0f, 1.0f, 1.0f);
-
277 m_light_->SetSpecularPower(16.0f);
-
278
-
279 // Set the number of lights we will use.
-
280 num_lights_ = 4;
-
281 // Create and initialize the light objects array.
-
282 lights_.resize(num_lights_);
-
283
-
284 lights_[0] = new light_class;
-
285 lights_[0]->SetDiffuseColor(1.0f, 1.0f, 1.0f, 1.0f); // White
-
286 lights_[0]->SetDirection(0.0f, 0.0f, -1.0f);
-
287 lights_[0]->SetAmbientColor(0.15f, 0.15f, 0.15f, 1.0f);
-
288 lights_[0]->SetSpecularColor(1.0f, 1.0f, 1.0f, 1.0f);
-
289 lights_[0]->SetSpecularPower(16.0f);
-
290 lights_[0]->SetPosition(10.0f, 7.0f, -5.0f);
-
291
-
292 lights_[1] = new light_class;
-
293 lights_[1]->SetDiffuseColor(1.0f, 0.0f, 0.0f, 1.0f); // Red
-
294 lights_[1]->SetDirection(0.0f, 0.0f, -1.0f);
-
295 lights_[1]->SetAmbientColor(0.15f, 0.15f, 0.15f, 1.0f);
-
296 lights_[1]->SetSpecularColor(1.0f, 0.0f, 0.0f, 1.0f);
-
297 lights_[1]->SetSpecularPower(16.0f);
-
298 lights_[1]->SetPosition(-10.0f, 7.0f, -5.0f);
-
299
-
300 lights_[2] = new light_class;
-
301 lights_[2]->SetDiffuseColor(0.0f, 1.0f, 0.0f, 1.0f); // Green
-
302 lights_[2]->SetDirection(0.0f, 0.0f, -1.0f);
-
303 lights_[2]->SetAmbientColor(0.15f, 0.15f, 0.15f, 1.0f);
-
304 lights_[2]->SetSpecularColor(0.0f, 1.0f, 0.0f, 1.0f);
-
305 lights_[2]->SetSpecularPower(16.0f);
-
306 lights_[2]->SetPosition(10.0f, 7.0f, 5.0f);
-
307
-
308 lights_[3] = new light_class;
-
309 lights_[3]->SetDiffuseColor(0.0f, 0.0f, 1.0f, 1.0f); // Blue
-
310 lights_[3]->SetDirection(0.0f, 0.0f, -1.0f);
-
311 lights_[3]->SetAmbientColor(0.15f, 0.15f, 0.15f, 1.0f);
-
312 lights_[3]->SetSpecularColor(0.0f, 0.0f, 1.0f, 1.0f);
-
313 lights_[3]->SetSpecularPower(16.0f);
-
314 lights_[3]->SetPosition(-10.0f, 7.0f, 5.0f);
-
315
-
316 // ------------------------------------------------------------- //
-
317 // ----------------------- || THE SUN || ----------------------- //
-
318 // ------------------------------------------------------------- //
-
319
-
320 sun_light_ = new light_class;
-
321 sun_light_->SetDiffuseColor(1.0f, 1.0f, 1.0f, 1.0f); // White
-
322 sun_light_->SetDirection(0.0f, -1.0f, 0.0f);
-
323 sun_light_->SetAmbientColor(0.15f, 0.15f, 0.15f, 1.0f);
-
324 sun_light_->SetPosition(0.0f, 100.0f, 0.0f);
-
325 sun_light_->SetIntensity(1.0f);
-
326
-
327 sun_camera_->set_position(sun_light_->GetPosition().x, sun_light_->GetPosition().y, sun_light_->GetPosition().z);
-
328 sun_camera_->set_rotation(0.0f, 0.0f, 0.0f);
-
329 sun_camera_->render();
-
330
-
331 // Create and initialize the normal map shader object.
-
332 shader_manager_ = new shader_manager_class;
-
333
-
334 result = shader_manager_->initialize(direct_3d_->get_device(), hwnd);
-
335 if (!result)
-
336 {
-
337 Logger::Get().Log("Could not initialize the shader manager object", __FILE__, __LINE__, Logger::LogLevel::Error);
-
338 return false;
-
339 }
-
340
-
341 // Set the initial render count string.
-
342 strcpy_s(renderString, "render Count: 0");
-
343
-
344 // Create and initialize the text object for the render count string.
-
345 render_count_string_ = new text_class;
-
346
-
347 result = render_count_string_->Initialize(direct_3d_->get_device(), direct_3d_->get_device_context(), screenWidth, screenHeight, 32, font_, renderString, 10, 10, 1.0f, 1.0f, 1.0f);
-
348 if (!result)
-
349 {
-
350 Logger::Get().Log("Could not initialize the render count string", __FILE__, __LINE__, Logger::LogLevel::Error);
-
351 return false;
-
352 }
-
353
-
354 // Create and initialize the model list object.
-
355 model_list_ = new ModelListClass;
-
356 model_list_->Initialize(25);
-
357
-
358 // Charger les textures_ initiales pour bath_model_
-
359 std::vector<std::wstring> bathTextures = {
-
360 L"assets/Texture/marble01.png"
-
361 };
-
362
-
363 TextureContainer BathTextures;
-
364
-
365 textures.clear();
-
366 for (const auto& textureFilename : bathTextures)
-
367 {
-
368 ID3D11ShaderResourceView* texture = nullptr;
-
369 Hresult = DirectX::CreateWICTextureFromFile(direct_3d_->get_device(), direct_3d_->get_device_context(), textureFilename.c_str(), nullptr, &texture);
-
370 if (FAILED(Hresult))
-
371 {
-
372 Logger::Get().Log("Failed to load texture: " + std::string(textureFilename.begin(), textureFilename.end()), __FILE__, __LINE__, Logger::LogLevel::Error);
-
373 return false;
-
374 }
-
375 BathTextures.diffuse.push_back(texture);
-
376 }
-
377
-
378 // Set the file name of the bath model.
-
379 strcpy_s(modelFilename, "assets/Model/TXT/bath.txt");
-
380
-
381 // Create and initialize the bath model object.
-
382 bath_model_ = new model_class;
-
383
-
384 result = bath_model_->Initialize(direct_3d_->get_device(), direct_3d_->get_device_context(), modelFilename, BathTextures);
-
385 if (!result)
-
386 {
-
387 MessageBox(hwnd, L"Could not initialize the bath model object.", L"Error", MB_OK);
-
388 return false;
-
389 }
-
390
-
391 // Set the file names of the water model.
-
392 strcpy_s(modelFilename, "assets/Model/TXT/water.txt");
-
393 // replace first element with the new filename
-
394 std::vector<std::wstring> waterTextures = {
-
395 L"assets/Texture/water01.png"
-
396 };
-
397
-
398 TextureContainer WaterTextures;
-
399
-
400 textures.clear();
-
401 for (const auto& textureFilename : waterTextures)
-
402 {
-
403 ID3D11ShaderResourceView* texture = nullptr;
-
404 Hresult = DirectX::CreateWICTextureFromFile(direct_3d_->get_device(), direct_3d_->get_device_context(), textureFilename.c_str(), nullptr, &texture);
-
405 if (FAILED(Hresult))
-
406 {
-
407 Logger::Get().Log("Failed to load texture: " + std::string(textureFilename.begin(), textureFilename.end()), __FILE__, __LINE__, Logger::LogLevel::Error);
-
408 return false;
-
409 }
-
410 WaterTextures.diffuse.push_back(texture);
-
411 }
-
412
-
413 // Create and initialize the water model object.
-
414 water_model_ = new model_class;
-
415
-
416 result = water_model_->Initialize(direct_3d_->get_device(), direct_3d_->get_device_context(), modelFilename, WaterTextures);
-
417 if (!result)
-
418 {
-
419 MessageBox(hwnd, L"Could not initialize the water model object.", L"Error", MB_OK);
-
420 return false;
-
421 }
-
422
-
423 // Create and initialize the refraction render to texture object.
-
424 refraction_texture_ = new render_texture_class;
-
425
-
426 result = refraction_texture_->Initialize(direct_3d_->get_device(), screenWidth, screenHeight, screen_depth, screen_near, 1);
-
427 if (!result)
-
428 {
-
429 MessageBox(hwnd, L"Could not initialize the refraction render texture object.", L"Error", MB_OK);
-
430 return false;
-
431 }
-
432
-
433 // Create and initialize the reflection render to texture object.
-
434 reflection_texture_ = new render_texture_class;
-
435
-
436 result = reflection_texture_->Initialize(direct_3d_->get_device(), screenWidth, screenHeight, screen_depth, screen_near, 1);
-
437 if (!result)
-
438 {
-
439 MessageBox(hwnd, L"Could not initialize the reflection render texture object.", L"Error", MB_OK);
-
440 return false;
-
441 }
-
442
-
443 // Set the height of the water.
-
444 water_height_ = -9.25f;
-
445
-
446 // initialize the position of the water.
-
447 water_translation_ = 100.0f;
-
448
-
449 // Create and initialize the timer object.
-
450 timer_ = new timer_class;
-
451
-
452 result = timer_->Initialize();
-
453 if (!result)
-
454 {
-
455 Logger::Get().Log("Could not initialize the timer object", __FILE__, __LINE__, Logger::LogLevel::Error);
-
456 return false;
-
457 }
-
458
-
459 // Create the position class object.
-
460 position_ = new position_class;
-
461
-
462 // Create and initialize the fps object.
-
463 fps_ = new fps_class();
-
464
-
465 fps_->Initialize();
-
466
-
467 // Set the initial fps and fps string.
-
468 previous_fps_ = -1;
-
469 strcpy_s(fpsString, "Fps: 0");
-
470
-
471 // Create and initialize the text object for the fps string.
-
472 fps_string_ = new text_class;
-
473
-
474 result = fps_string_->Initialize(direct_3d_->get_device(), direct_3d_->get_device_context(), screenWidth, screenHeight, 32, font_, fpsString, 10, 10, 0.0f, 1.0f, 0.0f);
-
475 if (!result)
-
476 {
-
477 Logger::Get().Log("Could not initialize the fps string", __FILE__, __LINE__, Logger::LogLevel::Error);
-
478 return false;
-
479 }
-
480
-
481 shadow_map_ = new shadow_map();
-
482 if (!shadow_map_->initialize(direct_3d_->get_device(), 2048, 2048))
-
483 {
-
484 Logger::Get().Log("Could not initialize the shadow map object", __FILE__, __LINE__, Logger::LogLevel::Error);
-
485 return false;
-
486 }
-
487
-
488 stats_ = new stats();
-
489 if (!stats_->initialize(this))
-
490 {
-
491 Logger::Get().Log("Could not initialize the stats object", __FILE__, __LINE__, Logger::LogLevel::Error);
-
492 return false;
-
493 }
-
494
-
495 physics_ = new physics;
-
496
-
497 physics_thread_ = std::thread(&application_class::physics_thread_function, this);
-
498
-
499 //ConstructSkyboxWithPlanes();
-
500 Skybox* skybox = new Skybox;
-
501 skybox->Initialize(direct_3d_);
-
502 skybox_.push_back(skybox->ConstructSkybox(this));
-
503
-
504 culling_active_ = true;
-
505 culling_thread_ = std::thread(&application_class::culling_thread_function, this);
-
506
-
507 }
-
508 catch (const std::exception& e)
-
509 {
-
510 Logger::Get().Log(std::string("Exception caught during initialization: ") + e.what(), __FILE__, __LINE__, Logger::LogLevel::Error);
-
511 return false;
-
512 }
-
513 Logger::Get().Log("Application class initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
514
-
515
-
516
-
517 return true;
-
518}
- -
Definition Skybox.h:8
-
object * ConstructSkybox(application_class *app)
Definition Skybox.cpp:26
-
void Initialize(d_3d_class *d3dClassRef)
Definition Skybox.cpp:21
-
void set_hwnd(HWND hwnd)
-
void set_windowed(bool windowed)
-
void physics_thread_function()
Thread function for handling physics updates. this function will run in a separate thread to handle p...
-
void set_screen_width(int screen_width)
-
void set_screen_height(int screen_height)
- - - -
virtual bool initialize(int, int, bool, HWND, bool, float, float)
Initializes the Direct3D device and related resources.
- - - - - - - - - - - - -
Definition stats.h:13
- - -
-
-
- -

◆ is_windowed()

- -
-
- - - - - -
- - - - - - - -
bool application_class::is_windowed () const
-
-inline
-
-

Check if the application is running in windowed mode.

Returns
True if the application is in windowed mode, false otherwise.
- -

Definition at line 332 of file application_class.h.

-
332{ return windowed_; };
-
-
-
- -

◆ physics_thread_function()

- -
-
- - - - - - - -
void application_class::physics_thread_function ()
-
- -

Thread function for handling physics updates. this function will run in a separate thread to handle physics updates at a fixed rate (50 fps by default).

- -

Definition at line 1978 of file application_class.cpp.

-
1979{
-
1980 auto fixedUpdateInterval = std::chrono::milliseconds(1000 / physics_tick_rate_);
-
1981 auto lastTime = std::chrono::steady_clock::now();
-
1982
-
1983 while (!should_quit_)
-
1984 {
-
1985 auto now = std::chrono::steady_clock::now();
-
1986 if (now - lastTime >= fixedUpdateInterval)
-
1987 {
-
1988 lastTime = now;
-
1989
-
1990 float deltaTime = 1.0f / static_cast<float>(physics_tick_rate_);
-
1991 bool result = render_physics(deltaTime);
-
1992 if (!result)
-
1993 {
-
1994 Logger::Get().Log("Could not render the physics scene", __FILE__, __LINE__, Logger::LogLevel::Error);
-
1995 return;
-
1996 }
-
1997 }
-
1998 // Attendre un peu pour éviter de surcharger le CPU
-
1999 std::this_thread::sleep_for(std::chrono::milliseconds(1));
-
2000 }
-
2001}
-
-
-
- -

◆ set_can_fixed_update()

- -
-
- - - - - -
- - - - - - - -
void application_class::set_can_fixed_update (bool can_fixed_update)
-
-inline
-
-

Set the flag indicating whether the application can perform fixed updates.

Parameters
- - -
can_fixed_updateTrue to allow fixed updates, false to disallow them.
-
-
- -

Definition at line 416 of file application_class.h.

-
416{ can_fixed_update_ = can_fixed_update; };
-
-
-
- -

◆ set_cel_shading()

- -
-
- - - - - -
- - - - - - - -
void application_class::set_cel_shading (const bool enable)
-
-inline
-
-

Set the cel shading mode. This function isn't used in the current implementation. It's an old function that was used for cel shading effects before the complete implementation of the cel shading shader.

Parameters
- - -
enable
-
-
- -

Definition at line 297 of file application_class.h.

-
297{ enable_cel_shading_ = enable; };
-
-
-
- -

◆ set_direct_3d()

- -
-
- - - - - -
- - - - - - - -
void application_class::set_direct_3d (d_3d_class * direct_3d)
-
-inline
-
- -

Definition at line 88 of file application_class.h.

-
88{ direct_3d_ = direct_3d; };
-
-
-
- -

◆ set_frustum()

- -
-
- - - - - -
- - - - - - - -
void application_class::set_frustum (const frustum & frustum)
-
-inline
-
-

Set the frustum used for culling.

Parameters
- - -
frustumThe new frustum to set for culling.
-
-
- -

Definition at line 376 of file application_class.h.

-
376{ frustum_culling_ = frustum; };
- -
-
-
- -

◆ set_frustum_tolerance()

- -
-
- - - - - -
- - - - - - - -
void application_class::set_frustum_tolerance (const float frustum_tolerance)
-
-inline
-
-

Set the frustum culling tolerance. This value is used to determine how much an object must be outside the frustum to be culled.

Parameters
- - -
frustum_toleranceThe new frustum culling tolerance as a float.
-
-
- -

Definition at line 405 of file application_class.h.

-
405{ frustum_culling_tolerance_ = frustum_tolerance; };
-
-
-
- -

◆ set_hwnd()

- -
-
- - - - - -
- - - - - - - -
void application_class::set_hwnd (HWND hwnd)
-
-inline
-
-

Set the handle to the window.

Parameters
- - -
hwndThe new handle to the window as an HWND.
-
-
- -

Definition at line 326 of file application_class.h.

-
326{ hwnd_ = hwnd; };
-
-
-
- -

◆ set_light_color()

- -
-
- - - - - - - - - - - -
void application_class::set_light_color (int index,
XMVECTOR color )
-
-

Set the color for a specific light index.

Parameters
- - - -
indexThe index of the light to set the color for.
colorThe new color as an XMVECTOR.
-
-
- -

Definition at line 1738 of file application_class.cpp.

-
1739{
-
1740 //convert to XMFLOAT4
-
1741 XMFLOAT4 lightColor;
-
1742 XMStoreFloat4(&lightColor, color);
-
1743
-
1744 //set the color
-
1745 lights_[index]->SetDiffuseColor(lightColor.x, lightColor.y, lightColor.z, 1.0f);
-
1746}
-
-
-
- -

◆ set_light_position()

- -
-
- - - - - - - - - - - -
void application_class::set_light_position (int index,
XMVECTOR position )
-
-

Set the position for a specific light index.

Parameters
- - - -
indexThe index of the light to set the position for.
positionThe new position as an XMVECTOR.
-
-
- -

Definition at line 1748 of file application_class.cpp.

-
1749{
-
1750 //convert to XMFLOAT4
-
1751 XMFLOAT4 lightPosition;
-
1752 XMStoreFloat4(&lightPosition, position);
-
1753
-
1754 //set the position
-
1755 lights_[index]->SetPosition(lightPosition.x, lightPosition.y, lightPosition.z);
-
1756}
-
-
-
- -

◆ set_object_id()

- -
-
- - - - - -
- - - - - - - -
void application_class::set_object_id (int object_id)
-
-inline
-
-

Set the object ID.

Parameters
- - -
object_idThe new object ID as an integer.
-
-
- -

Definition at line 232 of file application_class.h.

-
232{ object_id_ = object_id; };
-
-
-
- -

◆ set_path()

- -
-
- - - - - -
- - - - - - - -
void application_class::set_path (WCHAR * path)
-
-inline
-
-

Set the executable path of the engine.

Parameters
- - -
path
-
-
- -

Definition at line 207 of file application_class.h.

-
207{ path_ = path; };
-
-
-
- -

◆ set_physics_tick_rate()

- -
-
- - - - - -
- - - - - - - -
void application_class::set_physics_tick_rate (int physics_tick_rate)
-
-inline
-
-

Set the physics tick rate.

Parameters
- - -
physics_tick_rateThe new physics tick rate in frames per second.
-
-
- -

Definition at line 151 of file application_class.h.

-
151{ physics_tick_rate_ = physics_tick_rate; };
-
-
-
- -

◆ set_render_count()

- -
-
- - - - - -
- - - - - - - -
void application_class::set_render_count (const int render_count)
-
-inline
-
-

Set the number of objects rendered in the current frame.

Parameters
- - -
render_countThe new render count as an integer.
-
-
- -

Definition at line 393 of file application_class.h.

-
393{ render_count_ = render_count; };
-
-
-
- -

◆ set_screen_height()

- -
-
- - - - - - - -
void application_class::set_screen_height (int screen_height)
-
-

Set the screen height.

Parameters
- - -
screen_heightThe new height of the screen in pixels as an integer.
-
-
- -

Definition at line 1758 of file application_class.cpp.

-
1759{
-
1760 // log the new screen height
-
1761 Logger::Get().Log("Setting screen height to " + std::to_string(height), __FILE__, __LINE__);
-
1762 screen_height_ = height;
-
1763}
-
-
-
- -

◆ set_screen_width()

- -
-
- - - - - - - -
void application_class::set_screen_width (int screen_width)
-
-

Set the screen width.

Parameters
- - -
screen_widthThe new width of the screen in pixels as an integer.
-
-
- -

Definition at line 1765 of file application_class.cpp.

-
1766{
-
1767 // log the new screen width
-
1768 Logger::Get().Log("Setting screen width to " + std::to_string(width), __FILE__, __LINE__);
-
1769 screen_width_ = width;
-
1770}
-
-
-
- -

◆ set_should_quit()

- -
-
- - - - - -
- - - - - - - -
void application_class::set_should_quit (const bool should_quit)
-
-inline
-
-

Set the should_quit flag. This flag indicates whether the application should quit.

Parameters
- - -
should_quitThe new value for the should_quit flag as a boolean.
-
-
- -

Definition at line 289 of file application_class.h.

-
289{ should_quit_ = should_quit; };
-
-
-
- -

◆ set_speed()

- -
-
- - - - - -
- - - - - - - -
void application_class::set_speed (const float speed)
-
-inline
-
-

Set the speed value. An old value used for the demo spinning object. This value is not used in the current implementation.

Parameters
- - -
speedThe new speed value as a float.
-
-
- -

Definition at line 187 of file application_class.h.

-
187{ this->speed_ = speed; };
-
-
-
- -

◆ set_vsync()

- -
-
- - - - - -
- - - - - - - -
void application_class::set_vsync (bool vsync)
-
-inline
-
-

Set the V-sync state.

Parameters
- - -
vsync
-
-
- -

Definition at line 303 of file application_class.h.

-
303 {
-
304 vsync_enabled_ = vsync;
-
305 if (direct_3d_) {
-
306 direct_3d_->set_vsync(vsync);
-
307 Logger::Get().Log("Setting Vsync to " + std::to_string(vsync), __FILE__, __LINE__);
-
308 }
-
309 };
-
void set_vsync(bool vsync)
Sets the vertical sync state.
-
-
-
- -

◆ set_w_folder()

- -
-
- - - - - -
- - - - - - - -
void application_class::set_w_folder (const std::filesystem::path & w_folder)
-
-inline
-
-

Set the working folder of the engine.

- -

Definition at line 211 of file application_class.h.

-
211{ w_folder_ = w_folder; };
-
-
-
- -

◆ set_window_size()

- -
-
- - - - - -
- - - - - - - -
void application_class::set_window_size (const ImVec2 size)
-
-inline
-
-

Set the window size for an ImGui window. This isn't used in the current implementation.

Parameters
- - -
size
-
-
- -

Definition at line 344 of file application_class.h.

-
344{ window_size_ = size; };
-
-
-
- -

◆ set_windowed()

- -
-
- - - - - -
- - - - - - - -
void application_class::set_windowed (bool windowed)
-
-inline
-
-

Set the windowed mode state.

Parameters
- - -
windowedTrue to set the application in windowed mode, false for full screen.
-
-
- -

Definition at line 337 of file application_class.h.

-
337{ windowed_ = windowed; };
-
-
-
- -

◆ shutdown()

- -
-
- - - - - - - -
void application_class::shutdown ()
-
-

Shutdown the application and release resources.

- -

Definition at line 520 of file application_class.cpp.

-
521{
-
522 Logger::Get().Log("Shutting down application class", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
523
-
524 // Release the shader manager object.
-
525 if (shader_manager_)
-
526 {
-
527 Logger::Get().Log("Releasing the shader manager object", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
528
-
529 shader_manager_->shutdown();
-
530 delete shader_manager_;
-
531 shader_manager_ = 0;
-
532
-
533 Logger::Get().Log("Shader manager object released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
534 }
-
535
-
536 // Release the reflection render texture object.
-
537 if (reflection_texture_)
-
538 {
-
539 reflection_texture_->Shutdown();
-
540 delete reflection_texture_;
-
541 reflection_texture_ = 0;
-
542 }
-
543
-
544 // Release the refraction render texture object.
-
545 if (refraction_texture_)
-
546 {
-
547 refraction_texture_->Shutdown();
-
548 delete refraction_texture_;
-
549 refraction_texture_ = 0;
-
550 }
-
551
-
552 // Release the water model object.
-
553 if (water_model_)
-
554 {
-
555 water_model_->Shutdown();
-
556 delete water_model_;
-
557 water_model_ = 0;
-
558 }
-
559
-
560 // Release the bath model object.
-
561 if (bath_model_)
-
562 {
-
563 bath_model_->Shutdown();
-
564 delete bath_model_;
-
565 bath_model_ = 0;
-
566 }
-
567 // Release the physics object.
-
568 if (physics_)
-
569 {
-
570 delete physics_;
-
571 physics_ = 0;
-
572 }
-
573
-
574 // Release the display plane object.
-
575 if (display_plane_)
-
576 {
-
577 Logger::Get().Log("Releasing the display plane object", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
578
-
579 display_plane_->Shutdown();
-
580 delete display_plane_;
-
581 display_plane_ = 0;
-
582
-
583 Logger::Get().Log("Display plane object released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
584 }
-
585
-
586 // Release the position object.
-
587 if (position_)
-
588 {
-
589 Logger::Get().Log("Releasing the position object", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
590
-
591 delete position_;
-
592 position_ = 0;
-
593
-
594 Logger::Get().Log("Position object released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
595 }
-
596
-
597 // Release the model list object.
-
598 if (model_list_)
-
599 {
-
600 Logger::Get().Log("Releasing the model list object", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
601
-
602 model_list_->Shutdown();
-
603 delete model_list_;
-
604 model_list_ = 0;
-
605
-
606 Logger::Get().Log("Model list object released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
607 }
-
608
-
609 // Release the text objects for the render count string.
-
610 if (render_count_string_)
-
611 {
-
612 Logger::Get().Log("Releasing the render count string object", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
613
-
614 render_count_string_->Shutdown();
-
615 delete render_count_string_;
-
616 render_count_string_ = 0;
-
617
-
618 Logger::Get().Log("render count string object released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
619 }
-
620
-
621 // Release the text objects for the mouse strings.
-
622 if (mouse_strings_)
-
623 {
-
624 Logger::Get().Log("Releasing the mouse strings", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
625
-
626 mouse_strings_[0].Shutdown();
-
627 mouse_strings_[1].Shutdown();
-
628 mouse_strings_[2].Shutdown();
-
629
-
630 delete[] mouse_strings_;
-
631 mouse_strings_ = 0;
-
632
-
633 Logger::Get().Log("Mouse strings released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
634 }
-
635
-
636 // Release the text object for the fps string.
-
637 if (fps_string_)
-
638 {
-
639 Logger::Get().Log("Releasing the fps string object", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
640
-
641 fps_string_->Shutdown();
-
642 delete fps_string_;
-
643 fps_string_ = 0;
-
644
-
645 Logger::Get().Log("Fps string object released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
646 }
-
647
-
648 // Release the fps object.
-
649 if (fps_)
-
650 {
-
651 Logger::Get().Log("Releasing the fps object", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
652
-
653 delete fps_;
-
654 fps_ = 0;
-
655
-
656 Logger::Get().Log("Fps object released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
657 }
-
658
-
659 // Release the font object.
-
660 if (font_)
-
661 {
-
662 Logger::Get().Log("Releasing the font object", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
663
-
664 font_->Shutdown();
-
665 delete font_;
-
666 font_ = 0;
-
667
-
668 Logger::Get().Log("Font object released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
669 }
-
670
-
671 // Release the font shader object.
-
672 if (font_shader_)
-
673 {
-
674 Logger::Get().Log("Releasing the font shader object", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
675
-
676 font_shader_->shutdown();
-
677 delete font_shader_;
-
678 font_shader_ = 0;
-
679
-
680 Logger::Get().Log("Font shader object released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
681 }
-
682
-
683 // Release the timer object.
-
684 if (timer_)
-
685 {
-
686 Logger::Get().Log("Releasing the timer object", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
687
-
688 delete timer_;
-
689 timer_ = 0;
-
690
-
691 Logger::Get().Log("Timer object released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
692 }
-
693
-
694 // Release the sprite object.
-
695 if (sprite_)
-
696 {
-
697 Logger::Get().Log("Releasing the sprite object", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
698
-
699 sprite_->Shutdown();
-
700 delete sprite_;
-
701 sprite_ = 0;
-
702
-
703 Logger::Get().Log("Sprite object released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
704 }
-
705
-
706 for (auto light : lights_)
-
707 {
-
708 Logger::Get().Log("Releasing the light object", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
709 if (light)
-
710 {
-
711 delete light;
-
712 light = 0;
-
713 }
-
714 Logger::Get().Log("Light object released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
715 }
-
716
-
717 // Release the light object.
-
718 if (m_light_)
-
719 {
-
720 Logger::Get().Log("Releasing the light object", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
721 delete m_light_;
-
722 m_light_ = 0;
-
723 Logger::Get().Log("Light object released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
724 }
-
725
-
726 // Release the model object.
-
727 if (model_)
-
728 {
-
729 Logger::Get().Log("Releasing the model object", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
730 model_->Shutdown();
-
731 delete model_;
-
732 model_ = 0;
-
733 Logger::Get().Log("Model object released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
734 }
-
735
-
736 if (scene_texture_)
-
737 {
-
738 scene_texture_->Shutdown();
-
739 delete scene_texture_;
-
740 scene_texture_ = nullptr;
-
741 }
-
742
-
743 if (sun_camera_)
-
744 {
-
745 Logger::Get().Log("Releasing the sun camera object", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
746 delete sun_camera_;
-
747 sun_camera_ = nullptr;
-
748 Logger::Get().Log("Sun camera object released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
749 }
-
750
-
751 if (shadow_map_) {
-
752 shadow_map_->shutdown();
-
753 delete shadow_map_;
-
754 shadow_map_ = nullptr;
-
755 }
-
756
-
757 Logger::Get().Log("Application class shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
758}
-
-
-
- -

◆ update_stats_after_modification()

- -
-
- - - - - - - -
void application_class::update_stats_after_modification ()
-
-

Update the stats after an update in the scene.

- -

Definition at line 2066 of file application_class.cpp.

-
2067{
-
2068 if (stats_)
-
2069 {
-
2070 stats_ -> update_geometric_stats();
-
2071 }
-
2072}
-
-
-
-

Member Data Documentation

- -

◆ textures

- -
-
- - - - -
std::vector<ID3D11ShaderResourceView*> application_class::textures
-
- -

Definition at line 533 of file application_class.h.

- -
-
-
The documentation for this class was generated from the following files: -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:ddfaaea81e22338f83ac37e42e8d97ee9b44624f23cdc6a954428d1a9f596186 +size 317745 diff --git a/doxygen_docs/html/classapplication__class.js b/doxygen_docs/html/classapplication__class.js index a3c65cd..6b87099 100644 --- a/doxygen_docs/html/classapplication__class.js +++ b/doxygen_docs/html/classapplication__class.js @@ -1,66 +1,3 @@ -var classapplication__class = -[ - [ "application_class", "classapplication__class.html#ab3b678dde613c8568a2124482ed45a73", null ], - [ "add_cube", "classapplication__class.html#aaa09afdc106fb3f82788c42272811657", null ], - [ "add_kobject", "classapplication__class.html#a9a39dfe69bca6fe96a339ab47b2f0539", null ], - [ "construct_frustum", "classapplication__class.html#a7b959a12a5574b263556937f1c94e255", null ], - [ "create_big_cube", "classapplication__class.html#a7b0482e4b79a4c3bf32e1f40ccb48678", null ], - [ "delete_entity_by_id", "classapplication__class.html#a5ade90e873b7b6a31c148672dd0305cb", null ], - [ "delete_terrain", "classapplication__class.html#a69bce73916e1180493ac74030dbb77ba", null ], - [ "frame", "classapplication__class.html#a0d9b9cbfbe1a2efa52606fcbbdfb40ca", null ], - [ "generate_terrain", "classapplication__class.html#aca20ad22e0c95f5404e3c47a11317025", null ], - [ "get_aspect_ratio", "classapplication__class.html#a1bbbc70e5a68278f410e9b2b93942230", null ], - [ "get_back_buffer_srv", "classapplication__class.html#a0e7b21b1421fd52bb3740fb25f26e4a7", null ], - [ "get_can_fixed_update", "classapplication__class.html#abf98d275e281e99e54a68d3b53ba7b94", null ], - [ "get_entity_manager", "classapplication__class.html#ab6487040a8f3f90c62eaaeec09504071", null ], - [ "get_fps", "classapplication__class.html#a8a2103b81e5a5f73ebce656b96467ee3", null ], - [ "get_frustum", "classapplication__class.html#a29f11f9f0ab0f41af7b1b657d9310209", null ], - [ "get_frustum_tolerance", "classapplication__class.html#aa271ce1d2803a5a1fcd9becad215ecb0", null ], - [ "get_hwnd", "classapplication__class.html#a692f521b7d27a89a95848dd912342c1f", null ], - [ "get_light_color", "classapplication__class.html#a85c04a3f2d050cb750d7986ebc7e76a5", null ], - [ "get_light_position", "classapplication__class.html#a54f4915b1878fde4dc60ff26be5712ee", null ], - [ "get_lights", "classapplication__class.html#a9b1ca112e8d8fd01a7061d9a638e9f3e", null ], - [ "get_model_cache", "classapplication__class.html#a6eff226c2686a261a394b1c046096c5e", null ], - [ "get_object_id", "classapplication__class.html#a32624a7be14230d2120de382c2c2e298", null ], - [ "get_physics", "classapplication__class.html#ab1924a7177c04594ec5dab7fe4c0104f", null ], - [ "get_physics_tick_rate", "classapplication__class.html#a118113b8ab8ad1065b032d57150fa7dd", null ], - [ "get_reflection_texture", "classapplication__class.html#a25592af930b0ee6c34d667fc0f8d69e1", null ], - [ "get_refraction_texture", "classapplication__class.html#a8d993ac51d86d09c2b03b612ed914a74", null ], - [ "get_render_count", "classapplication__class.html#acc0c095b41d72833d974229cc64d0689", null ], - [ "get_render_texture", "classapplication__class.html#a3ec69cb088888911ab1e32490c39f3e6", null ], - [ "get_scene_texture", "classapplication__class.html#a69a84a1345d56bb8d81e7d3427ce969e", null ], - [ "get_screen_height", "classapplication__class.html#a468b1ed714bae99f4f2fcf7a93407bfb", null ], - [ "get_screen_width", "classapplication__class.html#ae4bf8de77c3edaac71aaba75193c3be9", null ], - [ "get_should_quit", "classapplication__class.html#afea1cdf2706dc45cdae0396b7948f2b0", null ], - [ "get_speed", "classapplication__class.html#ad724a8b8867f487bc602406ae20e1301", null ], - [ "get_stats", "classapplication__class.html#adfd9213758db871e03aada83dee961b3", null ], - [ "get_sun_light", "classapplication__class.html#ad757f3dc7ad49b74643fca7947889ed6", null ], - [ "get_terrain_entity_count", "classapplication__class.html#afe1ff7bf39935cae054c8f3743e923e1", null ], - [ "get_vsync", "classapplication__class.html#aa79efde57fb87b64bf95b47ee87c3bff", null ], - [ "get_w_folder", "classapplication__class.html#a2f6b5156b585944bb912d93fa1595af2", null ], - [ "get_window_size", "classapplication__class.html#a3c76d728525b1ee4558a41383f9f2217", null ], - [ "initialize", "classapplication__class.html#a3be4f6532857c72283450ce43907f309", null ], - [ "is_windowed", "classapplication__class.html#aac1577a0fe08e8007980b6b1778da478", null ], - [ "physics_thread_function", "classapplication__class.html#aa583e172e6a2d45cb9b4841634b9eea4", null ], - [ "set_can_fixed_update", "classapplication__class.html#aa0a44059eae0a8df0cb65a7962d598ed", null ], - [ "set_cel_shading", "classapplication__class.html#a1bdce1b8c5a23cd60dd35c441a670601", null ], - [ "set_frustum", "classapplication__class.html#abd47278db9d786b80833c787900c145b", null ], - [ "set_frustum_tolerance", "classapplication__class.html#a2f41c2a8f5f18aca2859b02e804c7a1a", null ], - [ "set_hwnd", "classapplication__class.html#a40392869f0ff57982fef8098dd3354fe", null ], - [ "set_light_color", "classapplication__class.html#a79b165193754e7361b0a467f5e70c72b", null ], - [ "set_light_position", "classapplication__class.html#a1715fe1c06659636399b60e859e6b2ae", null ], - [ "set_object_id", "classapplication__class.html#ae586e8e9431b6d6168c335a9ae0f08ca", null ], - [ "set_path", "classapplication__class.html#a4ead7c7ba402fb9619000d201c0cf95f", null ], - [ "set_physics_tick_rate", "classapplication__class.html#a8b03fc0a380762e268606262914e55a8", null ], - [ "set_render_count", "classapplication__class.html#a1f607939202c0cb805df935eb38dabe7", null ], - [ "set_screen_height", "classapplication__class.html#ae5ed92985e95d9f34a152cae2d7345d7", null ], - [ "set_screen_width", "classapplication__class.html#aca66fefd8c7c473e2700a69f13a4cb6b", null ], - [ "set_should_quit", "classapplication__class.html#a96068cd56a5bb2ed0c02db3b70272be2", null ], - [ "set_speed", "classapplication__class.html#a7b1a11759ecc6b80542c7f4f3cf4e8e9", null ], - [ "set_vsync", "classapplication__class.html#a642858510be15dc3d2890ccc5f6df31f", null ], - [ "set_w_folder", "classapplication__class.html#a5dbf967cc3d2a08b07c13b6aa44fafe1", null ], - [ "set_window_size", "classapplication__class.html#ab0418282e11e00cebb3a63747384a24b", null ], - [ "set_windowed", "classapplication__class.html#a7faa4a3a5150086acaec8bc223a4bf7e", null ], - [ "shutdown", "classapplication__class.html#af2ef20892819f21303002a0f3005e73d", null ], - [ "update_stats_after_modification", "classapplication__class.html#aa453b06f65ab6344907f0c65670de202", null ] -]; \ No newline at end of file +version https://git-lfs.github.com/spec/v1 +oid sha256:a27b5184e6a649ff37ae5fd83e4892e86e0908a6b22ebc5fc0c2618be7ca7fb1 +size 6258 diff --git a/doxygen_docs/html/classbitmap__class-members.html b/doxygen_docs/html/classbitmap__class-members.html index 2f48866..4d50070 100644 --- a/doxygen_docs/html/classbitmap__class-members.html +++ b/doxygen_docs/html/classbitmap__class-members.html @@ -1,123 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
bitmap_class Member List
-
-
- -

This is the complete list of members for bitmap_class, including all inherited members.

- - - - - - - - - - -
bitmap_class() (defined in bitmap_class)bitmap_class
bitmap_class(const bitmap_class &) (defined in bitmap_class)bitmap_class
get_index_count() (defined in bitmap_class)bitmap_class
get_texture() (defined in bitmap_class)bitmap_class
initialize(ID3D11Device *, ID3D11DeviceContext *, int, int, char *, int, int) (defined in bitmap_class)bitmap_class
render(ID3D11DeviceContext *) (defined in bitmap_class)bitmap_class
set_render_location(int, int) (defined in bitmap_class)bitmap_class
shutdown() (defined in bitmap_class)bitmap_class
~bitmap_class() (defined in bitmap_class)bitmap_class
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:8b21a2f441b55447e51cb35e5197cca1e6ada4f7eb31ee6ca6f119e39a0f201e +size 6885 diff --git a/doxygen_docs/html/classbitmap__class.html b/doxygen_docs/html/classbitmap__class.html index fb8c45e..6da8628 100644 --- a/doxygen_docs/html/classbitmap__class.html +++ b/doxygen_docs/html/classbitmap__class.html @@ -1,427 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: bitmap_class Class Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
- -
bitmap_class Class Reference
-
-
- - - - - - - - - - - - - - - - -

-Public Member Functions

 bitmap_class (const bitmap_class &)
 
bool initialize (ID3D11Device *, ID3D11DeviceContext *, int, int, char *, int, int)
 
void shutdown ()
 
bool render (ID3D11DeviceContext *)
 
int get_index_count ()
 
ID3D11ShaderResourceView * get_texture ()
 
void set_render_location (int, int)
 
-

Detailed Description

-
-

Definition at line 21 of file bitmap_class.h.

-

Constructor & Destructor Documentation

- -

◆ bitmap_class() [1/2]

- -
-
- - - - - - - -
bitmap_class::bitmap_class ()
-
- -

Definition at line 3 of file bitmap_class.cpp.

-
4{
-
5 vertex_buffer_ = 0;
-
6 index_buffer_ = 0;
-
7 texture_ = 0;
-
8}
-
-
-
- -

◆ bitmap_class() [2/2]

- -
-
- - - - - - - -
bitmap_class::bitmap_class (const bitmap_class & other)
-
- -

Definition at line 11 of file bitmap_class.cpp.

-
12{
-
13}
-
-
-
- -

◆ ~bitmap_class()

- -
-
- - - - - - - -
bitmap_class::~bitmap_class ()
-
- -

Definition at line 16 of file bitmap_class.cpp.

-
17{
-
18}
-
-
-
-

Member Function Documentation

- -

◆ get_index_count()

- -
-
- - - - - - - -
int bitmap_class::get_index_count ()
-
- -

Definition at line 86 of file bitmap_class.cpp.

-
87{
-
88 return index_count_;
-
89}
-
-
-
- -

◆ get_texture()

- -
-
- - - - - - - -
ID3D11ShaderResourceView * bitmap_class::get_texture ()
-
- -

Definition at line 91 of file bitmap_class.cpp.

-
92{
-
93 return texture_->GetTexture();
-
94}
-
-
-
- -

◆ initialize()

- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool bitmap_class::initialize (ID3D11Device * device,
ID3D11DeviceContext * deviceContext,
int screenWidth,
int screenHeight,
char * textureFilename,
int renderX,
int renderY )
-
- -

Definition at line 21 of file bitmap_class.cpp.

-
22{
-
23 Logger::Get().Log("Initializing bitmap class", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
24
-
25 bool result;
-
26
-
27 // Store the screen size.
-
28 screen_width_ = screenWidth;
-
29 screen_height_ = screenHeight;
-
30
-
31 // Store where the bitmap should be rendered to.
-
32 render_x_ = renderX;
-
33 render_y_ = renderY;
-
34
-
35 // initialize the vertex and index buffer that hold the geometry for the bitmap quad.
-
36 result = initialize_buffers(device);
-
37 if (!result)
-
38 {
-
39 Logger::Get().Log("Failed to initialize buffers", __FILE__, __LINE__, Logger::LogLevel::Error);
-
40 return false;
-
41 }
-
42
-
43 // Load the texture for this bitmap.
-
44 result = load_texture(device, deviceContext, textureFilename);
-
45 if (!result)
-
46 {
-
47 Logger::Get().Log("Failed to load texture", __FILE__, __LINE__, Logger::LogLevel::Error);
-
48 return false;
-
49 }
-
50
-
51 Logger::Get().Log("Bitmap class initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
52
-
53 return true;
-
54}
-
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 bitmap_class::render (ID3D11DeviceContext * deviceContext)
-
- -

Definition at line 67 of file bitmap_class.cpp.

-
68{
-
69 bool result;
-
70
-
71
-
72 // Update the buffers if the position of the bitmap has changed from its original position.
-
73 result = update_buffers(deviceContext);
-
74 if (!result)
-
75 {
-
76 Logger::Get().Log("Failed to update buffers", __FILE__, __LINE__, Logger::LogLevel::Error);
-
77 return false;
-
78 }
-
79
-
80 // Put the vertex and index buffers on the graphics pipeline to prepare them for drawing.
-
81 render_buffers(deviceContext);
-
82
-
83 return true;
-
84}
-
-
-
- -

◆ set_render_location()

- -
-
- - - - - - - - - - - -
void bitmap_class::set_render_location (int x,
int y )
-
- -

Definition at line 356 of file bitmap_class.cpp.

-
357{
-
358 render_x_ = x;
-
359 render_y_ = y;
-
360 return;
-
361}
-
-
-
- -

◆ shutdown()

- -
-
- - - - - - - -
void bitmap_class::shutdown ()
-
- -

Definition at line 56 of file bitmap_class.cpp.

-
57{
-
58 // Release the bitmap texture.
-
59 release_texture();
-
60
-
61 // Release the vertex and index buffers.
-
62 shutdown_buffers();
-
63
-
64 return;
-
65}
-
-
-
-
The documentation for this class was generated from the following files: -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:2a00cbda1f43746d7ebed15caeca006e6e8cd9b4c03ca6443a4c88c041faf001 +size 26569 diff --git a/doxygen_docs/html/classcamera__class-members.html b/doxygen_docs/html/classcamera__class-members.html index c9fb5f1..05f7060 100644 --- a/doxygen_docs/html/classcamera__class-members.html +++ b/doxygen_docs/html/classcamera__class-members.html @@ -1,125 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
camera_class Member List
-
-
- -

This is the complete list of members for camera_class, including all inherited members.

- - - - - - - - - - - - -
camera_class()camera_class
camera_class(const camera_class &) (defined in camera_class)camera_class
get_position()camera_class
get_reflection_view_matrix(XMMATRIX &) constcamera_class
get_rotation()camera_class
get_view_matrix(XMMATRIX &view_matrix) constcamera_class
render()camera_class
render_reflection(float)camera_class
set_position(float, float, float)camera_class
set_rotation(float, float, float)camera_class
~camera_class() (defined in camera_class)camera_class
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:6a78e3645ebb71e54ff052186c6a1049356c90134879c79b430426336584e4c8 +size 7288 diff --git a/doxygen_docs/html/classcamera__class.html b/doxygen_docs/html/classcamera__class.html index 15c2231..9744849 100644 --- a/doxygen_docs/html/classcamera__class.html +++ b/doxygen_docs/html/classcamera__class.html @@ -1,574 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: camera_class Class Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
- -
camera_class Class Reference
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

-Public Member Functions

 camera_class ()
 Default constructor for camera_class. Initializes the camera position and rotation to zero.
 
 camera_class (const camera_class &)
 
void set_position (float, float, float)
 Sets the position of the camera in 3D space.
 
void set_rotation (float, float, float)
 Sets the rotation of the camera in 3D space.
 
XMFLOAT3 get_position ()
 Gets the current position of the camera.
 
XMFLOAT3 get_rotation ()
 Gets the current rotation of the camera.
 
void render ()
 Updates the camera's view matrix based on its position and rotation. This method recalculates the view matrix to reflect the current camera state.
 
XMMATRIX get_view_matrix (XMMATRIX &view_matrix) const
 Retrieves the current view matrix of the camera.
 
void render_reflection (float)
 Renders the reflection of the scene from the camera's perspective.
 
void get_reflection_view_matrix (XMMATRIX &) const
 Retrieves the reflection view matrix of the camera.
 
-

Detailed Description

-
-

Definition at line 18 of file camera_class.h.

-

Constructor & Destructor Documentation

- -

◆ camera_class() [1/2]

- -
-
- - - - - - - -
camera_class::camera_class ()
-
- -

Default constructor for camera_class. Initializes the camera position and rotation to zero.

- -

Definition at line 6 of file camera_class.cpp.

-
7{
-
8 position_x_ = 0.0f;
-
9 position_y_ = 0.0f;
-
10 position_z_ = 0.0f;
-
11
-
12 rotation_x_ = 0.0f;
-
13 rotation_y_ = 0.0f;
-
14 rotation_z_ = 0.0f;
-
15}
-
-
-
- -

◆ camera_class() [2/2]

- -
-
- - - - - - - -
camera_class::camera_class (const camera_class & other)
-
- -

Definition at line 18 of file camera_class.cpp.

-
19{
-
20}
-
-
-
- -

◆ ~camera_class()

- -
-
- - - - - - - -
camera_class::~camera_class ()
-
- -

Definition at line 23 of file camera_class.cpp.

-
24{
-
25}
-
-
-
-

Member Function Documentation

- -

◆ get_position()

- -
-
- - - - - - - -
XMFLOAT3 camera_class::get_position ()
-
- -

Gets the current position of the camera.

-
Returns
A 3D vector representing the camera's position.
- -

Definition at line 44 of file camera_class.cpp.

-
45{
-
46 return XMFLOAT3(position_x_, position_y_, position_z_);
-
47}
-
-
-
- -

◆ get_reflection_view_matrix()

- -
-
- - - - - - - -
void camera_class::get_reflection_view_matrix (XMMATRIX & reflectionViewMatrix) const
-
- -

Retrieves the reflection view matrix of the camera.

-
Parameters
- - -
reflection_view_matrixThe matrix to store the reflection view matrix.
-
-
- -

Definition at line 167 of file camera_class.cpp.

-
168{
-
169 reflectionViewMatrix = reflection_view_matrix_;
-
170 return;
-
171}
-
-
-
- -

◆ get_rotation()

- -
-
- - - - - - - -
XMFLOAT3 camera_class::get_rotation ()
-
- -

Gets the current rotation of the camera.

-
Returns
A 3D vector representing the camera's rotation in degrees.
- -

Definition at line 50 of file camera_class.cpp.

-
51{
-
52 return XMFLOAT3(rotation_x_, rotation_y_, rotation_z_);
-
53}
-
-
-
- -

◆ get_view_matrix()

- -
-
- - - - - - - -
XMMATRIX camera_class::get_view_matrix (XMMATRIX & view_matrix) const
-
- -

Retrieves the current view matrix of the camera.

-
Returns
The view matrix representing the camera's orientation and position.
- -

Definition at line 108 of file camera_class.cpp.

-
109{
-
110 view_matrix = view_matrix_;
-
111 return view_matrix;
-
112}
-
-
-
- -

◆ render()

- -
-
- - - - - - - -
void camera_class::render ()
-
- -

Updates the camera's view matrix based on its position and rotation. This method recalculates the view matrix to reflect the current camera state.

- -

Definition at line 55 of file camera_class.cpp.

-
56{
-
57 XMFLOAT3 up, position, lookAt;
-
58 XMVECTOR upVector, positionVector, lookAtVector;
-
59 float yaw, pitch, roll;
-
60 XMMATRIX rotationMatrix;
-
61
-
62
-
63 // Setup the vector that points upwards.
-
64 up.x = 0.0f;
-
65 up.y = 1.0f;
-
66 up.z = 0.0f;
-
67
-
68 // Load it into a XMVECTOR structure.
-
69 upVector = XMLoadFloat3(&up);
-
70
-
71 // Setup the position of the camera in the world.
-
72 position.x = position_x_;
-
73 position.y = position_y_;
-
74 position.z = position_z_;
-
75
-
76 // Load it into a XMVECTOR structure.
-
77 positionVector = XMLoadFloat3(&position);
-
78
-
79 // Setup where the camera is looking by default.
-
80 lookAt.x = 0.0f;
-
81 lookAt.y = 0.0f;
-
82 lookAt.z = 1.0f;
-
83
-
84 // Load it into a XMVECTOR structure.
-
85 lookAtVector = XMLoadFloat3(&lookAt);
-
86
-
87 // Set the yaw (Y axis), pitch (X axis), and roll (Z axis) rotations in radians.
-
88 pitch = rotation_x_ * 0.0174532925f;
-
89 yaw = rotation_y_ * 0.0174532925f;
-
90 roll = rotation_z_ * 0.0174532925f;
-
91
-
92 // Create the rotation matrix from the yaw, pitch, and roll values.
-
93 rotationMatrix = XMMatrixRotationRollPitchYaw(pitch, yaw, roll);
-
94
-
95 // Transform the lookAt and up vector by the rotation matrix so the view is correctly rotated at the origin.
-
96 lookAtVector = XMVector3TransformCoord(lookAtVector, rotationMatrix);
-
97 upVector = XMVector3TransformCoord(upVector, rotationMatrix);
-
98
-
99 // Translate the rotated camera position to the location of the viewer.
-
100 lookAtVector = XMVectorAdd(positionVector, lookAtVector);
-
101
-
102 // Finally create the view matrix from the three updated vectors.
-
103 view_matrix_ = XMMatrixLookAtLH(positionVector, lookAtVector, upVector);
-
104
-
105 return;
-
106}
-
-
-
- -

◆ render_reflection()

- -
-
- - - - - - - -
void camera_class::render_reflection (float height)
-
- -

Renders the reflection of the scene from the camera's perspective.

-
Parameters
- - -
reflection_plane_yThe y-coordinate of the reflection plane.
-
-
- -

Definition at line 114 of file camera_class.cpp.

-
115{
-
116 XMFLOAT3 up, position, lookAt;
-
117 XMVECTOR upVector, positionVector, lookAtVector;
-
118 float yaw, pitch, roll;
-
119 XMMATRIX rotationMatrix;
-
120
-
121
-
122 // Setup the vector that points upwards.
-
123 up.x = 0.0f;
-
124 up.y = 1.0f;
-
125 up.z = 0.0f;
-
126
-
127 // Load it into a XMVECTOR structure.
-
128 upVector = XMLoadFloat3(&up);
-
129
-
130 // Setup the position of the camera in the world.
-
131 position.x = position_x_;
-
132 position.y = -position_y_ + (height * 2.0f);
-
133 position.z = position_z_;
-
134
-
135 // Load it into a XMVECTOR structure.
-
136 positionVector = XMLoadFloat3(&position);
-
137
-
138 // Setup where the camera is looking by default.
-
139 lookAt.x = 0.0f;
-
140 lookAt.y = 0.0f;
-
141 lookAt.z = 1.0f;
-
142
-
143 // Load it into a XMVECTOR structure.
-
144 lookAtVector = XMLoadFloat3(&lookAt);
-
145
-
146 // Set the yaw (Y axis), pitch (X axis), and roll (Z axis) rotations in radians.
-
147 pitch = (-1.0f * rotation_x_) * 0.0174532925f; // Invert for reflection
-
148 yaw = rotation_y_ * 0.0174532925f;
-
149 roll = rotation_z_ * 0.0174532925f;
-
150
-
151 // Create the rotation matrix from the yaw, pitch, and roll values.
-
152 rotationMatrix = XMMatrixRotationRollPitchYaw(pitch, yaw, roll);
-
153
-
154 // Transform the lookAt and up vector by the rotation matrix so the view is correctly rotated at the origin.
-
155 lookAtVector = XMVector3TransformCoord(lookAtVector, rotationMatrix);
-
156 upVector = XMVector3TransformCoord(upVector, rotationMatrix);
-
157
-
158 // Translate the rotated camera position to the location of the viewer.
-
159 lookAtVector = XMVectorAdd(positionVector, lookAtVector);
-
160
-
161 // Finally create the view matrix from the three updated vectors.
-
162 reflection_view_matrix_ = XMMatrixLookAtLH(positionVector, lookAtVector, upVector);
-
163
-
164 return;
-
165}
-
-
-
- -

◆ set_position()

- -
-
- - - - - - - - - - - - - - - - -
void camera_class::set_position (float x,
float y,
float z )
-
- -

Sets the position of the camera in 3D space.

-
Parameters
- - - - -
position_xThe x-coordinate of the camera's position.
position_yThe y-coordinate of the camera's position.
position_zThe z-coordinate of the camera's position.
-
-
- -

Definition at line 27 of file camera_class.cpp.

-
28{
-
29 position_x_ = x;
-
30 position_y_ = y;
-
31 position_z_ = z;
-
32 return;
-
33}
-
-
-
- -

◆ set_rotation()

- -
-
- - - - - - - - - - - - - - - - -
void camera_class::set_rotation (float x,
float y,
float z )
-
- -

Sets the rotation of the camera in 3D space.

-
Parameters
- - - - -
rotation_xThe rotation around the x-axis in degrees.
rotation_yThe rotation around the y-axis in degrees.
rotation_zThe rotation around the z-axis in degrees.
-
-
- -

Definition at line 36 of file camera_class.cpp.

-
37{
-
38 rotation_x_ = x;
-
39 rotation_y_ = y;
-
40 rotation_z_ = z;
-
41 return;
-
42}
-
-
-
-
The documentation for this class was generated from the following files: -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:16ffef16fc50fbbd593a1dbaed4677704e69b20328e1f759c9f8ec3e71b62c05 +size 36908 diff --git a/doxygen_docs/html/classcamera__class.js b/doxygen_docs/html/classcamera__class.js index b054f7a..8338be4 100644 --- a/doxygen_docs/html/classcamera__class.js +++ b/doxygen_docs/html/classcamera__class.js @@ -1,12 +1,3 @@ -var classcamera__class = -[ - [ "camera_class", "classcamera__class.html#ac18562f9e46ca033440ba9df2d180e20", null ], - [ "get_position", "classcamera__class.html#af416c69abe70579751cd404cba8bf388", null ], - [ "get_reflection_view_matrix", "classcamera__class.html#ac4d85cc166aec75e54528dc9dee8a075", null ], - [ "get_rotation", "classcamera__class.html#aa8073c109a536d48478257a3e1e889cd", null ], - [ "get_view_matrix", "classcamera__class.html#ac17736821f337ce7fd52b9857095de68", null ], - [ "render", "classcamera__class.html#a0820187f209f9628e6b2a8af34d71057", null ], - [ "render_reflection", "classcamera__class.html#a58b36223405de07000d108129c998075", null ], - [ "set_position", "classcamera__class.html#a4b9ac7f98297d2007abd1ed3d326d381", null ], - [ "set_rotation", "classcamera__class.html#a410c4bbfd5ba10d0785f5ac9178f9b3f", null ] -]; \ No newline at end of file +version https://git-lfs.github.com/spec/v1 +oid sha256:f63e08aad3bdb890b6fe61bdd31d23fc64a85b16ff99283ecb09807d85f812ba +size 863 diff --git a/doxygen_docs/html/classcelshade__class-members.html b/doxygen_docs/html/classcelshade__class-members.html index 313b69a..1a7951c 100644 --- a/doxygen_docs/html/classcelshade__class-members.html +++ b/doxygen_docs/html/classcelshade__class-members.html @@ -1,120 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
celshade_class Member List
-
-
- -

This is the complete list of members for celshade_class, including all inherited members.

- - - - - - - -
celshade_class() (defined in celshade_class)celshade_class
celshade_class(const celshade_class &) (defined in celshade_class)celshade_class
initialize(ID3D11Device *, HWND) (defined in celshade_class)celshade_class
render(ID3D11DeviceContext *device_context, int index_count, XMMATRIX world_matrix, XMMATRIX view_matrix, XMMATRIX projection_matrix, ID3D11ShaderResourceView *texture, XMFLOAT4 diffuse_color, XMFLOAT4 ambient_color, XMFLOAT3 sun_direction, float intensity) (defined in celshade_class)celshade_class
shutdown() (defined in celshade_class)celshade_class
~celshade_class() (defined in celshade_class)celshade_class
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:f0d5e78994820dcd4216e742998388d044ff58c9e6adf5040ebf8fc26d66f751 +size 6309 diff --git a/doxygen_docs/html/classcelshade__class.html b/doxygen_docs/html/classcelshade__class.html index d934271..669a0ec 100644 --- a/doxygen_docs/html/classcelshade__class.html +++ b/doxygen_docs/html/classcelshade__class.html @@ -1,373 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: celshade_class Class Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
- -
celshade_class Class Reference
-
-
- - - - - - - - - - -

-Public Member Functions

 celshade_class (const celshade_class &)
 
bool initialize (ID3D11Device *, HWND)
 
void shutdown ()
 
bool render (ID3D11DeviceContext *device_context, int index_count, XMMATRIX world_matrix, XMMATRIX view_matrix, XMMATRIX projection_matrix, ID3D11ShaderResourceView *texture, XMFLOAT4 diffuse_color, XMFLOAT4 ambient_color, XMFLOAT3 sun_direction, float intensity)
 
-

Detailed Description

-
-

Definition at line 11 of file celshade_class.h.

-

Constructor & Destructor Documentation

- -

◆ celshade_class() [1/2]

- -
-
- - - - - - - -
celshade_class::celshade_class ()
-
- -

Definition at line 7 of file celshade_class.cpp.

-
8{
-
9 vertex_shader_ = 0;
-
10 pixel_shader_ = 0;
-
11 layout_ = 0;
-
12 sample_state_ = 0;
-
13 matrix_buffer_ = 0;
-
14 camera_buffer_ = 0;
-
15 sunlight_buffer_ = 0;
-
16 sunlight_color_buffer_ = 0;
-
17 sunlight_position_buffer_ = 0;
-
18}
-
-
-
- -

◆ celshade_class() [2/2]

- -
-
- - - - - - - -
celshade_class::celshade_class (const celshade_class & other)
-
- -

Definition at line 21 of file celshade_class.cpp.

-
22{
-
23}
-
-
-
- -

◆ ~celshade_class()

- -
-
- - - - - - - -
celshade_class::~celshade_class ()
-
- -

Definition at line 26 of file celshade_class.cpp.

-
27{
-
28}
-
-
-
-

Member Function Documentation

- -

◆ initialize()

- -
-
- - - - - - - - - - - -
bool celshade_class::initialize (ID3D11Device * device,
HWND hwnd )
-
- -

Definition at line 31 of file celshade_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/celshading.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/celshading.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 = initialize_shader(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("SunLightShaderClass 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 celshade_class::render (ID3D11DeviceContext * device_context,
int index_count,
XMMATRIX world_matrix,
XMMATRIX view_matrix,
XMMATRIX projection_matrix,
ID3D11ShaderResourceView * texture,
XMFLOAT4 diffuse_color,
XMFLOAT4 ambient_color,
XMFLOAT3 sun_direction,
float intensity )
-
- -

Definition at line 77 of file celshade_class.cpp.

-
79{
-
80 bool result;
-
81
-
82
-
83 // Set the shader parameters that it will use for rendering.
-
84 result = set_shader_parameters(deviceContext, world_matrix, view_matrix, projection_matrix, texture, diffuse_color, ambient_color, sun_direction, 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 render_shader(deviceContext, index_count);
-
93
-
94 return true;
-
95}
-
-
-
- -

◆ shutdown()

- -
-
- - - - - - - -
void celshade_class::shutdown ()
-
- -

Definition at line 69 of file celshade_class.cpp.

-
70{
-
71 // shutdown the vertex and pixel shaders as well as the related objects.
-
72 shutdown_shader();
-
73
-
74 return;
-
75}
-
-
-
-
The documentation for this class was generated from the following files: -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:2f502678e55db1631f7ec5c37f52d00792429068057222f49823e0f882b663e4 +size 23998 diff --git a/doxygen_docs/html/classcolor__shader__class-members.html b/doxygen_docs/html/classcolor__shader__class-members.html index 379d3ee..f6c6baf 100644 --- a/doxygen_docs/html/classcolor__shader__class-members.html +++ b/doxygen_docs/html/classcolor__shader__class-members.html @@ -1,120 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
color_shader_class Member List
-
-
- -

This is the complete list of members for color_shader_class, including all inherited members.

- - - - - - - -
color_shader_class() (defined in color_shader_class)color_shader_class
color_shader_class(const color_shader_class &) (defined in color_shader_class)color_shader_class
initialize(ID3D11Device *, HWND) (defined in color_shader_class)color_shader_class
render(ID3D11DeviceContext *, int, XMMATRIX, XMMATRIX, XMMATRIX) (defined in color_shader_class)color_shader_class
shutdown() (defined in color_shader_class)color_shader_class
~color_shader_class() (defined in color_shader_class)color_shader_class
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:4fd57ed7c86abea146109376ad6d46254e1f1731a80208746f232e7018ce2aa3 +size 6258 diff --git a/doxygen_docs/html/classcolor__shader__class.html b/doxygen_docs/html/classcolor__shader__class.html index 019ed8a..e7b5231 100644 --- a/doxygen_docs/html/classcolor__shader__class.html +++ b/doxygen_docs/html/classcolor__shader__class.html @@ -1,345 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: color_shader_class Class Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
- -
color_shader_class Class Reference
-
-
- - - - - - - - - - -

-Public Member Functions

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

Detailed Description

-
-

Definition at line 23 of file color_shader_class.h.

-

Constructor & Destructor Documentation

- -

◆ color_shader_class() [1/2]

- -
-
- - - - - - - -
color_shader_class::color_shader_class ()
-
- -

Definition at line 6 of file color_shader_class.cpp.

-
7{
-
8 vertex_shader_ = 0;
-
9 pixel_shader_ = 0;
-
10 layout_ = 0;
-
11 matrix_buffer_ = 0;
-
12}
-
-
-
- -

◆ color_shader_class() [2/2]

- -
-
- - - - - - - -
color_shader_class::color_shader_class (const color_shader_class & other)
-
- -

Definition at line 15 of file color_shader_class.cpp.

-
16{
-
17}
-
-
-
- -

◆ ~color_shader_class()

- -
-
- - - - - - - -
color_shader_class::~color_shader_class ()
-
- -

Definition at line 20 of file color_shader_class.cpp.

-
21{
-
22}
-
-
-
-

Member Function Documentation

- -

◆ initialize()

- -
-
- - - - - - - - - - - -
bool color_shader_class::initialize (ID3D11Device * device,
HWND hwnd )
-
- -

Definition at line 24 of file color_shader_class.cpp.

-
25{
-
26 Logger::Get().Log("Initializing color_shader_class", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
27
-
28 bool result;
-
29 wchar_t vsFilename[128];
-
30 wchar_t psFilename[128];
-
31 int error;
-
32
-
33
-
34 // Set the filename of the vertex shader.
-
35 error = wcscpy_s(vsFilename, 128, L"src/hlsl/Color.vs");
-
36 if (error != 0)
-
37 {
-
38 Logger::Get().Log("Error copying string", __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/Color.ps");
-
44 if (error != 0)
-
45 {
-
46 Logger::Get().Log("Error copying string", __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("Error initializing shader", __FILE__, __LINE__, Logger::LogLevel::Error);
-
55 return false;
-
56 }
-
57
-
58 Logger::Get().Log("color_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 color_shader_class::render (ID3D11DeviceContext * deviceContext,
int indexCount,
XMMATRIX worldMatrix,
XMMATRIX viewMatrix,
XMMATRIX projectionMatrix )
-
- -

Definition at line 71 of file color_shader_class.cpp.

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

◆ shutdown()

- -
-
- - - - - - - -
void color_shader_class::shutdown ()
-
- -

Definition at line 63 of file color_shader_class.cpp.

-
64{
-
65 // shutdown the vertex and pixel shaders as well as the related objects.
-
66 shutdown_shader();
-
67
-
68 return;
-
69}
-
-
-
-
The documentation for this class was generated from the following files: -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:5bad11f61ad3baeb2426000c84caf42d1f7097d9721bc8257639e6fe87957911 +size 22506 diff --git a/doxygen_docs/html/classd__3d__class-members.html b/doxygen_docs/html/classd__3d__class-members.html index e994fad..e326b8d 100644 --- a/doxygen_docs/html/classd__3d__class-members.html +++ b/doxygen_docs/html/classd__3d__class-members.html @@ -1,139 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
d_3d_class Member List
-
-
- -

This is the complete list of members for d_3d_class, including all inherited members.

- - - - - - - - - - - - - - - - - - - - - - - - - - -
begin_scene(float, float, float, float)d_3d_classvirtual
d_3d_class()d_3d_class
d_3d_class(const d_3d_class &) (defined in d_3d_class)d_3d_class
disable_alpha_blending()d_3d_class
enable_alpha_blending()d_3d_class
end_scene()d_3d_classvirtual
get_device()d_3d_class
get_device_context()d_3d_class
get_ortho_matrix() constd_3d_classinline
get_projection_matrix() constd_3d_classinline
get_swap_chain()d_3d_class
get_video_card_info(char *description, int &memory)d_3d_class
get_world_matrix() constd_3d_classinline
initialize(int, int, bool, HWND, bool, float, float)d_3d_classvirtual
release_resources()d_3d_class
reset_resources(int newWidth, int newHeight)d_3d_class
reset_viewport()d_3d_class
resize_swap_chain(int width, int height)d_3d_class
set_back_buffer_render_target()d_3d_class
set_vsync(bool vsync)d_3d_class
shutdown()d_3d_class
swap_chain (defined in d_3d_class)d_3d_class
turn_z_buffer_off()d_3d_class
turn_z_buffer_on()d_3d_class
~d_3d_class() (defined in d_3d_class)d_3d_class
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:5cae82618a3953c8a1d0e56b1eb042112708bc2f2723a902ed36f854b94d4fa2 +size 11052 diff --git a/doxygen_docs/html/classd__3d__class.html b/doxygen_docs/html/classd__3d__class.html index df687a9..c1cad46 100644 --- a/doxygen_docs/html/classd__3d__class.html +++ b/doxygen_docs/html/classd__3d__class.html @@ -1,1567 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: d_3d_class Class Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
- -
d_3d_class Class Reference
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

-Public Member Functions

 d_3d_class ()
 Default constructor for d_3d_class.
 
 d_3d_class (const d_3d_class &)
 
virtual bool initialize (int, int, bool, HWND, bool, float, float)
 Initializes the Direct3D device and related resources.
 
void shutdown ()
 Releases Direct3D resources.
 
virtual void begin_scene (float, float, float, float)
 Begins the rendering process for a new frame.
 
virtual void end_scene ()
 Ends the rendering process for the current frame.
 
ID3D11Device * get_device ()
 Gets the Direct3D device.
 
ID3D11DeviceContext * get_device_context ()
 Gets the Direct3D device context.
 
IDXGISwapChain * get_swap_chain ()
 
void resize_swap_chain (int width, int height)
 
void set_vsync (bool vsync)
 Sets the vertical sync state.
 
XMMATRIX get_projection_matrix () const
 
XMMATRIX get_world_matrix () const
 
XMMATRIX get_ortho_matrix () const
 
void get_video_card_info (char *description, int &memory)
 
void set_back_buffer_render_target ()
 
void reset_viewport ()
 
void release_resources ()
 
void reset_resources (int newWidth, int newHeight)
 
void turn_z_buffer_on ()
 
void turn_z_buffer_off ()
 
void enable_alpha_blending ()
 
void disable_alpha_blending ()
 
- - - -

-Public Attributes

IDXGISwapChain * swap_chain
 
-

Detailed Description

-
-

Definition at line 30 of file d_3d_class.h.

-

Constructor & Destructor Documentation

- -

◆ d_3d_class() [1/2]

- -
-
- - - - - - - -
d_3d_class::d_3d_class ()
-
- -

Default constructor for d_3d_class.

- -

Definition at line 7 of file d_3d_class.cpp.

-
8{
-
9 swap_chain = 0;
-
10 device_ = 0;
-
11 device_context_ = 0;
-
12 render_target_view_ = 0;
-
13 depth_stencil_buffer_ = 0;
-
14 depth_stencil_state_ = 0;
-
15 depth_stencil_view_ = 0;
-
16 raster_state_ = 0;
-
17 depth_disabled_stencil_state_ = 0;
-
18 alpha_enable_blending_state_ = 0;
-
19 alpha_disable_blending_state_ = 0;
-
20}
-
-
-
- -

◆ d_3d_class() [2/2]

- -
-
- - - - - - - -
d_3d_class::d_3d_class (const d_3d_class & other)
-
- -

Definition at line 23 of file d_3d_class.cpp.

-
24{
-
25}
-
-
-
- -

◆ ~d_3d_class()

- -
-
- - - - - - - -
d_3d_class::~d_3d_class ()
-
- -

Definition at line 28 of file d_3d_class.cpp.

-
29{
-
30}
-
-
-
-

Member Function Documentation

- -

◆ begin_scene()

- -
-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - -
void d_3d_class::begin_scene (float red,
float green,
float blue,
float alpha )
-
-virtual
-
- -

Begins the rendering process for a new frame.

-
Parameters
- - - - - -
redRed component of the clear color.
greenGreen component of the clear color.
blueBlue component of the clear color.
alphaAlpha component of the clear color.
-
-
- -

Definition at line 516 of file d_3d_class.cpp.

-
517{
-
518 float color[4];
-
519
-
520
-
521 // Setup the color to clear the buffer to.
-
522 color[0] = red;
-
523 color[1] = green;
-
524 color[2] = blue;
-
525 color[3] = alpha;
-
526
-
527 // Clear the back buffer.
-
528 device_context_->ClearRenderTargetView(render_target_view_, color);
-
529
-
530
-
531
-
532 // Clear the depth buffer.
-
533 device_context_->ClearDepthStencilView(depth_stencil_view_, D3D11_CLEAR_DEPTH, 1.0f, 0);
-
534
-
535 return;
-
536}
-
-
-
- -

◆ disable_alpha_blending()

- -
-
- - - - - - - -
void d_3d_class::disable_alpha_blending ()
-
-

Turn off alpha blending to disable transparency effects.

- -

Definition at line 754 of file d_3d_class.cpp.

-
755{
-
756 float blendFactor[4];
-
757
-
758
-
759 // Setup the blend factor.
-
760 blendFactor[0] = 0.0f;
-
761 blendFactor[1] = 0.0f;
-
762 blendFactor[2] = 0.0f;
-
763 blendFactor[3] = 0.0f;
-
764
-
765 // Turn off the alpha blending.
-
766 device_context_->OMSetBlendState(alpha_disable_blending_state_, blendFactor, 0xffffffff);
-
767
-
768 return;
-
769}
-
-
-
- -

◆ enable_alpha_blending()

- -
-
- - - - - - - -
void d_3d_class::enable_alpha_blending ()
-
-

Turn on alpha blending for transparency effects.

- -

Definition at line 737 of file d_3d_class.cpp.

-
738{
-
739 float blendFactor[4];
-
740
-
741
-
742 // Setup the blend factor.
-
743 blendFactor[0] = 0.0f;
-
744 blendFactor[1] = 0.0f;
-
745 blendFactor[2] = 0.0f;
-
746 blendFactor[3] = 0.0f;
-
747
-
748 // Turn on the alpha blending.
-
749 device_context_->OMSetBlendState(alpha_enable_blending_state_, blendFactor, 0xffffffff);
-
750
-
751 return;
-
752}
-
-
-
- -

◆ end_scene()

- -
-
- - - - - -
- - - - - - - -
void d_3d_class::end_scene ()
-
-virtual
-
- -

Ends the rendering process for the current frame.

- -

Definition at line 539 of file d_3d_class.cpp.

-
540{
-
541 // Present the back buffer to the screen since rendering is complete.
-
542 if (vsync_enabled_)
-
543 {
-
544 // Lock to screen refresh rate.
-
545 swap_chain->Present(1, 0);
-
546 }
-
547 else
-
548 {
-
549 // Present as fast as possible.
-
550 swap_chain->Present(0, 0);
-
551 }
-
552
-
553 return;
-
554}
-
-
-
- -

◆ get_device()

- -
-
- - - - - - - -
ID3D11Device * d_3d_class::get_device ()
-
- -

Gets the Direct3D device.

-
Returns
Pointer to the ID3D11Device interface.
- -

Definition at line 557 of file d_3d_class.cpp.

-
558{
-
559 return device_;
-
560}
-
-
-
- -

◆ get_device_context()

- -
-
- - - - - - - -
ID3D11DeviceContext * d_3d_class::get_device_context ()
-
- -

Gets the Direct3D device context.

-
Returns
Pointer to the ID3D11DeviceContext interface.
- -

Definition at line 563 of file d_3d_class.cpp.

-
564{
-
565 return device_context_;
-
566}
-
-
-
- -

◆ get_ortho_matrix()

- -
-
- - - - - -
- - - - - - - -
XMMATRIX d_3d_class::get_ortho_matrix () const
-
-inline
-
-

Get the orthographic matrix.

-
Returns
XMMATRIX representing the orthographic matrix.
- -

Definition at line 121 of file d_3d_class.h.

-
121{ return ortho_matrix_; };
-
-
-
- -

◆ get_projection_matrix()

- -
-
- - - - - -
- - - - - - - -
XMMATRIX d_3d_class::get_projection_matrix () const
-
-inline
-
-

Get the projection matrix.

-
Returns
XMMATRIX representing the projection matrix.
- -

Definition at line 109 of file d_3d_class.h.

-
109{ return projection_matrix_; };
-
-
-
- -

◆ get_swap_chain()

- -
-
- - - - - - - -
IDXGISwapChain * d_3d_class::get_swap_chain ()
-
-

Get the swap chain associated with the Direct3D device.

Returns
Pointer to the IDXGISwapChain interface.
- -

Definition at line 690 of file d_3d_class.cpp.

-
691{
-
692 return swap_chain;
-
693}
-
-
-
- -

◆ get_video_card_info()

- -
-
- - - - - - - - - - - -
void d_3d_class::get_video_card_info (char * description,
int & memory )
-
-

Get the Video Card information.

Parameters
- - - -
descriptionPointer to a character array to store the video card description.
memoryReference to an integer to store the video card memory size.
-
-
- -

Definition at line 568 of file d_3d_class.cpp.

-
569{
-
570 strcpy_s(cardName, 128, video_card_description_);
-
571 memory = video_card_memory_;
-
572 return;
-
573}
-
-
-
- -

◆ get_world_matrix()

- -
-
- - - - - -
- - - - - - - -
XMMATRIX d_3d_class::get_world_matrix () const
-
-inline
-
-

Get the world matrix.

-
Returns
XMMATRIX representing the world matrix.
- -

Definition at line 115 of file d_3d_class.h.

-
115{ return world_matrix_;};
-
-
-
- -

◆ initialize()

- -
-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool d_3d_class::initialize (int screenWidth,
int screenHeight,
bool vsync,
HWND hwnd,
bool fullscreen,
float screenDepth,
float screenNear )
-
-virtual
-
- -

Initializes the Direct3D device and related resources.

-
Parameters
- - - - - - - - -
screenWidthWidth of the screen.
screenHeightHeight of the screen.
vsyncWhether to enable vertical sync.
hwndHandle to the window.
fullscreenWhether to run in fullscreen mode.
screenDepthDepth of the screen.
screenNearNear clipping plane distance.
-
-
-
Returns
True if initialization was successful, false otherwise.
- -

Definition at line 33 of file d_3d_class.cpp.

-
34{
-
35 Logger::Get().Log("Initializing D3Dclass", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
36
-
37 HRESULT result;
-
38 IDXGIFactory* factory;
-
39 IDXGIAdapter* adapter;
-
40 IDXGIOutput* adapterOutput;
-
41 unsigned int numModes, i, numerator, denominator;
-
42 unsigned long long stringLength;
-
43 DXGI_MODE_DESC* displayModeList;
-
44 DXGI_ADAPTER_DESC adapterDesc;
-
45 int error;
-
46 DXGI_SWAP_CHAIN_DESC swapChainDesc;
-
47 D3D_FEATURE_LEVEL featureLevel;
-
48 ID3D11Texture2D* backBufferPtr;
-
49 D3D11_TEXTURE2D_DESC depthBufferDesc;
-
50 D3D11_DEPTH_STENCIL_DESC depthStencilDesc;
-
51 D3D11_DEPTH_STENCIL_VIEW_DESC depthStencilViewDesc;
-
52 D3D11_RASTERIZER_DESC rasterDesc;
-
53 float fieldOfView, screenAspect;
-
54 D3D11_DEPTH_STENCIL_DESC depthDisabledStencilDesc;
-
55 D3D11_BLEND_DESC blendStateDescription;
-
56
-
57 // Store the vsync setting.
-
58 vsync_enabled_ = vsync;
-
59
-
60 // Create a DirectX graphics interface factory.
-
61 result = CreateDXGIFactory(__uuidof(IDXGIFactory), (void**)&factory);
-
62 if (FAILED(result))
-
63 {
-
64 Logger::Get().Log("Failed to create DXGIFactory", __FILE__, __LINE__, Logger::LogLevel::Error);
-
65 return false;
-
66 }
-
67
-
68 // Use the factory to create an adapter for the primary graphics interface (video card).
-
69 result = factory->EnumAdapters(0, &adapter);
-
70 if (FAILED(result))
-
71 {
-
72 Logger::Get().Log("Failed to create adapter", __FILE__, __LINE__, Logger::LogLevel::Error);
-
73 return false;
-
74 }
-
75
-
76 // Enumerate the primary adapter output (monitor).
-
77 result = adapter->EnumOutputs(0, &adapterOutput);
-
78 if (FAILED(result))
-
79 {
-
80 Logger::Get().Log("Failed to create adapter output", __FILE__, __LINE__, Logger::LogLevel::Error);
-
81 return false;
-
82 }
-
83
-
84 // Get the number of modes that fit the DXGI_FORMAT_R8G8B8A8_UNORM display format for the adapter output (monitor).
-
85 result = adapterOutput->GetDisplayModeList(DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_ENUM_MODES_INTERLACED, &numModes, NULL);
-
86 if (FAILED(result))
-
87 {
-
88 Logger::Get().Log("Failed to get display mode list", __FILE__, __LINE__, Logger::LogLevel::Error);
-
89 return false;
-
90 }
-
91
-
92 // Create a list to hold all the possible display modes for this monitor/video card combination.
-
93 displayModeList = new DXGI_MODE_DESC[numModes];
-
94 if (!displayModeList)
-
95 {
-
96 Logger::Get().Log("Failed to create display mode list", __FILE__, __LINE__, Logger::LogLevel::Error);
-
97 return false;
-
98 }
-
99
-
100 // Now fill the display mode list structures.
-
101 result = adapterOutput->GetDisplayModeList(DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_ENUM_MODES_INTERLACED, &numModes, displayModeList);
-
102 if (FAILED(result))
-
103 {
-
104 Logger::Get().Log("Failed to fill display mode list", __FILE__, __LINE__, Logger::LogLevel::Error);
-
105 return false;
-
106 }
-
107
-
108 // Now go through all the display modes and find the one that matches the screen width and height.
-
109 // When a match is found store the numerator and denominator of the refresh rate for that monitor.
-
110 for (i = 0; i < numModes; i++)
-
111 {
-
112 if (displayModeList[i].Width == (unsigned int)screenWidth)
-
113 {
-
114 if (displayModeList[i].Height == (unsigned int)screenHeight)
-
115 {
-
116 numerator = displayModeList[i].RefreshRate.Numerator;
-
117 denominator = displayModeList[i].RefreshRate.Denominator;
-
118 }
-
119 }
-
120 }
-
121
-
122 // Get the adapter (video card) description.
-
123 result = adapter->GetDesc(&adapterDesc);
-
124 if (FAILED(result))
-
125 {
-
126 Logger::Get().Log("Failed to get adapter description", __FILE__, __LINE__, Logger::LogLevel::Error);
-
127 return false;
-
128 }
-
129
-
130 // Store the dedicated video card memory in megabytes.
-
131 video_card_memory_ = (int)(adapterDesc.DedicatedVideoMemory / 1024 / 1024);
-
132
-
133 // Convert the name of the video card to a character array and store it.
-
134 error = wcstombs_s(&stringLength, video_card_description_, 128, adapterDesc.Description, 128);
-
135 if (error != 0)
-
136 {
-
137 Logger::Get().Log("Failed to convert video card name to character array", __FILE__, __LINE__, Logger::LogLevel::Error);
-
138 return false;
-
139 }
-
140
-
141 // Release the display mode list.
-
142 delete[] displayModeList;
-
143 displayModeList = 0;
-
144
-
145 // Release the adapter output.
-
146 adapterOutput->Release();
-
147 adapterOutput = 0;
-
148
-
149 // Release the adapter.
-
150 adapter->Release();
-
151 adapter = 0;
-
152
-
153 // Release the factory.
-
154 factory->Release();
-
155 factory = 0;
-
156
-
157 // initialize the swap chain description.
-
158 ZeroMemory(&swapChainDesc, sizeof(swapChainDesc));
-
159
-
160 // Set to a single back buffer.
-
161 swapChainDesc.BufferCount = 1;
-
162
-
163 // Set the width and height of the back buffer.
-
164 swapChainDesc.BufferDesc.Width = screenWidth;
-
165 swapChainDesc.BufferDesc.Height = screenHeight;
-
166
-
167 // Set regular 32-bit surface for the back buffer.
-
168 swapChainDesc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
-
169
-
170 // Set the refresh rate of the back buffer.
-
171 if (vsync_enabled_)
-
172 {
-
173 swapChainDesc.BufferDesc.RefreshRate.Numerator = numerator;
-
174 swapChainDesc.BufferDesc.RefreshRate.Denominator = denominator;
-
175 }
-
176 else
-
177 {
-
178 swapChainDesc.BufferDesc.RefreshRate.Numerator = 0;
-
179 swapChainDesc.BufferDesc.RefreshRate.Denominator = 1;
-
180 }
-
181
-
182 // Set the usage of the back buffer.
-
183 swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
-
184
-
185 // Set the handle for the window to render to.
-
186 swapChainDesc.OutputWindow = hwnd;
-
187
-
188 // Turn multisampling off.
-
189 swapChainDesc.SampleDesc.Count = 1;
-
190 swapChainDesc.SampleDesc.Quality = 0;
-
191
-
192 // Set to full screen or windowed mode.
-
193 if (fullscreen)
-
194 {
-
195 swapChainDesc.Windowed = false;
-
196 }
-
197 else
-
198 {
-
199 swapChainDesc.Windowed = true;
-
200 }
-
201
-
202 // Set the scan line ordering and scaling to unspecified.
-
203 swapChainDesc.BufferDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED;
-
204 swapChainDesc.BufferDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED;
-
205
-
206 // Discard the back buffer contents after presenting.
-
207 swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
-
208
-
209 // Don't set the advanced flags.
-
210 swapChainDesc.Flags = 0;
-
211
-
212 // Set the feature level to DirectX 11.
-
213 featureLevel = D3D_FEATURE_LEVEL_11_0;
-
214
-
215 // Create the swap chain, Direct3D device, and Direct3D device context.
-
216 result = D3D11CreateDeviceAndSwapChain(NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, 0, &featureLevel, 1,
-
217 D3D11_SDK_VERSION, &swapChainDesc, &swap_chain, &device_, NULL, &device_context_);
-
218 if (FAILED(result))
-
219 {
-
220 Logger::Get().Log("Failed to create swap chain, device and device context", __FILE__, __LINE__, Logger::LogLevel::Error);
-
221 return false;
-
222 }
-
223
-
224 // Get the pointer to the back buffer.
-
225 result = swap_chain->GetBuffer(0, __uuidof(ID3D11Texture2D), (LPVOID*)&backBufferPtr);
-
226 if (FAILED(result))
-
227 {
-
228 Logger::Get().Log("Failed to get pointer to back buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
-
229 return false;
-
230 }
-
231
-
232 // Create the render target view with the back buffer pointer.
-
233 result = device_->CreateRenderTargetView(backBufferPtr, NULL, &render_target_view_);
-
234 if (FAILED(result))
-
235 {
-
236 Logger::Get().Log("Failed to create render target view", __FILE__, __LINE__, Logger::LogLevel::Error);
-
237 return false;
-
238 }
-
239
-
240 // Release pointer to the back buffer as we no longer need it.
-
241 backBufferPtr->Release();
-
242 backBufferPtr = 0;
-
243
-
244 // initialize the description of the depth buffer.
-
245 ZeroMemory(&depthBufferDesc, sizeof(depthBufferDesc));
-
246
-
247 // Set up the description of the depth buffer.
-
248 depthBufferDesc.Width = screenWidth;
-
249 depthBufferDesc.Height = screenHeight;
-
250 depthBufferDesc.MipLevels = 1;
-
251 depthBufferDesc.ArraySize = 1;
-
252 depthBufferDesc.Format = DXGI_FORMAT_D24_UNORM_S8_UINT;
-
253 depthBufferDesc.SampleDesc.Count = 1;
-
254 depthBufferDesc.SampleDesc.Quality = 0;
-
255 depthBufferDesc.Usage = D3D11_USAGE_DEFAULT;
-
256 depthBufferDesc.BindFlags = D3D11_BIND_DEPTH_STENCIL;
-
257 depthBufferDesc.CPUAccessFlags = 0;
-
258 depthBufferDesc.MiscFlags = 0;
-
259
-
260 // Create the texture for the depth buffer using the filled out description.
-
261 result = device_->CreateTexture2D(&depthBufferDesc, NULL, &depth_stencil_buffer_);
-
262 if (FAILED(result))
-
263 {
-
264 Logger::Get().Log("Failed to create texture for depth buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
-
265 return false;
-
266 }
-
267
-
268 // initialize the description of the stencil state.
-
269 ZeroMemory(&depthStencilDesc, sizeof(depthStencilDesc));
-
270
-
271 // Set up the description of the stencil state.
-
272 depthStencilDesc.DepthEnable = true;
-
273 depthStencilDesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL;
-
274 depthStencilDesc.DepthFunc = D3D11_COMPARISON_LESS;
-
275
-
276 depthStencilDesc.StencilEnable = true;
-
277 depthStencilDesc.StencilReadMask = 0xFF;
-
278 depthStencilDesc.StencilWriteMask = 0xFF;
-
279
-
280 // Stencil operations if pixel is front-facing.
-
281 depthStencilDesc.FrontFace.StencilFailOp = D3D11_STENCIL_OP_KEEP;
-
282 depthStencilDesc.FrontFace.StencilDepthFailOp = D3D11_STENCIL_OP_INCR;
-
283 depthStencilDesc.FrontFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
-
284 depthStencilDesc.FrontFace.StencilFunc = D3D11_COMPARISON_ALWAYS;
-
285
-
286 // Stencil operations if pixel is back-facing.
-
287 depthStencilDesc.BackFace.StencilFailOp = D3D11_STENCIL_OP_KEEP;
-
288 depthStencilDesc.BackFace.StencilDepthFailOp = D3D11_STENCIL_OP_DECR;
-
289 depthStencilDesc.BackFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
-
290 depthStencilDesc.BackFace.StencilFunc = D3D11_COMPARISON_ALWAYS;
-
291
-
292 // Create the depth stencil state.
-
293 result = device_->CreateDepthStencilState(&depthStencilDesc, &depth_stencil_state_);
-
294 if (FAILED(result))
-
295 {
-
296 Logger::Get().Log("Failed to create depth stencil state", __FILE__, __LINE__, Logger::LogLevel::Error);
-
297 return false;
-
298 }
-
299
-
300 // Set the depth stencil state.
-
301 device_context_->OMSetDepthStencilState(depth_stencil_state_, 1);
-
302
-
303 // initialize the depth stencil view.
-
304 ZeroMemory(&depthStencilViewDesc, sizeof(depthStencilViewDesc));
-
305
-
306 // Set up the depth stencil view description.
-
307 depthStencilViewDesc.Format = DXGI_FORMAT_D24_UNORM_S8_UINT;
-
308 depthStencilViewDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D;
-
309 depthStencilViewDesc.Texture2D.MipSlice = 0;
-
310
-
311 // Create the depth stencil view.
-
312 result = device_->CreateDepthStencilView(depth_stencil_buffer_, &depthStencilViewDesc, &depth_stencil_view_);
-
313 if (FAILED(result))
-
314 {
-
315 Logger::Get().Log("Failed to create depth stencil view", __FILE__, __LINE__, Logger::LogLevel::Error);
-
316 return false;
-
317 }
-
318
-
319 // Bind the render target view and depth stencil buffer to the output render pipeline.
-
320 device_context_->OMSetRenderTargets(1, &render_target_view_, depth_stencil_view_);
-
321
-
322 // Setup the raster description which will determine how and what polygons will be drawn.
-
323 rasterDesc.AntialiasedLineEnable = false;
-
324 rasterDesc.CullMode = D3D11_CULL_BACK;
-
325 rasterDesc.DepthBias = 0;
-
326 rasterDesc.DepthBiasClamp = 0.0f;
-
327 rasterDesc.DepthClipEnable = true;
-
328 rasterDesc.FillMode = D3D11_FILL_SOLID;
-
329 rasterDesc.FrontCounterClockwise = false;
-
330 rasterDesc.MultisampleEnable = false;
-
331 rasterDesc.ScissorEnable = false;
-
332 rasterDesc.SlopeScaledDepthBias = 0.0f;
-
333
-
334 // Create the rasterizer state from the description we just filled out.
-
335 result = device_->CreateRasterizerState(&rasterDesc, &raster_state_);
-
336 if (FAILED(result))
-
337 {
-
338 Logger::Get().Log("Failed to create rasterizer state", __FILE__, __LINE__, Logger::LogLevel::Error);
-
339 return false;
-
340 }
-
341
-
342 // Now set the rasterizer state.
-
343 device_context_->RSSetState(raster_state_);
-
344
-
345 // Setup the viewport for rendering.
-
346 viewport_.Width = (float)screenWidth;
-
347 viewport_.Height = (float)screenHeight;
-
348 viewport_.MinDepth = 0.0f;
-
349 viewport_.MaxDepth = 1.0f;
-
350 viewport_.TopLeftX = 0.0f;
-
351 viewport_.TopLeftY = 0.0f;
-
352
-
353 // Create the viewport.
-
354 device_context_->RSSetViewports(1, &viewport_);
-
355
-
356 // Setup the projection matrix.
-
357 fieldOfView = 3.141592654f / 4.0f;
-
358 screenAspect = (float)screenWidth / (float)screenHeight;
-
359
-
360 // Create the projection matrix for 3D rendering.
-
361 projection_matrix_ = XMMatrixPerspectiveFovLH(fieldOfView, screenAspect, screenNear, screenDepth);
-
362
-
363 // initialize the world matrix to the identity matrix.
-
364 world_matrix_ = XMMatrixIdentity();
-
365
-
366 // Create an orthographic projection matrix for 2D rendering.
-
367 ortho_matrix_ = XMMatrixOrthographicLH((float)screenWidth, (float)screenHeight, screenNear, screenDepth);
-
368
-
369 // Clear the second depth stencil state before setting the parameters.
-
370 ZeroMemory(&depthDisabledStencilDesc, sizeof(depthDisabledStencilDesc));
-
371
-
372 // Now create a second depth stencil state which turns off the Z buffer for 2D rendering. The only difference is
-
373 // that DepthEnable is set to false, all other parameters are the same as the other depth stencil state.
-
374 depthDisabledStencilDesc.DepthEnable = false;
-
375 depthDisabledStencilDesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL;
-
376 depthDisabledStencilDesc.DepthFunc = D3D11_COMPARISON_LESS;
-
377 depthDisabledStencilDesc.StencilEnable = true;
-
378 depthDisabledStencilDesc.StencilReadMask = 0xFF;
-
379 depthDisabledStencilDesc.StencilWriteMask = 0xFF;
-
380 depthDisabledStencilDesc.FrontFace.StencilFailOp = D3D11_STENCIL_OP_KEEP;
-
381 depthDisabledStencilDesc.FrontFace.StencilDepthFailOp = D3D11_STENCIL_OP_INCR;
-
382 depthDisabledStencilDesc.FrontFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
-
383 depthDisabledStencilDesc.FrontFace.StencilFunc = D3D11_COMPARISON_ALWAYS;
-
384 depthDisabledStencilDesc.BackFace.StencilFailOp = D3D11_STENCIL_OP_KEEP;
-
385 depthDisabledStencilDesc.BackFace.StencilDepthFailOp = D3D11_STENCIL_OP_DECR;
-
386 depthDisabledStencilDesc.BackFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
-
387 depthDisabledStencilDesc.BackFace.StencilFunc = D3D11_COMPARISON_ALWAYS;
-
388
-
389 // Create the state using the device.
-
390 result = device_->CreateDepthStencilState(&depthDisabledStencilDesc, &depth_disabled_stencil_state_);
-
391 if (FAILED(result))
-
392 {
-
393 Logger::Get().Log("Failed to create depth disabled stencil state", __FILE__, __LINE__, Logger::LogLevel::Error);
-
394 return false;
-
395 }
-
396
-
397 // Clear the blend state description.
-
398 ZeroMemory(&blendStateDescription, sizeof(D3D11_BLEND_DESC));
-
399
-
400 // Create an alpha enabled blend state description.
-
401 blendStateDescription.RenderTarget[0].BlendEnable = TRUE;
-
402 blendStateDescription.RenderTarget[0].SrcBlend = D3D11_BLEND_ONE;
-
403 blendStateDescription.RenderTarget[0].DestBlend = D3D11_BLEND_INV_SRC_ALPHA;
-
404 blendStateDescription.RenderTarget[0].BlendOp = D3D11_BLEND_OP_ADD;
-
405 blendStateDescription.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_ONE;
-
406 blendStateDescription.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_ZERO;
-
407 blendStateDescription.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD;
-
408 blendStateDescription.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL;
-
409
-
410 // Create the blend state using the description.
-
411 result = device_->CreateBlendState(&blendStateDescription, &alpha_enable_blending_state_);
-
412 if (FAILED(result))
-
413 {
-
414 Logger::Get().Log("Failed to create alpha enabled blend state", __FILE__, __LINE__, Logger::LogLevel::Error);
-
415 return false;
-
416 }
-
417
-
418 // Modify the description to create an alpha disabled blend state description.
-
419 blendStateDescription.RenderTarget[0].BlendEnable = FALSE;
-
420
-
421 // Create the blend state using the description.
-
422 result = device_->CreateBlendState(&blendStateDescription, &alpha_disable_blending_state_);
-
423 if (FAILED(result))
-
424 {
-
425 Logger::Get().Log("Failed to create alpha disabled blend state", __FILE__, __LINE__, Logger::LogLevel::Error);
-
426 return false;
-
427 }
-
428
-
429 return true;
-
430}
-
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
-
-
-
- -

◆ release_resources()

- -
-
- - - - - - - -
void d_3d_class::release_resources ()
-
-

Release all Direct3D resources.

- -

Definition at line 593 of file d_3d_class.cpp.

-
594{
-
595 Logger::Get().Log("Releasing D3D resources", __FILE__, __LINE__);
-
596
-
597 // libere la vue
-
598 if (render_target_view_)
-
599 {
-
600 render_target_view_->Release();
-
601 render_target_view_ = 0;
-
602 }
-
603
-
604 // libere le buffer de profondeur
-
605 if (depth_stencil_buffer_)
-
606 {
-
607 depth_stencil_buffer_->Release();
-
608 depth_stencil_buffer_ = 0;
-
609 }
-
610
-
611 // libere la vue de profondeur
-
612 if (depth_stencil_view_)
-
613 {
-
614 depth_stencil_view_->Release();
-
615 depth_stencil_view_ = 0;
-
616 }
-
617
-
618 Logger::Get().Log("D3D resources released", __FILE__, __LINE__);
-
619}
-
-
-
- -

◆ reset_resources()

- -
-
- - - - - - - - - - - -
void d_3d_class::reset_resources (int newWidth,
int newHeight )
-
-

Reset Direct3D resources based on the new width and height.

Parameters
- - - -
newWidth
newHeight
-
-
- -

Definition at line 622 of file d_3d_class.cpp.

-
623{
-
624 Logger::Get().Log("Resetting D3D resources", __FILE__, __LINE__);
-
625
-
626 HRESULT result;
-
627
-
628 ID3D11Texture2D* backBuffer;
-
629 result = swap_chain->GetBuffer(0, __uuidof(ID3D11Texture2D), (LPVOID*)&backBuffer);
-
630 if (FAILED(result))
-
631 {
-
632 Logger::Get().Log("Failed to get back buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
-
633 return;
-
634 }
-
635
-
636 result = device_->CreateRenderTargetView(backBuffer, NULL, &render_target_view_);
-
637 if (FAILED(result))
-
638 {
-
639 Logger::Get().Log("Failed to create render target view", __FILE__, __LINE__, Logger::LogLevel::Error);
-
640 return;
-
641 }
-
642
-
643 result = backBuffer->Release();
-
644 if (FAILED(result))
-
645 {
-
646 Logger::Get().Log("Failed to release back buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
-
647 return;
-
648 }
-
649
-
650 // Recreate the depth/stencil buffer and view
-
651 D3D11_TEXTURE2D_DESC depthBufferDesc;
-
652 ZeroMemory(&depthBufferDesc, sizeof(depthBufferDesc));
-
653 depthBufferDesc.Width = newWidth;
-
654 depthBufferDesc.Height = newHeight;
-
655 depthBufferDesc.MipLevels = 1;
-
656 depthBufferDesc.ArraySize = 1;
-
657 depthBufferDesc.Format = DXGI_FORMAT_D24_UNORM_S8_UINT;
-
658 depthBufferDesc.SampleDesc.Count = 1;
-
659 depthBufferDesc.SampleDesc.Quality = 0;
-
660 depthBufferDesc.Usage = D3D11_USAGE_DEFAULT;
-
661 depthBufferDesc.BindFlags = D3D11_BIND_DEPTH_STENCIL;
-
662 depthBufferDesc.CPUAccessFlags = 0;
-
663 depthBufferDesc.MiscFlags = 0;
-
664
-
665 D3D11_DEPTH_STENCIL_VIEW_DESC depthStencilViewDesc;
-
666 ZeroMemory(&depthStencilViewDesc, sizeof(depthStencilViewDesc));
-
667 depthStencilViewDesc.Format = depthBufferDesc.Format;
-
668 depthStencilViewDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D;
-
669 depthStencilViewDesc.Texture2D.MipSlice = 0;
-
670
-
671 // Other depthStencilDesc settings...
-
672 result = device_->CreateTexture2D(&depthBufferDesc, NULL, &depth_stencil_buffer_);
-
673 if (FAILED(result))
-
674 {
-
675 Logger::Get().Log("Failed to create depth stencil buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
-
676 return;
-
677 }
-
678
-
679 result = device_->CreateDepthStencilView(depth_stencil_buffer_, &depthStencilViewDesc, &depth_stencil_view_);
-
680 if (FAILED(result))
-
681 {
-
682 Logger::Get().Log("Failed to create depth stencil view", __FILE__, __LINE__, Logger::LogLevel::Error);
-
683 return;
-
684 }
-
685
-
686 // Set the new render target and depth/stencil views for rendering
-
687 device_context_->OMSetRenderTargets(1, &render_target_view_, depth_stencil_view_);
-
688}
-
-
-
- -

◆ reset_viewport()

- -
-
- - - - - - - -
void d_3d_class::reset_viewport ()
-
-

Resets the viewport to the default settings.

- -

Definition at line 585 of file d_3d_class.cpp.

-
586{
-
587 // Set the viewport.
-
588 device_context_->RSSetViewports(1, &viewport_);
-
589
-
590 return;
-
591}
-
-
-
- -

◆ resize_swap_chain()

- -
-
- - - - - - - - - - - -
void d_3d_class::resize_swap_chain (int width,
int height )
-
-

Resizes the swap chain to the specified width and height.

Parameters
- - - -
widthNew width of the swap chain.
heightNew height of the swap chain.
-
-
- -

Definition at line 695 of file d_3d_class.cpp.

-
696{
-
697
-
698 // log the new width and height
-
699 Logger::Get().Log("Resizing swap chain to " + std::to_string(newWidth) + "x" + std::to_string(newHeight), __FILE__, __LINE__);
-
700
-
701 HRESULT result;
-
702
-
703 // Release existing DirectX resources
- -
705 device_context_->Flush();
-
706
-
707 // Resize the swap chain
-
708 result = swap_chain->ResizeBuffers(0, newWidth, newHeight, DXGI_FORMAT_UNKNOWN, 0);
-
709 if (FAILED(result))
-
710 {
-
711 Logger::Get().Log("Failed to resize swap chain", __FILE__, __LINE__, Logger::LogLevel::Error);
-
712 return;
-
713 }
-
714
-
715 // Reset the resources
-
716 reset_resources(newWidth, newHeight);
-
717
-
718 // Update the viewport
-
719 viewport_.Width = static_cast<float>(newWidth);
-
720 viewport_.Height = static_cast<float>(newHeight);
-
721 device_context_->RSSetViewports(1, &viewport_);
-
722}
-
void release_resources()
-
void reset_resources(int newWidth, int newHeight)
-
-
-
- -

◆ set_back_buffer_render_target()

- -
-
- - - - - - - -
void d_3d_class::set_back_buffer_render_target ()
-
-

Set the render target to the back buffer.

- -

Definition at line 576 of file d_3d_class.cpp.

-
577{
-
578 // Bind the render target view and depth stencil buffer to the output render pipeline.
-
579 device_context_->OMSetRenderTargets(1, &render_target_view_, depth_stencil_view_);
-
580
-
581 return;
-
582}
-
-
-
- -

◆ set_vsync()

- -
-
- - - - - - - -
void d_3d_class::set_vsync (bool vsync)
-
- -

Sets the vertical sync state.

-
Parameters
- - -
vsyncTrue to enable vertical sync, false to disable.
-
-
- -

Definition at line 771 of file d_3d_class.cpp.

-
772{
-
773 vsync_enabled_ = vsync;
-
774}
-
-
-
- -

◆ shutdown()

- -
-
- - - - - - - -
void d_3d_class::shutdown ()
-
- -

Releases Direct3D resources.

- -

Definition at line 433 of file d_3d_class.cpp.

-
434{
-
435
-
436 Logger::Get().Log("Shutting down D3Dclass", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
437
-
438 // Before shutting down set to windowed mode or when you release the swap chain it will throw an exception.
-
439 if (swap_chain)
-
440 {
-
441 swap_chain->SetFullscreenState(false, NULL);
-
442 }
-
443
-
444 if (alpha_enable_blending_state_)
-
445 {
-
446 alpha_enable_blending_state_->Release();
-
447 alpha_enable_blending_state_ = 0;
-
448 }
-
449
-
450 if (alpha_disable_blending_state_)
-
451 {
-
452 alpha_disable_blending_state_->Release();
-
453 alpha_disable_blending_state_ = 0;
-
454 }
-
455
-
456 if (depth_disabled_stencil_state_)
-
457 {
-
458 depth_disabled_stencil_state_->Release();
-
459 depth_disabled_stencil_state_ = 0;
-
460 }
-
461
-
462 if (raster_state_)
-
463 {
-
464 raster_state_->Release();
-
465 raster_state_ = 0;
-
466 }
-
467
-
468 if (depth_stencil_view_)
-
469 {
-
470 depth_stencil_view_->Release();
-
471 depth_stencil_view_ = 0;
-
472 }
-
473
-
474 if (depth_stencil_state_)
-
475 {
-
476 depth_stencil_state_->Release();
-
477 depth_stencil_state_ = 0;
-
478 }
-
479
-
480 if (depth_stencil_buffer_)
-
481 {
-
482 depth_stencil_buffer_->Release();
-
483 depth_stencil_buffer_ = 0;
-
484 }
-
485
-
486 if (render_target_view_)
-
487 {
-
488 render_target_view_->Release();
-
489 render_target_view_ = 0;
-
490 }
-
491
-
492 if (device_context_)
-
493 {
-
494 device_context_->Release();
-
495 device_context_ = 0;
-
496 }
-
497
-
498 if (device_)
-
499 {
-
500 device_->Release();
-
501 device_ = 0;
-
502 }
-
503
-
504 if (swap_chain)
-
505 {
-
506 swap_chain->Release();
-
507 swap_chain = 0;
-
508 }
-
509
-
510 Logger::Get().Log("D3Dclass shutdown", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
511
-
512 return;
-
513}
-
-
-
- -

◆ turn_z_buffer_off()

- -
-
- - - - - - - -
void d_3d_class::turn_z_buffer_off ()
-
-

Turn off the Z-buffer to disable depth.

- -

Definition at line 731 of file d_3d_class.cpp.

-
732{
-
733 device_context_->OMSetDepthStencilState(depth_disabled_stencil_state_, 1);
-
734 return;
-
735}
-
-
-
- -

◆ turn_z_buffer_on()

- -
-
- - - - - - - -
void d_3d_class::turn_z_buffer_on ()
-
-

Turn on the Z-buffer to enable depth.

- -

Definition at line 724 of file d_3d_class.cpp.

-
725{
-
726 device_context_->OMSetDepthStencilState(depth_stencil_state_, 1);
-
727 return;
-
728}
-
-
-
-

Member Data Documentation

- -

◆ swap_chain

- -
-
- - - - -
IDXGISwapChain* d_3d_class::swap_chain
-
- -

Definition at line 85 of file d_3d_class.h.

- -
-
-
The documentation for this class was generated from the following files: -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:a63b893ec6d13962c9d0caf51b3dc20f681316f1c6567e8946e8b82cf9aa6e2c +size 126850 diff --git a/doxygen_docs/html/classd__3d__class.js b/doxygen_docs/html/classd__3d__class.js index c5c6775..64ed6f6 100644 --- a/doxygen_docs/html/classd__3d__class.js +++ b/doxygen_docs/html/classd__3d__class.js @@ -1,25 +1,3 @@ -var classd__3d__class = -[ - [ "d_3d_class", "classd__3d__class.html#a9858f0cfaa93dec1b76ccea6e31c85bc", null ], - [ "begin_scene", "classd__3d__class.html#acaf14bacf9de484d9f4deb4e148d272c", null ], - [ "disable_alpha_blending", "classd__3d__class.html#a971e5902f64a1885238bb94dc071ab18", null ], - [ "enable_alpha_blending", "classd__3d__class.html#a93b990eb289ab87c5e488353b9a90d7c", null ], - [ "end_scene", "classd__3d__class.html#a0c3bc2a6265c0922ac7fa20264036bb9", null ], - [ "get_device", "classd__3d__class.html#a0979aea3c4bb6815908fbe188fc1c67e", null ], - [ "get_device_context", "classd__3d__class.html#a4ad87066c014351689f12981234beadb", null ], - [ "get_ortho_matrix", "classd__3d__class.html#aa24cb2be2ecf760dd8ff350e88534130", null ], - [ "get_projection_matrix", "classd__3d__class.html#a64893c249b126bdc97f63c00e7c78758", null ], - [ "get_swap_chain", "classd__3d__class.html#aa25b4b30b0ee3160c4d6c86ceeedd70d", null ], - [ "get_video_card_info", "classd__3d__class.html#a7373ca22ab51dd0f8949a917fa057f19", null ], - [ "get_world_matrix", "classd__3d__class.html#a2a910b75177d248036bb4418038406f1", null ], - [ "initialize", "classd__3d__class.html#aeba928a71d4440004fff00603ed06658", null ], - [ "release_resources", "classd__3d__class.html#a17c8aa0768ac5005f1e9cb27dac70a0e", null ], - [ "reset_resources", "classd__3d__class.html#a1d13282bf58145a96b3a77285b075a7a", null ], - [ "reset_viewport", "classd__3d__class.html#a63f75e9982d09b8cd8d06a1f79c01246", null ], - [ "resize_swap_chain", "classd__3d__class.html#a953be067f947e9be5b6fbdf1ac35bb60", null ], - [ "set_back_buffer_render_target", "classd__3d__class.html#a2e36ee106e2d9066c96ded6a3e97ac0c", null ], - [ "set_vsync", "classd__3d__class.html#ab0f3edaca84f6371ebbdb6291a60b59c", null ], - [ "shutdown", "classd__3d__class.html#ac6f9c4ea768ab32707ddb7a095ca60b3", null ], - [ "turn_z_buffer_off", "classd__3d__class.html#af10a177e15842ad232f394d30f80a4e6", null ], - [ "turn_z_buffer_on", "classd__3d__class.html#a00a377d6a09653fd3f7e68af8afcea3a", null ] -]; \ No newline at end of file +version https://git-lfs.github.com/spec/v1 +oid sha256:61f7b5d88a797db007cd22242fd34f448d4d3376f28e3b70367cc99a24bc5244 +size 2082 diff --git a/doxygen_docs/html/classdepth__shader__class-members.html b/doxygen_docs/html/classdepth__shader__class-members.html index c04822c..6756076 100644 --- a/doxygen_docs/html/classdepth__shader__class-members.html +++ b/doxygen_docs/html/classdepth__shader__class-members.html @@ -1,120 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
depth_shader_class Member List
-
-
- -

This is the complete list of members for depth_shader_class, including all inherited members.

- - - - - - - -
depth_shader_class() (defined in depth_shader_class)depth_shader_class
depth_shader_class(const depth_shader_class &) (defined in depth_shader_class)depth_shader_class
initialize(ID3D11Device *, HWND) (defined in depth_shader_class)depth_shader_class
render(ID3D11DeviceContext *, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView *) (defined in depth_shader_class)depth_shader_class
shutdown() (defined in depth_shader_class)depth_shader_class
~depth_shader_class() (defined in depth_shader_class)depth_shader_class
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:b4dec3df6d3d68b44e5a02a395a2935ad73ae9eecf2c74b385f63ea3a5441b6d +size 6286 diff --git a/doxygen_docs/html/classdepth__shader__class.html b/doxygen_docs/html/classdepth__shader__class.html index e2185c4..a9e52d3 100644 --- a/doxygen_docs/html/classdepth__shader__class.html +++ b/doxygen_docs/html/classdepth__shader__class.html @@ -1,349 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: depth_shader_class Class Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
- -
depth_shader_class Class Reference
-
-
- - - - - - - - - - -

-Public Member Functions

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

Detailed Description

-
-

Definition at line 20 of file depth_shader_class.h.

-

Constructor & Destructor Documentation

- -

◆ depth_shader_class() [1/2]

- -
-
- - - - - - - -
depth_shader_class::depth_shader_class ()
-
- -

Definition at line 4 of file depth_shader_class.cpp.

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

◆ depth_shader_class() [2/2]

- -
-
- - - - - - - -
depth_shader_class::depth_shader_class (const depth_shader_class & other)
-
- -

Definition at line 14 of file depth_shader_class.cpp.

-
15{
-
16}
-
-
-
- -

◆ ~depth_shader_class()

- -
-
- - - - - - - -
depth_shader_class::~depth_shader_class ()
-
- -

Definition at line 19 of file depth_shader_class.cpp.

-
20{
-
21}
-
-
-
-

Member Function Documentation

- -

◆ initialize()

- -
-
- - - - - - - - - - - -
bool depth_shader_class::initialize (ID3D11Device * device,
HWND hwnd )
-
- -

Definition at line 24 of file depth_shader_class.cpp.

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

Definition at line 69 of file depth_shader_class.cpp.

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

◆ shutdown()

- -
-
- - - - - - - -
void depth_shader_class::shutdown ()
-
- -

Definition at line 61 of file depth_shader_class.cpp.

-
62{
-
63 // shutdown the vertex and pixel shaders as well as the related objects.
-
64 shutdown_shader();
-
65
-
66 return;
-
67}
-
-
-
-
The documentation for this class was generated from the following files: -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:9046b4f8b7afb272d05b1dfb0d999b08b0cce62bec3d7ee596c9c7a523969351 +size 22731 diff --git a/doxygen_docs/html/classdisplay__plane__class-members.html b/doxygen_docs/html/classdisplay__plane__class-members.html index bca7036..a3a7ea9 100644 --- a/doxygen_docs/html/classdisplay__plane__class-members.html +++ b/doxygen_docs/html/classdisplay__plane__class-members.html @@ -1,121 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
display_plane_class Member List
-
-
- -

This is the complete list of members for display_plane_class, including all inherited members.

- - - - - - - - -
display_plane_class() (defined in display_plane_class)display_plane_class
display_plane_class(const display_plane_class &) (defined in display_plane_class)display_plane_class
GetIndexCount() (defined in display_plane_class)display_plane_class
Initialize(ID3D11Device *, float, float) (defined in display_plane_class)display_plane_class
Render(ID3D11DeviceContext *) (defined in display_plane_class)display_plane_class
Shutdown() (defined in display_plane_class)display_plane_class
~display_plane_class() (defined in display_plane_class)display_plane_class
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:ea7b36cca40d80db053f06434da9dc724a8b34221e5eb501cc115c66bc4e5b28 +size 6563 diff --git a/doxygen_docs/html/classdisplay__plane__class.html b/doxygen_docs/html/classdisplay__plane__class.html index f705467..dd39c7c 100644 --- a/doxygen_docs/html/classdisplay__plane__class.html +++ b/doxygen_docs/html/classdisplay__plane__class.html @@ -1,320 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: display_plane_class Class Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
- -
display_plane_class Class Reference
-
-
- - - - - - - - - - - - -

-Public Member Functions

 display_plane_class (const display_plane_class &)
 
bool Initialize (ID3D11Device *, float, float)
 
void Shutdown ()
 
void Render (ID3D11DeviceContext *)
 
int GetIndexCount ()
 
-

Detailed Description

-
-

Definition at line 14 of file display_plane_class.h.

-

Constructor & Destructor Documentation

- -

◆ display_plane_class() [1/2]

- -
-
- - - - - - - -
display_plane_class::display_plane_class ()
-
- -

Definition at line 4 of file display_plane_class.cpp.

-
5{
-
6 m_vertexBuffer = 0;
-
7 m_indexBuffer = 0;
-
8}
-
-
-
- -

◆ display_plane_class() [2/2]

- -
-
- - - - - - - -
display_plane_class::display_plane_class (const display_plane_class & other)
-
- -

Definition at line 11 of file display_plane_class.cpp.

-
12{
-
13}
-
-
-
- -

◆ ~display_plane_class()

- -
-
- - - - - - - -
display_plane_class::~display_plane_class ()
-
- -

Definition at line 16 of file display_plane_class.cpp.

-
17{
-
18}
-
-
-
-

Member Function Documentation

- -

◆ GetIndexCount()

- -
-
- - - - - - - -
int display_plane_class::GetIndexCount ()
-
- -

Definition at line 56 of file display_plane_class.cpp.

-
57{
-
58 return m_indexCount;
-
59}
-
-
-
- -

◆ Initialize()

- -
-
- - - - - - - - - - - - - - - - -
bool display_plane_class::Initialize (ID3D11Device * device,
float width,
float height )
-
- -

Definition at line 20 of file display_plane_class.cpp.

-
21{
-
22 Logger::Get().Log("Initializing display_plane_class, width: " + std::to_string(width) + ", height: " + std::to_string(height), __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
23 bool result;
-
24
-
25
-
26 // initialize the vertex and index buffer that hold the geometry for the button.
-
27 result = InitializeBuffers(device, width, height);
-
28 if (!result)
-
29 {
-
30 Logger::Get().Log("Could not initialize buffers", __FILE__, __LINE__, Logger::LogLevel::Error);
-
31 return false;
-
32 }
-
33
-
34 return true;
-
35}
-
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()

- -
-
- - - - - - - -
void display_plane_class::Render (ID3D11DeviceContext * deviceContext)
-
- -

Definition at line 47 of file display_plane_class.cpp.

-
48{
-
49 // Put the vertex and index buffers on the graphics pipeline to prepare them for drawing.
-
50 RenderBuffers(deviceContext);
-
51
-
52 return;
-
53}
-
-
-
- -

◆ Shutdown()

- -
-
- - - - - - - -
void display_plane_class::Shutdown ()
-
- -

Definition at line 38 of file display_plane_class.cpp.

-
39{
-
40 // Release the vertex and index buffers.
-
41 ShutdownBuffers();
-
42
-
43 return;
-
44}
-
-
-
-
The documentation for this class was generated from the following files: -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:5974f6564440b61a1a977fec5c29d0dbeea3ed81ae6d6faff67ebad2f6ff42af +size 18891 diff --git a/doxygen_docs/html/classecs_1_1_component-members.html b/doxygen_docs/html/classecs_1_1_component-members.html index 7c18dca..ccbc10d 100644 --- a/doxygen_docs/html/classecs_1_1_component-members.html +++ b/doxygen_docs/html/classecs_1_1_component-members.html @@ -1,122 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
ecs::Component Member List
-
-
- -

This is the complete list of members for ecs::Component, including all inherited members.

- - - - - - - - - -
Component()=default (defined in ecs::Component)ecs::Component
Component(const Component &)=delete (defined in ecs::Component)ecs::Component
Component(Component &&)=default (defined in ecs::Component)ecs::Component
Initialize()ecs::Componentinlinevirtual
operator=(const Component &)=delete (defined in ecs::Component)ecs::Component
operator=(Component &&)=default (defined in ecs::Component)ecs::Component
Update(float deltaTime)ecs::Componentinlinevirtual
~Component()=default (defined in ecs::Component)ecs::Componentvirtual
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:87d9ebabc9b5632c50a91199e92a026e568dd7196a432f21a8e6d361bbf2628b +size 6861 diff --git a/doxygen_docs/html/classecs_1_1_component.html b/doxygen_docs/html/classecs_1_1_component.html index 1bd3ff0..8395c70 100644 --- a/doxygen_docs/html/classecs_1_1_component.html +++ b/doxygen_docs/html/classecs_1_1_component.html @@ -1,223 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: ecs::Component Class Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
- -
ecs::Component Class Reference
-
-
-
-Inheritance diagram for ecs::Component:
-
-
- - -ecs::IdentityComponent -ecs::ModelPathComponent -ecs::PhysicsComponent -ecs::RenderComponent -ecs::ShaderComponent -ecs::TransformComponent - -
- - - - - - - - - - - - - - -

-Public Member Functions

Component (const Component &)=delete
 
-Componentoperator= (const Component &)=delete
 
Component (Component &&)=default
 
-Componentoperator= (Component &&)=default
 
virtual void Initialize ()
 
virtual void Update (float deltaTime)
 
-

Detailed Description

-
-

Definition at line 12 of file component.h.

-

Member Function Documentation

- -

◆ Initialize()

- -
-
- - - - - -
- - - - - - - -
virtual void ecs::Component::Initialize ()
-
-inlinevirtual
-
-

Virtual function to initialize the component.

- -

Reimplemented in ecs::IdentityComponent, ecs::ModelPathComponent, ecs::PhysicsComponent, ecs::RenderComponent, and ecs::ShaderComponent.

- -

Definition at line 28 of file component.h.

-
28{}
-
-
-
- -

◆ Update()

- -
-
- - - - - -
- - - - - - - -
virtual void ecs::Component::Update (float deltaTime)
-
-inlinevirtual
-
-

Virtual function to update the component.

Parameters
- - -
deltaTimeTime since the last update.
-
-
- -

Reimplemented in ecs::ModelPathComponent, ecs::PhysicsComponent, ecs::RenderComponent, and ecs::ShaderComponent.

- -

Definition at line 34 of file component.h.

-
34{}
-
-
-
-
The documentation for this class was generated from the following file: -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:69570ed928d11237692920d9292c3974896e27808440725fba09a2aebf4552ab +size 12821 diff --git a/doxygen_docs/html/classecs_1_1_component.js b/doxygen_docs/html/classecs_1_1_component.js index 36810bf..7cebd11 100644 --- a/doxygen_docs/html/classecs_1_1_component.js +++ b/doxygen_docs/html/classecs_1_1_component.js @@ -1,5 +1,3 @@ -var classecs_1_1_component = -[ - [ "Initialize", "classecs_1_1_component.html#a9372874f51e5f63584d65fc378d39459", null ], - [ "Update", "classecs_1_1_component.html#a59c0f739c4ff19227e27ed7b9f6352e0", null ] -]; \ No newline at end of file +version https://git-lfs.github.com/spec/v1 +oid sha256:baf038caa113b2ad04cc68daec360fd250cceea62e33563538dd1f8da860c965 +size 214 diff --git a/doxygen_docs/html/classecs_1_1_component.png b/doxygen_docs/html/classecs_1_1_component.png index 513a0be..1d6a3d6 100644 Binary files a/doxygen_docs/html/classecs_1_1_component.png and b/doxygen_docs/html/classecs_1_1_component.png differ diff --git a/doxygen_docs/html/classecs_1_1_entity-members.html b/doxygen_docs/html/classecs_1_1_entity-members.html index 2d45bc0..0b4a8db 100644 --- a/doxygen_docs/html/classecs_1_1_entity-members.html +++ b/doxygen_docs/html/classecs_1_1_entity-members.html @@ -1,126 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
ecs::Entity Member List
-
-
- -

This is the complete list of members for ecs::Entity, including all inherited members.

- - - - - - - - - - - - - -
AddComponent(Args &&... args)ecs::Entityinline
Entity(EntityID id)ecs::Entityinlineexplicit
Entity(const Entity &)=deleteecs::Entity
Entity(Entity &&)=defaultecs::Entity
GetComponent()ecs::Entityinline
GetID() constecs::Entityinline
HasComponent() constecs::Entityinline
operator=(const Entity &)=delete (defined in ecs::Entity)ecs::Entity
operator=(Entity &&)=default (defined in ecs::Entity)ecs::Entity
RemoveComponent()ecs::Entityinline
UpdateComponents(float deltaTime)ecs::Entityinline
~Entity()=default (defined in ecs::Entity)ecs::Entity
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:d2b1c61c099d60870331da9bc965a9de0695b12d0aa200f9ce2ea35ccd2133dc +size 7844 diff --git a/doxygen_docs/html/classecs_1_1_entity.html b/doxygen_docs/html/classecs_1_1_entity.html index 7da158c..ff0ac28 100644 --- a/doxygen_docs/html/classecs_1_1_entity.html +++ b/doxygen_docs/html/classecs_1_1_entity.html @@ -1,501 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: ecs::Entity Class Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
- -
ecs::Entity Class Reference
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -

-Public Member Functions

 Entity (EntityID id)
 
 Entity (const Entity &)=delete
 
-Entityoperator= (const Entity &)=delete
 
 Entity (Entity &&)=default
 
-Entityoperator= (Entity &&)=default
 
EntityID GetID () const
 
template<typename T , typename... Args>
std::shared_ptr< T > AddComponent (Args &&... args)
 
template<typename T >
std::shared_ptr< T > GetComponent ()
 
template<typename T >
bool HasComponent () const
 
template<typename T >
void RemoveComponent ()
 
void UpdateComponents (float deltaTime)
 
-

Detailed Description

-
-

Definition at line 15 of file entity.h.

-

Constructor & Destructor Documentation

- -

◆ Entity() [1/3]

- -
-
- - - - - -
- - - - - - - -
ecs::Entity::Entity (EntityID id)
-
-inlineexplicit
-
-

Builder for an Entity with a unique ID.

- -

Definition at line 20 of file entity.h.

-
20: m_ID(id) {}
-
-
-
- -

◆ Entity() [2/3]

- -
-
- - - - - -
- - - - - - - -
ecs::Entity::Entity (const Entity & )
-
-delete
-
-

No copy constructor or assignment operator to prevent copying.

- -
-
- -

◆ Entity() [3/3]

- -
-
- - - - - -
- - - - - - - -
ecs::Entity::Entity (Entity && )
-
-default
-
-

Move constructor and assignment operator to allow moving entities.

- -
-
-

Member Function Documentation

- -

◆ AddComponent()

- -
-
-
-template<typename T , typename... Args>
- - - - - -
- - - - - - - -
std::shared_ptr< T > ecs::Entity::AddComponent (Args &&... args)
-
-inline
-
-

Add a component of type T to the entity. If the component already exists, it returns the existing component.

Template Parameters
- - -
T
-
-
-
Parameters
- - -
argsArguments to construct the component.
-
-
-
Returns
A shared pointer to the added or existing component.
- -

Definition at line 49 of file entity.h.

-
49 {
-
50 static_assert(std::is_base_of<Component, T>::value, "T must derive from Component");
-
51
- -
53
-
54 // Vérifier si le composant existe déjà
-
55 if (m_Components.find(typeID) != m_Components.end()) {
-
56 return std::static_pointer_cast<T>(m_Components[typeID]);
-
57 }
-
58
-
59 // Créer et ajouter le composant
-
60 auto component = std::make_shared<T>(std::forward<Args>(args)...);
-
61 m_Components[typeID] = component;
-
62
-
63 // Initialiser le composant
-
64 component->Initialize();
-
65
-
66 return component;
-
67 }
-
std::type_index ComponentTypeID
Definition component.h:48
-
ComponentTypeID GetComponentTypeID()
Definition component.h:54
-
-
-
- -

◆ GetComponent()

- -
-
-
-template<typename T >
- - - - - -
- - - - - - - -
std::shared_ptr< T > ecs::Entity::GetComponent ()
-
-inline
-
-

Get a component of type T from the entity.

Template Parameters
- - -
T
-
-
-
Returns
A shared pointer to the component if it exists, nullptr otherwise.
- -

Definition at line 75 of file entity.h.

-
75 {
-
76 static_assert(std::is_base_of<Component, T>::value, "T must derive from Component");
-
77
- -
79
-
80 auto it = m_Components.find(typeID);
-
81 if (it != m_Components.end()) {
-
82 return std::static_pointer_cast<T>(it->second);
-
83 }
-
84
-
85 return nullptr;
-
86 }
-
-
-
- -

◆ GetID()

- -
-
- - - - - -
- - - - - - - -
EntityID ecs::Entity::GetID () const
-
-inline
-
-

Get the unique identifier for the entity.

Returns
The unique ID of the entity.
- -

Definition at line 39 of file entity.h.

-
39{ return m_ID; }
-
-
-
- -

◆ HasComponent()

- -
-
-
-template<typename T >
- - - - - -
- - - - - - - -
bool ecs::Entity::HasComponent () const
-
-inline
-
-

Check if the entity has a component of type T.

Template Parameters
- - -
T
-
-
-
Returns
true if the entity has the component, false otherwise.
- -

Definition at line 94 of file entity.h.

-
94 {
-
95 static_assert(std::is_base_of<Component, T>::value, "T must derive from Component");
-
96
- -
98 return m_Components.find(typeID) != m_Components.end();
-
99 }
-
-
-
- -

◆ RemoveComponent()

- -
-
-
-template<typename T >
- - - - - -
- - - - - - - -
void ecs::Entity::RemoveComponent ()
-
-inline
-
-

Remove a component of type T from the entity.

Template Parameters
- - -
T
-
-
- -

Definition at line 106 of file entity.h.

-
106 {
-
107 static_assert(std::is_base_of<Component, T>::value, "T must derive from Component");
-
108
- -
110 auto it = m_Components.find(typeID);
-
111
-
112 if (it != m_Components.end()) {
-
113 m_Components.erase(it);
-
114 }
-
115 }
-
-
-
- -

◆ UpdateComponents()

- -
-
- - - - - -
- - - - - - - -
void ecs::Entity::UpdateComponents (float deltaTime)
-
-inline
-
-

Update all components of the entity.

Parameters
- - -
deltaTime
-
-
- -

Definition at line 121 of file entity.h.

-
121 {
-
122 for (auto& [typeID, component] : m_Components) {
-
123 component->Update(deltaTime);
-
124 }
-
125 }
-
-
-
-
The documentation for this class was generated from the following file: -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:615eb8bde8e699ee18890a3b234b0725aff20ce3b16395607717e2fda76ae66e +size 29632 diff --git a/doxygen_docs/html/classecs_1_1_entity.js b/doxygen_docs/html/classecs_1_1_entity.js index 4af4f26..c80e28c 100644 --- a/doxygen_docs/html/classecs_1_1_entity.js +++ b/doxygen_docs/html/classecs_1_1_entity.js @@ -1,12 +1,3 @@ -var classecs_1_1_entity = -[ - [ "Entity", "classecs_1_1_entity.html#aa505e8d9a076bd37b83e319c33a8fb3e", null ], - [ "Entity", "classecs_1_1_entity.html#a1cace49b2034c62e076d8e5354a1e15f", null ], - [ "Entity", "classecs_1_1_entity.html#a318d92a576baeaf8d684fd9ee400ebe8", null ], - [ "AddComponent", "classecs_1_1_entity.html#a240b05cecbe32a6222082f3b4a789a98", null ], - [ "GetComponent", "classecs_1_1_entity.html#a1debe96608ed65b741812a9340c52220", null ], - [ "GetID", "classecs_1_1_entity.html#a9fab84a0393816b3a911588fc1f7121a", null ], - [ "HasComponent", "classecs_1_1_entity.html#a29deb83cc77c7c2466d0f76f7b340869", null ], - [ "RemoveComponent", "classecs_1_1_entity.html#a87fe0ec023ff9df7bcfff0eb13a90bb7", null ], - [ "UpdateComponents", "classecs_1_1_entity.html#a239d0855906f8c66371d7d1fa895a11f", null ] -]; \ No newline at end of file +version https://git-lfs.github.com/spec/v1 +oid sha256:abcc6e7b9f765a46ea6581bb25c5628c8022784224f4799c9d98749865123fd5 +size 839 diff --git a/doxygen_docs/html/classecs_1_1_entity_manager-members.html b/doxygen_docs/html/classecs_1_1_entity_manager-members.html index 5a960c4..617a305 100644 --- a/doxygen_docs/html/classecs_1_1_entity_manager-members.html +++ b/doxygen_docs/html/classecs_1_1_entity_manager-members.html @@ -1,124 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
ecs::EntityManager Member List
-
-
- -

This is the complete list of members for ecs::EntityManager, including all inherited members.

- - - - - - - - - - - -
Clear()ecs::EntityManagerinline
CreateEntity()ecs::EntityManagerinline
DestroyEntity(EntityID id)ecs::EntityManagerinline
EntityManager()ecs::EntityManagerinline
GetAllEntities()ecs::EntityManagerinline
GetEntitiesWithComponent()ecs::EntityManagerinline
GetEntity(EntityID id)ecs::EntityManagerinline
GetEntityCount() constecs::EntityManagerinline
UpdateEntities(float deltaTime)ecs::EntityManagerinline
~EntityManager()=default (defined in ecs::EntityManager)ecs::EntityManager
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:ad4662d66cfe845d3169182476adac486fb2852f7baaf1b6589cb0fd500787cf +size 7529 diff --git a/doxygen_docs/html/classecs_1_1_entity_manager.html b/doxygen_docs/html/classecs_1_1_entity_manager.html index 264038c..cb6cf21 100644 --- a/doxygen_docs/html/classecs_1_1_entity_manager.html +++ b/doxygen_docs/html/classecs_1_1_entity_manager.html @@ -1,496 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: ecs::EntityManager Class Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
- -
ecs::EntityManager Class Reference
-
-
- - - - - - - - - - - - - - - - - - - - - - -

-Public Member Functions

 EntityManager ()
 Type pour l'ID d'une entité.
 
std::shared_ptr< EntityCreateEntity ()
 
void DestroyEntity (EntityID id)
 
std::shared_ptr< EntityGetEntity (EntityID id)
 
void UpdateEntities (float deltaTime)
 
std::vector< std::shared_ptr< Entity > > GetAllEntities ()
 
template<typename T >
std::vector< std::shared_ptr< Entity > > GetEntitiesWithComponent ()
 
size_t GetEntityCount () const
 
void Clear ()
 
-

Detailed Description

-
-

Definition at line 9 of file entity_manager.h.

-

Constructor & Destructor Documentation

- -

◆ EntityManager()

- -
-
- - - - - -
- - - - - - - -
ecs::EntityManager::EntityManager ()
-
-inline
-
- -

Type pour l'ID d'une entité.

- -

Definition at line 15 of file entity_manager.h.

-
15: m_NextEntityID(0) {}
-
-
-
-

Member Function Documentation

- -

◆ Clear()

- -
-
- - - - - -
- - - - - - - -
void ecs::EntityManager::Clear ()
-
-inline
-
-

Clear all entities and reset the EntityManager. This will remove all entities and free their IDs for future use.

- -

Definition at line 121 of file entity_manager.h.

-
121 {
-
122 m_Entities.clear();
-
123
-
124 // Vider la file des IDs libres
-
125 std::queue<EntityID> empty;
-
126 std::swap(m_FreeIDs, empty);
-
127
-
128 m_NextEntityID = 0;
-
129 }
-
-
-
- -

◆ CreateEntity()

- -
-
- - - - - -
- - - - - - - -
std::shared_ptr< Entity > ecs::EntityManager::CreateEntity ()
-
-inline
-
-

Create a new entity.

Returns
A shared pointer to the newly created entity.
- -

Definition at line 22 of file entity_manager.h.

-
22 {
-
23 EntityID id;
-
24
-
25 // Réutiliser les IDs des entités supprimées si possible
-
26 if (!m_FreeIDs.empty()) {
-
27 id = m_FreeIDs.front();
-
28 m_FreeIDs.pop();
-
29 } else {
-
30 id = m_NextEntityID++;
-
31 }
-
32
-
33 auto entity = std::make_shared<Entity>(id);
-
34 m_Entities[id] = entity;
-
35
-
36 return entity;
-
37 }
-
uint32_t EntityID
Definition entity.h:13
-
-
-
- -

◆ DestroyEntity()

- -
-
- - - - - -
- - - - - - - -
void ecs::EntityManager::DestroyEntity (EntityID id)
-
-inline
-
-

Destroy an entity by its ID and recycle its ID for future use.

Parameters
- - -
idThe ID of the entity to destroy.
-
-
- -

Definition at line 43 of file entity_manager.h.

-
43 {
-
44 auto it = m_Entities.find(id);
-
45 if (it != m_Entities.end()) {
-
46 m_Entities.erase(it);
-
47 m_FreeIDs.push(id); // Recycler l'ID
-
48 }
-
49 }
-
-
-
- -

◆ GetAllEntities()

- -
-
- - - - - -
- - - - - - - -
std::vector< std::shared_ptr< Entity > > ecs::EntityManager::GetAllEntities ()
-
-inline
-
-

Get all entities managed by the EntityManager.

Returns
A vector of shared pointers to all entities.
- -

Definition at line 78 of file entity_manager.h.

-
78 {
-
79 std::vector<std::shared_ptr<Entity>> result;
-
80 result.reserve(m_Entities.size());
-
81
-
82 for (const auto& [id, entity] : m_Entities) {
-
83 result.push_back(entity);
-
84 }
-
85
-
86 return result;
-
87 }
-
-
-
- -

◆ GetEntitiesWithComponent()

- -
-
-
-template<typename T >
- - - - - -
- - - - - - - -
std::vector< std::shared_ptr< Entity > > ecs::EntityManager::GetEntitiesWithComponent ()
-
-inline
-
-

Get all entities that have a specific component type.

Template Parameters
- - -
TThe component type to filter entities by.
-
-
-
Returns
A vector of shared pointers to entities that have the specified component.
- -

Definition at line 95 of file entity_manager.h.

-
95 {
-
96 static_assert(std::is_base_of<Component, T>::value, "T must derive from Component");
-
97
-
98 std::vector<std::shared_ptr<Entity>> result;
-
99
-
100 for (auto& [id, entity] : m_Entities) {
-
101 if (entity->HasComponent<T>()) {
-
102 result.push_back(entity);
-
103 }
-
104 }
-
105
-
106 return result;
-
107 }
-
-
-
- -

◆ GetEntity()

- -
-
- - - - - -
- - - - - - - -
std::shared_ptr< Entity > ecs::EntityManager::GetEntity (EntityID id)
-
-inline
-
-

Get an entity by its ID.

Parameters
- - -
idThe ID of the entity to retrieve.
-
-
-
Returns
A shared pointer to the entity, or nullptr if it does not exist.
- -

Definition at line 56 of file entity_manager.h.

-
56 {
-
57 auto it = m_Entities.find(id);
-
58 if (it != m_Entities.end()) {
-
59 return it->second;
-
60 }
-
61 return nullptr;
-
62 }
-
-
-
- -

◆ GetEntityCount()

- -
-
- - - - - -
- - - - - - - -
size_t ecs::EntityManager::GetEntityCount () const
-
-inline
-
-

Get the total number of entities managed by the EntityManager.

Returns
The count of entities.
- -

Definition at line 113 of file entity_manager.h.

-
113 {
-
114 return m_Entities.size();
-
115 }
-
-
-
- -

◆ UpdateEntities()

- -
-
- - - - - -
- - - - - - - -
void ecs::EntityManager::UpdateEntities (float deltaTime)
-
-inline
-
-

Update all entities by calling their UpdateComponents method.

Parameters
- - -
deltaTimeThe time elapsed since the last update.
-
-
- -

Definition at line 68 of file entity_manager.h.

-
68 {
-
69 for (auto& [id, entity] : m_Entities) {
-
70 entity->UpdateComponents(deltaTime);
-
71 }
-
72 }
-
-
-
-
The documentation for this class was generated from the following file: -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:07cdbc9ef0ea4c8e96fac11f5df04f3687f04eb6706c72f4aba5463916fb6f83 +size 29349 diff --git a/doxygen_docs/html/classecs_1_1_entity_manager.js b/doxygen_docs/html/classecs_1_1_entity_manager.js index 31ab9ac..4ffc5d8 100644 --- a/doxygen_docs/html/classecs_1_1_entity_manager.js +++ b/doxygen_docs/html/classecs_1_1_entity_manager.js @@ -1,12 +1,3 @@ -var classecs_1_1_entity_manager = -[ - [ "EntityManager", "classecs_1_1_entity_manager.html#acba3847d62f7cd79e22d5ffa490c1f53", null ], - [ "Clear", "classecs_1_1_entity_manager.html#a6c31a8b7c0a01e473566fd801db91a55", null ], - [ "CreateEntity", "classecs_1_1_entity_manager.html#a696dcb2fd36215b0a9214880d21033a2", null ], - [ "DestroyEntity", "classecs_1_1_entity_manager.html#a4cb0da19e3a95b7cb1390843882176a9", null ], - [ "GetAllEntities", "classecs_1_1_entity_manager.html#ad4116858dc1c324cdd558e5ac6c7f21b", null ], - [ "GetEntitiesWithComponent", "classecs_1_1_entity_manager.html#a42887acde34ab3d1cd13c0396b053d72", null ], - [ "GetEntity", "classecs_1_1_entity_manager.html#a79acf6578756702d83d509dbf1fce0d8", null ], - [ "GetEntityCount", "classecs_1_1_entity_manager.html#ad84a022bfad4f381179c1e007d7c9c8a", null ], - [ "UpdateEntities", "classecs_1_1_entity_manager.html#aac0b39f03cc669d8bc8f3073daa2079c", null ] -]; \ No newline at end of file +version https://git-lfs.github.com/spec/v1 +oid sha256:31db37ccec6a68a9263bbaf4ea2008b2a8f6f3c1d00d039813a6163be9700f23 +size 947 diff --git a/doxygen_docs/html/classecs_1_1_identity_component-members.html b/doxygen_docs/html/classecs_1_1_identity_component-members.html index 44fdf2e..da668c0 100644 --- a/doxygen_docs/html/classecs_1_1_identity_component-members.html +++ b/doxygen_docs/html/classecs_1_1_identity_component-members.html @@ -1,134 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
ecs::IdentityComponent Member List
-
-
- -

This is the complete list of members for ecs::IdentityComponent, including all inherited members.

- - - - - - - - - - - - - - - - - - - - - -
Component()=default (defined in ecs::Component)ecs::Component
Component(const Component &)=delete (defined in ecs::Component)ecs::Component
Component(Component &&)=default (defined in ecs::Component)ecs::Component
GetId() constecs::IdentityComponentinline
GetName() constecs::IdentityComponentinline
GetType() constecs::IdentityComponentinline
IdentityComponent()ecs::IdentityComponentinline
IdentityComponent(int id) (defined in ecs::IdentityComponent)ecs::IdentityComponentinlineexplicit
IdentityComponent(int id, const std::string &name) (defined in ecs::IdentityComponent)ecs::IdentityComponentinline
Initialize() overrideecs::IdentityComponentinlinevirtual
ObjectTypeToString(ObjectType type)ecs::IdentityComponentinlinestatic
operator=(const Component &)=delete (defined in ecs::Component)ecs::Component
operator=(Component &&)=default (defined in ecs::Component)ecs::Component
SetId(int id)ecs::IdentityComponentinline
SetName(const std::string &name)ecs::IdentityComponentinline
SetType(ObjectType type)ecs::IdentityComponentinline
StringToObjectType(const std::string &str)ecs::IdentityComponentinlinestatic
Update(float deltaTime)ecs::Componentinlinevirtual
~Component()=default (defined in ecs::Component)ecs::Componentvirtual
~IdentityComponent()=default (defined in ecs::IdentityComponent)ecs::IdentityComponent
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:52d8a45198b9eb0e7ce6db365ff975d1f80dcd0e8064150c731b74db110ef376 +size 11094 diff --git a/doxygen_docs/html/classecs_1_1_identity_component.html b/doxygen_docs/html/classecs_1_1_identity_component.html index 40c1bb4..fef2ccd 100644 --- a/doxygen_docs/html/classecs_1_1_identity_component.html +++ b/doxygen_docs/html/classecs_1_1_identity_component.html @@ -1,570 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: ecs::IdentityComponent Class Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
- -
ecs::IdentityComponent Class Reference
-
-
-
-Inheritance diagram for ecs::IdentityComponent:
-
-
- - -ecs::Component - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

-Public Member Functions

 IdentityComponent ()
 
 IdentityComponent (int id)
 
 IdentityComponent (int id, const std::string &name)
 
void Initialize () override
 
int GetId () const
 
void SetId (int id)
 
const std::string & GetName () const
 
void SetName (const std::string &name)
 
ObjectType GetType () const
 
void SetType (ObjectType type)
 
- Public Member Functions inherited from ecs::Component
Component (const Component &)=delete
 
-Componentoperator= (const Component &)=delete
 
Component (Component &&)=default
 
-Componentoperator= (Component &&)=default
 
virtual void Update (float deltaTime)
 
- - - - - -

-Static Public Member Functions

static std::string ObjectTypeToString (ObjectType type)
 
static ObjectType StringToObjectType (const std::string &str)
 
-

Detailed Description

-
-

Definition at line 18 of file identity_component.h.

-

Constructor & Destructor Documentation

- -

◆ IdentityComponent() [1/3]

- -
-
- - - - - -
- - - - - - - -
ecs::IdentityComponent::IdentityComponent ()
-
-inline
-
-

Builder for the IdentityComponent class.

- -

Definition at line 23 of file identity_component.h.

-
23: m_id(0), m_type(ObjectType::Unknown) {}
-
-
-
- -

◆ IdentityComponent() [2/3]

- -
-
- - - - - -
- - - - - - - -
ecs::IdentityComponent::IdentityComponent (int id)
-
-inlineexplicit
-
- -

Definition at line 24 of file identity_component.h.

-
24: m_id(id), m_type(ObjectType::Unknown) {}
-
-
-
- -

◆ IdentityComponent() [3/3]

- -
-
- - - - - -
- - - - - - - - - - - -
ecs::IdentityComponent::IdentityComponent (int id,
const std::string & name )
-
-inline
-
- -

Definition at line 25 of file identity_component.h.

-
25: m_id(id), m_name(name), m_type(ObjectType::Unknown) {}
-
-
-
-

Member Function Documentation

- -

◆ GetId()

- -
-
- - - - - -
- - - - - - - -
int ecs::IdentityComponent::GetId () const
-
-inline
-
-

Get the ID stored by the component.

Returns
The ID as an int.
- -

Definition at line 40 of file identity_component.h.

-
40{ return m_id; }
-
-
-
- -

◆ GetName()

- -
-
- - - - - -
- - - - - - - -
const std::string & ecs::IdentityComponent::GetName () const
-
-inline
-
-

Get the name of the object.

Returns
The name as a string.
- -

Definition at line 51 of file identity_component.h.

-
51{ return m_name; }
-
-
-
- -

◆ GetType()

- -
-
- - - - - -
- - - - - - - -
ObjectType ecs::IdentityComponent::GetType () const
-
-inline
-
-

Get the type of the object.

Returns
The type as an ObjectType enum.
- -

Definition at line 62 of file identity_component.h.

-
62{ return m_type; }
-
-
-
- -

◆ Initialize()

- -
-
- - - - - -
- - - - - - - -
void ecs::IdentityComponent::Initialize ()
-
-inlineoverridevirtual
-
-

Initialize the component. This method is called when the component is added to an entity. It can be used to set up initial values or perform any necessary setup.

- -

Reimplemented from ecs::Component.

- -

Definition at line 33 of file identity_component.h.

-
33{}
-
-
-
- -

◆ ObjectTypeToString()

- -
-
- - - - - -
- - - - - - - -
static std::string ecs::IdentityComponent::ObjectTypeToString (ObjectType type)
-
-inlinestatic
-
-

Convert an ObjectType to a string representation.

Parameters
- - -
typeThe ObjectType to convert.
-
-
-
Returns
A string representation of the ObjectType.
- -

Definition at line 74 of file identity_component.h.

-
74 {
-
75 switch (type) {
-
76 case ObjectType::Cube: return "Cube";
-
77 case ObjectType::Sphere: return "Sphere";
-
78 case ObjectType::Terrain: return "Terrain";
-
79 default: return "Unknown";
-
80 }
-
81 }
-
-
-
- -

◆ SetId()

- -
-
- - - - - -
- - - - - - - -
void ecs::IdentityComponent::SetId (int id)
-
-inline
-
-

Set the ID for the component.

Parameters
- - -
idThe ID to set.
-
-
- -

Definition at line 45 of file identity_component.h.

-
45{ m_id = id; }
-
-
-
- -

◆ SetName()

- -
-
- - - - - -
- - - - - - - -
void ecs::IdentityComponent::SetName (const std::string & name)
-
-inline
-
-

Set the name of the object.

Parameters
- - -
nameThe name to set.
-
-
- -

Definition at line 56 of file identity_component.h.

-
56{ m_name = name; }
-
-
-
- -

◆ SetType()

- -
-
- - - - - -
- - - - - - - -
void ecs::IdentityComponent::SetType (ObjectType type)
-
-inline
-
-

Set the type of the object.

Parameters
- - -
typeThe type to set as an ObjectType enum.
-
-
- -

Definition at line 67 of file identity_component.h.

-
67{ m_type = type; }
-
-
-
- -

◆ StringToObjectType()

- -
-
- - - - - -
- - - - - - - -
static ObjectType ecs::IdentityComponent::StringToObjectType (const std::string & str)
-
-inlinestatic
-
-

Convert a string representation to an ObjectType.

Parameters
- - -
strThe string to convert.
-
-
-
Returns
The corresponding ObjectType, or Unknown if the string does not match any type.
- -

Definition at line 88 of file identity_component.h.

-
88 {
-
89 if (str == "Cube") return ObjectType::Cube;
-
90 if (str == "Sphere") return ObjectType::Sphere;
-
91 if (str == "Terrain") return ObjectType::Terrain;
-
92 return ObjectType::Unknown;
-
93 }
-
-
-
-
The documentation for this class was generated from the following file: -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:232328374a51bf2e09563817475e8d6fe80ccbbc3c12784df6ec39170ca9cbd1 +size 33145 diff --git a/doxygen_docs/html/classecs_1_1_identity_component.js b/doxygen_docs/html/classecs_1_1_identity_component.js index e911d7b..9977ef2 100644 --- a/doxygen_docs/html/classecs_1_1_identity_component.js +++ b/doxygen_docs/html/classecs_1_1_identity_component.js @@ -1,11 +1,3 @@ -var classecs_1_1_identity_component = -[ - [ "IdentityComponent", "classecs_1_1_identity_component.html#a253122e10cbe22c42831d250d48a8316", null ], - [ "GetId", "classecs_1_1_identity_component.html#af7fcece7aaa148512ba153d1d3a4cc1c", null ], - [ "GetName", "classecs_1_1_identity_component.html#a6f97e89a74db7fda99f144c66c17935f", null ], - [ "GetType", "classecs_1_1_identity_component.html#abc33d5a325706c7c115b88fd9635a4cd", null ], - [ "Initialize", "classecs_1_1_identity_component.html#a04b2bb43ccf6c4842704f30463033b3b", null ], - [ "SetId", "classecs_1_1_identity_component.html#a69797f6d9f9926293d2e0b4e84e3bbb3", null ], - [ "SetName", "classecs_1_1_identity_component.html#aa04b3e5f2e40271ba50dfd35c3217013", null ], - [ "SetType", "classecs_1_1_identity_component.html#a7cbca5e7e2c877b45c900df4660c0e35", null ] -]; \ No newline at end of file +version https://git-lfs.github.com/spec/v1 +oid sha256:3de597bb6d940cedfa5d50d167e28c78b5c25d48804fa5225c0044e193cf53a9 +size 842 diff --git a/doxygen_docs/html/classecs_1_1_identity_component.png b/doxygen_docs/html/classecs_1_1_identity_component.png index aeef4e3..f842042 100644 Binary files a/doxygen_docs/html/classecs_1_1_identity_component.png and b/doxygen_docs/html/classecs_1_1_identity_component.png differ diff --git a/doxygen_docs/html/classecs_1_1_model_path_component-members.html b/doxygen_docs/html/classecs_1_1_model_path_component-members.html index 8018ac2..261684d 100644 --- a/doxygen_docs/html/classecs_1_1_model_path_component-members.html +++ b/doxygen_docs/html/classecs_1_1_model_path_component-members.html @@ -1,127 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
ecs::ModelPathComponent Member List
-
-
- -

This is the complete list of members for ecs::ModelPathComponent, including all inherited members.

- - - - - - - - - - - - - - -
Component()=default (defined in ecs::Component)ecs::Component
Component(const Component &)=delete (defined in ecs::Component)ecs::Component
Component(Component &&)=default (defined in ecs::Component)ecs::Component
GetPath() constecs::ModelPathComponentinline
Initialize() overrideecs::ModelPathComponentinlinevirtual
ModelPathComponent()=default (defined in ecs::ModelPathComponent)ecs::ModelPathComponent
ModelPathComponent(const std::wstring &path) (defined in ecs::ModelPathComponent)ecs::ModelPathComponentinlineexplicit
operator=(const Component &)=delete (defined in ecs::Component)ecs::Component
operator=(Component &&)=default (defined in ecs::Component)ecs::Component
SetPath(const std::wstring &path)ecs::ModelPathComponentinline
Update(float deltaTime) overrideecs::ModelPathComponentinlinevirtual
~Component()=default (defined in ecs::Component)ecs::Componentvirtual
~ModelPathComponent()=default (defined in ecs::ModelPathComponent)ecs::ModelPathComponent
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:4284170f58fea0e884eaec26fb86ad2bb344ceb8a9f94f381822c79c2794a2e3 +size 8753 diff --git a/doxygen_docs/html/classecs_1_1_model_path_component.html b/doxygen_docs/html/classecs_1_1_model_path_component.html index 8471b8f..69e95a4 100644 --- a/doxygen_docs/html/classecs_1_1_model_path_component.html +++ b/doxygen_docs/html/classecs_1_1_model_path_component.html @@ -1,317 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: ecs::ModelPathComponent Class Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
- -
ecs::ModelPathComponent Class Reference
-
-
-
-Inheritance diagram for ecs::ModelPathComponent:
-
-
- - -ecs::Component - -
- - - - - - - - - - - - - - - - - - - - - -

-Public Member Functions

 ModelPathComponent (const std::wstring &path)
 
void Initialize () override
 
void Update (float deltaTime) override
 
const std::wstring & GetPath () const
 
void SetPath (const std::wstring &path)
 
- Public Member Functions inherited from ecs::Component
Component (const Component &)=delete
 
-Componentoperator= (const Component &)=delete
 
Component (Component &&)=default
 
-Componentoperator= (Component &&)=default
 
-

Detailed Description

-
-

Definition at line 7 of file model_path_component.h.

-

Constructor & Destructor Documentation

- -

◆ ModelPathComponent()

- -
-
- - - - - -
- - - - - - - -
ecs::ModelPathComponent::ModelPathComponent (const std::wstring & path)
-
-inlineexplicit
-
- -

Definition at line 10 of file model_path_component.h.

-
10: m_path(path) {}
-
-
-
-

Member Function Documentation

- -

◆ GetPath()

- -
-
- - - - - -
- - - - - - - -
const std::wstring & ecs::ModelPathComponent::GetPath () const
-
-inline
-
-

Get the path of the model.

Returns
The path as a std::wstring.
- -

Definition at line 20 of file model_path_component.h.

-
20{ return m_path; }
-
-
-
- -

◆ Initialize()

- -
-
- - - - - -
- - - - - - - -
void ecs::ModelPathComponent::Initialize ()
-
-inlineoverridevirtual
-
-

Virtual function to initialize the component.

- -

Reimplemented from ecs::Component.

- -

Definition at line 13 of file model_path_component.h.

-
13{}
-
-
-
- -

◆ SetPath()

- -
-
- - - - - -
- - - - - - - -
void ecs::ModelPathComponent::SetPath (const std::wstring & path)
-
-inline
-
-

Set the path of the model.

Parameters
- - -
pathThe path to set as a std::wstring.
-
-
- -

Definition at line 25 of file model_path_component.h.

-
25{ m_path = path; }
-
-
-
- -

◆ Update()

- -
-
- - - - - -
- - - - - - - -
void ecs::ModelPathComponent::Update (float deltaTime)
-
-inlineoverridevirtual
-
-

Virtual function to update the component.

Parameters
- - -
deltaTimeTime since the last update.
-
-
- -

Reimplemented from ecs::Component.

- -

Definition at line 14 of file model_path_component.h.

-
14{}
-
-
-
-
The documentation for this class was generated from the following file: -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:eb4f6c47811410d3eef3cba39ebf9d054ba6231361c01edba7ca1097dce6a70f +size 17212 diff --git a/doxygen_docs/html/classecs_1_1_model_path_component.js b/doxygen_docs/html/classecs_1_1_model_path_component.js index ea82250..b2879c0 100644 --- a/doxygen_docs/html/classecs_1_1_model_path_component.js +++ b/doxygen_docs/html/classecs_1_1_model_path_component.js @@ -1,7 +1,3 @@ -var classecs_1_1_model_path_component = -[ - [ "GetPath", "classecs_1_1_model_path_component.html#a7996bbc72216b56b0b26cef13acad6cc", null ], - [ "Initialize", "classecs_1_1_model_path_component.html#a8819a3be58b6748ced6763a598e2f7f8", null ], - [ "SetPath", "classecs_1_1_model_path_component.html#aeef7076b697463196a2ce5440ca10f89", null ], - [ "Update", "classecs_1_1_model_path_component.html#a64d1c1fa22bb222e6c85f5312ea8795b", null ] -]; \ No newline at end of file +version https://git-lfs.github.com/spec/v1 +oid sha256:ed8aa95a6bd1fa23580fc473efb7767daef7845ec04985b080e41625c80e2682 +size 449 diff --git a/doxygen_docs/html/classecs_1_1_model_path_component.png b/doxygen_docs/html/classecs_1_1_model_path_component.png index 2689c6d..9654043 100644 Binary files a/doxygen_docs/html/classecs_1_1_model_path_component.png and b/doxygen_docs/html/classecs_1_1_model_path_component.png differ diff --git a/doxygen_docs/html/classecs_1_1_physics_component-members.html b/doxygen_docs/html/classecs_1_1_physics_component-members.html index 0fab98f..6760b7d 100644 --- a/doxygen_docs/html/classecs_1_1_physics_component-members.html +++ b/doxygen_docs/html/classecs_1_1_physics_component-members.html @@ -1,142 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
ecs::PhysicsComponent Member List
-
-
- -

This is the complete list of members for ecs::PhysicsComponent, including all inherited members.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Component()=default (defined in ecs::Component)ecs::Component
Component(const Component &)=delete (defined in ecs::Component)ecs::Component
Component(Component &&)=default (defined in ecs::Component)ecs::Component
GetAcceleration() constecs::PhysicsComponentinline
GetBoundingRadius() constecs::PhysicsComponentinline
GetMass() constecs::PhysicsComponentinline
GetPreviousPosition() constecs::PhysicsComponentinline
GetVelocity() constecs::PhysicsComponentinline
Initialize() overrideecs::PhysicsComponentinlinevirtual
IsGravityEnabled() constecs::PhysicsComponentinline
IsGrounded() constecs::PhysicsComponentinline
IsPhysicsEnabled() constecs::PhysicsComponentinline
LaunchObject(float alpha, float initialStretch, float springConstant)ecs::PhysicsComponentinline
operator=(const Component &)=delete (defined in ecs::Component)ecs::Component
operator=(Component &&)=default (defined in ecs::Component)ecs::Component
PhysicsComponent()ecs::PhysicsComponentinline
SetAcceleration(XMVECTOR acceleration)ecs::PhysicsComponentinline
SetBoundingRadius(float radius)ecs::PhysicsComponentinline
SetGravityEnabled(bool enabled)ecs::PhysicsComponentinline
SetGrounded(bool isGrounded)ecs::PhysicsComponentinline
SetMass(float mass)ecs::PhysicsComponentinline
SetPhysicsEnabled(bool enabled)ecs::PhysicsComponentinline
SetPreviousPosition(XMVECTOR position)ecs::PhysicsComponentinline
SetUpdatePositionCallback(std::function< void(XMVECTOR)> callback)ecs::PhysicsComponentinline
SetVelocity(XMVECTOR velocity)ecs::PhysicsComponentinline
Update(float deltaTime) overrideecs::PhysicsComponentinlinevirtual
~Component()=default (defined in ecs::Component)ecs::Componentvirtual
~PhysicsComponent()=default (defined in ecs::PhysicsComponent)ecs::PhysicsComponent
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:a76f6f3daafa9968deb85c206eca724c2c0c4286a34b7cc45b662dde6e873449 +size 13644 diff --git a/doxygen_docs/html/classecs_1_1_physics_component.html b/doxygen_docs/html/classecs_1_1_physics_component.html index 28fbef1..9e7619c 100644 --- a/doxygen_docs/html/classecs_1_1_physics_component.html +++ b/doxygen_docs/html/classecs_1_1_physics_component.html @@ -1,930 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: ecs::PhysicsComponent Class Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
- -
ecs::PhysicsComponent Class Reference
-
-
-
-Inheritance diagram for ecs::PhysicsComponent:
-
-
- - -ecs::Component - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

-Public Member Functions

 PhysicsComponent ()
 
void Initialize () override
 
void Update (float deltaTime) override
 
void LaunchObject (float alpha, float initialStretch, float springConstant)
 
void SetVelocity (XMVECTOR velocity)
 
void SetAcceleration (XMVECTOR acceleration)
 
void SetMass (float mass)
 
void SetGrounded (bool isGrounded)
 
void SetPhysicsEnabled (bool enabled)
 
void SetBoundingRadius (float radius)
 
void SetPreviousPosition (XMVECTOR position)
 
void SetGravityEnabled (bool enabled)
 
void SetUpdatePositionCallback (std::function< void(XMVECTOR)> callback)
 
XMVECTOR GetVelocity () const
 
XMVECTOR GetAcceleration () const
 
float GetMass () const
 
bool IsGrounded () const
 
bool IsPhysicsEnabled () const
 
float GetBoundingRadius () const
 
XMVECTOR GetPreviousPosition () const
 
bool IsGravityEnabled () const
 
- Public Member Functions inherited from ecs::Component
Component (const Component &)=delete
 
-Componentoperator= (const Component &)=delete
 
Component (Component &&)=default
 
-Componentoperator= (Component &&)=default
 
-

Detailed Description

-
-

Definition at line 9 of file physics_component.h.

-

Constructor & Destructor Documentation

- -

◆ PhysicsComponent()

- -
-
- - - - - -
- - - - - - - -
ecs::PhysicsComponent::PhysicsComponent ()
-
-inline
-
-

Builder for the PhysicsComponent class. Use default values for velocity, acceleration, mass, bounding radius, and grounded state.

- -

Definition at line 15 of file physics_component.h.

-
15 {
-
16 m_Velocity = XMVectorZero();
-
17 m_Acceleration = XMVectorZero();
-
18 m_PreviousPosition = XMVectorZero();
-
19 m_Mass = 1.0f;
-
20 m_BoundingRadius = 1.0f;
-
21 m_IsGrounded = false;
-
22 m_IsPhysicsEnabled = false;
-
23 m_GravityEnabled = true;
-
24 }
-
-
-
-

Member Function Documentation

- -

◆ GetAcceleration()

- -
-
- - - - - -
- - - - - - - -
XMVECTOR ecs::PhysicsComponent::GetAcceleration () const
-
-inline
-
-

Get the current acceleration of the object.

Returns
The acceleration as an XMVECTOR.
- -

Definition at line 160 of file physics_component.h.

-
160{ return m_Acceleration; }
-
-
-
- -

◆ GetBoundingRadius()

- -
-
- - - - - -
- - - - - - - -
float ecs::PhysicsComponent::GetBoundingRadius () const
-
-inline
-
-

Get the bounding radius of the object.

Returns
The bounding radius as a float.
- -

Definition at line 180 of file physics_component.h.

-
180{ return m_BoundingRadius; }
-
-
-
- -

◆ GetMass()

- -
-
- - - - - -
- - - - - - - -
float ecs::PhysicsComponent::GetMass () const
-
-inline
-
-

Get the mass of the object.

Returns
The mass as a float.
- -

Definition at line 165 of file physics_component.h.

-
165{ return m_Mass; }
-
-
-
- -

◆ GetPreviousPosition()

- -
-
- - - - - -
- - - - - - - -
XMVECTOR ecs::PhysicsComponent::GetPreviousPosition () const
-
-inline
-
-

Get the previous position of the object. This is used to calculate the movement and collision detection.

Returns
The previous position as an XMVECTOR.
- -

Definition at line 186 of file physics_component.h.

-
186{ return m_PreviousPosition; }
-
-
-
- -

◆ GetVelocity()

- -
-
- - - - - -
- - - - - - - -
XMVECTOR ecs::PhysicsComponent::GetVelocity () const
-
-inline
-
-

Get the current velocity of the object.

Returns
The velocity as an XMVECTOR.
- -

Definition at line 155 of file physics_component.h.

-
155{ return m_Velocity; }
-
-
-
- -

◆ Initialize()

- -
-
- - - - - -
- - - - - - - -
void ecs::PhysicsComponent::Initialize ()
-
-inlineoverridevirtual
-
-

Initialize the component. This method is called when the component is added to an entity. It can be used to set up initial values or perform any necessary setup.

- -

Reimplemented from ecs::Component.

- -

Definition at line 33 of file physics_component.h.

-
33 {
-
34 // Initialisation du composant physique
-
35 }
-
-
-
- -

◆ IsGravityEnabled()

- -
-
- - - - - -
- - - - - - - -
bool ecs::PhysicsComponent::IsGravityEnabled () const
-
-inline
-
-

Check if gravity is enabled for the object.

Returns
True if gravity is enabled, false otherwise.
- -

Definition at line 191 of file physics_component.h.

-
191{ return m_GravityEnabled; }
-
-
-
- -

◆ IsGrounded()

- -
-
- - - - - -
- - - - - - - -
bool ecs::PhysicsComponent::IsGrounded () const
-
-inline
-
-

Get the grounded state of the object.

Returns
True if the object is grounded, false otherwise.
- -

Definition at line 170 of file physics_component.h.

-
170{ return m_IsGrounded; }
-
-
-
- -

◆ IsPhysicsEnabled()

- -
-
- - - - - -
- - - - - - - -
bool ecs::PhysicsComponent::IsPhysicsEnabled () const
-
-inline
-
-

Check if physics is enabled for the object.

Returns
True if physics is enabled, false otherwise.
- -

Definition at line 175 of file physics_component.h.

-
175{ return m_IsPhysicsEnabled; }
-
-
-
- -

◆ LaunchObject()

- -
-
- - - - - -
- - - - - - - - - - - - - - - - -
void ecs::PhysicsComponent::LaunchObject (float alpha,
float initialStretch,
float springConstant )
-
-inline
-
-

Launch an object with a spring-like force. This method calculates the initial velocity based on the angle, initial stretch, and spring constant.

-

This method will be removed in the future

-
Parameters
- - - - -
alphaThe launch angle in degrees.
initialStretchThe initial stretch of the spring.
springConstantThe spring constant.
-
-
- -

Definition at line 70 of file physics_component.h.

-
70 {
-
71 // Constants
-
72 const float gravity = -9.81f;
-
73
-
74 // Convert alpha from degrees to radians if needed
-
75 float alphaRadians = alpha * (XM_PI / 180.0f);
-
76
-
77 // Scale factors to make the physics simulation more visible
-
78 float scaleFactor = 200.0f; // Adjust this based on your world scale
-
79
-
80 // Calculate initial velocity magnitude
-
81 float velocityMagnitude = initialStretch * sqrtf(springConstant / m_Mass) *
-
82 sqrtf(1.0f - powf((m_Mass * gravity * sinf(alphaRadians) /
-
83 (springConstant * initialStretch)), 2.0f));
-
84
-
85 // Apply scale factor
-
86 velocityMagnitude *= scaleFactor;
-
87
-
88 // Calculate velocity components
-
89 XMVECTOR velocity = XMVectorSet(
-
90 velocityMagnitude * cosf(alphaRadians), // vx = v0 * cos(alpha)
-
91 velocityMagnitude * sinf(alphaRadians), // vy = v0 * sin(alpha)
-
92 0.0f, // z-component (0 for 2D trajectory)
-
93 0.0f
-
94 );
-
95
-
96 // Apply velocity
-
97 SetVelocity(velocity);
-
98
-
99 // Enable physics and reset grounded state
-
100 SetPhysicsEnabled(true);
-
101 SetGrounded(false);
-
102 }
-
void SetVelocity(XMVECTOR velocity)
-
void SetGrounded(bool isGrounded)
-
void SetPhysicsEnabled(bool enabled)
-
-
-
- -

◆ SetAcceleration()

- -
-
- - - - - -
- - - - - - - -
void ecs::PhysicsComponent::SetAcceleration (XMVECTOR acceleration)
-
-inline
-
-

Set the acceleration of the object.

Parameters
- - -
acceleration
-
-
- -

Definition at line 113 of file physics_component.h.

-
113{ m_Acceleration = acceleration; }
-
-
-
- -

◆ SetBoundingRadius()

- -
-
- - - - - -
- - - - - - - -
void ecs::PhysicsComponent::SetBoundingRadius (float radius)
-
-inline
-
-

Set the bounding radius of the object.

Parameters
- - -
radiusThe bounding radius to set.
-
-
- -

Definition at line 133 of file physics_component.h.

-
133{ m_BoundingRadius = radius; }
-
-
-
- -

◆ SetGravityEnabled()

- -
-
- - - - - -
- - - - - - - -
void ecs::PhysicsComponent::SetGravityEnabled (bool enabled)
-
-inline
-
-

Enable or disable gravity for the object.

Parameters
- - -
enabledTrue to enable gravity, false to disable.
-
-
- -

Definition at line 143 of file physics_component.h.

-
143{ m_GravityEnabled = enabled; }
-
-
-
- -

◆ SetGrounded()

- -
-
- - - - - -
- - - - - - - -
void ecs::PhysicsComponent::SetGrounded (bool isGrounded)
-
-inline
-
-

Set the grounded state of the object.

Parameters
- - -
isGroundedTrue if the object is grounded, false otherwise.
-
-
- -

Definition at line 123 of file physics_component.h.

-
123{ m_IsGrounded = isGrounded; }
-
-
-
- -

◆ SetMass()

- -
-
- - - - - -
- - - - - - - -
void ecs::PhysicsComponent::SetMass (float mass)
-
-inline
-
-

Set the mass of the object.

Parameters
- - -
massThe mass to set.
-
-
- -

Definition at line 118 of file physics_component.h.

-
118{ m_Mass = mass; }
-
-
-
- -

◆ SetPhysicsEnabled()

- -
-
- - - - - -
- - - - - - - -
void ecs::PhysicsComponent::SetPhysicsEnabled (bool enabled)
-
-inline
-
-

Enable or disable physics for the object.

Parameters
- - -
enabledTrue to enable physics, false to disable.
-
-
- -

Definition at line 128 of file physics_component.h.

-
128{ m_IsPhysicsEnabled = enabled; }
-
-
-
- -

◆ SetPreviousPosition()

- -
-
- - - - - -
- - - - - - - -
void ecs::PhysicsComponent::SetPreviousPosition (XMVECTOR position)
-
-inline
-
-

Set the previous position of the object.

Parameters
- - -
positionThe previous position to set.
-
-
- -

Definition at line 138 of file physics_component.h.

-
138{ m_PreviousPosition = position; }
-
-
-
- -

◆ SetUpdatePositionCallback()

- -
-
- - - - - -
- - - - - - - -
void ecs::PhysicsComponent::SetUpdatePositionCallback (std::function< void(XMVECTOR)> callback)
-
-inline
-
-

Set the callback to update the position of the object. This callback will be connected to the TransformComponent to update the position.

Parameters
- - -
callbackThe callback function that takes an XMVECTOR as a parameter.
-
-
- -

Definition at line 149 of file physics_component.h.

-
149{ m_UpdatePositionCallback = callback; }
-
-
-
- -

◆ SetVelocity()

- -
-
- - - - - -
- - - - - - - -
void ecs::PhysicsComponent::SetVelocity (XMVECTOR velocity)
-
-inline
-
-

Set the velocity of the object.

Parameters
- - -
velocity
-
-
- -

Definition at line 108 of file physics_component.h.

-
108{ m_Velocity = velocity; }
-
-
-
- -

◆ Update()

- -
-
- - - - - -
- - - - - - - -
void ecs::PhysicsComponent::Update (float deltaTime)
-
-inlineoverridevirtual
-
-

Update the physics component. This method is called every frame to update the physics state.

-

This method is not the final update method It will be called by the EntityManager's in the physics Thread. This is due to the fact that the physics system is not updated every frame. The physics thread is called at a fixed time step (50 FPS by default).

-
Parameters
- - -
deltaTimeThe time elapsed since the last frame.
-
-
- -

Reimplemented from ecs::Component.

- -

Definition at line 48 of file physics_component.h.

-
48 {
-
49 if (!m_IsPhysicsEnabled) return;
-
50
-
51 // Mise à jour de la vélocité basée sur l'accélération
-
52 m_Velocity = m_Velocity + m_Acceleration * deltaTime;
-
53
-
54 // Si la physique est activée et qu'une fonction de mise à jour de position est définie
-
55 if (m_UpdatePositionCallback) {
-
56 m_UpdatePositionCallback(m_Velocity * deltaTime);
-
57 }
-
58 }
-
-
-
-
The documentation for this class was generated from the following file: -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:d6656f26c634f07cadaa137c3596094cc7a2ba32ae55900ae8c4e84bdb00fa59 +size 54313 diff --git a/doxygen_docs/html/classecs_1_1_physics_component.js b/doxygen_docs/html/classecs_1_1_physics_component.js index b00a93d..615ce00 100644 --- a/doxygen_docs/html/classecs_1_1_physics_component.js +++ b/doxygen_docs/html/classecs_1_1_physics_component.js @@ -1,24 +1,3 @@ -var classecs_1_1_physics_component = -[ - [ "PhysicsComponent", "classecs_1_1_physics_component.html#a13c45de519868a3e035fc8a3cb4c3da0", null ], - [ "GetAcceleration", "classecs_1_1_physics_component.html#ae40284b6a494abd2ad1d8a4bbb641117", null ], - [ "GetBoundingRadius", "classecs_1_1_physics_component.html#acb77c488322bbb5776e08fd9be5908d7", null ], - [ "GetMass", "classecs_1_1_physics_component.html#acbe98be444ae347a32951435472e5a28", null ], - [ "GetPreviousPosition", "classecs_1_1_physics_component.html#af3e592a83a8145612bea36927c222082", null ], - [ "GetVelocity", "classecs_1_1_physics_component.html#abc1702442a7fa0915f7760b20d5a17ae", null ], - [ "Initialize", "classecs_1_1_physics_component.html#ab58952fc61030f1047beb2d6dbec82cf", null ], - [ "IsGravityEnabled", "classecs_1_1_physics_component.html#a29ed13dad5513dff62d8427e856bd74d", null ], - [ "IsGrounded", "classecs_1_1_physics_component.html#ae3438c93efe882c97086e0f9bc2f54dd", null ], - [ "IsPhysicsEnabled", "classecs_1_1_physics_component.html#ab1d2d882d7ff058a67d3e266257edb95", null ], - [ "LaunchObject", "classecs_1_1_physics_component.html#a156fb8329b7b2434ee94ab8c03fdc6e2", null ], - [ "SetAcceleration", "classecs_1_1_physics_component.html#a462dd9f0b3452e9c98d5dea7d9959f50", null ], - [ "SetBoundingRadius", "classecs_1_1_physics_component.html#ab95922862da80f63814d47f8c2b69cea", null ], - [ "SetGravityEnabled", "classecs_1_1_physics_component.html#a19fa3fa510051cc0d8a0ddb21e92f9fe", null ], - [ "SetGrounded", "classecs_1_1_physics_component.html#ab750af34ccb7fd9f2cb4cea2c7a9a253", null ], - [ "SetMass", "classecs_1_1_physics_component.html#af091ab5887798b0407700d4712795a0c", null ], - [ "SetPhysicsEnabled", "classecs_1_1_physics_component.html#afb716a1474b17b0bcf1c4eb7b6f3c758", null ], - [ "SetPreviousPosition", "classecs_1_1_physics_component.html#a9fd15ccd7dfe9955116ac5d52e01a6e7", null ], - [ "SetUpdatePositionCallback", "classecs_1_1_physics_component.html#a93d17ee763b557489210f35b54829976", null ], - [ "SetVelocity", "classecs_1_1_physics_component.html#a5a4f3b4503ce9b199da87f5e11673501", null ], - [ "Update", "classecs_1_1_physics_component.html#a83aaa878464b8ef2dbc0e7a927689d79", null ] -]; \ No newline at end of file +version https://git-lfs.github.com/spec/v1 +oid sha256:8727f51a389bb3bffdbaa4851f966ca22654b358c07c861b134f5981217200b4 +size 2245 diff --git a/doxygen_docs/html/classecs_1_1_physics_component.png b/doxygen_docs/html/classecs_1_1_physics_component.png index 8452add..8ee7a7c 100644 Binary files a/doxygen_docs/html/classecs_1_1_physics_component.png and b/doxygen_docs/html/classecs_1_1_physics_component.png differ diff --git a/doxygen_docs/html/classecs_1_1_render_component-members.html b/doxygen_docs/html/classecs_1_1_render_component-members.html index 7329651..9a42131 100644 --- a/doxygen_docs/html/classecs_1_1_render_component-members.html +++ b/doxygen_docs/html/classecs_1_1_render_component-members.html @@ -1,136 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
ecs::RenderComponent Member List
-
-
- -

This is the complete list of members for ecs::RenderComponent, including all inherited members.

- - - - - - - - - - - - - - - - - - - - - - - -
Component()=default (defined in ecs::Component)ecs::Component
Component(const Component &)=delete (defined in ecs::Component)ecs::Component
Component(Component &&)=default (defined in ecs::Component)ecs::Component
GetIndexCount() constecs::RenderComponentinline
GetModel() constecs::RenderComponentinline
GetModelFilePath() constecs::RenderComponentinline
GetTexture(TextureType type, int index=0)ecs::RenderComponentinline
Initialize() overrideecs::RenderComponentinlinevirtual
InitializeFromFile(ID3D11Device *device, ID3D11DeviceContext *deviceContext, const char *modelFilename, TextureContainer &textureContainer)ecs::RenderComponentinline
InitializeWithModel(std::shared_ptr< model_class > model)ecs::RenderComponentinline
IsVisible() constecs::RenderComponentinline
LoadTexturesFromPath(std::vector< std::wstring > &texturePaths, TextureContainer &texturesContainer, ID3D11Device *device, ID3D11DeviceContext *deviceContext)ecs::RenderComponentinline
operator=(const Component &)=delete (defined in ecs::Component)ecs::Component
operator=(Component &&)=default (defined in ecs::Component)ecs::Component
Render(ID3D11DeviceContext *deviceContext)ecs::RenderComponentinline
RenderComponent()ecs::RenderComponentinline
SetModel(std::shared_ptr< model_class > model)ecs::RenderComponentinline
SetModelFilePath(const std::string &path)ecs::RenderComponentinline
SetVisible(bool visible)ecs::RenderComponentinline
Update(float deltaTime) overrideecs::RenderComponentinlinevirtual
~Component()=default (defined in ecs::Component)ecs::Componentvirtual
~RenderComponent()=default (defined in ecs::RenderComponent)ecs::RenderComponent
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:ec043bf21598cf285fc29055a85f06aa18677998504a177a354f0bc71c571609 +size 11860 diff --git a/doxygen_docs/html/classecs_1_1_render_component.html b/doxygen_docs/html/classecs_1_1_render_component.html index 591c7a2..6bfbf4c 100644 --- a/doxygen_docs/html/classecs_1_1_render_component.html +++ b/doxygen_docs/html/classecs_1_1_render_component.html @@ -1,764 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: ecs::RenderComponent Class Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
- -
ecs::RenderComponent Class Reference
-
-
-
-Inheritance diagram for ecs::RenderComponent:
-
-
- - -ecs::Component - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

-Public Member Functions

 RenderComponent ()
 
void Initialize () override
 
void Update (float deltaTime) override
 
bool InitializeWithModel (std::shared_ptr< model_class > model)
 
bool InitializeFromFile (ID3D11Device *device, ID3D11DeviceContext *deviceContext, const char *modelFilename, TextureContainer &textureContainer)
 
bool LoadTexturesFromPath (std::vector< std::wstring > &texturePaths, TextureContainer &texturesContainer, ID3D11Device *device, ID3D11DeviceContext *deviceContext)
 
std::shared_ptr< model_classGetModel () const
 
void SetModel (std::shared_ptr< model_class > model)
 
const std::string & GetModelFilePath () const
 
void SetModelFilePath (const std::string &path)
 
bool IsVisible () const
 
void SetVisible (bool visible)
 
ID3D11ShaderResourceView * GetTexture (TextureType type, int index=0)
 
int GetIndexCount () const
 
void Render (ID3D11DeviceContext *deviceContext)
 
- Public Member Functions inherited from ecs::Component
Component (const Component &)=delete
 
-Componentoperator= (const Component &)=delete
 
Component (Component &&)=default
 
-Componentoperator= (Component &&)=default
 
-

Detailed Description

-
-

Definition at line 29 of file render_component.h.

-

Constructor & Destructor Documentation

- -

◆ RenderComponent()

- -
-
- - - - - -
- - - - - - - -
ecs::RenderComponent::RenderComponent ()
-
-inline
-
-

Builder for the RenderComponent class.

- -

Definition at line 34 of file render_component.h.

-
34: m_model(nullptr), m_isVisible(true) {}
-
-
-
-

Member Function Documentation

- -

◆ GetIndexCount()

- -
-
- - - - - -
- - - - - - - -
int ecs::RenderComponent::GetIndexCount () const
-
-inline
-
-

Get the number of vertices in the model. This method retrieves the vertex count from the model.

Returns
The number of vertices as an integer.
- -

Definition at line 174 of file render_component.h.

-
174 {
-
175 return m_model ? m_model->GetIndexCount() : 0;
-
176 }
-
-
-
- -

◆ GetModel()

- -
-
- - - - - -
- - - - - - - -
std::shared_ptr< model_class > ecs::RenderComponent::GetModel () const
-
-inline
-
-

Get the model associated with this RenderComponent.

Returns
A shared pointer to the model_class instance.
- -

Definition at line 113 of file render_component.h.

-
113{ return m_model; }
-
-
-
- -

◆ GetModelFilePath()

- -
-
- - - - - -
- - - - - - - -
const std::string & ecs::RenderComponent::GetModelFilePath () const
-
-inline
-
-

Get the file path of the model associated with this RenderComponent.

Returns
The file path as a string.
- -

Definition at line 125 of file render_component.h.

-
125{ return m_modelFilePath; }
-
-
-
- -

◆ GetTexture()

- -
-
- - - - - -
- - - - - - - - - - - -
ID3D11ShaderResourceView * ecs::RenderComponent::GetTexture (TextureType type,
int index = 0 )
-
-inline
-
-

Get a texture of a specific type by index. This method retrieves the texture from the model based on the specified type and index.

Parameters
- - - -
typeThe type of texture to retrieve (Diffuse, Normal, Specular, Alpha).
indexThe index of the texture to retrieve (default is 0).
-
-
-
Returns
A pointer to the ID3D11ShaderResourceView of the texture, or nullptr if not found.
- -

Definition at line 152 of file render_component.h.

-
152 {
-
153 if (!m_model) return nullptr;
-
154
-
155 switch (type) {
-
156 case TextureType::Diffuse:
-
157 return m_model->GetTexture(::TextureType::Diffuse, index);
-
158 case TextureType::Normal:
-
159 return m_model->GetTexture(::TextureType::Normal, index);
-
160 case TextureType::Specular:
-
161 return m_model->GetTexture(::TextureType::Specular, index);
-
162 case TextureType::Alpha:
-
163 return m_model->GetTexture(::TextureType::Alpha, index);
-
164 default:
-
165 return nullptr;
-
166 }
-
167 }
-
-
-
- -

◆ Initialize()

- -
-
- - - - - -
- - - - - - - -
void ecs::RenderComponent::Initialize ()
-
-inlineoverridevirtual
-
-

Virtual function to initialize the component.

- -

Reimplemented from ecs::Component.

- -

Definition at line 37 of file render_component.h.

-
37{}
-
-
-
- -

◆ InitializeFromFile()

- -
-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - -
bool ecs::RenderComponent::InitializeFromFile (ID3D11Device * device,
ID3D11DeviceContext * deviceContext,
const char * modelFilename,
TextureContainer & textureContainer )
-
-inline
-
-

Initialize the RenderComponent from a model file. This method checks if the model is already cached; if not, it loads the model from the specified file.

Parameters
- - - - - -
deviceThe Direct3D device used for rendering.
deviceContextThe Direct3D device context used for rendering.
modelFilenameThe path to the model file to load.
textureContainerThe container for textures used by the model.
-
-
-
Returns
True if initialization was successful, false otherwise.
- -

Definition at line 61 of file render_component.h.

-
62 {
-
63 // Vérifier si le modèle existe déjà dans le cache
-
64 std::string filename(modelFilename);
-
65 auto it = g_model_cache.find(filename);
-
66 if (it != g_model_cache.end()) {
-
67 m_model = it->second;
-
68 } else {
-
69 // Créer un nouveau modèle
-
70 auto new_model = std::make_shared<model_class>();
-
71 if (!new_model->Initialize(device, deviceContext, const_cast<char*>(modelFilename), textureContainer)) {
-
72 return false;
-
73 }
-
74 g_model_cache[filename] = new_model;
-
75 m_model = new_model;
-
76 }
-
77
-
78 m_modelFilePath = modelFilename;
-
79 return true;
-
80 }
-
-
-
- -

◆ InitializeWithModel()

- -
-
- - - - - -
- - - - - - - -
bool ecs::RenderComponent::InitializeWithModel (std::shared_ptr< model_class > model)
-
-inline
-
-

Initialize the RenderComponent with a model. This method allows the component to be initialized with an existing model instance.

Parameters
- - -
modelA shared pointer to the model_class instance to use.
-
-
-
Returns
True if initialization was successful, false otherwise.
- -

Definition at line 46 of file render_component.h.

-
46 {
-
47 if (!model) return false;
-
48 m_model = model;
-
49 return true;
-
50 }
-
-
-
- -

◆ IsVisible()

- -
-
- - - - - -
- - - - - - - -
bool ecs::RenderComponent::IsVisible () const
-
-inline
-
-

Check if the model is currently visible.

Returns
True if the model is visible, false otherwise.
- -

Definition at line 137 of file render_component.h.

-
137{ return m_isVisible; }
-
-
-
- -

◆ LoadTexturesFromPath()

- -
-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - -
bool ecs::RenderComponent::LoadTexturesFromPath (std::vector< std::wstring > & texturePaths,
TextureContainer & texturesContainer,
ID3D11Device * device,
ID3D11DeviceContext * deviceContext )
-
-inline
-
-

Load textures from a list of file paths into the texture container. This method uses DirectX's WIC texture loader to load textures from the specified paths.

Parameters
- - - - - -
texturePathsA vector of file paths to the textures to load.
texturesContainerThe container where the loaded textures will be stored.
deviceThe Direct3D device used for rendering.
deviceContextThe Direct3D device context used for rendering.
-
-
-
Returns
True if all textures were loaded successfully, false otherwise.
- -

Definition at line 91 of file render_component.h.

-
92 {
-
93 HRESULT result;
-
94
-
95 int i = 0;
-
96 for (const auto& texturePath : texturePaths) {
-
97 ID3D11ShaderResourceView* texture = nullptr;
-
98 result = DirectX::CreateWICTextureFromFile(device, deviceContext, texturePath.c_str(), nullptr, &texture);
-
99 if (FAILED(result)) {
-
100 return false;
-
101 }
-
102 texturesContainer.AssignTexture(texturesContainer, texture, texturePath, i);
-
103 i++;
-
104 }
-
105
-
106 return true;
-
107 }
-
-
-
- -

◆ Render()

- -
-
- - - - - -
- - - - - - - -
void ecs::RenderComponent::Render (ID3D11DeviceContext * deviceContext)
-
-inline
-
-

Render the model using the provided device context. This method calls the Render method of the model if it is initialized and visible.

Parameters
- - -
deviceContextThe Direct3D device context used for rendering.
-
-
- -

Definition at line 183 of file render_component.h.

-
183 {
-
184 if (m_model && m_isVisible) {
-
185 m_model->Render(deviceContext);
-
186 }
-
187 }
-
-
-
- -

◆ SetModel()

- -
-
- - - - - -
- - - - - - - -
void ecs::RenderComponent::SetModel (std::shared_ptr< model_class > model)
-
-inline
-
-

Set the model for this RenderComponent. This method allows the component to be set with an existing model instance.

Parameters
- - -
modelA shared pointer to the model_class instance to set.
-
-
- -

Definition at line 119 of file render_component.h.

-
119{ m_model = model; }
-
-
-
- -

◆ SetModelFilePath()

- -
-
- - - - - -
- - - - - - - -
void ecs::RenderComponent::SetModelFilePath (const std::string & path)
-
-inline
-
-

Set the file path of the model for this RenderComponent. This method allows the component to be set with a specific model file path.

Parameters
- - -
pathThe file path to set as a string.
-
-
- -

Definition at line 131 of file render_component.h.

-
131{ m_modelFilePath = path; }
-
-
-
- -

◆ SetVisible()

- -
-
- - - - - -
- - - - - - - -
void ecs::RenderComponent::SetVisible (bool visible)
-
-inline
-
-

Set the visibility of the model. This method allows the component to control whether the model should be rendered or not.

Parameters
- - -
visibleTrue to make the model visible, false to hide it.
-
-
- -

Definition at line 143 of file render_component.h.

-
143{ m_isVisible = visible; }
-
-
-
- -

◆ Update()

- -
-
- - - - - -
- - - - - - - -
void ecs::RenderComponent::Update (float deltaTime)
-
-inlineoverridevirtual
-
-

Virtual function to update the component.

Parameters
- - -
deltaTimeTime since the last update.
-
-
- -

Reimplemented from ecs::Component.

- -

Definition at line 38 of file render_component.h.

-
38{}
-
-
-
-
The documentation for this class was generated from the following file: -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:34429951483fa8c0c028d6d6e571c576a05693d0c49c8e2aea2c15f3e0a6d528 +size 47462 diff --git a/doxygen_docs/html/classecs_1_1_render_component.js b/doxygen_docs/html/classecs_1_1_render_component.js index 957744a..70270ea 100644 --- a/doxygen_docs/html/classecs_1_1_render_component.js +++ b/doxygen_docs/html/classecs_1_1_render_component.js @@ -1,18 +1,3 @@ -var classecs_1_1_render_component = -[ - [ "RenderComponent", "classecs_1_1_render_component.html#a9b8099cc84f4ca11f9cfca7d80081d6b", null ], - [ "GetIndexCount", "classecs_1_1_render_component.html#ae01aca10690322ec92899e99bf5e244e", null ], - [ "GetModel", "classecs_1_1_render_component.html#a2797ae01f7f42594a0291529d0ec8ef0", null ], - [ "GetModelFilePath", "classecs_1_1_render_component.html#aa9bc77dc2ea430ec9008bda7993f766c", null ], - [ "GetTexture", "classecs_1_1_render_component.html#a8d3c778be73e8cbb27b3ea102698a7f2", null ], - [ "Initialize", "classecs_1_1_render_component.html#aa92950c4ebad0379f626493bda1a79bb", null ], - [ "InitializeFromFile", "classecs_1_1_render_component.html#a0aeb040ec34ba3619f08269e5744597e", null ], - [ "InitializeWithModel", "classecs_1_1_render_component.html#a5014687c529c5dd29c1689da1dd64776", null ], - [ "IsVisible", "classecs_1_1_render_component.html#ad77b9089172b2567767aac2ac05118ea", null ], - [ "LoadTexturesFromPath", "classecs_1_1_render_component.html#a64e1e92929e2384d09c31b8d2afb258d", null ], - [ "Render", "classecs_1_1_render_component.html#a61dc5966b89474a415e3d19d28760a64", null ], - [ "SetModel", "classecs_1_1_render_component.html#ab3a01e06c359132815a5a35ed950a19a", null ], - [ "SetModelFilePath", "classecs_1_1_render_component.html#acac2902002c2ca0618c41525d1584088", null ], - [ "SetVisible", "classecs_1_1_render_component.html#ae0beed54f3cfe42213e1767da1b36d46", null ], - [ "Update", "classecs_1_1_render_component.html#a6cfff9944a89629f5f7a7d1451446f0d", null ] -]; \ No newline at end of file +version https://git-lfs.github.com/spec/v1 +oid sha256:c70d1d2d6dc2c65720859f8d20c6e74d603f4859563f6f39b6fd06f99795ffc5 +size 1573 diff --git a/doxygen_docs/html/classecs_1_1_render_component.png b/doxygen_docs/html/classecs_1_1_render_component.png index 65a2b07..5889501 100644 Binary files a/doxygen_docs/html/classecs_1_1_render_component.png and b/doxygen_docs/html/classecs_1_1_render_component.png differ diff --git a/doxygen_docs/html/classecs_1_1_render_system-members.html b/doxygen_docs/html/classecs_1_1_render_system-members.html index 3416a4f..94c5632 100644 --- a/doxygen_docs/html/classecs_1_1_render_system-members.html +++ b/doxygen_docs/html/classecs_1_1_render_system-members.html @@ -1,117 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
ecs::RenderSystem Member List
-
-
- -

This is the complete list of members for ecs::RenderSystem, including all inherited members.

- - - - -
RenderAllEntities(EntityManager *entityManager, const DirectX::XMMATRIX &viewMatrix, const DirectX::XMMATRIX &projectionMatrix, const DirectX::XMFLOAT4 *diffuseColors, const DirectX::XMFLOAT4 *lightPositions, const DirectX::XMFLOAT4 *ambientColors, const DirectX::XMFLOAT3 &cameraPos, const DirectX::XMFLOAT4 &sunlightDiffuse, const DirectX::XMFLOAT4 &sunlightAmbient, const DirectX::XMFLOAT3 &sunlightDirection, float sunlightIntensity)ecs::RenderSysteminline
RenderEntity(std::shared_ptr< Entity > entity, const DirectX::XMMATRIX &viewMatrix, const DirectX::XMMATRIX &projectionMatrix, const DirectX::XMFLOAT4 *diffuseColors, const DirectX::XMFLOAT4 *lightPositions, const DirectX::XMFLOAT4 *ambientColors, const DirectX::XMFLOAT3 &cameraPosition, const DirectX::XMFLOAT4 &sunlightDiffuse, const DirectX::XMFLOAT4 &sunlightAmbient, const DirectX::XMFLOAT3 &sunlightDirection, float sunlightIntensity)ecs::RenderSysteminline
RenderSystem(ID3D11DeviceContext *deviceContext, shader_manager_class *shaderManager)ecs::RenderSysteminline
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:1f5d961686028fe6ce5add25ee25a86e43b233b11773009e1d479a2346eb7854 +size 6273 diff --git a/doxygen_docs/html/classecs_1_1_render_system.html b/doxygen_docs/html/classecs_1_1_render_system.html index 9672e31..4fa1b60 100644 --- a/doxygen_docs/html/classecs_1_1_render_system.html +++ b/doxygen_docs/html/classecs_1_1_render_system.html @@ -1,536 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: ecs::RenderSystem Class Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
- -
ecs::RenderSystem Class Reference
-
-
- - - - - - - - -

-Public Member Functions

 RenderSystem (ID3D11DeviceContext *deviceContext, shader_manager_class *shaderManager)
 
bool RenderEntity (std::shared_ptr< Entity > entity, const DirectX::XMMATRIX &viewMatrix, const DirectX::XMMATRIX &projectionMatrix, const DirectX::XMFLOAT4 *diffuseColors, const DirectX::XMFLOAT4 *lightPositions, const DirectX::XMFLOAT4 *ambientColors, const DirectX::XMFLOAT3 &cameraPosition, const DirectX::XMFLOAT4 &sunlightDiffuse, const DirectX::XMFLOAT4 &sunlightAmbient, const DirectX::XMFLOAT3 &sunlightDirection, float sunlightIntensity)
 
int RenderAllEntities (EntityManager *entityManager, const DirectX::XMMATRIX &viewMatrix, const DirectX::XMMATRIX &projectionMatrix, const DirectX::XMFLOAT4 *diffuseColors, const DirectX::XMFLOAT4 *lightPositions, const DirectX::XMFLOAT4 *ambientColors, const DirectX::XMFLOAT3 &cameraPos, const DirectX::XMFLOAT4 &sunlightDiffuse, const DirectX::XMFLOAT4 &sunlightAmbient, const DirectX::XMFLOAT3 &sunlightDirection, float sunlightIntensity)
 
-

Detailed Description

-
-

Definition at line 11 of file render_system.h.

-

Constructor & Destructor Documentation

- -

◆ RenderSystem()

- -
-
- - - - - -
- - - - - - - - - - - -
ecs::RenderSystem::RenderSystem (ID3D11DeviceContext * deviceContext,
shader_manager_class * shaderManager )
-
-inline
-
-

Builder for the RenderSystem class. This class is responsible for rendering entities with the necessary components.

Parameters
- - - -
deviceContext
shaderManager
-
-
- -

Definition at line 19 of file render_system.h.

-
20 : m_deviceContext(deviceContext), m_shaderManager(shaderManager) {}
-
-
-
-

Member Function Documentation

- -

◆ RenderAllEntities()

- -
-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int ecs::RenderSystem::RenderAllEntities (EntityManager * entityManager,
const DirectX::XMMATRIX & viewMatrix,
const DirectX::XMMATRIX & projectionMatrix,
const DirectX::XMFLOAT4 * diffuseColors,
const DirectX::XMFLOAT4 * lightPositions,
const DirectX::XMFLOAT4 * ambientColors,
const DirectX::XMFLOAT3 & cameraPos,
const DirectX::XMFLOAT4 & sunlightDiffuse,
const DirectX::XMFLOAT4 & sunlightAmbient,
const DirectX::XMFLOAT3 & sunlightDirection,
float sunlightIntensity )
-
-inline
-
-

Render all entities in the EntityManager that have the necessary components. This method iterates through all entities and renders them if they have the required components.

Parameters
- - - - - - - - - - - - -
entityManagerThe EntityManager containing the entities to render.
viewMatrixThe view matrix for rendering.
projectionMatrixThe projection matrix for rendering.
diffuseColorsArray of diffuse colors for lighting.
lightPositionsArray of light positions for lighting.
ambientColorsArray of ambient colors for lighting.
cameraPosThe position of the camera in world space.
sunlightDiffuseThe diffuse color of sunlight.
sunlightAmbientThe ambient color of sunlight.
sunlightDirectionThe direction of sunlight in world space.
sunlightIntensityThe intensity of sunlight.
-
-
-
Returns
The number of entities rendered successfully.
- -

Definition at line 214 of file render_system.h.

-
224 {
-
225
-
226 int renderCount = 0;
-
227
-
228 // Récupérer toutes les entités qui ont les composants RenderComponent et TransformComponent
-
229 auto entities = entityManager->GetEntitiesWithComponent<RenderComponent>();
-
230
-
231 for (auto& entity : entities) {
-
232 auto render = entity->GetComponent<RenderComponent>();
-
233
-
234 // Vérifier si l'entité a un TransformComponent
-
235 auto transform = entity->GetComponent<TransformComponent>();
-
236 if (!transform) continue;
-
237
-
238 // Vérifier si le modèle est visible
-
239 if (!render->IsVisible()) continue;
-
240
-
241 // Effectuer le rendu
-
242 if (RenderEntity(entity, viewMatrix, projectionMatrix,
-
243 diffuseColors, lightPositions, ambientColors,cameraPos,
-
244 sunlightDiffuse, sunlightAmbient, sunlightDirection,
-
245 sunlightIntensity)) {
-
246 renderCount++;
-
247 }
-
248 }
-
249
-
250 return renderCount;
-
251 }
-
bool RenderEntity(std::shared_ptr< Entity > entity, const DirectX::XMMATRIX &viewMatrix, const DirectX::XMMATRIX &projectionMatrix, const DirectX::XMFLOAT4 *diffuseColors, const DirectX::XMFLOAT4 *lightPositions, const DirectX::XMFLOAT4 *ambientColors, const DirectX::XMFLOAT3 &cameraPosition, const DirectX::XMFLOAT4 &sunlightDiffuse, const DirectX::XMFLOAT4 &sunlightAmbient, const DirectX::XMFLOAT3 &sunlightDirection, float sunlightIntensity)
-
-
-
- -

◆ RenderEntity()

- -
-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool ecs::RenderSystem::RenderEntity (std::shared_ptr< Entity > entity,
const DirectX::XMMATRIX & viewMatrix,
const DirectX::XMMATRIX & projectionMatrix,
const DirectX::XMFLOAT4 * diffuseColors,
const DirectX::XMFLOAT4 * lightPositions,
const DirectX::XMFLOAT4 * ambientColors,
const DirectX::XMFLOAT3 & cameraPosition,
const DirectX::XMFLOAT4 & sunlightDiffuse,
const DirectX::XMFLOAT4 & sunlightAmbient,
const DirectX::XMFLOAT3 & sunlightDirection,
float sunlightIntensity )
-
-inline
-
-

Render an entity with the necessary components. This method checks if the entity has the required components and renders it using the appropriate shader.

Parameters
- - - - - - - - - - - - -
entityThe entity to render.
viewMatrixThe view matrix for rendering.
projectionMatrixThe projection matrix for rendering.
diffuseColorsArray of diffuse colors for lighting.
lightPositionsArray of light positions for lighting.
ambientColorsArray of ambient colors for lighting.
cameraPositionThe position of the camera in world space.
sunlightDiffuseThe diffuse color of sunlight.
sunlightAmbientThe ambient color of sunlight.
sunlightDirectionThe direction of sunlight in world space.
sunlightIntensityThe intensity of sunlight.
-
-
-
Returns
True if rendering was successful, false otherwise.
- -

Definition at line 38 of file render_system.h.

-
48 {
-
49
-
50 // Vérifier si l'entité a tous les composants nécessaires
-
51 auto transform = entity->GetComponent<TransformComponent>();
-
52 auto render = entity->GetComponent<RenderComponent>();
-
53 auto shader = entity->GetComponent<ShaderComponent>();
-
54
-
55 if (!transform || !render || !shader || !render->GetModel())
-
56 return false;
-
57
-
58 // Calculer la matrice monde
-
59 XMMATRIX scaleMatrix = transform->GetScaleMatrix();
-
60 XMMATRIX rotateMatrix = transform->GetRotateMatrix();
-
61 XMMATRIX translateMatrix = transform->GetTranslateMatrix();
-
62
-
63 XMMATRIX worldMatrix = XMMatrixMultiply(
-
64 XMMatrixMultiply(scaleMatrix, rotateMatrix),
-
65 translateMatrix
-
66 );
-
67
-
68 // Rendre le modèle
-
69 render->Render(m_deviceContext);
-
70
-
71 // Sélectionner le shader approprié
-
72 switch (shader->GetActiveShader()) {
-
73 case ShaderType::ALPHA_MAPPING:
-
74 return m_shaderManager->render_alpha_map_shader(
-
75 m_deviceContext,
-
76 render->GetIndexCount(),
-
77 worldMatrix,
-
78 viewMatrix,
-
79 projectionMatrix,
-
80 render->GetTexture(TextureType::Diffuse, 0),
-
81 render->GetTexture(TextureType::Diffuse, 1),
-
82 render->GetTexture(TextureType::Alpha, 0)
-
83 );
-
84
-
85 case ShaderType::CEL_SHADING:
-
86 return m_shaderManager->render_cel_shading_shader(
-
87 m_deviceContext,
-
88 render->GetIndexCount(),
-
89 worldMatrix,
-
90 viewMatrix,
-
91 projectionMatrix,
-
92 render->GetTexture(TextureType::Diffuse, 0),
-
93 sunlightDiffuse,
-
94 sunlightAmbient,
-
95 sunlightDirection,
-
96 sunlightIntensity
-
97 );
-
98
-
99 case ShaderType::NORMAL_MAPPING:
-
100 return m_shaderManager->render_normal_map_shader(
-
101 m_deviceContext,
-
102 render->GetIndexCount(),
-
103 worldMatrix,
-
104 viewMatrix,
-
105 projectionMatrix,
-
106 render->GetTexture(TextureType::Diffuse, 0),
-
107 render->GetTexture(TextureType::Normal, 0),
-
108 sunlightDirection,
-
109 sunlightDiffuse
-
110 );
-
111
-
112 case ShaderType::SPECULAR_MAPPING:
-
113
-
114 return m_shaderManager->render_spec_map_shader(
-
115 m_deviceContext,
-
116 render->GetIndexCount(),
-
117 worldMatrix,
-
118 viewMatrix,
-
119 projectionMatrix,
-
120 render->GetTexture(TextureType::Diffuse, 0),
-
121 render->GetTexture(TextureType::Normal, 0),
-
122 render->GetTexture(TextureType::Specular, 0),
-
123 sunlightDirection,
-
124 sunlightDiffuse,
-
125 cameraPosition,
-
126 sunlightDiffuse, // Couleur speculaire (à ajuster)
-
127 16.0f // Puissance speculaire (à ajuster)
-
128 );
-
129
-
130 case ShaderType::LIGHTING:
-
131 {
-
132 // Créer des copies locales non constantes des tableaux
-
133 DirectX::XMFLOAT4 localDiffuseColors[4];
-
134 DirectX::XMFLOAT4 localLightPositions[4];
-
135 DirectX::XMFLOAT4 localAmbientColors[4];
-
136
-
137 // Copier les données
-
138 for (int i = 0; i < 4; i++) {
-
139 localDiffuseColors[i] = diffuseColors[i];
-
140 localLightPositions[i] = lightPositions[i];
-
141 localAmbientColors[i] = ambientColors[i];
-
142 }
-
143
-
144 return m_shaderManager->renderlight_shader(
-
145 m_deviceContext,
-
146 render->GetIndexCount(),
-
147 worldMatrix,
-
148 viewMatrix,
-
149 projectionMatrix,
-
150 render->GetTexture(TextureType::Diffuse, 0),
-
151 localDiffuseColors,
-
152 localLightPositions,
-
153 localAmbientColors
-
154 );
-
155 }
-
156
-
157 case ShaderType::SUNLIGHT:
-
158 return m_shaderManager->render_sunlight_shader(
-
159 m_deviceContext,
-
160 render->GetIndexCount(),
-
161 worldMatrix,
-
162 viewMatrix,
-
163 projectionMatrix,
-
164 render->GetTexture(TextureType::Diffuse, 0),
-
165 sunlightDiffuse,
-
166 sunlightAmbient,
-
167 sunlightDirection,
-
168 sunlightIntensity
-
169 );
-
170
-
171 case ShaderType::SKYBOX:
-
172 return m_shaderManager->render_skybox_shader(
-
173 m_deviceContext,
-
174 render->GetIndexCount(),
-
175 worldMatrix,
-
176 viewMatrix,
-
177 projectionMatrix,
-
178 render->GetTexture(TextureType::Diffuse, 0),
-
179 sunlightDiffuse,
-
180 sunlightAmbient,
-
181 sunlightDirection,
-
182 sunlightIntensity
-
183 );
-
184
-
185 case ShaderType::TEXTURE:
-
186 default:
-
187 return m_shaderManager->render_texture_shader(
-
188 m_deviceContext,
-
189 render->GetIndexCount(),
-
190 worldMatrix,
-
191 viewMatrix,
-
192 projectionMatrix,
-
193 render->GetTexture(TextureType::Diffuse, 0)
-
194 );
-
195 }
-
196 }
-
-
-
-
The documentation for this class was generated from the following file: -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:7d5b9663d2c2adf4ac33c13b5eebca9393ce6a0b9a7a79eb29d10019704842d0 +size 39397 diff --git a/doxygen_docs/html/classecs_1_1_render_system.js b/doxygen_docs/html/classecs_1_1_render_system.js index 50bfe0a..87ba4e9 100644 --- a/doxygen_docs/html/classecs_1_1_render_system.js +++ b/doxygen_docs/html/classecs_1_1_render_system.js @@ -1,6 +1,3 @@ -var classecs_1_1_render_system = -[ - [ "RenderSystem", "classecs_1_1_render_system.html#a4db69fd99c18112dcbaa931a01bb9780", null ], - [ "RenderAllEntities", "classecs_1_1_render_system.html#a8d65c73dad3be4070153c3f568d5a139", null ], - [ "RenderEntity", "classecs_1_1_render_system.html#aef4d62c3ef06a880712d183a2848de2f", null ] -]; \ No newline at end of file +version https://git-lfs.github.com/spec/v1 +oid sha256:895764ac8b42bb35d47238d2b1b8f4ca964672c3a00d89f75a5ab0ef7e706d2a +size 338 diff --git a/doxygen_docs/html/classecs_1_1_shader_component-members.html b/doxygen_docs/html/classecs_1_1_shader_component-members.html index e7d9bdb..4c806b8 100644 --- a/doxygen_docs/html/classecs_1_1_shader_component-members.html +++ b/doxygen_docs/html/classecs_1_1_shader_component-members.html @@ -1,128 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
ecs::ShaderComponent Member List
-
-
- -

This is the complete list of members for ecs::ShaderComponent, including all inherited members.

- - - - - - - - - - - - - - - -
Component()=default (defined in ecs::Component)ecs::Component
Component(const Component &)=delete (defined in ecs::Component)ecs::Component
Component(Component &&)=default (defined in ecs::Component)ecs::Component
GetActiveShader() constecs::ShaderComponentinline
Initialize() overrideecs::ShaderComponentinlinevirtual
operator=(const Component &)=delete (defined in ecs::Component)ecs::Component
operator=(Component &&)=default (defined in ecs::Component)ecs::Component
SetActiveShader(ShaderType shader)ecs::ShaderComponentinline
ShaderComponent()ecs::ShaderComponentinline
ShaderTypeToString(ShaderType type)ecs::ShaderComponentinlinestatic
StringToShaderType(const std::string &str)ecs::ShaderComponentinlinestatic
Update(float deltaTime) overrideecs::ShaderComponentinlinevirtual
~Component()=default (defined in ecs::Component)ecs::Componentvirtual
~ShaderComponent()=default (defined in ecs::ShaderComponent)ecs::ShaderComponent
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:0dbc8eb8ede860305906f11233d9c75ef0d7f4abe836076d12759032ad0b3306 +size 8994 diff --git a/doxygen_docs/html/classecs_1_1_shader_component.html b/doxygen_docs/html/classecs_1_1_shader_component.html index 9caed16..9f5a046 100644 --- a/doxygen_docs/html/classecs_1_1_shader_component.html +++ b/doxygen_docs/html/classecs_1_1_shader_component.html @@ -1,422 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: ecs::ShaderComponent Class Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
- -
ecs::ShaderComponent Class Reference
-
-
-
-Inheritance diagram for ecs::ShaderComponent:
-
-
- - -ecs::Component - -
- - - - - - - - - - - - - - - - - - - - - -

-Public Member Functions

 ShaderComponent ()
 
void Initialize () override
 
void Update (float deltaTime) override
 
ShaderType GetActiveShader () const
 
void SetActiveShader (ShaderType shader)
 
- Public Member Functions inherited from ecs::Component
Component (const Component &)=delete
 
-Componentoperator= (const Component &)=delete
 
Component (Component &&)=default
 
-Componentoperator= (Component &&)=default
 
- - - - - -

-Static Public Member Functions

static ShaderType StringToShaderType (const std::string &str)
 
static std::string ShaderTypeToString (ShaderType type)
 
-

Detailed Description

-
-

Definition at line 24 of file shader_component.h.

-

Constructor & Destructor Documentation

- -

◆ ShaderComponent()

- -
-
- - - - - -
- - - - - - - -
ecs::ShaderComponent::ShaderComponent ()
-
-inline
-
-

Builder for the ShaderComponent class. Initializes the active shader to LIGHTING by default.

- -

Definition at line 31 of file shader_component.h.

-
31: m_activeShader(ShaderType::LIGHTING) {}
-
-
-
-

Member Function Documentation

- -

◆ GetActiveShader()

- -
-
- - - - - -
- - - - - - - -
ShaderType ecs::ShaderComponent::GetActiveShader () const
-
-inline
-
-

Get the currently active shader type.

Returns
The active shader type as a ShaderType enum.
- -

Definition at line 41 of file shader_component.h.

-
41{ return m_activeShader; }
-
-
-
- -

◆ Initialize()

- -
-
- - - - - -
- - - - - - - -
void ecs::ShaderComponent::Initialize ()
-
-inlineoverridevirtual
-
-

Virtual function to initialize the component.

- -

Reimplemented from ecs::Component.

- -

Definition at line 34 of file shader_component.h.

-
34{}
-
-
-
- -

◆ SetActiveShader()

- -
-
- - - - - -
- - - - - - - -
void ecs::ShaderComponent::SetActiveShader (ShaderType shader)
-
-inline
-
-

Set the active shader type. This method allows changing the shader type used for rendering.

Parameters
- - -
shaderThe shader type to set as a ShaderType enum.
-
-
- -

Definition at line 47 of file shader_component.h.

-
47{ m_activeShader = shader; }
-
-
-
- -

◆ ShaderTypeToString()

- -
-
- - - - - -
- - - - - - - -
static std::string ecs::ShaderComponent::ShaderTypeToString (ShaderType type)
-
-inlinestatic
-
-

Convert a ShaderType enum to its string representation. This method provides a string name for each shader type.

Parameters
- - -
typeThe shader type as a ShaderType enum.
-
-
-
Returns
The name of the shader type as a string.
- -

Definition at line 75 of file shader_component.h.

-
75 {
-
76 switch (type) {
-
77 case ShaderType::ALPHA_MAPPING: return "ALPHA_MAPPING";
-
78 case ShaderType::CEL_SHADING: return "CEL_SHADING";
-
79 case ShaderType::NORMAL_MAPPING: return "NORMAL_MAPPING";
-
80 case ShaderType::SPECULAR_MAPPING: return "SPECULAR_MAPPING";
-
81 case ShaderType::TEXTURE: return "TEXTURE";
-
82 case ShaderType::LIGHTING: return "LIGHTING";
-
83 case ShaderType::SUNLIGHT: return "SUNLIGHT";
-
84 case ShaderType::SKYBOX: return "SKYBOX";
-
85 case ShaderType::REFLECTION: return "REFLECTION";
-
86 case ShaderType::REFRACTION: return "REFRACTION";
-
87 default: return "TEXTURE";
-
88 }
-
89 }
-
-
-
- -

◆ StringToShaderType()

- -
-
- - - - - -
- - - - - - - -
static ShaderType ecs::ShaderComponent::StringToShaderType (const std::string & str)
-
-inlinestatic
-
-

Set the active shader type from a string. This method converts a string representation of a shader type to the corresponding ShaderType enum.

Parameters
- - -
shaderNameThe name of the shader type as a string.
-
-
-
Returns
The ShaderType enum corresponding to the provided string.
- -

Definition at line 55 of file shader_component.h.

-
55 {
-
56 if (str == "ALPHA_MAPPING") return ShaderType::ALPHA_MAPPING;
-
57 if (str == "CEL_SHADING") return ShaderType::CEL_SHADING;
-
58 if (str == "NORMAL_MAPPING") return ShaderType::NORMAL_MAPPING;
-
59 if (str == "SPECULAR_MAPPING") return ShaderType::SPECULAR_MAPPING;
-
60 if (str == "TEXTURE") return ShaderType::TEXTURE;
-
61 if (str == "LIGHTING") return ShaderType::LIGHTING;
-
62 if (str == "SUNLIGHT") return ShaderType::SUNLIGHT;
-
63 if (str == "SKYBOX") return ShaderType::SKYBOX;
-
64 if (str == "REFLECTION") return ShaderType::REFLECTION;
-
65 if (str == "REFRACTION") return ShaderType::REFRACTION;
-
66 return ShaderType::TEXTURE;
-
67 }
-
-
-
- -

◆ Update()

- -
-
- - - - - -
- - - - - - - -
void ecs::ShaderComponent::Update (float deltaTime)
-
-inlineoverridevirtual
-
-

Virtual function to update the component.

Parameters
- - -
deltaTimeTime since the last update.
-
-
- -

Reimplemented from ecs::Component.

- -

Definition at line 35 of file shader_component.h.

-
35{}
-
-
-
-
The documentation for this class was generated from the following file: -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:3a24d469a70b29da54f396827bb7371e7748619afab1f36352cbf33b501741ce +size 27637 diff --git a/doxygen_docs/html/classecs_1_1_shader_component.js b/doxygen_docs/html/classecs_1_1_shader_component.js index 9f9fe8e..918b69c 100644 --- a/doxygen_docs/html/classecs_1_1_shader_component.js +++ b/doxygen_docs/html/classecs_1_1_shader_component.js @@ -1,8 +1,3 @@ -var classecs_1_1_shader_component = -[ - [ "ShaderComponent", "classecs_1_1_shader_component.html#a58198e14a710f43735b0e22d5f9d8296", null ], - [ "GetActiveShader", "classecs_1_1_shader_component.html#aad636c8a9e23f0ef494a2fe66d1ae6b4", null ], - [ "Initialize", "classecs_1_1_shader_component.html#a69a5ca163458465936525b14270fe46e", null ], - [ "SetActiveShader", "classecs_1_1_shader_component.html#a4664380323123817e65900a12fa9496f", null ], - [ "Update", "classecs_1_1_shader_component.html#a2ebc1ef592626fc729884677c771ccbf", null ] -]; \ No newline at end of file +version https://git-lfs.github.com/spec/v1 +oid sha256:22e220a8632385965c40065658817137b76dc6731b1f01980425faf3c3a27e9a +size 550 diff --git a/doxygen_docs/html/classecs_1_1_shader_component.png b/doxygen_docs/html/classecs_1_1_shader_component.png index 293d2a8..3bebea8 100644 Binary files a/doxygen_docs/html/classecs_1_1_shader_component.png and b/doxygen_docs/html/classecs_1_1_shader_component.png differ diff --git a/doxygen_docs/html/classecs_1_1_transform_component-members.html b/doxygen_docs/html/classecs_1_1_transform_component-members.html index 8d5ab87..8edb721 100644 --- a/doxygen_docs/html/classecs_1_1_transform_component-members.html +++ b/doxygen_docs/html/classecs_1_1_transform_component-members.html @@ -1,138 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
ecs::TransformComponent Member List
-
-
- -

This is the complete list of members for ecs::TransformComponent, including all inherited members.

- - - - - - - - - - - - - - - - - - - - - - - - - -
Component()=default (defined in ecs::Component)ecs::Component
Component(const Component &)=delete (defined in ecs::Component)ecs::Component
Component(Component &&)=default (defined in ecs::Component)ecs::Component
GetPosition() constecs::TransformComponentinline
GetRotateMatrix() constecs::TransformComponentinline
GetRotation() constecs::TransformComponentinline
GetScale() constecs::TransformComponentinline
GetScaleMatrix() constecs::TransformComponentinline
GetTranslateMatrix() constecs::TransformComponentinline
GetWorldMatrix() constecs::TransformComponentinline
Initialize()ecs::Componentinlinevirtual
operator=(const Component &)=delete (defined in ecs::Component)ecs::Component
operator=(Component &&)=default (defined in ecs::Component)ecs::Component
SetPosition(XMVECTOR position)ecs::TransformComponentinline
SetRotateMatrix(XMMATRIX matrix)ecs::TransformComponentinline
SetRotation(XMVECTOR rotation)ecs::TransformComponentinline
SetScale(XMVECTOR scale)ecs::TransformComponentinline
SetScaleMatrix(XMMATRIX matrix)ecs::TransformComponentinline
SetTranslateMatrix(XMMATRIX matrix)ecs::TransformComponentinline
TransformComponent()ecs::TransformComponentinline
Update(float deltaTime)ecs::Componentinlinevirtual
UpdateWorldMatrix()ecs::TransformComponentinline
~Component()=default (defined in ecs::Component)ecs::Componentvirtual
~TransformComponent()=default (defined in ecs::TransformComponent)ecs::TransformComponent
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:5d9619dd8a0183124ede627cf23784047e2a10fc5bed04af4dd720d79088810b +size 12258 diff --git a/doxygen_docs/html/classecs_1_1_transform_component.html b/doxygen_docs/html/classecs_1_1_transform_component.html index 957ab97..c17a18b 100644 --- a/doxygen_docs/html/classecs_1_1_transform_component.html +++ b/doxygen_docs/html/classecs_1_1_transform_component.html @@ -1,702 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: ecs::TransformComponent Class Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
- -
ecs::TransformComponent Class Reference
-
-
-
-Inheritance diagram for ecs::TransformComponent:
-
-
- - -ecs::Component - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

-Public Member Functions

 TransformComponent ()
 
void SetPosition (XMVECTOR position)
 
void SetRotation (XMVECTOR rotation)
 
void SetScale (XMVECTOR scale)
 
XMVECTOR GetPosition () const
 
XMVECTOR GetRotation () const
 
XMVECTOR GetScale () const
 
void UpdateWorldMatrix ()
 
XMMATRIX GetScaleMatrix () const
 
XMMATRIX GetRotateMatrix () const
 
XMMATRIX GetTranslateMatrix () const
 
XMMATRIX GetWorldMatrix () const
 
void SetScaleMatrix (XMMATRIX matrix)
 
void SetRotateMatrix (XMMATRIX matrix)
 
void SetTranslateMatrix (XMMATRIX matrix)
 
- Public Member Functions inherited from ecs::Component
Component (const Component &)=delete
 
-Componentoperator= (const Component &)=delete
 
Component (Component &&)=default
 
-Componentoperator= (Component &&)=default
 
virtual void Initialize ()
 
virtual void Update (float deltaTime)
 
-

Detailed Description

-
-

Definition at line 9 of file transform_component.h.

-

Constructor & Destructor Documentation

- -

◆ TransformComponent()

- -
-
- - - - - -
- - - - - - - -
ecs::TransformComponent::TransformComponent ()
-
-inline
-
-

Builder for the TransformComponent class. Initializes the matrices to identity matrices.

- -

Definition at line 16 of file transform_component.h.

-
16 {
-
17 m_ScaleMatrix = XMMatrixIdentity();
-
18 m_RotateMatrix = XMMatrixIdentity();
-
19 m_TranslateMatrix = XMMatrixIdentity();
-
20 m_WorldMatrix = XMMatrixIdentity();
-
21 }
-
-
-
-

Member Function Documentation

- -

◆ GetPosition()

- -
-
- - - - - -
- - - - - - - -
XMVECTOR ecs::TransformComponent::GetPosition () const
-
-inline
-
-

Get the position of the object in world space.

Returns
The position as an XMVECTOR (x, y, z, (w is O.0f)).
- -

Definition at line 66 of file transform_component.h.

-
66 {
-
67 XMFLOAT4X4 matrix;
-
68 XMStoreFloat4x4(&matrix, m_TranslateMatrix);
-
69 return XMVectorSet(matrix._41, matrix._42, matrix._43, 0.0f);
-
70 }
-
-
-
- -

◆ GetRotateMatrix()

- -
-
- - - - - -
- - - - - - - -
XMMATRIX ecs::TransformComponent::GetRotateMatrix () const
-
-inline
-
-

Get the rotation matrix.

Returns
The rotation matrix as an XMMATRIX.
- -

Definition at line 124 of file transform_component.h.

-
124{ return m_RotateMatrix; }
-
-
-
- -

◆ GetRotation()

- -
-
- - - - - -
- - - - - - - -
XMVECTOR ecs::TransformComponent::GetRotation () const
-
-inline
-
-

Get the rotation of the object in world space.

Returns
The rotation as an XMVECTOR (roll, pitch, yaw, (w is O.0f)).
- -

Definition at line 76 of file transform_component.h.

-
76 {
-
77 XMFLOAT4X4 matrix;
-
78 XMStoreFloat4x4(&matrix, m_RotateMatrix);
-
79 float rotationX = atan2f(matrix._32, matrix._33);
-
80 float rotationY = atan2f(-matrix._31, sqrtf(matrix._32 * matrix._32 + matrix._33 * matrix._33));
-
81 float rotationZ = atan2f(matrix._21, matrix._11);
-
82 return XMVectorSet(rotationX, rotationY, rotationZ, 0.0f);
-
83 }
-
-
-
- -

◆ GetScale()

- -
-
- - - - - -
- - - - - - - -
XMVECTOR ecs::TransformComponent::GetScale () const
-
-inline
-
-

Get the scale of the object in world space.

Returns
The scale as an XMVECTOR (x, y, z, (w is O.0f)).
- -

Definition at line 89 of file transform_component.h.

-
89 {
-
90 XMFLOAT4X4 matrix;
-
91 XMStoreFloat4x4(&matrix, m_ScaleMatrix);
-
92
-
93 XMVECTOR row1 = XMLoadFloat3(reinterpret_cast<XMFLOAT3*>(&matrix._11));
-
94 XMVECTOR row2 = XMLoadFloat3(reinterpret_cast<XMFLOAT3*>(&matrix._21));
-
95 XMVECTOR row3 = XMLoadFloat3(reinterpret_cast<XMFLOAT3*>(&matrix._31));
-
96
-
97 XMVECTOR scale = XMVectorSet(
-
98 XMVectorGetX(XMVector3Length(row1)),
-
99 XMVectorGetX(XMVector3Length(row2)),
-
100 XMVectorGetX(XMVector3Length(row3)),
-
101 0.0f
-
102 );
-
103
-
104 return scale;
-
105 }
-
-
-
- -

◆ GetScaleMatrix()

- -
-
- - - - - -
- - - - - - - -
XMMATRIX ecs::TransformComponent::GetScaleMatrix () const
-
-inline
-
-

Get the scale matrix.

Returns
The scale matrix as an XMMATRIX.
- -

Definition at line 119 of file transform_component.h.

-
119{ return m_ScaleMatrix; }
-
-
-
- -

◆ GetTranslateMatrix()

- -
-
- - - - - -
- - - - - - - -
XMMATRIX ecs::TransformComponent::GetTranslateMatrix () const
-
-inline
-
-

Get the translation matrix.

Returns
The translation matrix as an XMMATRIX.
- -

Definition at line 129 of file transform_component.h.

-
129{ return m_TranslateMatrix; }
-
-
-
- -

◆ GetWorldMatrix()

- -
-
- - - - - -
- - - - - - - -
XMMATRIX ecs::TransformComponent::GetWorldMatrix () const
-
-inline
-
-

Get the world matrix. This matrix combines scale, rotation, and translation to represent the object's position in world space.

Returns
The world matrix as an XMMATRIX.
- -

Definition at line 135 of file transform_component.h.

-
135{ return m_WorldMatrix; }
-
-
-
- -

◆ SetPosition()

- -
-
- - - - - -
- - - - - - - -
void ecs::TransformComponent::SetPosition (XMVECTOR position)
-
-inline
-
-

Set the position of the object in world space.

Parameters
- - -
position
-
-
- -

Definition at line 29 of file transform_component.h.

-
29 {
-
30 XMFLOAT4X4 matrix;
-
31 XMStoreFloat4x4(&matrix, m_TranslateMatrix);
-
32 matrix._41 = XMVectorGetX(position);
-
33 matrix._42 = XMVectorGetY(position);
-
34 matrix._43 = XMVectorGetZ(position);
-
35 m_TranslateMatrix = XMLoadFloat4x4(&matrix);
- -
37 }
- -
-
-
- -

◆ SetRotateMatrix()

- -
-
- - - - - -
- - - - - - - -
void ecs::TransformComponent::SetRotateMatrix (XMMATRIX matrix)
-
-inline
-
-

Set the rotation matrix directly. This method allows setting the rotation matrix without modifying the individual rotation components.

Parameters
- - -
matrixThe rotation matrix to set as an XMMATRIX.
-
-
- -

Definition at line 148 of file transform_component.h.

-
148{ m_RotateMatrix = matrix; UpdateWorldMatrix(); }
-
-
-
- -

◆ SetRotation()

- -
-
- - - - - -
- - - - - - - -
void ecs::TransformComponent::SetRotation (XMVECTOR rotation)
-
-inline
-
-

Set the rotation of the object in world space.

Parameters
- - -
rotationThe rotation as an XMVECTOR (roll, pitch, yaw).
-
-
- -

Definition at line 43 of file transform_component.h.

-
43 {
-
44 m_RotateMatrix = XMMatrixRotationRollPitchYawFromVector(rotation);
- -
46 }
-
-
-
- -

◆ SetScale()

- -
-
- - - - - -
- - - - - - - -
void ecs::TransformComponent::SetScale (XMVECTOR scale)
-
-inline
-
-

Set the scale of the object in world space.

Parameters
- - -
scaleThe scale as an XMVECTOR (x, y, z).
-
-
- -

Definition at line 52 of file transform_component.h.

-
52 {
-
53 XMFLOAT4X4 matrix;
-
54 XMStoreFloat4x4(&matrix, m_ScaleMatrix);
-
55 matrix._11 = XMVectorGetX(scale);
-
56 matrix._22 = XMVectorGetY(scale);
-
57 matrix._33 = XMVectorGetZ(scale);
-
58 m_ScaleMatrix = XMLoadFloat4x4(&matrix);
- -
60 }
-
-
-
- -

◆ SetScaleMatrix()

- -
-
- - - - - -
- - - - - - - -
void ecs::TransformComponent::SetScaleMatrix (XMMATRIX matrix)
-
-inline
-
-

Set the scale matrix directly. This method allows setting the scale matrix without modifying the individual scale components.

Parameters
- - -
matrixThe scale matrix to set as an XMMATRIX.
-
-
- -

Definition at line 142 of file transform_component.h.

-
142{ m_ScaleMatrix = matrix; UpdateWorldMatrix(); }
-
-
-
- -

◆ SetTranslateMatrix()

- -
-
- - - - - -
- - - - - - - -
void ecs::TransformComponent::SetTranslateMatrix (XMMATRIX matrix)
-
-inline
-
-

Set the translation matrix directly. This method allows setting the translation matrix without modifying the individual translation components.

Parameters
- - -
matrixThe translation matrix to set as an XMMATRIX.
-
-
- -

Definition at line 154 of file transform_component.h.

-
154{ m_TranslateMatrix = matrix; UpdateWorldMatrix(); }
-
-
-
- -

◆ UpdateWorldMatrix()

- -
-
- - - - - -
- - - - - - - -
void ecs::TransformComponent::UpdateWorldMatrix ()
-
-inline
-
-

Update the world matrix based on the current scale, rotation, and translation matrices. This method is called whenever one of the matrices is modified.

- -

Definition at line 111 of file transform_component.h.

-
111 {
-
112 m_WorldMatrix = m_ScaleMatrix * m_RotateMatrix * m_TranslateMatrix;
-
113 }
-
-
-
-
The documentation for this class was generated from the following file: -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:91c31457fdc10b2d87b8774276a1b3fd2ab1121f950dcd235c2c80ee8cb4f597 +size 42364 diff --git a/doxygen_docs/html/classecs_1_1_transform_component.js b/doxygen_docs/html/classecs_1_1_transform_component.js index 7ab73cb..0c1b07c 100644 --- a/doxygen_docs/html/classecs_1_1_transform_component.js +++ b/doxygen_docs/html/classecs_1_1_transform_component.js @@ -1,18 +1,3 @@ -var classecs_1_1_transform_component = -[ - [ "TransformComponent", "classecs_1_1_transform_component.html#a66dc72687d5a68513beb31b5ae28564f", null ], - [ "GetPosition", "classecs_1_1_transform_component.html#a2936d569829c3c440d3bf5bde6353efe", null ], - [ "GetRotateMatrix", "classecs_1_1_transform_component.html#aedc64114b30f9aa629caf6548bfc3c07", null ], - [ "GetRotation", "classecs_1_1_transform_component.html#a50130c13fb3f0d01a473eead605aaa40", null ], - [ "GetScale", "classecs_1_1_transform_component.html#af5cb7911c9deab8a49c9f8ae3ce099c5", null ], - [ "GetScaleMatrix", "classecs_1_1_transform_component.html#aca8c9c9d0266636b7431696a6905b419", null ], - [ "GetTranslateMatrix", "classecs_1_1_transform_component.html#a2c5c5b5d1081b942ab7d5776d4418044", null ], - [ "GetWorldMatrix", "classecs_1_1_transform_component.html#a0d9f3426b6952e0468705820835ac331", null ], - [ "SetPosition", "classecs_1_1_transform_component.html#ad825453d2a065640aa71618c00612249", null ], - [ "SetRotateMatrix", "classecs_1_1_transform_component.html#a5d868ff759cb7709328938681d62f913", null ], - [ "SetRotation", "classecs_1_1_transform_component.html#a67f155836cd31a336324bb1ea4b3741a", null ], - [ "SetScale", "classecs_1_1_transform_component.html#ac98d110ada557fce53563306700516b7", null ], - [ "SetScaleMatrix", "classecs_1_1_transform_component.html#aa1d23303805dd960452dd16a5c077835", null ], - [ "SetTranslateMatrix", "classecs_1_1_transform_component.html#ae6c18c31f088f065f059b490773b3a08", null ], - [ "UpdateWorldMatrix", "classecs_1_1_transform_component.html#a28d1fe5ba04d4ff6f9eb136ea656e35e", null ] -]; \ No newline at end of file +version https://git-lfs.github.com/spec/v1 +oid sha256:f32cd237448dcea58eb8f191bc821fdb9f9a29c3174a53faf69d0f9fdbf66fe1 +size 1640 diff --git a/doxygen_docs/html/classecs_1_1_transform_component.png b/doxygen_docs/html/classecs_1_1_transform_component.png index 6159f20..2383c31 100644 Binary files a/doxygen_docs/html/classecs_1_1_transform_component.png and b/doxygen_docs/html/classecs_1_1_transform_component.png differ diff --git a/doxygen_docs/html/classes.html b/doxygen_docs/html/classes.html index f550aca..265a378 100644 --- a/doxygen_docs/html/classes.html +++ b/doxygen_docs/html/classes.html @@ -1,165 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Class Index - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
Class Index
-
-
-
A | B | C | D | E | F | I | L | M | N | O | P | R | S | T | V | W
- -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:390f982865995441f0952de533f8736b1a2bfcaeae7add0e7c06dbb1bea5c6f4 +size 13038 diff --git a/doxygen_docs/html/classfont__class-members.html b/doxygen_docs/html/classfont__class-members.html index e68a6f9..d6b9dc2 100644 --- a/doxygen_docs/html/classfont__class-members.html +++ b/doxygen_docs/html/classfont__class-members.html @@ -1,123 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
font_class Member List
-
-
- -

This is the complete list of members for font_class, including all inherited members.

- - - - - - - - - - -
BuildVertexArray(void *, char *, float, float) (defined in font_class)font_class
font_class() (defined in font_class)font_class
font_class(const font_class &) (defined in font_class)font_class
GetFontHeight() (defined in font_class)font_class
GetSentencePixelLength(char *) (defined in font_class)font_class
GetTexture() (defined in font_class)font_class
Initialize(ID3D11Device *, ID3D11DeviceContext *, int) (defined in font_class)font_class
Shutdown() (defined in font_class)font_class
~font_class() (defined in font_class)font_class
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:048d620f90777131ca1eac22589086c38411e254a5c3e2f6730ac97cdf85e3ab +size 6789 diff --git a/doxygen_docs/html/classfont__class.html b/doxygen_docs/html/classfont__class.html index d117308..9123c2b 100644 --- a/doxygen_docs/html/classfont__class.html +++ b/doxygen_docs/html/classfont__class.html @@ -1,492 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: font_class Class Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
- -
font_class Class Reference
-
-
- - - - - - - - - - - - - - - - -

-Public Member Functions

 font_class (const font_class &)
 
bool Initialize (ID3D11Device *, ID3D11DeviceContext *, int)
 
void Shutdown ()
 
ID3D11ShaderResourceView * GetTexture ()
 
void BuildVertexArray (void *, char *, float, float)
 
int GetSentencePixelLength (char *)
 
int GetFontHeight ()
 
-

Detailed Description

-
-

Definition at line 22 of file font_class.h.

-

Constructor & Destructor Documentation

- -

◆ font_class() [1/2]

- -
-
- - - - - - - -
font_class::font_class ()
-
- -

Definition at line 3 of file font_class.cpp.

-
4{
-
5 m_Font = 0;
-
6 m_Texture = 0;
-
7}
-
-
-
- -

◆ font_class() [2/2]

- -
-
- - - - - - - -
font_class::font_class (const font_class & other)
-
- -

Definition at line 10 of file font_class.cpp.

-
11{
-
12}
-
-
-
- -

◆ ~font_class()

- -
-
- - - - - - - -
font_class::~font_class ()
-
- -

Definition at line 15 of file font_class.cpp.

-
16{
-
17}
-
-
-
-

Member Function Documentation

- -

◆ BuildVertexArray()

- -
-
- - - - - - - - - - - - - - - - - - - - - -
void font_class::BuildVertexArray (void * vertices,
char * sentence,
float drawX,
float drawY )
-
- -

Definition at line 178 of file font_class.cpp.

-
179{
-
180 VertexType* vertexPtr;
-
181 int numLetters, index, i, letter;
-
182
-
183
-
184 // Coerce the input vertices into a VertexType structure.
-
185 vertexPtr = (VertexType*)vertices;
-
186
-
187 // Get the number of letters in the sentence.
-
188 numLetters = (int)strlen(sentence);
-
189
-
190 // Initialize the index to the vertex array.
-
191 index = 0;
-
192
-
193 // Draw each letter onto a quad.
-
194 for (i = 0; i < numLetters; i++)
-
195 {
-
196 letter = ((int)sentence[i]) - 32;
-
197
-
198 // If the letter is a space then just move over three pixels.
-
199 if (letter == 0)
-
200 {
-
201 drawX = drawX + m_spaceSize;
-
202 }
-
203 else
-
204 {
-
205 // First triangle in quad.
-
206 vertexPtr[index].position = XMFLOAT3(drawX, drawY, 0.0f); // Top left.
-
207 vertexPtr[index].texture = XMFLOAT2(m_Font[letter].left, 0.0f);
-
208 index++;
-
209
-
210 vertexPtr[index].position = XMFLOAT3((drawX + m_Font[letter].size), (drawY - m_fontHeight), 0.0f); // Bottom right.
-
211 vertexPtr[index].texture = XMFLOAT2(m_Font[letter].right, 1.0f);
-
212 index++;
-
213
-
214 vertexPtr[index].position = XMFLOAT3(drawX, (drawY - m_fontHeight), 0.0f); // Bottom left.
-
215 vertexPtr[index].texture = XMFLOAT2(m_Font[letter].left, 1.0f);
-
216 index++;
-
217
-
218 // Second triangle in quad.
-
219 vertexPtr[index].position = XMFLOAT3(drawX, drawY, 0.0f); // Top left.
-
220 vertexPtr[index].texture = XMFLOAT2(m_Font[letter].left, 0.0f);
-
221 index++;
-
222
-
223 vertexPtr[index].position = XMFLOAT3(drawX + m_Font[letter].size, drawY, 0.0f); // Top right.
-
224 vertexPtr[index].texture = XMFLOAT2(m_Font[letter].right, 0.0f);
-
225 index++;
-
226
-
227 vertexPtr[index].position = XMFLOAT3((drawX + m_Font[letter].size), (drawY - m_fontHeight), 0.0f); // Bottom right.
-
228 vertexPtr[index].texture = XMFLOAT2(m_Font[letter].right, 1.0f);
-
229 index++;
-
230
-
231 // Update the x location for drawing by the size of the letter and one pixel.
-
232 drawX = drawX + m_Font[letter].size + 1.0f;
-
233 }
-
234 }
-
235
-
236 return;
-
237}
-
-
-
- -

◆ GetFontHeight()

- -
-
- - - - - - - -
int font_class::GetFontHeight ()
-
- -

Definition at line 265 of file font_class.cpp.

-
266{
-
267 return (int)m_fontHeight;
-
268}
-
-
-
- -

◆ GetSentencePixelLength()

- -
-
- - - - - - - -
int font_class::GetSentencePixelLength (char * sentence)
-
- -

Definition at line 239 of file font_class.cpp.

-
240{
-
241 int pixelLength, numLetters, i, letter;
-
242
-
243
-
244 pixelLength = 0;
-
245 numLetters = (int)strlen(sentence);
-
246
-
247 for (i = 0; i < numLetters; i++)
-
248 {
-
249 letter = ((int)sentence[i]) - 32;
-
250
-
251 // If the letter is a space then count it as three pixels.
-
252 if (letter == 0)
-
253 {
-
254 pixelLength += m_spaceSize;
-
255 }
-
256 else
-
257 {
-
258 pixelLength += (m_Font[letter].size + 1);
-
259 }
-
260 }
-
261
-
262 return pixelLength;
-
263}
-
-
-
- -

◆ GetTexture()

- -
-
- - - - - - - -
ID3D11ShaderResourceView * font_class::GetTexture ()
-
- -

Definition at line 173 of file font_class.cpp.

-
174{
-
175 return m_Texture->GetTexture();
-
176}
-
-
-
- -

◆ Initialize()

- -
-
- - - - - - - - - - - - - - - - -
bool font_class::Initialize (ID3D11Device * device,
ID3D11DeviceContext * deviceContext,
int fontChoice )
-
- -

Definition at line 19 of file font_class.cpp.

-
20{
-
21 Logger::Get().Log("Initializing font class", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
22
-
23 char fontFilename[128];
-
24 char fontTextureFilename[128];
-
25 bool result;
-
26
-
27 // Choose one of the available fonts, and default to the first font otherwise.
-
28 switch (fontChoice)
-
29 {
-
30 case 0:
-
31 {
-
32 strcpy_s(fontFilename, "font01.txt");
-
33 strcpy_s(fontTextureFilename, "font01.tga");
-
34 m_fontHeight = 32.0f;
-
35 m_spaceSize = 3;
-
36 break;
-
37 }
-
38 default:
-
39 {
-
40 strcpy_s(fontFilename, "font01.txt");
-
41 strcpy_s(fontTextureFilename, "font01.tga");
-
42 m_fontHeight = 32.0f;
-
43 m_spaceSize = 3;
-
44 break;
-
45 }
-
46 }
-
47
-
48 // Load in the text file containing the font data.
-
49 result = LoadFontData(fontFilename);
-
50 if (!result)
-
51 {
-
52 Logger::Get().Log("Failed to load font data", __FILE__, __LINE__, Logger::LogLevel::Error);
-
53 return false;
-
54 }
-
55
-
56 // Load the texture that has the font characters on it.
-
57 result = LoadTexture(device, deviceContext, fontTextureFilename);
-
58 if (!result)
-
59 {
-
60 Logger::Get().Log("Failed to load font texture", __FILE__, __LINE__, Logger::LogLevel::Error);
-
61 return false;
-
62 }
-
63
-
64 Logger::Get().Log("Font class initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
65
-
66 return true;
-
67}
-
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
-
-
-
- -

◆ Shutdown()

- -
-
- - - - - - - -
void font_class::Shutdown ()
-
- -

Definition at line 69 of file font_class.cpp.

-
70{
-
71 // Release the font texture.
-
72 ReleaseTexture();
-
73
-
74 // Release the font data.
-
75 ReleaseFontData();
-
76
-
77 return;
-
78}
-
-
-
-
The documentation for this class was generated from the following files: -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:c354777a2a22a2ce2a41f37556a00f88f14a07c8a39220ad5401c990199f38d3 +size 33362 diff --git a/doxygen_docs/html/classfont__shader__class-members.html b/doxygen_docs/html/classfont__shader__class-members.html index 40641d7..1055d6f 100644 --- a/doxygen_docs/html/classfont__shader__class-members.html +++ b/doxygen_docs/html/classfont__shader__class-members.html @@ -1,120 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
font_shader_class Member List
-
-
- -

This is the complete list of members for font_shader_class, including all inherited members.

- - - - - - - -
font_shader_class() (defined in font_shader_class)font_shader_class
font_shader_class(const font_shader_class &) (defined in font_shader_class)font_shader_class
initialize(ID3D11Device *, HWND) (defined in font_shader_class)font_shader_class
render(ID3D11DeviceContext *, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView *, XMFLOAT4) (defined in font_shader_class)font_shader_class
shutdown() (defined in font_shader_class)font_shader_class
~font_shader_class() (defined in font_shader_class)font_shader_class
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:6d17af6ccee6196ad489ce34c24529d8c5de02ee7a99b31c144d64ef0ce9be1c +size 6264 diff --git a/doxygen_docs/html/classfont__shader__class.html b/doxygen_docs/html/classfont__shader__class.html index d226519..0c0f333 100644 --- a/doxygen_docs/html/classfont__shader__class.html +++ b/doxygen_docs/html/classfont__shader__class.html @@ -1,356 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: font_shader_class Class Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
- -
font_shader_class Class Reference
-
-
- - - - - - - - - - -

-Public Member Functions

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

Detailed Description

-
-

Definition at line 20 of file font_shader_class.h.

-

Constructor & Destructor Documentation

- -

◆ font_shader_class() [1/2]

- -
-
- - - - - - - -
font_shader_class::font_shader_class ()
-
- -

Definition at line 4 of file font_shader_class.cpp.

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

◆ font_shader_class() [2/2]

- -
-
- - - - - - - -
font_shader_class::font_shader_class (const font_shader_class & other)
-
- -

Definition at line 15 of file font_shader_class.cpp.

-
16{
-
17}
-
-
-
- -

◆ ~font_shader_class()

- -
-
- - - - - - - -
font_shader_class::~font_shader_class ()
-
- -

Definition at line 20 of file font_shader_class.cpp.

-
21{
-
22}
-
-
-
-

Member Function Documentation

- -

◆ initialize()

- -
-
- - - - - - - - - - - -
bool font_shader_class::initialize (ID3D11Device * device,
HWND hwnd )
-
- -

Definition at line 25 of file font_shader_class.cpp.

-
26{
-
27 Logger::Get().Log("Initializing font_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/font.vs");
-
36 if (error != 0)
-
37 {
-
38 Logger::Get().Log("Error copying string", __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/font.ps");
-
44 if (error != 0)
-
45 {
-
46 Logger::Get().Log("Error copying string", __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("Error initializing shader", __FILE__, __LINE__, Logger::LogLevel::Error);
-
55 return false;
-
56 }
-
57
-
58 Logger::Get().Log("font_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 font_shader_class::render (ID3D11DeviceContext * deviceContext,
int indexCount,
XMMATRIX worldMatrix,
XMMATRIX viewMatrix,
XMMATRIX projectionMatrix,
ID3D11ShaderResourceView * texture,
XMFLOAT4 pixelColor )
-
- -

Definition at line 71 of file font_shader_class.cpp.

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

◆ shutdown()

- -
-
- - - - - - - -
void font_shader_class::shutdown ()
-
- -

Definition at line 63 of file font_shader_class.cpp.

-
64{
-
65 // shutdown the vertex and pixel shaders as well as the related objects.
-
66 shutdown_shader();
-
67
-
68 return;
-
69}
-
-
-
-
The documentation for this class was generated from the following files: -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:0a9b64a6b29d65972222e40c1c3e6c8bbb96237bcdf185a9db0f510018bc8b56 +size 23070 diff --git a/doxygen_docs/html/classfps__class-members.html b/doxygen_docs/html/classfps__class-members.html index 87e17ff..18403e5 100644 --- a/doxygen_docs/html/classfps__class-members.html +++ b/doxygen_docs/html/classfps__class-members.html @@ -1,124 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
fps_class Member List
-
-
- -

This is the complete list of members for fps_class, including all inherited members.

- - - - - - - - - - - -
fps_class() (defined in fps_class)fps_class
fps_class(const fps_class &) (defined in fps_class)fps_class
Frame() (defined in fps_class)fps_class
GetFps() (defined in fps_class)fps_class
GetFrameTime() const (defined in fps_class)fps_class
GetMaxFps() const (defined in fps_class)fps_class
GetMinFps() const (defined in fps_class)fps_class
Initialize() (defined in fps_class)fps_class
ResetStats() (defined in fps_class)fps_class
~fps_class() (defined in fps_class)fps_class
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:79ca44d567721155ed0a527f80aa75e545712b3e65585c603b527f07fc3ac650 +size 6913 diff --git a/doxygen_docs/html/classfps__class.html b/doxygen_docs/html/classfps__class.html index 13ae322..929c269 100644 --- a/doxygen_docs/html/classfps__class.html +++ b/doxygen_docs/html/classfps__class.html @@ -1,392 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: fps_class Class Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
- -
fps_class Class Reference
-
-
- - - - - - - - - - - - - - - - - - -

-Public Member Functions

 fps_class (const fps_class &)
 
void Initialize ()
 
void Frame ()
 
int GetFps ()
 
int GetMinFps () const
 
int GetMaxFps () const
 
float GetFrameTime () const
 
void ResetStats ()
 
-

Detailed Description

-
-

Definition at line 20 of file fps_class.h.

-

Constructor & Destructor Documentation

- -

◆ fps_class() [1/2]

- -
-
- - - - - - - -
fps_class::fps_class ()
-
- -

Definition at line 4 of file fps_class.cpp.

-
5{
-
6}
-
-
-
- -

◆ fps_class() [2/2]

- -
-
- - - - - - - -
fps_class::fps_class (const fps_class & other)
-
- -

Definition at line 9 of file fps_class.cpp.

-
10{
-
11}
-
-
-
- -

◆ ~fps_class()

- -
-
- - - - - - - -
fps_class::~fps_class ()
-
- -

Definition at line 14 of file fps_class.cpp.

-
15{
-
16}
-
-
-
-

Member Function Documentation

- -

◆ Frame()

- -
-
- - - - - - - -
void fps_class::Frame ()
-
- -

Definition at line 31 of file fps_class.cpp.

-
32{
-
33
-
34 unsigned int currentTime = timeGetTime();
-
35
-
36 m_frameTime = (currentTime - m_previousTime) * 0.001f;
-
37 m_previousTime = currentTime;
-
38
-
39 m_count++;
-
40
-
41 if (timeGetTime() >= (m_startTime + 1000))
-
42 {
-
43 m_fps = m_count;
-
44
-
45 if (m_fps < m_minFps)
-
46 m_minFps = m_fps;
-
47
-
48 if (m_fps > m_maxFps)
-
49 m_maxFps = m_fps;
-
50
-
51 m_count = 0;
-
52 m_startTime = timeGetTime();
-
53 }
-
54
-
55 return;
-
56}
-
-
-
- -

◆ GetFps()

- -
-
- - - - - - - -
int fps_class::GetFps ()
-
- -

Definition at line 79 of file fps_class.cpp.

-
80{
-
81 return m_fps;
-
82}
-
-
-
- -

◆ GetFrameTime()

- -
-
- - - - - - - -
float fps_class::GetFrameTime () const
-
- -

Definition at line 68 of file fps_class.cpp.

-
69{
-
70 return m_frameTime;
-
71}
-
-
-
- -

◆ GetMaxFps()

- -
-
- - - - - - - -
int fps_class::GetMaxFps () const
-
- -

Definition at line 63 of file fps_class.cpp.

-
64{
-
65 return m_maxFps;
-
66}
-
-
-
- -

◆ GetMinFps()

- -
-
- - - - - - - -
int fps_class::GetMinFps () const
-
- -

Definition at line 58 of file fps_class.cpp.

-
59{
-
60 return m_minFps;
-
61}
-
-
-
- -

◆ Initialize()

- -
-
- - - - - - - -
void fps_class::Initialize ()
-
- -

Definition at line 18 of file fps_class.cpp.

-
19{
-
20 m_fps = 0;
-
21 m_count = 0;
-
22 m_minFps = INT_MAX;
-
23 m_maxFps = 0;
-
24 m_frameTime = 0.0f;
-
25 m_previousTime = timeGetTime();
-
26 m_startTime = m_previousTime;
-
27
-
28 return;
-
29}
-
-
-
- -

◆ ResetStats()

- -
-
- - - - - - - -
void fps_class::ResetStats ()
-
- -

Definition at line 73 of file fps_class.cpp.

-
74{
-
75 m_minFps = INT_MAX;
-
76 m_maxFps = 0;
-
77}
-
-
-
-
The documentation for this class was generated from the following files: -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:9425f988314871246ff7527311fe0cde0d149150188a3780eb3d197e00d84e9b +size 21214 diff --git a/doxygen_docs/html/classfps__limiter-members.html b/doxygen_docs/html/classfps__limiter-members.html index c9c0d27..4dedb7f 100644 --- a/doxygen_docs/html/classfps__limiter-members.html +++ b/doxygen_docs/html/classfps__limiter-members.html @@ -1,116 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
fps_limiter Member List
-
-
- -

This is the complete list of members for fps_limiter, including all inherited members.

- - - -
fps_limiter(const float target_fps=60.0f)fps_limiterinlineexplicit
should_run()fps_limiterinline
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:319e66eb091d507df72ef4c6b9ca64d4b33d1b6b438e85a0fcbceb84823f9063 +size 4974 diff --git a/doxygen_docs/html/classfps__limiter.html b/doxygen_docs/html/classfps__limiter.html index 4c014b2..583bc9d 100644 --- a/doxygen_docs/html/classfps__limiter.html +++ b/doxygen_docs/html/classfps__limiter.html @@ -1,201 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: fps_limiter Class Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
- -
fps_limiter Class Reference
-
-
- - - - - - -

-Public Member Functions

 fps_limiter (const float target_fps=60.0f)
 
bool should_run ()
 
-

Detailed Description

-
-

Definition at line 4 of file fps_limiter.h.

-

Constructor & Destructor Documentation

- -

◆ fps_limiter()

- -
-
- - - - - -
- - - - - - - -
fps_limiter::fps_limiter (const float target_fps = 60.0f)
-
-inlineexplicit
-
-

Builder for fps_limiter class This class is used to limit the execution rate of a loop based on a target frames per second (FPS).

Parameters
- - -
target_fpsTarget frames per second for the limiter. The default is 60.0f FPS.
-
-
- -

Definition at line 12 of file fps_limiter.h.

-
13 : min_delta_(1.0f / target_fps), last_time_(std::chrono::high_resolution_clock::now()) {}
-
-
-
-

Member Function Documentation

- -

◆ should_run()

- -
-
- - - - - -
- - - - - - - -
bool fps_limiter::should_run ()
-
-inline
-
-

Function to check if enough time has passed since the last execution.

Returns
True if the time since the last call is greater than or equal to the minimum delta time, otherwise false.
- -

Definition at line 19 of file fps_limiter.h.

-
19 {
-
20 const auto now = std::chrono::high_resolution_clock::now();
-
21 if (const float elapsed = std::chrono::duration<float>(now - last_time_).count(); elapsed >= min_delta_) {
-
22 last_time_ = now;
-
23 return true;
-
24 }
-
25 return false;
-
26 }
-
-
-
-
The documentation for this class was generated from the following file: -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:5bb7c6909b01e781a7a5027a6b99fb3c0127cf1f4e4a49566ae26a198867012b +size 10037 diff --git a/doxygen_docs/html/classfps__limiter.js b/doxygen_docs/html/classfps__limiter.js index 0cfff73..8968fa8 100644 --- a/doxygen_docs/html/classfps__limiter.js +++ b/doxygen_docs/html/classfps__limiter.js @@ -1,5 +1,3 @@ -var classfps__limiter = -[ - [ "fps_limiter", "classfps__limiter.html#af20845a17030a3c44b0f7e7fc08c016f", null ], - [ "should_run", "classfps__limiter.html#ad0ce9120462473ec9ee26df5f5fb13cf", null ] -]; \ No newline at end of file +version https://git-lfs.github.com/spec/v1 +oid sha256:4340bf615fb978b54478c75b8ba358f7f8e6b84e4513f5252ca26203392d4cf1 +size 204 diff --git a/doxygen_docs/html/classfrustum-members.html b/doxygen_docs/html/classfrustum-members.html index 183ecbb..29abbe8 100644 --- a/doxygen_docs/html/classfrustum-members.html +++ b/doxygen_docs/html/classfrustum-members.html @@ -1,116 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
frustum Member List
-
-
- -

This is the complete list of members for frustum, including all inherited members.

- - - -
CheckCube(float xCenter, float yCenter, float zCenter, float radius, float tolerance)frustum
ConstructFrustum(float screenDepth, XMMATRIX projectionMatrix, XMMATRIX viewMatrix)frustum
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:0ce5ccbf1e5f0c5db84684b1515d298d030125957952fd2ea73d99bea96cd4cd +size 4939 diff --git a/doxygen_docs/html/classfrustum.html b/doxygen_docs/html/classfrustum.html index 98b0a9f..5693650 100644 --- a/doxygen_docs/html/classfrustum.html +++ b/doxygen_docs/html/classfrustum.html @@ -1,297 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: frustum Class Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
- -
frustum Class Reference
-
-
- - - - - - -

-Public Member Functions

void ConstructFrustum (float screenDepth, XMMATRIX projectionMatrix, XMMATRIX viewMatrix)
 
bool CheckCube (float xCenter, float yCenter, float zCenter, float radius, float tolerance)
 
-

Detailed Description

-
-

Definition at line 4 of file frustum.h.

-

Member Function Documentation

- -

◆ CheckCube()

- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - -
bool frustum::CheckCube (float xCenter,
float yCenter,
float zCenter,
float radius,
float tolerance )
-
-

Check if a point is inside the frustum.

Parameters
- - - - -
xX coordinate of the point.
yY coordinate of the point.
zZ coordinate of the point.
-
-
-
Returns
True if the point is inside the frustum, otherwise false.
- -

Definition at line 59 of file frustum.cpp.

-
60{
-
61 // Vérifiez chaque plan du frustum pour voir si le cube est à l'intérieur
-
62 for (int i = 0; i < 6; i++)
-
63 {
-
64 XMVECTOR plane = m_planes[i];
-
65 if (XMVectorGetX(plane) * (xCenter - radius) + XMVectorGetY(plane) * (yCenter - radius) + XMVectorGetZ(plane) * (zCenter - radius) + XMVectorGetW(plane) > -tolerance)
-
66 continue;
-
67 if (XMVectorGetX(plane) * (xCenter + radius) + XMVectorGetY(plane) * (yCenter - radius) + XMVectorGetZ(plane) * (zCenter - radius) + XMVectorGetW(plane) > -tolerance)
-
68 continue;
-
69 if (XMVectorGetX(plane) * (xCenter - radius) + XMVectorGetY(plane) * (yCenter + radius) + XMVectorGetZ(plane) * (zCenter - radius) + XMVectorGetW(plane) > -tolerance)
-
70 continue;
-
71 if (XMVectorGetX(plane) * (xCenter + radius) + XMVectorGetY(plane) * (yCenter + radius) + XMVectorGetZ(plane) * (zCenter - radius) + XMVectorGetW(plane) > -tolerance)
-
72 continue;
-
73 if (XMVectorGetX(plane) * (xCenter - radius) + XMVectorGetY(plane) * (yCenter - radius) + XMVectorGetZ(plane) * (zCenter + radius) + XMVectorGetW(plane) > -tolerance)
-
74 continue;
-
75 if (XMVectorGetX(plane) * (xCenter + radius) + XMVectorGetY(plane) * (yCenter - radius) + XMVectorGetZ(plane) * (zCenter + radius) + XMVectorGetW(plane) > -tolerance)
-
76 continue;
-
77 if (XMVectorGetX(plane) * (xCenter - radius) + XMVectorGetY(plane) * (yCenter + radius) + XMVectorGetZ(plane) * (zCenter + radius) + XMVectorGetW(plane) > -tolerance)
-
78 continue;
-
79 if (XMVectorGetX(plane) * (xCenter + radius) + XMVectorGetY(plane) * (yCenter + radius) + XMVectorGetZ(plane) * (zCenter + radius) + XMVectorGetW(plane) > -tolerance)
-
80 continue;
-
81
-
82 // Si le cube est en dehors de l'un des plans, il n'est pas dans le frustum
-
83 return false;
-
84 }
-
85
-
86 // Si le cube est à l'intérieur de tous les plans, il est dans le frustum
-
87 return true;
-
88}
-
-
-
- -

◆ ConstructFrustum()

- -
-
- - - - - - - - - - - - - - - - -
void frustum::ConstructFrustum (float screenDepth,
XMMATRIX projectionMatrix,
XMMATRIX viewMatrix )
-
-

Create a frustum object.

Parameters
- - - - -
screenDepth
projectionMatrix
viewMatrix
-
-
- -

Definition at line 3 of file frustum.cpp.

-
4{
-
5 XMMATRIX matrix;
-
6 XMVECTOR planes[6];
-
7
-
8 // Calculate the minimum Z distance in the frustum.
-
9 float zMinimum = -projectionMatrix.r[3].m128_f32[2] / projectionMatrix.r[2].m128_f32[2];
-
10 float r = screenDepth / (screenDepth - zMinimum);
-
11 projectionMatrix.r[2].m128_f32[2] = r;
-
12 projectionMatrix.r[3].m128_f32[2] = -r * zMinimum;
-
13
-
14 // Create the frustum matrix from the view matrix and updated projection matrix.
-
15 matrix = XMMatrixMultiply(viewMatrix, projectionMatrix);
-
16
-
17 // Calculate near plane of frustum.
-
18 planes[0] = XMPlaneNormalize(XMVectorSet(matrix.r[0].m128_f32[3] + matrix.r[0].m128_f32[2],
-
19 matrix.r[1].m128_f32[3] + matrix.r[1].m128_f32[2],
-
20 matrix.r[2].m128_f32[3] + matrix.r[2].m128_f32[2],
-
21 matrix.r[3].m128_f32[3] + matrix.r[3].m128_f32[2]));
-
22
-
23 // Calculate far plane of frustum.
-
24 planes[1] = XMPlaneNormalize(XMVectorSet(matrix.r[0].m128_f32[3] - matrix.r[0].m128_f32[2],
-
25 matrix.r[1].m128_f32[3] - matrix.r[1].m128_f32[2],
-
26 matrix.r[2].m128_f32[3] - matrix.r[2].m128_f32[2],
-
27 matrix.r[3].m128_f32[3] - matrix.r[3].m128_f32[2]));
-
28
-
29 // Calculate left plane of frustum.
-
30 planes[2] = XMPlaneNormalize(XMVectorSet(matrix.r[0].m128_f32[3] + matrix.r[0].m128_f32[0],
-
31 matrix.r[1].m128_f32[3] + matrix.r[1].m128_f32[0],
-
32 matrix.r[2].m128_f32[3] + matrix.r[2].m128_f32[0],
-
33 matrix.r[3].m128_f32[3] + matrix.r[3].m128_f32[0]));
-
34
-
35 // Calculate right plane of frustum.
-
36 planes[3] = XMPlaneNormalize(XMVectorSet(matrix.r[0].m128_f32[3] - matrix.r[0].m128_f32[0],
-
37 matrix.r[1].m128_f32[3] - matrix.r[1].m128_f32[0],
-
38 matrix.r[2].m128_f32[3] - matrix.r[2].m128_f32[0],
-
39 matrix.r[3].m128_f32[3] - matrix.r[3].m128_f32[0]));
-
40
-
41 // Calculate top plane of frustum.
-
42 planes[4] = XMPlaneNormalize(XMVectorSet(matrix.r[0].m128_f32[3] - matrix.r[0].m128_f32[1],
-
43 matrix.r[1].m128_f32[3] - matrix.r[1].m128_f32[1],
-
44 matrix.r[2].m128_f32[3] - matrix.r[2].m128_f32[1],
-
45 matrix.r[3].m128_f32[3] - matrix.r[3].m128_f32[1]));
-
46
-
47 // Calculate bottom plane of frustum.
-
48 planes[5] = XMPlaneNormalize(XMVectorSet(matrix.r[0].m128_f32[3] + matrix.r[0].m128_f32[1],
-
49 matrix.r[1].m128_f32[3] + matrix.r[1].m128_f32[1],
-
50 matrix.r[2].m128_f32[3] + matrix.r[2].m128_f32[1],
-
51 matrix.r[3].m128_f32[3] + matrix.r[3].m128_f32[1]));
-
52
-
53 for (int i = 0; i < 6; i++)
-
54 {
-
55 m_planes[i] = planes[i];
-
56 }
-
57}
-
-
-
-
The documentation for this class was generated from the following files: -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:8b1fcb2fdb7ea3da2bfdab2d1f16d38a76bb81c71dfc9d4c26da8dd117b34d03 +size 20270 diff --git a/doxygen_docs/html/classfrustum.js b/doxygen_docs/html/classfrustum.js index d151c84..a0777b0 100644 --- a/doxygen_docs/html/classfrustum.js +++ b/doxygen_docs/html/classfrustum.js @@ -1,5 +1,3 @@ -var classfrustum = -[ - [ "CheckCube", "classfrustum.html#aa631d4d670499da25b2c3720cc15c855", null ], - [ "ConstructFrustum", "classfrustum.html#a17fbc652d86a362739d01c66ab8aa036", null ] -]; \ No newline at end of file +version https://git-lfs.github.com/spec/v1 +oid sha256:a6c72c42d6c26508c6503f5fa97bc8a81c71edfdb3788c9ac3cb44429a531409 +size 193 diff --git a/doxygen_docs/html/classimgui_manager-members.html b/doxygen_docs/html/classimgui_manager-members.html index 0edbcad..fcb2abb 100644 --- a/doxygen_docs/html/classimgui_manager-members.html +++ b/doxygen_docs/html/classimgui_manager-members.html @@ -1,137 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
imguiManager Member List
-
-
- -

This is the complete list of members for imguiManager, including all inherited members.

- - - - - - - - - - - - - - - - - - - - - - - - -
GetWindowSize() constimguiManagerinline
imguiManager()imguiManager
ImGuiWidgetRenderer()imguiManager
Initialize(HWND hwnd, ID3D11Device *device, ID3D11DeviceContext *deviceContext)imguiManager
m_EnableCelShading (defined in imguiManager)imguiManager
NewFrame()imguiManager
Render()imguiManager
SetApp(std::shared_ptr< application_class > app)imguiManagerinline
SetupDockspace()imguiManager
SetWindowSize(ImVec2 size)imguiManagerinline
Shutdown()imguiManager
WidgetAddObject()imguiManager
WidgetButton()imguiManager
WidgetEngineSettingsWindow()imguiManager
WidgetFPS()imguiManager
WidgetLightWindow()imguiManager
WidgetLogWindow()imguiManager
WidgetObjectWindow()imguiManager
WidgetRenderStats()imguiManager
WidgetRenderWindow(ImVec2 availableSize)imguiManager
WidgetSpeedSlider(float *speed)imguiManager
WidgetTerrainWindow()imguiManager
~imguiManager() (defined in imguiManager)imguiManager
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:483ddb9875e3f8c9e8d3ef2769404a66a5e2050baa674e147289dd43b3a7a175 +size 10480 diff --git a/doxygen_docs/html/classimgui_manager.html b/doxygen_docs/html/classimgui_manager.html index 7af47ec..c53415f 100644 --- a/doxygen_docs/html/classimgui_manager.html +++ b/doxygen_docs/html/classimgui_manager.html @@ -1,1812 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: imguiManager Class Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
- -
imguiManager Class Reference
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

-Public Member Functions

 imguiManager ()
 
bool Initialize (HWND hwnd, ID3D11Device *device, ID3D11DeviceContext *deviceContext)
 
void Shutdown ()
 
void Render ()
 
void NewFrame ()
 
void SetupDockspace ()
 
void WidgetSpeedSlider (float *speed)
 
void WidgetButton ()
 
void WidgetFPS ()
 
void WidgetAddObject ()
 
void WidgetObjectWindow ()
 
void WidgetTerrainWindow ()
 
void WidgetLightWindow ()
 
void WidgetEngineSettingsWindow ()
 
void WidgetRenderWindow (ImVec2 availableSize)
 
void WidgetLogWindow ()
 
void WidgetRenderStats ()
 
bool ImGuiWidgetRenderer ()
 
void SetWindowSize (ImVec2 size)
 
ImVec2 GetWindowSize () const
 
void SetApp (std::shared_ptr< application_class > app)
 
- - - -

-Public Attributes

bool m_EnableCelShading
 
-

Detailed Description

-
-

Definition at line 33 of file imguiManager.h.

-

Constructor & Destructor Documentation

- -

◆ imguiManager()

- -
-
- - - - - - - -
imguiManager::imguiManager ()
-
-

Constructor for imguiManager class. Initializes the ImGui manager with default values.

- -

Definition at line 7 of file imguiManager.cpp.

-
8{
-
9 io = nullptr;
-
10 m_frameTimeHistoryIndex = 0;
-
11
-
12 current_fps_ = 0;
-
13 min_fps_ = 0;
-
14 max_fps_ = 0;
-
15 draw_calls_ = 0;
-
16 total_vertex_count_ = 0;
-
17 total_triangle_count_ = 0;
-
18 visible_triangle_count_ = 0;
-
19 current_frame_time_ = 0;
-
20
-
21 showObjectWindow = false;
-
22 showTerrainWindow = false;
-
23 showLightWindow = false;
-
24 showOldSceneWindow = false;
-
25 showEngineSettingsWindow = false;
-
26 showLogWindow = false;
-
27 showStatsWindow = false;
-
28
-
29 // Initialiser l'historique des frametimes à zéro
-
30 for (int i = 0; i < FRAME_HISTORY_COUNT; i++)
-
31 {
-
32 m_frameTimeHistory[i] = 0.0f;
-
33 }
-
34
-
35 widgets_ = {
-
36 {&showObjectWindow, [&](){WidgetObjectWindow();}},
-
37 {&showEngineSettingsWindow, [&](){WidgetEngineSettingsWindow();}},
-
38 {&showTerrainWindow, [&](){WidgetTerrainWindow();}},
-
39 {&showLightWindow, [&](){WidgetLightWindow();}},
-
40 {&showLogWindow, [&](){WidgetLogWindow();}},
-
41 {&showOldSceneWindow, [&](){WidgetRenderWindow(ImVec2(800, 600));}},
-
42 {&showStatsWindow, [&](){WidgetRenderStats();}}
-
43 };
-
44}
-
void WidgetObjectWindow()
-
void WidgetLightWindow()
-
void WidgetEngineSettingsWindow()
-
void WidgetTerrainWindow()
-
void WidgetRenderWindow(ImVec2 availableSize)
-
void WidgetLogWindow()
-
void WidgetRenderStats()
-
-
-
- -

◆ ~imguiManager()

- -
-
- - - - - - - -
imguiManager::~imguiManager ()
-
- -

Definition at line 46 of file imguiManager.cpp.

-
47{
-
48}
-
-
-
-

Member Function Documentation

- -

◆ GetWindowSize()

- -
-
- - - - - -
- - - - - - - -
ImVec2 imguiManager::GetWindowSize () const
-
-inline
-
-

Get the current window size.

Returns
The current window size as an ImVec2.
- -

Definition at line 136 of file imguiManager.h.

-
136{ return windowSize; }
-
-
-
- -

◆ ImGuiWidgetRenderer()

- -
-
- - - - - - - -
bool imguiManager::ImGuiWidgetRenderer ()
-
-

Function to render the ImGui widgets. This function use the struct widget_entry to render the widgets that are registered.

Returns
True if the ImGui widgets were rendered successfully, otherwise false.
- -

Definition at line 744 of file imguiManager.cpp.

-
745{
-
746 // Start the Dear ImGui frame
-
747 NewFrame();
-
748
-
749 // Setup the dockspace
- -
751
-
752 //ImGui Widget
-
753 ImGui::Begin("Khaotic Engine", NULL);
-
754
-
755 float speed = app_->get_speed();
-
756
-
757 WidgetSpeedSlider(&speed);
-
758 app_->set_speed(speed);
-
759 WidgetButton();
- -
761
-
762 ImGui::End();
-
763
-
764 // Read the widget list and call the function if the show variable is true
-
765 for (const auto& entry : widgets_)
-
766 {
-
767 if (*entry.show == true) {entry.func();}
-
768 }
-
769
-
770 //render imgui
-
771 Render();
-
772
-
773 return true;
-
774}
-
void SetupDockspace()
- -
void WidgetAddObject()
- - -
void WidgetSpeedSlider(float *speed)
-
-
-
- -

◆ Initialize()

- -
-
- - - - - - - - - - - - - - - - -
bool imguiManager::Initialize (HWND hwnd,
ID3D11Device * device,
ID3D11DeviceContext * deviceContext )
-
-

Initializes the ImGui manager.

Parameters
- - - - -
hwndHandle to the window where ImGui will be rendered.
devicePointer to the Direct3D 11 device.
deviceContextPointer to the Direct3D 11 device context.
-
-
-
Returns
True if initialization was successful, otherwise false.
- -

Definition at line 50 of file imguiManager.cpp.

-
51{
-
52 Logger::Get().Log("Initializing imgui", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
53
-
54 m_device = device;
-
55 m_deviceContext = deviceContext;
-
56
-
57 IMGUI_CHECKVERSION();
-
58 ImGui::CreateContext();
-
59 io = &ImGui::GetIO();
-
60 io->ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard;
-
61 io->ConfigFlags |= ImGuiConfigFlags_DockingEnable;
-
62 io->FontGlobalScale = 1.0f;
-
63
-
64 ImGui_ImplWin32_Init(hwnd);
-
65 ImGui_ImplDX11_Init(m_device, m_deviceContext);
-
66
-
67 // Appliquer un thème sombre de base
-
68 ImGui::StyleColorsDark();
-
69
-
70 // Définir les couleurs pour une interface de type éditeur sobre
-
71 ImGuiStyle& style = ImGui::GetStyle();
-
72
-
73 // Palette de couleurs sobres inspirée des éditeurs modernes
-
74 ImVec4 background_dark = ImVec4(0.10f, 0.10f, 0.10f, 1.00f); // Fond foncé
-
75 ImVec4 background = ImVec4(0.15f, 0.15f, 0.15f, 1.00f); // Fond principal
-
76 ImVec4 background_light = ImVec4(0.20f, 0.20f, 0.20f, 1.00f); // Fond clair
-
77 ImVec4 accent = ImVec4(0.14f, 0.44f, 0.80f, 0.50f); // Accent bleu
-
78 ImVec4 accent_light = ImVec4(0.14f, 0.44f, 0.80f, 1.00f); // Accent bleu vif
-
79 ImVec4 text = ImVec4(1.0f, 1.0f, 1.0f, 1.00f); // Texte plus blanc
-
80 ImVec4 text_dim = ImVec4(0.70f, 0.70f, 0.70f, 1.00f);
-
81
-
82 // Ajustements de style généraux
-
83 style.WindowPadding = ImVec2(4.0f, 4.0f); // Moins de padding dans les fenêtres
-
84 style.FramePadding = ImVec2(4.0f, 3.0f); // Moins de padding dans les cadres
-
85 style.ItemSpacing = ImVec2(4.0f, 3.0f); // Moins d'espace entre les widgets
-
86 style.ItemInnerSpacing = ImVec2(3.0f, 3.0f); // Moins d'espace interne
-
87 style.DisplayWindowPadding = ImVec2(0.0f, 0.0f); // Pas de padding pour l'affichage
-
88 style.DisplaySafeAreaPadding = ImVec2(0.0f, 0.0f);
-
89 style.TouchExtraPadding = ImVec2(0.0f, 0.0f);
-
90 style.IndentSpacing = 20.0f;
-
91 style.ScrollbarSize = 14.0f;
-
92 style.GrabMinSize = 10.0f;
-
93
-
94 // Arrondis
-
95 style.WindowRounding = 4.0f;
-
96 style.ChildRounding = 4.0f;
-
97 style.FrameRounding = 3.0f;
-
98 style.PopupRounding = 4.0f;
-
99 style.ScrollbarRounding = 9.0f;
-
100 style.GrabRounding = 3.0f;
-
101 style.TabRounding = 4.0f;
-
102
-
103 // Couleurs principales
-
104 style.Colors[ImGuiCol_Text] = text;
-
105 style.Colors[ImGuiCol_TextDisabled] = text_dim;
-
106 style.Colors[ImGuiCol_WindowBg] = background;
-
107 style.Colors[ImGuiCol_ChildBg] = background_dark;
-
108 style.Colors[ImGuiCol_PopupBg] = background_dark;
-
109 style.Colors[ImGuiCol_Border] = ImVec4(0.25f, 0.25f, 0.27f, 1.00f);
-
110 style.Colors[ImGuiCol_BorderShadow] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
-
111
-
112 // Encadrements
-
113 style.Colors[ImGuiCol_FrameBg] = background_light;
-
114 style.Colors[ImGuiCol_FrameBgHovered] = ImVec4(0.25f, 0.25f, 0.25f, 1.00f);
-
115 style.Colors[ImGuiCol_FrameBgActive] = ImVec4(0.30f, 0.30f, 0.30f, 1.00f);
-
116
-
117 // Titres
-
118 style.Colors[ImGuiCol_TitleBg] = background_dark;
-
119 style.Colors[ImGuiCol_TitleBgActive] = accent;
-
120 style.Colors[ImGuiCol_TitleBgCollapsed] = ImVec4(0.12f, 0.12f, 0.12f, 0.90f);
-
121
-
122 // Éléments de menu
-
123 style.Colors[ImGuiCol_MenuBarBg] = background_dark;
-
124 style.Colors[ImGuiCol_ScrollbarBg] = background_dark;
-
125 style.Colors[ImGuiCol_ScrollbarGrab] = ImVec4(0.40f, 0.40f, 0.40f, 1.00f);
-
126 style.Colors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.50f, 0.50f, 0.50f, 1.00f);
-
127 style.Colors[ImGuiCol_ScrollbarGrabActive] = ImVec4(0.60f, 0.60f, 0.60f, 1.00f);
-
128
-
129 // Boutons et interactions
-
130 style.Colors[ImGuiCol_CheckMark] = accent_light;
-
131 style.Colors[ImGuiCol_SliderGrab] = accent;
-
132 style.Colors[ImGuiCol_SliderGrabActive] = accent_light;
-
133 style.Colors[ImGuiCol_Button] = background_light;
-
134 style.Colors[ImGuiCol_ButtonHovered] = ImVec4(0.30f, 0.30f, 0.30f, 1.00f);
-
135 style.Colors[ImGuiCol_ButtonActive] = accent;
-
136
-
137 // En-têtes et onglets
-
138 style.Colors[ImGuiCol_Header] = ImVec4(0.20f, 0.20f, 0.20f, 1.00f);
-
139 style.Colors[ImGuiCol_HeaderHovered] = ImVec4(0.25f, 0.25f, 0.25f, 1.00f);
-
140 style.Colors[ImGuiCol_HeaderActive] = accent;
-
141
-
142 style.Colors[ImGuiCol_Separator] = ImVec4(0.28f, 0.28f, 0.28f, 1.00f);
-
143 style.Colors[ImGuiCol_SeparatorHovered] = ImVec4(0.45f, 0.45f, 0.45f, 1.00f);
-
144 style.Colors[ImGuiCol_SeparatorActive] = accent;
-
145
-
146 style.Colors[ImGuiCol_Tab] = background_dark;
-
147 style.Colors[ImGuiCol_TabHovered] = accent;
-
148 style.Colors[ImGuiCol_TabActive] = accent;
-
149 style.Colors[ImGuiCol_TabUnfocused] = background_dark;
-
150 style.Colors[ImGuiCol_TabUnfocusedActive] = background;
-
151
-
152 // Autres éléments
-
153 style.Colors[ImGuiCol_DockingPreview] = accent;
-
154 style.Colors[ImGuiCol_DockingEmptyBg] = background_light;
-
155
-
156 // Charger une police avec une meilleure netteté
-
157 ImFontConfig fontConfig;
-
158 fontConfig.OversampleH = 2; // Suréchantillonnage horizontal
-
159 fontConfig.OversampleV = 2; // Suréchantillonnage vertical
-
160 fontConfig.PixelSnapH = true; // Alignement sur la grille de pixels
-
161 fontConfig.RasterizerMultiply = 1.2f; // Légère augmentation de l'épaisseur
-
162 io->Fonts->AddFontDefault(&fontConfig);
-
163
-
164 io->Fonts->Build();
-
165
-
166 // OU charger une police personnalisée (décommenter si vous avez la police)
-
167 // io->Fonts->AddFontFromFileTTF("assets/fonts/roboto.ttf", 16.0f, &fontConfig);
-
168
-
169
-
170 unsigned char* pixels;
-
171 int width, height;
-
172 io->Fonts->GetTexDataAsRGBA32(&pixels, &width, &height);
-
173
-
174 // initialize the scene manager
-
175 scene_manager_ = new scene_manager;
-
176 if (!scene_manager_->initialize(app_.get())) {
-
177 Logger::Get().Log("Failed to initialize scene manager", __FILE__, __LINE__, Logger::LogLevel::Error);
-
178 return false;
-
179 }
-
180
-
181 stats_ = app_->get_stats();
-
182
-
183 total_triangle_count_ = stats_->get_triangle_count_ptr();
-
184 total_vertex_count_ = stats_->get_vertex_count_ptr();
-
185
-
186 Logger::Get().Log("imgui initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
187
-
188 return true;
-
189}
-
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
- -
bool initialize(application_class *app)
-
-
-
- -

◆ NewFrame()

- -
-
- - - - - - - -
void imguiManager::NewFrame ()
-
-

Starts a new ImGui frame.

- -

Definition at line 213 of file imguiManager.cpp.

-
214{
-
215 ImGui_ImplDX11_NewFrame();
-
216 ImGui_ImplWin32_NewFrame();
-
217 ImGui::NewFrame();
-
218}
-
-
-
- -

◆ Render()

- -
-
- - - - - - - -
void imguiManager::Render ()
-
-

Renders the ImGui interface.

- -

Definition at line 200 of file imguiManager.cpp.

-
201{
-
202 ImGui::Render();
-
203
-
204 //app->get_direct_3d()->turn_z_buffer_off();
-
205 //app->get_direct_3d()->enable_alpha_blending();
-
206
-
207 ImGui_ImplDX11_RenderDrawData(ImGui::GetDrawData());
-
208
-
209 //app->get_direct_3d()->disable_alpha_blending();
-
210 //app->get_direct_3d()->turn_z_buffer_on();
-
211}
-
-
-
- -

◆ SetApp()

- -
-
- - - - - -
- - - - - - - -
void imguiManager::SetApp (std::shared_ptr< application_class > app)
-
-inline
-
-

Set the application class pointer for the ImGui manager.

Parameters
- - -
app
-
-
- -

Definition at line 142 of file imguiManager.h.

-
142{ app_ = app; }
-
-
-
- -

◆ SetupDockspace()

- -
-
- - - - - - - -
void imguiManager::SetupDockspace ()
-
-

Sets up the ImGui dockspace. This function creates a dockspace for the ImGui interface.

- -

Definition at line 220 of file imguiManager.cpp.

-
220 {
-
221 // Configuration du style pour supprimer l'espace autour des fenêtres dockées
-
222 ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f));
-
223 ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f);
-
224 ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f);
-
225
-
226 // Configuration du style pour les nœuds de dock
-
227 ImGui::PushStyleVar(ImGuiStyleVar_DockingSeparatorSize, 1.0f); // Réduit l'épaisseur des séparateurs
-
228
-
229 // Configuration de la fenêtre principale
-
230 ImGuiWindowFlags window_flags = ImGuiWindowFlags_MenuBar | ImGuiWindowFlags_NoDocking;
-
231 ImGuiViewport* viewport = ImGui::GetMainViewport();
-
232 ImGui::SetNextWindowPos(viewport->Pos);
-
233 ImGui::SetNextWindowSize(viewport->Size);
-
234 ImGui::SetNextWindowViewport(viewport->ID);
-
235 window_flags |= ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove;
-
236 window_flags |= ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_NoNavFocus;
-
237
-
238 ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(0, 0, 0, 0));
-
239
-
240 ImGui::Begin("DockSpace", nullptr, window_flags);
-
241
-
242 // Pop des styles après avoir créé la fenêtre principale
-
243 ImGui::PopStyleVar(4); // 4 car nous avons poussé 4 variables de style
-
244 ImGui::PopStyleColor();
-
245
-
246 // Configuration du DockSpace
-
247 ImGuiID dockspace_id = ImGui::GetID("MainDockSpace");
-
248 ImGuiDockNodeFlags dockspace_flags = ImGuiDockNodeFlags_PassthruCentralNode;
-
249 ImGui::DockSpace(dockspace_id, ImVec2(0.0f, 0.0f), dockspace_flags);
-
250
-
251 if (ImGui::BeginMenuBar()) {
-
252 if (ImGui::BeginMenu("Windows")) {
-
253 ImGui::MenuItem("Object Window", NULL, &showObjectWindow);
-
254 ImGui::MenuItem("Terrain Window", NULL, &showTerrainWindow);
-
255 ImGui::MenuItem("Light Window", NULL, &showLightWindow);
-
256 ImGui::MenuItem("Engine Settings Window", NULL, &showEngineSettingsWindow);
-
257 ImGui::MenuItem("Log Window", NULL, &showLogWindow);
-
258 ImGui::MenuItem("render Stats", NULL, &showStatsWindow);
-
259 ImGui::EndMenu();
-
260 }
-
261
-
262 if (ImGui::BeginMenu("Scene")) {
-
263 if (ImGui::MenuItem("Save Scene")) {
-
264 scene_manager_->save_scene();
-
265 }
-
266 if (ImGui::MenuItem("Save Scene As...")) {
-
267 scene_manager_->save_scene_as();
-
268 }
-
269 if (ImGui::MenuItem("Load Scene")) {
-
270 scene_manager_->load_scene();
-
271 }
-
272 ImGui::EndMenu();
-
273 }
-
274
-
275 ImGui::EndMenuBar();
-
276 }
-
277
-
278 ImGui::End();
-
279}
- - - -
-
-
- -

◆ SetWindowSize()

- -
-
- - - - - -
- - - - - - - -
void imguiManager::SetWindowSize (ImVec2 size)
-
-inline
-
-

set the Old scene window size.

Parameters
- - -
size
-
-
- -

Definition at line 131 of file imguiManager.h.

-
131{ windowSize = size; }
-
-
-
- -

◆ Shutdown()

- -
-
- - - - - - - -
void imguiManager::Shutdown ()
-
-

Shuts down the ImGui manager.

- -

Definition at line 191 of file imguiManager.cpp.

-
192{
-
193 Logger::Get().Log("Shutting down imgui", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
194 ImGui_ImplDX11_Shutdown();
-
195 ImGui_ImplWin32_Shutdown();
-
196 ImGui::DestroyContext();
-
197 Logger::Get().Log("imgui shutdown", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
198}
-
-
-
- -

◆ WidgetAddObject()

- -
-
- - - - - - - -
void imguiManager::WidgetAddObject ()
-
-

Create a widget to add a button wich will add an object to the scene.

- -

Definition at line 296 of file imguiManager.cpp.

-
297{
-
298 if (ImGui::CollapsingHeader("Objects"))
-
299 {
-
300 if (ImGui::Button("Add Cube"))
-
301 {
-
302 app_->add_cube();
-
303 }
-
304 ImGui::SameLine();
-
305 if (ImGui::Button("Import Object"))
-
306 {
-
307 // Open file dialog
-
308 OPENFILENAME ofn;
-
309 WCHAR szFile[260];
-
310 ZeroMemory(&ofn, sizeof(ofn));
-
311 ofn.lStructSize = sizeof(ofn);
-
312 ofn.hwndOwner = NULL;
-
313 ofn.lpstrFile = szFile;
-
314 ofn.lpstrFile[0] = '\0';
-
315 ofn.nMaxFile = sizeof(szFile);
-
316 ofn.lpstrFilter = L"OBJ\0*.obj\0KOBJ\0*.kobj\0TXT\0*.txt";
-
317 ofn.nFilterIndex = 1;
-
318 ofn.lpstrFileTitle = NULL;
-
319 ofn.nMaxFileTitle = 0;
-
320 ofn.lpstrInitialDir = NULL;
-
321 ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
-
322
-
323 if (GetOpenFileName(&ofn))
-
324 {
-
325 std::wstring filepath = ofn.lpstrFile;
-
326
-
327 WCHAR exePath[MAX_PATH];
-
328 GetModuleFileName(NULL,exePath,MAX_PATH);
-
329 std::wstring exeDir = exePath;
-
330 size_t pos = exeDir.find_last_of(L"\\/");
-
331 if(pos != std::wstring::npos)
-
332 {
-
333 exeDir = exeDir.substr(0, pos);
-
334 }
-
335
-
336 std::wstring targetDir = exeDir + L"\\Content\\Assets\\Kobject";
-
337
-
338
-
339 DWORD ftyp = GetFileAttributesW(targetDir.c_str());
-
340 if( ftyp == INVALID_FILE_ATTRIBUTES)
-
341 {
-
342 std::wstring contentDir = exeDir + L"\\Content";
-
343 if (GetFileAttributes(contentDir.c_str()) == INVALID_FILE_ATTRIBUTES)
-
344 {
-
345 CreateDirectory(contentDir.c_str(), NULL);
-
346 }
-
347 std::wstring assetsDir = contentDir + L"\\Assets";
-
348 if (GetFileAttributes(assetsDir.c_str()) == INVALID_FILE_ATTRIBUTES)
-
349 {
-
350 CreateDirectory(assetsDir.c_str(), NULL);
-
351 }
-
352 std::wstring kobjectDir = assetsDir + L"\\Kobject";
-
353 if (GetFileAttributes(kobjectDir.c_str()) == INVALID_FILE_ATTRIBUTES)
-
354 {
-
355 CreateDirectory(kobjectDir.c_str(), NULL);
-
356 }
-
357 }
-
358
-
359 size_t posFile = filepath.find_last_of(L"\\/");
-
360 std::wstring filename = (posFile != std::wstring::npos) ? filepath.substr(posFile + 1) : filepath;
-
361
-
362 std::wstring targetPath = targetDir + L"\\" + filename;
-
363
-
364 if (!CopyFile(filepath.c_str(), targetPath.c_str(), FALSE))
-
365 {
-
366 // En cas d'erreur, vous pouvez gérer ici l'erreur (par exemple afficher un message)
-
367 MessageBox(NULL, L"Erreur lors de la copie du fichier.", L"Erreur", MB_OK);
-
368 }
-
369 else
-
370 {
-
371 // On récupère le chemin relatif par rapport à exeDir
-
372 std::wstring relativePath = targetPath.substr(exeDir.size());
-
373
-
374 // Suppression du premier caractère s'il s'agit d'un antislash
-
375 if (!relativePath.empty() && (relativePath[0] == L'\\' || relativePath[0] == L'/'))
-
376 {
-
377 relativePath.erase(0, 1);
-
378 }
-
379
-
380 // Remplacer les antislashs par des slashs
-
381 std::replace(relativePath.begin(), relativePath.end(), L'\\', L'/');
-
382 app_->add_kobject(relativePath);
-
383 }
-
384
-
385 }
-
386
-
387 }
-
388 ImGui::SameLine();
-
389 ImGui::Text("Number of cubes: %d", app_->get_entity_manager()->GetEntityCount());
-
390 }
-
391}
-
-
-
- -

◆ WidgetButton()

- -
-
- - - - - - - -
void imguiManager::WidgetButton ()
-
-

Creates a button widget.

- -

Definition at line 286 of file imguiManager.cpp.

-
287{
-
288 static int counter = 0;
-
289
-
290 if (ImGui::Button("Button")) // Buttons return true when clicked (most widgets return true when edited/activated)
-
291 counter++;
-
292 ImGui::SameLine();
-
293 ImGui::Text("counter = %d", counter);
-
294}
-
-
-
- -

◆ WidgetEngineSettingsWindow()

- -
-
- - - - - - - -
void imguiManager::WidgetEngineSettingsWindow ()
-
-

Create a window to display the Engine settings.

- -

Definition at line 841 of file imguiManager.cpp.

-
842{
-
843 ImGui::Begin("Engine Settings", &showEngineSettingsWindow);
-
844
-
845 // Begining Of General Setting
-
846 ImGui::Text("General");
-
847
-
848 // Checkbox for toggling vsync globally in the application class by calling the set_vsync function in the application class when the checkbox state changes
-
849 bool vsync = app_->get_vsync();
-
850 if (ImGui::Checkbox("Vsync", &vsync))
-
851 {
-
852 app_->set_vsync(vsync);
-
853 }
-
854
-
855 // End Of General Setting
-
856 ImGui::Separator();
-
857 // culling section
-
858 ImGui::Text("Culling");
-
859
-
860 // float input for frustum tolerance
-
861 float frustumTolerance = app_->get_frustum_tolerance();
-
862 if (ImGui::DragFloat("Frustum Tolerance", &frustumTolerance, 0.1f, 0.0f, 100.0f))
-
863 {
-
864 app_->set_frustum_tolerance(frustumTolerance);
-
865 }
-
866
-
867 // End Of Culling Setting
-
868 ImGui::Separator();
-
869
-
870 // physics section
-
871 ImGui::Text("physics");
-
872
-
873 // Input To set the Fixed Update Interval
-
874 int physicsInterval = app_->get_physics_tick_rate();
-
875 if (ImGui::InputInt("physics Tick Rate", &physicsInterval))
-
876 {
-
877 app_->set_physics_tick_rate(physicsInterval);
-
878 }
-
879
-
880 // Input to change the gravity on same line
-
881 XMVECTOR gravity = app_->get_physics()->GetGravity();
-
882 float gravityValues[3] = { XMVectorGetX(gravity), XMVectorGetY(gravity), XMVectorGetZ(gravity) };
-
883 if (ImGui::DragFloat3("Gravity", gravityValues))
-
884 {
-
885 app_->get_physics()->SetGravity(XMVectorSet(gravityValues[0], gravityValues[1], gravityValues[2], 0.0f));
-
886 }
-
887
-
888 ImGui::End();
-
889}
-
-
-
- -

◆ WidgetFPS()

- -
-
- - - - - - - -
void imguiManager::WidgetFPS ()
-
-

Shows the FPS in a widget.

- -
-
- -

◆ WidgetLightWindow()

- -
-
- - - - - - - -
void imguiManager::WidgetLightWindow ()
-
-

Create a window to display the light settings.

- -

Definition at line 776 of file imguiManager.cpp.

-
777{
-
778 ImGui::Begin("Light", &showLightWindow);
-
779
-
780
-
781 // Sun light settings
-
782 light_class* sunLight = app_->get_sun_light();
-
783 // Direction input
-
784 XMFLOAT3 direction = sunLight->GetDirection();
-
785 float dir[3] = { direction.x, direction.y, direction.z };
-
786 if (ImGui::DragFloat3("Sun Direction", dir))
-
787 {
-
788 sunLight->SetDirection(dir[0], dir[1], dir[2]);
-
789 }
-
790 // Color input
-
791 XMFLOAT4 color = sunLight->GetDiffuseColor();
-
792 float col[3] = { color.x, color.y, color.z };
-
793 if (ImGui::ColorEdit3("Sun Color", col))
-
794 {
-
795 sunLight->SetDiffuseColor(col[0], col[1], col[2], 1.0f);
-
796 }
-
797 // Intensity input
-
798 float intensity = sunLight->GetIntensity();
-
799 if (ImGui::DragFloat("Sun Intensity", &intensity, 0.1f, 0.0f, 100.0f))
-
800 {
-
801 sunLight->SetIntensity(intensity);
-
802 }
-
803
-
804
-
805 ImGui::Separator();
-
806
-
807 int index = 0;
-
808
-
809 // Area light settings
-
810
-
811 for(auto& light : app_->get_lights())
-
812 {
-
813 std::string headerName = "Light " + std::to_string(index);
-
814 if (ImGui::CollapsingHeader(headerName.c_str()))
-
815 {
-
816 XMVECTOR position = app_->get_light_position(index);
-
817 XMVECTOR color = app_->get_light_color(index);
-
818 float pos[3] = { XMVectorGetX(position), XMVectorGetY(position), XMVectorGetZ(position) };
-
819 float col[3] = { XMVectorGetX(color), XMVectorGetY(color), XMVectorGetZ(color) };
-
820
-
821 std::string posLabel = "Position##" + std::to_string(index);
-
822 std::string colLabel = "Color##" + std::to_string(index);
-
823
-
824 if (ImGui::DragFloat3(posLabel.c_str(), pos))
-
825 {
-
826 app_->set_light_position(index, XMVectorSet(pos[0], pos[1], pos[2], 0.0f));
-
827 }
-
828
-
829 if (ImGui::ColorEdit3(colLabel.c_str(), col))
-
830 {
-
831 app_->set_light_color(index, XMVectorSet(col[0], col[1], col[2], 0.0f));
-
832 }
-
833
-
834 }
-
835 index++;
-
836 };
-
837
-
838 ImGui::End();
-
839}
- -
-
-
- -

◆ WidgetLogWindow()

- -
-
- - - - - - - -
void imguiManager::WidgetLogWindow ()
-
-

Create a window to display the log messages from the Logger.

- -

Definition at line 891 of file imguiManager.cpp.

-
892{
-
893 ImGui::Begin("Log Window" , &showLogWindow);
-
894
-
895 // Filtre de recherche
-
896 static ImGuiTextFilter filter;
-
897 filter.Draw("Filter ", 180);
-
898
-
899 ImGui::SameLine();
-
900
-
901 // Bouton pour ouvrir le fichier de log
-
902 if (ImGui::Button("Open Log File"))
-
903 {
-
904 ShellExecuteA(NULL, "open", Logger::Get().m_logFilePath.c_str(), NULL, NULL, SW_SHOWNORMAL);
-
905 }
-
906
-
907 // Place the menu on the same line as the filter
-
908 ImGui::SameLine();
-
909
-
910 // Menu déroulant pour les niveaux de log
-
911 if (ImGui::BeginMenu("Log Levels"))
-
912 {
-
913 for (size_t i = 0; i < Logger::LogLevelCount; ++i)
-
914 {
-
915 bool isVisible = !Logger::Get().m_disabledLogLevels[i];
-
916 if (ImGui::Checkbox(Logger::Get().GetLogLevelInfo(static_cast<Logger::LogLevel>(i)).name, &isVisible))
-
917 {
-
918 Logger::Get().m_disabledLogLevels[i] = !isVisible;
-
919 }
-
920 }
-
921 ImGui::EndMenu();
-
922 }
-
923
-
924 const auto& logBuffer = Logger::Get().GetLogBuffer();
-
925 std::vector<Logger::LogEntry> logfiltered;
-
926 int logCount = logBuffer.size();
-
927
-
928 // Affichage des logs filtrés
-
929 ImGui::BeginChild("Log");
-
930
-
931 for (const auto& log : logBuffer)
-
932 {
-
933 if (filter.PassFilter(log.message.c_str()) && !Logger::Get().m_disabledLogLevels[static_cast<size_t>(log.level)])
-
934 {
-
935 logfiltered.push_back(log);
-
936 }
-
937 }
-
938
-
939 if (logfiltered.size() == 0)
-
940 {
-
941 ImGui::Text("No logs to display.");
-
942 }
-
943 else
-
944 {
-
945 ImGuiListClipper clipper;
-
946 clipper.Begin(logCount);
-
947 while (clipper.Step())
-
948 {
-
949 for (int i = clipper.DisplayStart; i < clipper.DisplayEnd; i++)
-
950 {
-
951 if (i < logfiltered.size()) {
-
952 const auto& log = logfiltered[i];
-
953 ImGui::TextColored(Logger::Get().GetLogLevelInfo(log.level).color, log.message.c_str());
-
954 }
-
955
-
956 }
-
957 }
-
958 clipper.End();
-
959 }
-
960
-
961 // Scroll to the bottom
-
962 if (ImGui::GetScrollY() >= ImGui::GetScrollMaxY())
-
963 {
-
964 ImGui::SetScrollHereY(1.0f);
-
965 }
-
966
-
967 ImGui::EndChild();
-
968
-
969 ImGui::End();
-
970}
-
const std::deque< LogEntry > & GetLogBuffer() const
Definition Logger.h:220
-
LogLevel
Definition Logger.h:38
-
-
-
- -

◆ WidgetObjectWindow()

- -
-
- - - - - - - -
void imguiManager::WidgetObjectWindow ()
-
-

create a window to display the object list and their properties.

- -

Definition at line 393 of file imguiManager.cpp.

-
394{
-
395 ImGui::Begin("Objects", &showObjectWindow);
-
396
-
397 // Obtenir toutes les entités avec un composant d'identité et de transformation
-
398 auto entities = app_->get_entity_manager()->GetEntitiesWithComponent<ecs::IdentityComponent>();
-
399
-
400 int index = 0;
-
401 for (auto& entity : entities)
-
402 {
-
403 auto identity = entity->GetComponent<ecs::IdentityComponent>();
-
404 auto transform = entity->GetComponent<ecs::TransformComponent>();
-
405 auto render = entity->GetComponent<ecs::RenderComponent>();
-
406 auto shader = entity->GetComponent<ecs::ShaderComponent>();
-
407 auto physics = entity->GetComponent<ecs::PhysicsComponent>();
-
408
-
409 if (identity && transform)
-
410 {
-
411 std::string headerName = identity->GetName() + " " + std::to_string(identity->GetId());
-
412 if (ImGui::CollapsingHeader(headerName.c_str()))
-
413 {
-
414 // Position, Rotation, Scale
-
415 XMVECTOR position = transform->GetPosition();
-
416 XMVECTOR rotation = transform->GetRotation();
-
417 XMVECTOR scale = transform->GetScale();
-
418
-
419 float pos[3] = { XMVectorGetX(position), XMVectorGetY(position), XMVectorGetZ(position) };
-
420 std::string posLabel = "Position##" + std::to_string(identity->GetId());
-
421 if (ImGui::DragFloat3(posLabel.c_str(), pos))
-
422 {
-
423 transform->SetPosition(XMVectorSet(pos[0], pos[1], pos[2], 0.0f));
-
424 transform->UpdateWorldMatrix();
-
425 }
-
426
-
427 float rot[3] = { XMVectorGetX(rotation), XMVectorGetY(rotation), XMVectorGetZ(rotation) };
-
428 std::string rotLabel = "Rotation##" + std::to_string(identity->GetId());
-
429 if (ImGui::DragFloat3(rotLabel.c_str(), rot))
-
430 {
-
431 transform->SetRotation(XMVectorSet(rot[0], rot[1], rot[2], 0.0f));
-
432 transform->UpdateWorldMatrix();
-
433 }
-
434
-
435 float scl[3] = { XMVectorGetX(scale), XMVectorGetY(scale), XMVectorGetZ(scale) };
-
436 std::string sclLabel = "Scale##" + std::to_string(identity->GetId());
-
437 if (ImGui::DragFloat3(sclLabel.c_str(), scl))
-
438 {
-
439 transform->SetScale(XMVectorSet(scl[0], scl[1], scl[2], 0.0f));
-
440 transform->UpdateWorldMatrix();
-
441 }
-
442
-
443 ImGui::Separator();
-
444
-
445 // Textures - Seulement si le composant de rendu existe
-
446 if (render && render->GetModel())
-
447 {
-
448 // Définir les types de textures_
-
449 std::vector<std::string> textureCategories = {
-
450 "Diffuse", "Normal", "Specular", "Alpha"
-
451 };
-
452
-
453 std::vector<TextureType> textureTypes = {
-
454 TextureType::Diffuse, TextureType::Normal,
-
455 TextureType::Specular, TextureType::Alpha
-
456 };
-
457
-
458 // Créer un espace pour afficher les textures_ avec défilement
-
459 std::string textureChildId = "TextureChild##" + std::to_string(identity->GetId());
-
460 ImGui::BeginChild(textureChildId.c_str(), ImVec2(0, 200), true, ImGuiWindowFlags_HorizontalScrollbar);
-
461
-
462 // Pour chaque type de texture
-
463 for (int typeIndex = 0; typeIndex < textureCategories.size(); typeIndex++)
-
464 {
-
465 TextureType type = textureTypes[typeIndex];
-
466 std::string typeName = textureCategories[typeIndex];
-
467
-
468 // Afficher le titre de la catégorie
-
469 std::string categoryLabel = typeName + "##" + std::to_string(identity->GetId());
-
470 ImGui::Text("%s:", typeName.c_str());
-
471 ImGui::SameLine();
-
472
-
473 // Compter combien de textures_ de ce type existent
-
474 int textureCount = 0;
-
475 while (render->GetModel()->GetTexture(type, textureCount) != nullptr)
-
476 {
-
477 textureCount++;
-
478 }
-
479
-
480 // Afficher toutes les textures_ existantes
-
481 std::string groupId = "TextureGroup_" + std::to_string(identity->GetId()) + "_" + std::to_string(typeIndex);
-
482 ImGui::BeginGroup();
-
483 for (int texIndex = 0; texIndex < textureCount; texIndex++)
-
484 {
-
485 ID3D11ShaderResourceView* texture = render->GetModel()->GetTexture(type, texIndex);
-
486 if (texture)
-
487 {
-
488 // ID unique pour chaque bouton de texture
-
489 std::string buttonId = "tex##" + std::to_string(identity->GetId()) + "_" +
-
490 std::to_string(typeIndex) + "_" +
-
491 std::to_string(texIndex);
-
492
-
493 if (ImGui::ImageButton(buttonId.c_str(), (ImTextureID)texture, ImVec2(48, 48)))
-
494 {
-
495 // Ouvrir une boîte de dialogue pour changer la texture
-
496 OPENFILENAME ofn;
-
497 WCHAR szFile[260] = {0};
-
498 ZeroMemory(&ofn, sizeof(ofn));
-
499 ofn.lStructSize = sizeof(ofn);
-
500 ofn.hwndOwner = NULL;
-
501 ofn.lpstrFile = szFile;
-
502 ofn.nMaxFile = sizeof(szFile);
-
503 ofn.lpstrFilter = L"Texture\0*.png;*.jpg;*.dds\0";
-
504 ofn.nFilterIndex = 1;
-
505 ofn.lpstrInitialDir = NULL;
-
506 ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
-
507
-
508 if (GetOpenFileName(&ofn))
-
509 {
-
510 // Changer la texture existante
-
511 render->GetModel()->ChangeTexture(m_device, m_deviceContext, ofn.lpstrFile, type, texIndex);
-
512 }
-
513 }
-
514
-
515 // Afficher l'indice de texture et prévisualisation au survol
-
516 if (ImGui::IsItemHovered())
-
517 {
-
518 ImGui::BeginTooltip();
-
519 ImGui::Text("%s %d", typeName.c_str(), texIndex);
-
520 ImGui::Image((ImTextureID)texture, ImVec2(192, 192));
-
521 ImGui::EndTooltip();
-
522 }
-
523
-
524 ImGui::SameLine();
-
525 }
-
526 }
-
527
-
528 // Bouton pour ajouter une nouvelle texture
-
529 std::string addButtonLabel = "+##" + std::to_string(identity->GetId()) + "_" + std::to_string(typeIndex);
-
530 if (ImGui::Button(addButtonLabel.c_str(), ImVec2(48, 48)))
-
531 {
-
532 // Ouvrir une boîte de dialogue pour ajouter une texture
-
533 OPENFILENAME ofn;
-
534 WCHAR szFile[260] = {0};
-
535 ZeroMemory(&ofn, sizeof(ofn));
-
536 ofn.lStructSize = sizeof(ofn);
-
537 ofn.hwndOwner = NULL;
-
538 ofn.lpstrFile = szFile;
-
539 ofn.nMaxFile = sizeof(szFile);
-
540 ofn.lpstrFilter = L"Texture\0*.png;*.jpg;*.dds\0";
-
541 ofn.nFilterIndex = 1;
-
542 ofn.lpstrInitialDir = NULL;
-
543 ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
-
544
-
545 if (GetOpenFileName(&ofn))
-
546 {
-
547 // Ajouter une nouvelle texture
-
548 render->GetModel()->AddTexture(m_device, m_deviceContext, ofn.lpstrFile, type);
-
549 }
-
550 }
-
551
-
552 ImGui::EndGroup();
-
553 ImGui::Separator();
-
554 }
-
555
-
556 ImGui::EndChild();
-
557 }
-
558
-
559 ImGui::Separator();
-
560
-
561 // Delete button
-
562 std::string deleteLabel = "Delete##" + std::to_string(identity->GetId());
-
563 if (ImGui::Button(deleteLabel.c_str()))
-
564 {
-
565 app_->delete_entity_by_id(identity->GetId());
-
566 // Sortir du boucle après suppression pour éviter des accès invalides
-
567 break;
-
568 }
-
569
-
570 ImGui::Separator();
-
571
-
572 // Shader options
-
573 if (shader)
-
574 {
-
575 // Liste des options de shader
-
576 const char* shaderOptions[] = {
-
577 "Enable Global Lighting",
-
578 "Enable Lighting",
-
579 "Enable Cel Shading",
-
580 "Enable Normal Mapping",
-
581 "Enable Specular Mapping",
-
582 "Enable Alpha Mapping"
-
583 };
-
584
-
585 std::vector<ecs::ShaderType> shaderTypes = {
-
586 ecs::ShaderType::SUNLIGHT,
-
587 ecs::ShaderType::LIGHTING,
-
588 ecs::ShaderType::CEL_SHADING,
-
589 ecs::ShaderType::NORMAL_MAPPING,
-
590 ecs::ShaderType::SPECULAR_MAPPING,
-
591 ecs::ShaderType::ALPHA_MAPPING
-
592 };
-
593
-
594 // Trouver l'index actuel du shader pour cette entité spécifique
-
595 int currentShader = 0;
-
596 ecs::ShaderType activeShader = shader->GetActiveShader();
-
597 for (size_t i = 0; i < shaderTypes.size(); i++)
-
598 {
-
599 if (shaderTypes[i] == activeShader)
-
600 {
-
601 currentShader = static_cast<int>(i);
-
602 break;
-
603 }
-
604 }
-
605
-
606 // Création du menu déroulant avec un ID unique pour chaque entité
-
607 std::string shaderComboId = "Shader Options##" + std::to_string(identity->GetId());
-
608 if (ImGui::BeginCombo(shaderComboId.c_str(), shaderOptions[currentShader]))
-
609 {
-
610 for (int i = 0; i < IM_ARRAYSIZE(shaderOptions); i++)
-
611 {
-
612 // Crée une option sélectionnable pour chaque shader avec ID unique
-
613 std::string shaderSelectableId = std::to_string(i) + "##shader_" + std::to_string(identity->GetId());
-
614 bool isSelected = (currentShader == i);
-
615 if (ImGui::Selectable(shaderOptions[i], isSelected))
-
616 {
-
617 // Met à jour l'option sélectionnée uniquement pour cette entité
-
618 currentShader = i;
-
619 shader->SetActiveShader(shaderTypes[i]);
-
620 }
-
621
-
622 // Si l'option sélectionnée est active, nous mettons en surbrillance
-
623 if (isSelected)
-
624 ImGui::SetItemDefaultFocus();
-
625 }
-
626 ImGui::EndCombo();
-
627 }
-
628 }
-
629
-
630 ImGui::Separator();
-
631
-
632 // Physics
-
633 bool isPhysicsEnabled = (physics != nullptr);
-
634 std::string physicsLabel = "Physics##" + std::to_string(identity->GetId());
-
635
-
636 if (ImGui::Checkbox(physicsLabel.c_str(), &isPhysicsEnabled))
-
637 {
-
638 if (isPhysicsEnabled && !physics)
-
639 {
-
640 // Ajouter un composant de physique
-
641 physics = entity->AddComponent<ecs::PhysicsComponent>();
-
642 physics->Initialize();
-
643 }
-
644 else if (!isPhysicsEnabled && physics)
-
645 {
-
646 // Retirer le composant de physique
-
647 entity->RemoveComponent<ecs::PhysicsComponent>();
-
648 physics = nullptr;
-
649 }
-
650 }
-
651
-
652 if (physics)
-
653 {
-
654 // Gravity Enabled checkbox
-
655 bool gravityEnabled = physics->IsGravityEnabled();
-
656 std::string gravityLabel = "Gravity##" + std::to_string(identity->GetId());
-
657 if (ImGui::Checkbox(gravityLabel.c_str(), &gravityEnabled))
-
658 {
-
659 physics->SetGravityEnabled(gravityEnabled);
-
660 }
-
661
-
662 // 3 radio buttons pour le type d'objet physique avec IDs uniques
-
663 std::string typeLabel = "Type##" + std::to_string(identity->GetId());
-
664 ecs::ObjectType type = identity->GetType();
-
665
-
666 if (ImGui::RadioButton(("None##" + std::to_string(identity->GetId())).c_str(),
-
667 type == ecs::ObjectType::Unknown))
-
668 {
-
669 identity->SetType(ecs::ObjectType::Unknown);
-
670 }
-
671 ImGui::SameLine();
-
672 if (ImGui::RadioButton(("Cube##" + std::to_string(identity->GetId())).c_str(),
-
673 type == ecs::ObjectType::Cube))
-
674 {
-
675 identity->SetType(ecs::ObjectType::Cube);
-
676 }
-
677 ImGui::SameLine();
-
678 if (ImGui::RadioButton(("Sphere##" + std::to_string(identity->GetId())).c_str(),
-
679 type == ecs::ObjectType::Sphere))
-
680 {
-
681 identity->SetType(ecs::ObjectType::Sphere);
-
682 }
-
683 ImGui::SameLine();
-
684 if (ImGui::RadioButton(("Terrain##" + std::to_string(identity->GetId())).c_str(),
-
685 type == ecs::ObjectType::Terrain))
-
686 {
-
687 identity->SetType(ecs::ObjectType::Terrain);
-
688 }
-
689
-
690 }
-
691
-
692 ImGui::Separator();
-
693 }
-
694 index++;
-
695 }
-
696 }
-
697
-
698 ImGui::End();
-
699}
- - - - - - - - -
-
-
- -

◆ WidgetRenderStats()

- -
-
- - - - - - - -
void imguiManager::WidgetRenderStats ()
-
-

Create a window to display the stats of the engine. This includes FPS, draw calls, triangle count, etc. As well as the GPU, CPU information and RAM information.

- -

Definition at line 1018 of file imguiManager.cpp.

-
1019{
-
1020 ImGui::Begin("render Stats");
-
1021
-
1022 current_fps_ = stats_->get_current_fps();
-
1023 min_fps_ = stats_->get_min_fps();
-
1024 max_fps_ = stats_->get_max_fps();
-
1025 draw_calls_ = stats_->get_draw_calls();
-
1026
-
1027
-
1028 // total_vertex_count_ = stats_->get_total_vertex_count();
-
1029 // total_triangle_count_ = stats_->get_total_triangle_count();
-
1030
-
1031 visible_triangle_count_ = stats_->get_visible_triangle_count();
-
1032 current_frame_time_ = stats_->get_frame_time();
-
1033
-
1034 m_frameTimeHistory[m_frameTimeHistoryIndex] = current_frame_time_;
-
1035 m_frameTimeHistoryIndex = (m_frameTimeHistoryIndex + 1) % FRAME_HISTORY_COUNT;
-
1036
-
1037 ImGui::Text("FPS: %d", current_fps_);
-
1038 ImGui::SameLine();
-
1039 ImGui::Text("Min Fps: %d", min_fps_);
-
1040 ImGui::SameLine();
-
1041 ImGui::Text("Max Fps: %d", max_fps_);
-
1042
-
1043 ImGui::Separator();
-
1044
-
1045 // Trouver les valeurs min/max pour l'échelle du graphique
-
1046 float frameTimeMin = FLT_MAX;
-
1047 float frameTimeMax = 0.0f;
-
1048 for (int i = 0; i < FRAME_HISTORY_COUNT; i++) {
-
1049 if (m_frameTimeHistory[i] > 0.0f) {
-
1050 frameTimeMin = min(frameTimeMin, m_frameTimeHistory[i]);
-
1051 frameTimeMax = max(frameTimeMax, m_frameTimeHistory[i]);
-
1052 }
-
1053 }
-
1054 // S'assurer d'avoir au moins une petite plage
-
1055 if (frameTimeMax == 0.0f) frameTimeMax = 0.033f; // ~30 FPS
-
1056 if (frameTimeMin == FLT_MAX) frameTimeMin = 0.0f;
-
1057
-
1058 // Ajouter 10% de marge pour la lisibilité
-
1059 float margin = (frameTimeMax - frameTimeMin) * 0.1f;
-
1060 frameTimeMin = max(0.0f, frameTimeMin - margin);
-
1061 frameTimeMax += margin;
-
1062
-
1063 // Afficher le graphique
-
1064 ImGui::Text("Frame Time: %.3f ms", current_frame_time_ * 1000.0f);
-
1065 ImGui::PlotLines("FrameTimeGraph", // Au lieu de chaîne vide ""
-
1066 m_frameTimeHistory,
-
1067 FRAME_HISTORY_COUNT,
-
1068 m_frameTimeHistoryIndex,
-
1069 "",
-
1070 frameTimeMin,
-
1071 frameTimeMax,
-
1072 ImVec2(0, 80));
-
1073
-
1074 ImGui::Text("Draw Calls: %d", draw_calls_);
-
1075
-
1076 ImGui::Separator();
-
1077
-
1078 ImGui::Text("Statistiques de rendu:");
-
1079 ImGui::Text("Vertices total: %d", *total_vertex_count_);
-
1080
-
1081 ImGui::Text("Triangles total: %d", *total_triangle_count_);
-
1082 ImGui::SameLine();
-
1083 ImGui::Text("Triangles visibles: %d", visible_triangle_count_);
-
1084
-
1085 app_->get_direct_3d()->get_video_card_info(card_name_, video_memory_);
-
1086 cpu_name_ = stats_->get_cpu_name();
-
1087 version_driver_ = stats_->get_gpu_driver_version(app_->get_direct_3d()->get_device());
-
1088
-
1089 ImGui::Columns(3, "GPUCPURAMColumns", false);
-
1090 ImGui::SetColumnWidth(0, ImGui::GetWindowWidth() * 0.33f);
-
1091 ImGui::SetColumnWidth(1, ImGui::GetWindowWidth() * 0.33f);
-
1092
-
1093 // Premier collapsing header pour les informations GPU
-
1094 if (ImGui::CollapsingHeader("Informations GPU"))
-
1095 {
-
1096 ImGui::Text("Carte graphique: %s", card_name_);
-
1097 ImGui::Text("Memoire video: %d Mo", video_memory_);
-
1098 ImGui::Text("Pilote: %s", version_driver_.c_str());
-
1099 }
-
1100
-
1101 ImGui::NextColumn();
-
1102
-
1103 // Second collapsing header pour les informations CPU
-
1104 if (ImGui::CollapsingHeader("Informations CPU"))
-
1105 {
-
1106 SYSTEM_INFO sysInfo;
-
1107 GetSystemInfo(&sysInfo);
-
1108 ImGui::Text("Processeur: %s", cpu_name_.c_str());
-
1109 ImGui::Text("Nombre de coeurs: %u", sysInfo.dwNumberOfProcessors);
-
1110 ImGui::Text("Architecture: %s", (sysInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) ? "x64" : "x86");
-
1111 ImGui::Text("Taille de la page: %u octets", sysInfo.dwPageSize);
-
1112 ImGui::Text("Taille du cache: %u octets", sysInfo.dwAllocationGranularity);
-
1113 ImGui::Text("Type de processeur: %u", sysInfo.wProcessorLevel);
-
1114 ImGui::Text("Version du processeur: %u", sysInfo.wProcessorRevision);
-
1115 }
-
1116
-
1117 ImGui::NextColumn();
-
1118
-
1119 if (ImGui::CollapsingHeader("Informations RAM"))
-
1120 {
-
1121 MEMORYSTATUSEX mem_info;
-
1122 mem_info.dwLength = sizeof(MEMORYSTATUSEX);
-
1123 GlobalMemoryStatusEx(&mem_info);
-
1124 ImGui::Text("Memoire totale: %llu Mo", mem_info.ullTotalPhys / (1024 * 1024));
-
1125 ImGui::Text("Memoire disponible: %llu Mo", mem_info.ullAvailPhys / (1024 * 1024));
-
1126 ImGui::Text("Memoire utilisee: %llu Mo", (mem_info.ullTotalPhys - mem_info.ullAvailPhys) / (1024 * 1024));
-
1127 }
-
1128
-
1129 ImGui::Columns(1);
-
1130
-
1131 ImGui::End();
-
1132}
-
-
-
- -

◆ WidgetRenderWindow()

- -
-
- - - - - - - -
void imguiManager::WidgetRenderWindow (ImVec2 availableSize)
-
-

Create a window to display the scene. This window isn't used anymore.

- -

Definition at line 972 of file imguiManager.cpp.

-
973{
-
974 ImGui::Begin("render Window");
-
975
-
976 ImVec2 oldWindowSize = windowSize;
-
977 windowSize = ImGui::GetContentRegionAvail();
-
978
-
979 // Si la taille de la fenêtre a changé, ajustez la taille de la fenêtre de l'application
-
980 if (oldWindowSize.x != windowSize.x || oldWindowSize.y != windowSize.y)
-
981 {
-
982 app_->set_window_size(windowSize);
-
983 }
-
984
-
985
-
986 // Get the aspect ratio of the scene in app
-
987 float aspectRatio = app_->get_aspect_ratio();
-
988 // calculate the size of the window
-
989 if (windowSize.x / windowSize.y > aspectRatio)
-
990 {
-
991 windowSize.x = windowSize.y * aspectRatio;
-
992 }
-
993 else
-
994 {
-
995 windowSize.y = windowSize.x / aspectRatio;
-
996 }
-
997
-
998 ID3D11ShaderResourceView* texture = app_->get_scene_texture()->GetShaderResourceView();
-
999 if (texture)
-
1000 {
-
1001
-
1002 // Affichez la scenne projeté sur texture dans une fenêtre ImGui
-
1003 // alpha blend is not enable to render the texture
-
1004
-
1005 app_->get_direct_3d()->turn_z_buffer_off();
-
1006 app_->get_direct_3d()->enable_alpha_blending();
-
1007
-
1008 ImGui::Image((ImTextureID)texture, windowSize, ImVec2(0, 0), ImVec2(1, 1), ImVec4(1, 1, 1, 1));
-
1009 }
-
1010 else
-
1011 {
-
1012 ImGui::Text("render texture is not available.");
-
1013 }
-
1014
-
1015 ImGui::End();
-
1016}
-
-
-
- -

◆ WidgetSpeedSlider()

- -
-
- - - - - - - -
void imguiManager::WidgetSpeedSlider (float * speed)
-
-

Creates a slider widget to control the speed of the demo spinning cube.

Parameters
- - -
speed
-
-
- -

Definition at line 281 of file imguiManager.cpp.

-
282{
-
283 ImGui::SliderFloat("Speed", speed, 0.0f, 100.0f);
-
284}
-
-
-
- -

◆ WidgetTerrainWindow()

- -
-
- - - - - - - -
void imguiManager::WidgetTerrainWindow ()
-
-

Create a window to display the terrain generation options.

- -

Definition at line 701 of file imguiManager.cpp.

-
702{
-
703 ImGui::Begin("Terrain", &showTerrainWindow);
-
704
-
705 ImGui::Text("Number of terrain cubes: %d", app_->get_terrain_entity_count());
-
706
-
707 ImGui::Separator();
-
708
-
709 if (ImGui::Button("Generate Flat Terrain"))
-
710 {
-
711 app_->generate_terrain();
-
712 }
-
713
-
714 ImGui::Separator();
-
715
-
716 // Input for the number of cubes on each side
-
717 ImGui::Text("Number of cubes on each side: ");
-
718 ImGui::SameLine();
-
719 ImGui::InputInt("##SideCount", &m_SideCount);
-
720 if (m_SideCount < 1)
-
721 {
-
722 m_SideCount = 1;
-
723 }
-
724
-
725 ImGui::Separator();
-
726
-
727 if (ImGui::Button("Generate BigCube Terrain"))
-
728 {
-
729 app_->create_big_cube(m_SideCount);
-
730 }
-
731
-
732 ImGui::Separator();
-
733
-
734 if (ImGui::Button("Delete All Terrain Cubes"))
-
735 {
-
736 app_->delete_terrain();
-
737 }
-
738
-
739
-
740
-
741 ImGui::End();
-
742}
-
-
-
-

Member Data Documentation

- -

◆ m_EnableCelShading

- -
-
- - - - -
bool imguiManager::m_EnableCelShading
-
- -

Definition at line 146 of file imguiManager.h.

- -
-
-
The documentation for this class was generated from the following files: -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:66c70fb2ee1c1c2ec9b58cd06390b1343f88400fc8ea6338b241ce5ef5bc8c6a +size 173990 diff --git a/doxygen_docs/html/classimgui_manager.js b/doxygen_docs/html/classimgui_manager.js index fbd2b6c..ea1780a 100644 --- a/doxygen_docs/html/classimgui_manager.js +++ b/doxygen_docs/html/classimgui_manager.js @@ -1,24 +1,3 @@ -var classimgui_manager = -[ - [ "imguiManager", "classimgui_manager.html#ab323084ef02c7df421977b9342edfd5f", null ], - [ "GetWindowSize", "classimgui_manager.html#a8422f5e3790983a2c878d61968c6a657", null ], - [ "ImGuiWidgetRenderer", "classimgui_manager.html#ad5b5109acef17047334dba7e7aebf3aa", null ], - [ "Initialize", "classimgui_manager.html#a282c73b89df97bffb545dfa618f354ef", null ], - [ "NewFrame", "classimgui_manager.html#ae3d0eda2efd0dadc1aab2384083c941c", null ], - [ "Render", "classimgui_manager.html#aec282a32a74a9153697b66e47d683b3d", null ], - [ "SetApp", "classimgui_manager.html#a958907b5ec5b0a928a98198af01a4c46", null ], - [ "SetupDockspace", "classimgui_manager.html#a1496a85b51414a2d6fdbfa6bd53414ea", null ], - [ "SetWindowSize", "classimgui_manager.html#a7342adf62f12e139de6fbe6399ff7129", null ], - [ "Shutdown", "classimgui_manager.html#af6a2337e560cfd2fa52605f52e4e2d25", null ], - [ "WidgetAddObject", "classimgui_manager.html#a59142ebf31199eabc0e95fb4e03f0dcc", null ], - [ "WidgetButton", "classimgui_manager.html#a50050d9440111762dcaac05555994175", null ], - [ "WidgetEngineSettingsWindow", "classimgui_manager.html#a343ac602d7ef491b66bdb0d22b4cca54", null ], - [ "WidgetFPS", "classimgui_manager.html#aa3b3c6844e2616b5a4b230d0f223cb74", null ], - [ "WidgetLightWindow", "classimgui_manager.html#a16bf45ab2eca6c63053b9ce52d84a245", null ], - [ "WidgetLogWindow", "classimgui_manager.html#acc1037d25c4c832d469867cfda2ece8d", null ], - [ "WidgetObjectWindow", "classimgui_manager.html#a0933378a4a5bea9a7f0eefc9631ac369", null ], - [ "WidgetRenderStats", "classimgui_manager.html#aef824217cf1d2248b63eba6f577dbed6", null ], - [ "WidgetRenderWindow", "classimgui_manager.html#ab8dfce7344b08009a6e4343f66418cbf", null ], - [ "WidgetSpeedSlider", "classimgui_manager.html#af69a453ffe53d8db207fd7d4d76f20ab", null ], - [ "WidgetTerrainWindow", "classimgui_manager.html#ab5bc0ab6cfd9369bdadb72d589716e0d", null ] -]; \ No newline at end of file +version https://git-lfs.github.com/spec/v1 +oid sha256:48e89e955562b8bfa4154b7aa8865dba1a581a74308f403dc11167f3c74a86b1 +size 1979 diff --git a/doxygen_docs/html/classinput__class-members.html b/doxygen_docs/html/classinput__class-members.html index 884a4db..e2fef6c 100644 --- a/doxygen_docs/html/classinput__class-members.html +++ b/doxygen_docs/html/classinput__class-members.html @@ -1,140 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
input_class Member List
-
-
- -

This is the complete list of members for input_class, including all inherited members.

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Frame() (defined in input_class)input_classvirtual
GetMouseLocation(int &, int &) const (defined in input_class)input_class
Initialize(HINSTANCE, HWND, int, int) (defined in input_class)input_classvirtual
input_class() (defined in input_class)input_class
input_class(const input_class &) (defined in input_class)input_class
is_key_pressed(const unsigned int) (defined in input_class)input_class
IsAPressed() const (defined in input_class)input_class
IsDownArrowPressed() const (defined in input_class)input_class
IsDPressed() const (defined in input_class)input_class
IsEPressed() const (defined in input_class)input_class
IsEscapePressed() const (defined in input_class)input_class
IsKeyDown(unsigned int) const (defined in input_class)input_class
IsLeftArrowPressed() const (defined in input_class)input_class
IsLeftMousePressed() const (defined in input_class)input_class
IsQPressed() const (defined in input_class)input_class
IsRightArrowPressed() const (defined in input_class)input_class
IsRightMousePressed() const (defined in input_class)input_class
IsScrollDown() const (defined in input_class)input_class
IsScrollUp() const (defined in input_class)input_class
IsSPressed() const (defined in input_class)input_class
IsUpArrowPressed() const (defined in input_class)input_class
IsWPressed() const (defined in input_class)input_class
KeyDown(unsigned int) (defined in input_class)input_class
KeyUp(unsigned int) (defined in input_class)input_class
Shutdown() (defined in input_class)input_classvirtual
~input_class() (defined in input_class)input_class
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:8e1285855180a87494cfbd94d1744a0d1a78a27359aeed5eb9dd8d9d3956b598 +size 11555 diff --git a/doxygen_docs/html/classinput__class.html b/doxygen_docs/html/classinput__class.html index 5aa64c1..90a9c04 100644 --- a/doxygen_docs/html/classinput__class.html +++ b/doxygen_docs/html/classinput__class.html @@ -1,1030 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: input_class Class Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
- -
input_class Class Reference
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

-Public Member Functions

 input_class (const input_class &)
 
virtual bool Initialize (HINSTANCE, HWND, int, int)
 
virtual void Shutdown ()
 
virtual bool Frame ()
 
bool IsEscapePressed () const
 
void GetMouseLocation (int &, int &) const
 
bool IsLeftMousePressed () const
 
bool IsRightMousePressed () const
 
void KeyDown (unsigned int)
 
void KeyUp (unsigned int)
 
bool IsLeftArrowPressed () const
 
bool IsRightArrowPressed () const
 
bool IsScrollUp () const
 
bool IsScrollDown () const
 
bool IsUpArrowPressed () const
 
bool IsDownArrowPressed () const
 
bool IsAPressed () const
 
bool IsDPressed () const
 
bool IsWPressed () const
 
bool IsSPressed () const
 
bool IsQPressed () const
 
bool IsEPressed () const
 
bool IsKeyDown (unsigned int) const
 
bool is_key_pressed (const unsigned int)
 
-

Detailed Description

-
-

Definition at line 24 of file input_class.h.

-

Constructor & Destructor Documentation

- -

◆ input_class() [1/2]

- -
-
- - - - - - - -
input_class::input_class ()
-
- -

Definition at line 4 of file input_class.cpp.

-
5{
-
6 m_directInput = 0;
-
7 m_keyboard = 0;
-
8 m_mouse = 0;
-
9 m_previousTildeState = false;
-
10}
-
-
-
- -

◆ input_class() [2/2]

- -
-
- - - - - - - -
input_class::input_class (const input_class & other)
-
- -

Definition at line 13 of file input_class.cpp.

-
14{
-
15}
-
-
-
- -

◆ ~input_class()

- -
-
- - - - - - - -
input_class::~input_class ()
-
- -

Definition at line 18 of file input_class.cpp.

-
19{
-
20}
-
-
-
-

Member Function Documentation

- -

◆ Frame()

- -
-
- - - - - -
- - - - - - - -
bool input_class::Frame ()
-
-virtual
-
- -

Definition at line 176 of file input_class.cpp.

-
177{
-
178 bool result;
-
179
-
180
-
181 // Read the current state of the keyboard.
-
182 result = ReadKeyboard();
-
183 if (!result)
-
184 {
-
185 Logger::Get().Log("Failed to read keyboard state", __FILE__, __LINE__, Logger::LogLevel::Error);
-
186 return false;
-
187 }
-
188
-
189 // Read the current state of the mouse.
-
190 result = ReadMouse();
-
191 if (!result)
-
192 {
-
193 Logger::Get().Log("Failed to read mouse state", __FILE__, __LINE__, Logger::LogLevel::Error);
-
194 return false;
-
195 }
-
196
-
197 // Process the changes in the mouse and keyboard.
-
198 ProcessInput();
-
199
-
200 return true;
-
201}
-
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
-
-
-
- -

◆ GetMouseLocation()

- -
-
- - - - - - - - - - - -
void input_class::GetMouseLocation (int & mouseX,
int & mouseY ) const
-
- -

Definition at line 387 of file input_class.cpp.

-
388{
-
389 mouseX = m_mouseX;
-
390 mouseY = m_mouseY;
-
391 return;
-
392}
-
-
-
- -

◆ Initialize()

- -
-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - -
bool input_class::Initialize (HINSTANCE hinstance,
HWND hwnd,
int screenWidth,
int screenHeight )
-
-virtual
-
- -

Definition at line 22 of file input_class.cpp.

-
23{
-
24 Logger::Get().Log("Initializing input class", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
25
-
26 HRESULT result;
-
27 int i;
-
28
-
29 // Initialize all the keys to being released and not pressed.
-
30 for (i = 0; i < 256; i++)
-
31 {
-
32 m_keys[i] = false;
-
33 }
-
34
-
35 // Store the screen size which will be used for positioning the mouse cursor.
-
36 m_screenWidth = screenWidth;
-
37 m_screenHeight = screenHeight;
-
38
-
39 // Initialize the location of the mouse on the screen.
-
40 m_mouseX = 0;
-
41 m_mouseY = 0;
-
42
-
43 // Initialize the main direct input interface.
-
44 result = DirectInput8Create(hinstance, DIRECTINPUT_VERSION, IID_IDirectInput8, (void**)&m_directInput, NULL);
-
45 if (FAILED(result))
-
46 {
-
47 Logger::Get().Log("Failed to create direct input interface", __FILE__, __LINE__, Logger::LogLevel::Error);
-
48 return false;
-
49 }
-
50
-
51 // Initialize the direct input interface for the keyboard.
-
52 result = m_directInput->CreateDevice(GUID_SysKeyboard, &m_keyboard, NULL);
-
53 if (FAILED(result))
-
54 {
-
55 Logger::Get().Log("Failed to create direct input interface for the keyboard", __FILE__, __LINE__, Logger::LogLevel::Error);
-
56 return false;
-
57 }
-
58
-
59 // Set the data format. In this case since it is a keyboard we can use the predefined data format.
-
60 result = m_keyboard->SetDataFormat(&c_dfDIKeyboard);
-
61 if (FAILED(result))
-
62 {
-
63 Logger::Get().Log("Failed to set data format for the keyboard", __FILE__, __LINE__, Logger::LogLevel::Error);
-
64 return false;
-
65 }
-
66
-
67 // Set the cooperative level of the keyboard to share with other programs.
-
68 result = m_keyboard->SetCooperativeLevel(hwnd, DISCL_FOREGROUND | DISCL_NONEXCLUSIVE);
-
69 if (FAILED(result))
-
70 {
-
71 Logger::Get().Log("Failed to set cooperative level of the keyboard", __FILE__, __LINE__, Logger::LogLevel::Error);
-
72 return false;
-
73 }
-
74
-
75 // Now acquire the keyboard.
-
76 result = m_keyboard->Acquire();
-
77 if (FAILED(result))
-
78 {
-
79 Logger::Get().Log("Failed to acquire the keyboard", __FILE__, __LINE__, Logger::LogLevel::Error);
-
80 return false;
-
81 }
-
82
-
83 // Initialize the direct input interface for the mouse.
-
84 result = m_directInput->CreateDevice(GUID_SysMouse, &m_mouse, NULL);
-
85 if (FAILED(result))
-
86 {
-
87 Logger::Get().Log("Failed to create direct input interface for the mouse", __FILE__, __LINE__, Logger::LogLevel::Error);
-
88 return false;
-
89 }
-
90
-
91 // Set the data format for the mouse using the pre-defined mouse data format.
-
92 result = m_mouse->SetDataFormat(&c_dfDIMouse);
-
93 if (FAILED(result))
-
94 {
-
95 Logger::Get().Log("Failed to set data format for the mouse", __FILE__, __LINE__, Logger::LogLevel::Error);
-
96 return false;
-
97 }
-
98
-
99 // Set the cooperative level of the mouse to share with other programs.
-
100 result = m_mouse->SetCooperativeLevel(hwnd, DISCL_FOREGROUND | DISCL_NONEXCLUSIVE);
-
101 if (FAILED(result))
-
102 {
-
103 Logger::Get().Log("Failed to set cooperative level of the mouse", __FILE__, __LINE__, Logger::LogLevel::Error);
-
104 return false;
-
105 }
-
106
-
107 // Acquire the mouse.
-
108 result = m_mouse->Acquire();
-
109 if (FAILED(result))
-
110 {
-
111 Logger::Get().Log("Failed to acquire the mouse", __FILE__, __LINE__, Logger::LogLevel::Error);
-
112 return false;
-
113 }
-
114
-
115 Logger::Get().Log("Input class initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
116
-
117 return true;
-
118}
-
-
-
- -

◆ is_key_pressed()

- -
-
- - - - - - - -
bool input_class::is_key_pressed (const unsigned int key_code)
-
- -

Definition at line 436 of file input_class.cpp.

-
437{
-
438 if (m_keyboardState[key_code] & 0x80)
-
439 {
-
440 return true;
-
441 }
-
442
-
443 return false;
-
444}
-
-
-
- -

◆ IsAPressed()

- -
-
- - - - - - - -
bool input_class::IsAPressed () const
-
- -

Definition at line 324 of file input_class.cpp.

-
325{
-
326 // Touche A sur QWERTY, Q sur AZERTY
-
327 if (m_keyboardState[DIK_A] & 0x80)
-
328 {
-
329 return true;
-
330 }
-
331
-
332 return false;
-
333}
-
-
-
- -

◆ IsDownArrowPressed()

- -
-
- - - - - - - -
bool input_class::IsDownArrowPressed () const
-
- -

Definition at line 310 of file input_class.cpp.

-
311{
-
312 if (m_keyboardState[DIK_DOWN] & 0x80)
-
313 {
-
314 return true;
-
315 }
-
316
-
317 return false;
-
318}
-
-
-
- -

◆ IsDPressed()

- -
-
- - - - - - - -
bool input_class::IsDPressed () const
-
- -

Definition at line 335 of file input_class.cpp.

-
336{
-
337 if (m_keyboardState[DIK_D] & 0x80)
-
338 {
-
339 return true;
-
340 }
-
341
-
342 return false;
-
343}
-
-
-
- -

◆ IsEPressed()

- -
-
- - - - - - - -
bool input_class::IsEPressed () const
-
- -

Definition at line 377 of file input_class.cpp.

-
378{
-
379 if (m_keyboardState[DIK_E] & 0x80)
-
380 {
-
381 return true;
-
382 }
-
383
-
384 return false;
-
385}
-
-
-
- -

◆ IsEscapePressed()

- -
-
- - - - - - - -
bool input_class::IsEscapePressed () const
-
- -

Definition at line 267 of file input_class.cpp.

-
268{
-
269 // Do a bitwise and on the keyboard state to check if the escape key is currently being pressed.
-
270 if (m_keyboardState[DIK_ESCAPE] & 0x80)
-
271 {
-
272 return true;
-
273 }
-
274
-
275 return false;
-
276}
-
-
-
- -

◆ IsKeyDown()

- -
-
- - - - - - - -
bool input_class::IsKeyDown (unsigned int key) const
-
- -

Definition at line 138 of file input_class.cpp.

-
139{
-
140 // Return what state the key is in (pressed/not pressed).
-
141 return m_keys[key];
-
142}
-
-
-
- -

◆ IsLeftArrowPressed()

- -
-
- - - - - - - -
bool input_class::IsLeftArrowPressed () const
-
- -

Definition at line 278 of file input_class.cpp.

-
279{
-
280 if (m_keyboardState[DIK_LEFT] & 0x80)
-
281 {
-
282 return true;
-
283 }
-
284
-
285 return false;
-
286}
-
-
-
- -

◆ IsLeftMousePressed()

- -
-
- - - - - - - -
bool input_class::IsLeftMousePressed () const
-
- -

Definition at line 394 of file input_class.cpp.

-
395{
-
396 // Check the left mouse button state.
-
397 if (m_mouseState.rgbButtons[0] & 0x80)
-
398 {
-
399 return true;
-
400 }
-
401
-
402 return false;
-
403}
-
-
-
- -

◆ IsQPressed()

- -
-
- - - - - - - -
bool input_class::IsQPressed () const
-
- -

Definition at line 366 of file input_class.cpp.

-
367{
-
368 // Touche Q sur QWERTY, A sur AZERTY
-
369 if (m_keyboardState[DIK_Q] & 0x80)
-
370 {
-
371 return true;
-
372 }
-
373
-
374 return false;
-
375}
-
-
-
- -

◆ IsRightArrowPressed()

- -
-
- - - - - - - -
bool input_class::IsRightArrowPressed () const
-
- -

Definition at line 289 of file input_class.cpp.

-
290{
-
291 if (m_keyboardState[DIK_RIGHT] & 0x80)
-
292 {
-
293 return true;
-
294 }
-
295
-
296 return false;
-
297}
-
-
-
- -

◆ IsRightMousePressed()

- -
-
- - - - - - - -
bool input_class::IsRightMousePressed () const
-
- -

Definition at line 405 of file input_class.cpp.

-
406{
-
407 // Check the left mouse button state.
-
408 if (m_mouseState.rgbButtons[1] & 0x80)
-
409 {
-
410 return true;
-
411 }
-
412
-
413 return false;
-
414}
-
-
-
- -

◆ IsScrollDown()

- -
-
- - - - - - - -
bool input_class::IsScrollDown () const
-
- -

Definition at line 426 of file input_class.cpp.

-
427{
-
428 if (m_mouseState.lZ < 0)
-
429 {
-
430 return true;
-
431 }
-
432
-
433 return false;
-
434}
-
-
-
- -

◆ IsScrollUp()

- -
-
- - - - - - - -
bool input_class::IsScrollUp () const
-
- -

Definition at line 416 of file input_class.cpp.

-
417{
-
418 if (m_mouseState.lZ > 0)
-
419 {
-
420 return true;
-
421 }
-
422
-
423 return false;
-
424}
-
-
-
- -

◆ IsSPressed()

- -
-
- - - - - - - -
bool input_class::IsSPressed () const
-
- -

Definition at line 356 of file input_class.cpp.

-
357{
-
358 if (m_keyboardState[DIK_S] & 0x80)
-
359 {
-
360 return true;
-
361 }
-
362
-
363 return false;
-
364}
-
-
-
- -

◆ IsUpArrowPressed()

- -
-
- - - - - - - -
bool input_class::IsUpArrowPressed () const
-
- -

Definition at line 299 of file input_class.cpp.

-
300{
-
301 if (m_keyboardState[DIK_UP] & 0x80)
-
302 {
-
303 return true;
-
304 }
-
305
-
306 return false;
-
307}
-
-
-
- -

◆ IsWPressed()

- -
-
- - - - - - - -
bool input_class::IsWPressed () const
-
- -

Definition at line 345 of file input_class.cpp.

-
346{
-
347 // Touche W sur QWERTY, Z sur AZERTY
-
348 if (m_keyboardState[DIK_W] & 0x80)
-
349 {
-
350 return true;
-
351 }
-
352
-
353 return false;
-
354}
-
-
-
- -

◆ KeyDown()

- -
-
- - - - - - - -
void input_class::KeyDown (unsigned int input)
-
- -

Definition at line 121 of file input_class.cpp.

-
122{
-
123 // If a key is pressed then save that state in the key array.
-
124 Logger::Get().Log("Key down: " + std::to_string(input), __FILE__, __LINE__, Logger::LogLevel::Input);
-
125 m_keys[input] = true;
-
126 return;
-
127}
- -
-
-
- -

◆ KeyUp()

- -
-
- - - - - - - -
void input_class::KeyUp (unsigned int input)
-
- -

Definition at line 130 of file input_class.cpp.

-
131{
-
132 // If a key is released then clear that state in the key array.
-
133 m_keys[input] = false;
-
134 return;
-
135}
-
-
-
- -

◆ Shutdown()

- -
-
- - - - - -
- - - - - - - -
void input_class::Shutdown ()
-
-virtual
-
- -

Definition at line 144 of file input_class.cpp.

-
145{
-
146 Logger::Get().Log("Shutting down input class", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
147
-
148 // Release the mouse.
-
149 if (m_mouse)
-
150 {
-
151 m_mouse->Unacquire();
-
152 m_mouse->Release();
-
153 m_mouse = 0;
-
154 }
-
155
-
156 // Release the keyboard.
-
157 if (m_keyboard)
-
158 {
-
159 m_keyboard->Unacquire();
-
160 m_keyboard->Release();
-
161 m_keyboard = 0;
-
162 }
-
163
-
164 // Release the main interface to direct input.
-
165 if (m_directInput)
-
166 {
-
167 m_directInput->Release();
-
168 m_directInput = 0;
-
169 }
-
170
-
171 Logger::Get().Log("Input class shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
172
-
173 return;
-
174}
-
-
-
-
The documentation for this class was generated from the following files: -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:a0b20c7f6f9913918d0f7b4468737e8ffe0a3b394f07c5f7dc0457084bdd5a22 +size 73291 diff --git a/doxygen_docs/html/classlight__class-members.html b/doxygen_docs/html/classlight__class-members.html index 9ad1e70..2a5bd04 100644 --- a/doxygen_docs/html/classlight__class-members.html +++ b/doxygen_docs/html/classlight__class-members.html @@ -1,131 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
light_class Member List
-
-
- -

This is the complete list of members for light_class, including all inherited members.

- - - - - - - - - - - - - - - - - - -
GetAmbientColor() (defined in light_class)light_class
GetDiffuseColor() (defined in light_class)light_class
GetDirection() (defined in light_class)light_class
GetIntensity() const (defined in light_class)light_classinline
GetPosition() (defined in light_class)light_class
GetSpecularColor() (defined in light_class)light_class
GetSpecularPower() (defined in light_class)light_class
light_class() (defined in light_class)light_class
light_class(const light_class &) (defined in light_class)light_class
SetAmbientColor(float, float, float, float) (defined in light_class)light_class
SetDiffuseColor(float, float, float, float) (defined in light_class)light_class
SetDirection(float, float, float) (defined in light_class)light_class
SetIntensity(float intensity) (defined in light_class)light_classinline
SetPosition(float, float, float) (defined in light_class)light_class
SetSpecularColor(float, float, float, float) (defined in light_class)light_class
SetSpecularPower(float) (defined in light_class)light_class
~light_class() (defined in light_class)light_class
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:a952a9cf58917f13836856bc42a5a451a0d522a8580b33aa1eeadae154f19ec6 +size 9102 diff --git a/doxygen_docs/html/classlight__class.html b/doxygen_docs/html/classlight__class.html index 3e1c9d4..aa4908d 100644 --- a/doxygen_docs/html/classlight__class.html +++ b/doxygen_docs/html/classlight__class.html @@ -1,607 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: light_class Class Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
- -
light_class Class Reference
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

-Public Member Functions

 light_class (const light_class &)
 
void SetAmbientColor (float, float, float, float)
 
void SetDiffuseColor (float, float, float, float)
 
void SetDirection (float, float, float)
 
void SetSpecularColor (float, float, float, float)
 
void SetSpecularPower (float)
 
void SetPosition (float, float, float)
 
XMFLOAT4 GetAmbientColor ()
 
XMFLOAT4 GetDiffuseColor ()
 
XMFLOAT3 GetDirection ()
 
XMFLOAT4 GetSpecularColor ()
 
float GetSpecularPower ()
 
XMFLOAT4 GetPosition ()
 
void SetIntensity (float intensity)
 
float GetIntensity () const
 
-

Detailed Description

-
-

Definition at line 19 of file light_class.h.

-

Constructor & Destructor Documentation

- -

◆ light_class() [1/2]

- -
-
- - - - - - - -
light_class::light_class ()
-
- -

Definition at line 7 of file light_class.cpp.

-
8{
-
9}
-
-
-
- -

◆ light_class() [2/2]

- -
-
- - - - - - - -
light_class::light_class (const light_class & other)
-
- -

Definition at line 12 of file light_class.cpp.

-
13{
-
14}
-
-
-
- -

◆ ~light_class()

- -
-
- - - - - - - -
light_class::~light_class ()
-
- -

Definition at line 17 of file light_class.cpp.

-
18{
-
19}
-
-
-
-

Member Function Documentation

- -

◆ GetAmbientColor()

- -
-
- - - - - - - -
XMFLOAT4 light_class::GetAmbientColor ()
-
- -

Definition at line 61 of file light_class.cpp.

-
62{
-
63 return m_ambientColor;
-
64}
-
-
-
- -

◆ GetDiffuseColor()

- -
-
- - - - - - - -
XMFLOAT4 light_class::GetDiffuseColor ()
-
- -

Definition at line 67 of file light_class.cpp.

-
68{
-
69 return m_diffuseColor;
-
70}
-
-
-
- -

◆ GetDirection()

- -
-
- - - - - - - -
XMFLOAT3 light_class::GetDirection ()
-
- -

Definition at line 72 of file light_class.cpp.

-
73{
-
74 return m_direction;
-
75}
-
-
-
- -

◆ GetIntensity()

- -
-
- - - - - -
- - - - - - - -
float light_class::GetIntensity () const
-
-inline
-
- -

Definition at line 41 of file light_class.h.

-
41{ return m_intensity; }
-
-
-
- -

◆ GetPosition()

- -
-
- - - - - - - -
XMFLOAT4 light_class::GetPosition ()
-
- -

Definition at line 88 of file light_class.cpp.

-
89{
-
90 return m_position;
-
91}
-
-
-
- -

◆ GetSpecularColor()

- -
-
- - - - - - - -
XMFLOAT4 light_class::GetSpecularColor ()
-
- -

Definition at line 77 of file light_class.cpp.

-
78{
-
79 return m_specularColor;
-
80}
-
-
-
- -

◆ GetSpecularPower()

- -
-
- - - - - - - -
float light_class::GetSpecularPower ()
-
- -

Definition at line 83 of file light_class.cpp.

-
84{
-
85 return m_specularPower;
-
86}
-
-
-
- -

◆ SetAmbientColor()

- -
-
- - - - - - - - - - - - - - - - - - - - - -
void light_class::SetAmbientColor (float red,
float green,
float blue,
float alpha )
-
- -

Definition at line 21 of file light_class.cpp.

-
22{
-
23 m_ambientColor = XMFLOAT4(red, green, blue, alpha);
-
24 return;
-
25}
-
-
-
- -

◆ SetDiffuseColor()

- -
-
- - - - - - - - - - - - - - - - - - - - - -
void light_class::SetDiffuseColor (float red,
float green,
float blue,
float alpha )
-
- -

Definition at line 29 of file light_class.cpp.

-
30{
-
31 m_diffuseColor = XMFLOAT4(red, green, blue, alpha);
-
32 return;
-
33}
-
-
-
- -

◆ SetDirection()

- -
-
- - - - - - - - - - - - - - - - -
void light_class::SetDirection (float x,
float y,
float z )
-
- -

Definition at line 36 of file light_class.cpp.

-
37{
-
38 m_direction = XMFLOAT3(x, y, z);
-
39 return;
-
40}
-
-
-
- -

◆ SetIntensity()

- -
-
- - - - - -
- - - - - - - -
void light_class::SetIntensity (float intensity)
-
-inline
-
- -

Definition at line 40 of file light_class.h.

-
40{ m_intensity = intensity; }
-
-
-
- -

◆ SetPosition()

- -
-
- - - - - - - - - - - - - - - - -
void light_class::SetPosition (float x,
float y,
float z )
-
- -

Definition at line 55 of file light_class.cpp.

-
56{
-
57 m_position = XMFLOAT4(x, y, z, 1.0f);
-
58 return;
-
59}
-
-
-
- -

◆ SetSpecularColor()

- -
-
- - - - - - - - - - - - - - - - - - - - - -
void light_class::SetSpecularColor (float red,
float green,
float blue,
float alpha )
-
- -

Definition at line 42 of file light_class.cpp.

-
43{
-
44 m_specularColor = XMFLOAT4(red, green, blue, alpha);
-
45 return;
-
46}
-
-
-
- -

◆ SetSpecularPower()

- -
-
- - - - - - - -
void light_class::SetSpecularPower (float power)
-
- -

Definition at line 49 of file light_class.cpp.

-
50{
-
51 m_specularPower = power;
-
52 return;
-
53}
-
-
-
-
The documentation for this class was generated from the following files: -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:fac1f69fae6966cd050a41089636040073d08e1403182b4ce0b76e4c493eb6bd +size 32836 diff --git a/doxygen_docs/html/classlight__map__shader__class-members.html b/doxygen_docs/html/classlight__map__shader__class-members.html index b4f4e00..4b9c0ac 100644 --- a/doxygen_docs/html/classlight__map__shader__class-members.html +++ b/doxygen_docs/html/classlight__map__shader__class-members.html @@ -1,120 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
light_map_shader_class Member List
-
-
- -

This is the complete list of members for light_map_shader_class, including all inherited members.

- - - - - - - -
initialize(ID3D11Device *, HWND) (defined in light_map_shader_class)light_map_shader_class
light_map_shader_class() (defined in light_map_shader_class)light_map_shader_class
light_map_shader_class(const light_map_shader_class &) (defined in light_map_shader_class)light_map_shader_class
render(ID3D11DeviceContext *, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView *, ID3D11ShaderResourceView *) (defined in light_map_shader_class)light_map_shader_class
shutdown() (defined in light_map_shader_class)light_map_shader_class
~light_map_shader_class() (defined in light_map_shader_class)light_map_shader_class
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:1db4f8dd8a450400da8929b67faac2006944a9290ba55d8e2c58c19caee2d754 +size 6456 diff --git a/doxygen_docs/html/classlight__map__shader__class.html b/doxygen_docs/html/classlight__map__shader__class.html index ae38f23..048cce7 100644 --- a/doxygen_docs/html/classlight__map__shader__class.html +++ b/doxygen_docs/html/classlight__map__shader__class.html @@ -1,355 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: light_map_shader_class Class Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
- -
light_map_shader_class Class Reference
-
-
- - - - - - - - - - -

-Public Member Functions

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

Detailed Description

-
-

Definition at line 21 of file light_map_shader_class.h.

-

Constructor & Destructor Documentation

- -

◆ light_map_shader_class() [1/2]

- -
-
- - - - - - - -
light_map_shader_class::light_map_shader_class ()
-
- -

Definition at line 4 of file light_map_shader_class.cpp.

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

◆ light_map_shader_class() [2/2]

- -
-
- - - - - - - -
light_map_shader_class::light_map_shader_class (const light_map_shader_class & other)
-
- -

Definition at line 14 of file light_map_shader_class.cpp.

-
15{
-
16}
-
-
-
- -

◆ ~light_map_shader_class()

- -
-
- - - - - - - -
light_map_shader_class::~light_map_shader_class ()
-
- -

Definition at line 19 of file light_map_shader_class.cpp.

-
20{
-
21}
-
-
-
-

Member Function Documentation

- -

◆ initialize()

- -
-
- - - - - - - - - - - -
bool light_map_shader_class::initialize (ID3D11Device * device,
HWND hwnd )
-
- -

Definition at line 24 of file light_map_shader_class.cpp.

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

Definition at line 72 of file light_map_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, texture1, texture2);
-
80 if (!result)
-
81 {
-
82 Logger::Get().Log("Error setting 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 light_map_shader_class::shutdown ()
-
- -

Definition at line 63 of file light_map_shader_class.cpp.

-
64{
-
65 // shutdown the vertex and pixel shaders as well as the related objects.
-
66 shutdown_shader();
-
67
-
68 return;
-
69}
-
-
-
-
The documentation for this class was generated from the following files: -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:ee5b7aa19e343dcb1bf6a459654feb8b1a39b2fb77eaaa79492c27bece10d81c +size 23300 diff --git a/doxygen_docs/html/classlight__shader__class-members.html b/doxygen_docs/html/classlight__shader__class-members.html index 641e42a..e49213f 100644 --- a/doxygen_docs/html/classlight__shader__class-members.html +++ b/doxygen_docs/html/classlight__shader__class-members.html @@ -1,120 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
light_shader_class Member List
-
-
- -

This is the complete list of members for light_shader_class, including all inherited members.

- - - - - - - -
initialize(ID3D11Device *, HWND) (defined in light_shader_class)light_shader_class
light_shader_class() (defined in light_shader_class)light_shader_class
light_shader_class(const light_shader_class &) (defined in light_shader_class)light_shader_class
render(ID3D11DeviceContext *, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView *, XMFLOAT4[], XMFLOAT4[], XMFLOAT4[]) (defined in light_shader_class)light_shader_class
shutdown() (defined in light_shader_class)light_shader_class
~light_shader_class() (defined in light_shader_class)light_shader_class
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:015ed7c0f79540c262d8b7858f1505ee411c985ceeaa7c3de36552acab409a59 +size 6322 diff --git a/doxygen_docs/html/classlight__shader__class.html b/doxygen_docs/html/classlight__shader__class.html index cdb6793..5941fbc 100644 --- a/doxygen_docs/html/classlight__shader__class.html +++ b/doxygen_docs/html/classlight__shader__class.html @@ -1,368 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: light_shader_class Class Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
- -
light_shader_class Class Reference
-
-
- - - - - - - - - - -

-Public Member Functions

 light_shader_class (const light_shader_class &)
 
bool initialize (ID3D11Device *, HWND)
 
void shutdown ()
 
bool render (ID3D11DeviceContext *, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView *, XMFLOAT4[], XMFLOAT4[], XMFLOAT4[])
 
-

Detailed Description

-
-

Definition at line 27 of file light_shader_class.h.

-

Constructor & Destructor Documentation

- -

◆ light_shader_class() [1/2]

- -
-
- - - - - - - -
light_shader_class::light_shader_class ()
-
- -

Definition at line 7 of file light_shader_class.cpp.

-
8{
-
9 vertex_shader_ = 0;
-
10 pixel_shader_ = 0;
-
11 layout_ = 0;
-
12 sample_state_ = 0;
-
13 matrix_buffer_ = 0;
-
14 camera_buffer_ = 0;
-
15 light_buffer_ = 0;
-
16 light_color_buffer_ = 0;
-
17 light_position_buffer_ = 0;
-
18}
-
-
-
- -

◆ light_shader_class() [2/2]

- -
-
- - - - - - - -
light_shader_class::light_shader_class (const light_shader_class & other)
-
- -

Definition at line 21 of file light_shader_class.cpp.

-
22{
-
23}
-
-
-
- -

◆ ~light_shader_class()

- -
-
- - - - - - - -
light_shader_class::~light_shader_class ()
-
- -

Definition at line 26 of file light_shader_class.cpp.

-
27{
-
28}
-
-
-
-

Member Function Documentation

- -

◆ initialize()

- -
-
- - - - - - - - - - - -
bool light_shader_class::initialize (ID3D11Device * device,
HWND hwnd )
-
- -

Definition at line 31 of file light_shader_class.cpp.

-
32{
-
33 Logger::Get().Log("Initializing light_shader_class", __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/light.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/light.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 = initialize_shader(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("light_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 light_shader_class::render (ID3D11DeviceContext * deviceContext,
int indexCount,
XMMATRIX worldMatrix,
XMMATRIX viewMatrix,
XMMATRIX projectionMatrix,
ID3D11ShaderResourceView * texture,
XMFLOAT4 diffuseColor[],
XMFLOAT4 lightPosition[],
XMFLOAT4 ambientClor[] )
-
- -

Definition at line 77 of file light_shader_class.cpp.

-
79{
-
80 bool result;
-
81
-
82
-
83 // Set the shader parameters that it will use for rendering.
-
84 result = set_shader_parameters(deviceContext, worldMatrix, viewMatrix, projectionMatrix, texture, diffuseColor, lightPosition, ambientClor);
-
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 render_shader(deviceContext, indexCount);
-
93
-
94 return true;
-
95}
-
-
-
- -

◆ shutdown()

- -
-
- - - - - - - -
void light_shader_class::shutdown ()
-
- -

Definition at line 69 of file light_shader_class.cpp.

-
70{
-
71 // shutdown the vertex and pixel shaders as well as the related objects.
-
72 shutdown_shader();
-
73
-
74 return;
-
75}
-
-
-
-
The documentation for this class was generated from the following files: -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:8d5caf114ad8f5b570a70d0ac88ad087ab070c640aaa6f537d79f3d0393cf2d4 +size 23825 diff --git a/doxygen_docs/html/classmaster__shader-members.html b/doxygen_docs/html/classmaster__shader-members.html index f7baa2a..45537ea 100644 --- a/doxygen_docs/html/classmaster__shader-members.html +++ b/doxygen_docs/html/classmaster__shader-members.html @@ -1,122 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
master_shader Member List
-
-
- -

This is the complete list of members for master_shader, including all inherited members.

- - - - - - - - - -
initialize(ID3D11Device *device, HWND hwnd)=0 (defined in master_shader)master_shaderpure virtual
master_shader() (defined in master_shader)master_shader
master_shader(const master_shader &other)=delete (defined in master_shader)master_shader
ps_filename_ (defined in master_shader)master_shaderprotected
ps_name_ (defined in master_shader)master_shaderprotected
vs_filename_ (defined in master_shader)master_shaderprotected
vs_name_ (defined in master_shader)master_shaderprotected
~master_shader() (defined in master_shader)master_shadervirtual
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:463324972fcf976ac1c58bcece579432a4a6c6927c995aba85792a9001c9313c +size 6815 diff --git a/doxygen_docs/html/classmaster__shader.html b/doxygen_docs/html/classmaster__shader.html index fe838ae..e1829b2 100644 --- a/doxygen_docs/html/classmaster__shader.html +++ b/doxygen_docs/html/classmaster__shader.html @@ -1,337 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: master_shader Class Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
- -
master_shader Class Referenceabstract
-
-
- - - - - - -

-Public Member Functions

master_shader (const master_shader &other)=delete
 
virtual bool initialize (ID3D11Device *device, HWND hwnd)=0
 
- - - - - - - - - -

-Protected Attributes

wchar_t vs_filename_ [128]
 
wchar_t ps_filename_ [128]
 
wchar_t const * vs_name_ = L""
 
wchar_t const * ps_name_ = L""
 
-

Detailed Description

-
-

Definition at line 7 of file master_shader.h.

-

Constructor & Destructor Documentation

- -

◆ master_shader()

- -
-
- - - - - - - -
master_shader::master_shader ()
-
- -

Definition at line 4 of file master_shader.cpp.

-
5{
-
6 // Initialize shader filenames
-
7 wcscpy_s(vs_filename_, 128, vs_name_);
-
8 wcscpy_s(ps_filename_, 128, ps_name_);
-
9
-
10}
-
-
-
- -

◆ ~master_shader()

- -
-
- - - - - -
- - - - - - - -
master_shader::~master_shader ()
-
-virtual
-
- -

Definition at line 12 of file master_shader.cpp.

-
13{
-
14 // Destructor implementation
-
15}
-
-
-
-

Member Function Documentation

- -

◆ initialize()

- -
-
- - - - - -
- - - - - - - - - - - -
bool master_shader::initialize (ID3D11Device * device,
HWND hwnd )
-
-pure virtual
-
- -

Definition at line 17 of file master_shader.cpp.

-
18{
-
19 Logger::Get().Log("Initializing master_shader", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
20
-
21 bool success = false;
-
22
-
23 return true;
-
24}
-
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
-
-
-
-

Member Data Documentation

- -

◆ ps_filename_

- -
-
- - - - - -
- - - - -
wchar_t master_shader::ps_filename_[128]
-
-protected
-
- -

Definition at line 19 of file master_shader.h.

- -
-
- -

◆ ps_name_

- -
-
- - - - - -
- - - - -
wchar_t const* master_shader::ps_name_ = L""
-
-protected
-
- -

Definition at line 22 of file master_shader.h.

- -
-
- -

◆ vs_filename_

- -
-
- - - - - -
- - - - -
wchar_t master_shader::vs_filename_[128]
-
-protected
-
- -

Definition at line 19 of file master_shader.h.

- -
-
- -

◆ vs_name_

- -
-
- - - - - -
- - - - -
wchar_t const* master_shader::vs_name_ = L""
-
-protected
-
- -

Definition at line 21 of file master_shader.h.

- -
-
-
The documentation for this class was generated from the following files: -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:dfb3409348cf879f91da5558f7990ff944d33abaf8111d775cd499449487b2db +size 17158 diff --git a/doxygen_docs/html/classmodel__class-members.html b/doxygen_docs/html/classmodel__class-members.html index 02d9934..b2c42bb 100644 --- a/doxygen_docs/html/classmodel__class-members.html +++ b/doxygen_docs/html/classmodel__class-members.html @@ -1,135 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
model_class Member List
-
-
- -

This is the complete list of members for model_class, including all inherited members.

- - - - - - - - - - - - - - - - - - - - - - -
AddTexture(ID3D11Device *device, ID3D11DeviceContext *deviceContext, std::wstring filename, TextureType type) (defined in model_class)model_class
AddTexture(ID3D11ShaderResourceView *texture, TextureType type) (defined in model_class)model_class
ChangeTexture(ID3D11Device *device, ID3D11DeviceContext *deviceContext, std::wstring filename, TextureType type, int index) (defined in model_class)model_class
GetIndexCount() (defined in model_class)model_class
GetTexture(TextureType type, int index) const (defined in model_class)model_class
GetTextureContainer() const (defined in model_class)model_classinline
GetVertexCount() const (defined in model_class)model_classinline
Initialize(ID3D11Device *, ID3D11DeviceContext *, char *, const TextureContainer &) (defined in model_class)model_class
Initialize(ID3D11Device *, ID3D11DeviceContext *, char *) (defined in model_class)model_class
m_indexBuffer (defined in model_class)model_classprotected
m_indexCount (defined in model_class)model_classprotected
m_vertexBuffer (defined in model_class)model_classprotected
m_vertexCount (defined in model_class)model_classprotected
model_class() (defined in model_class)model_class
model_class(const model_class &)=delete (defined in model_class)model_class
operator=(const model_class &)=delete (defined in model_class)model_class
PreloadTextures(ID3D11Device *device, ID3D11DeviceContext *deviceContext, TextureContainer &textureContainer) (defined in model_class)model_class
Render(ID3D11DeviceContext *) (defined in model_class)model_class
SetTextureContainer(TextureContainer &texturesContainer) (defined in model_class)model_classinline
Shutdown() (defined in model_class)model_class
~model_class() (defined in model_class)model_class
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:7b9e82e673e8df1eb21c47f37ed2b56ca049b12ef4e786694815794c649e300e +size 10782 diff --git a/doxygen_docs/html/classmodel__class.html b/doxygen_docs/html/classmodel__class.html index e1f4c6d..f5f2663 100644 --- a/doxygen_docs/html/classmodel__class.html +++ b/doxygen_docs/html/classmodel__class.html @@ -1,934 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: model_class Class Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
- -
model_class Class Reference
-
-
- - - - - - - - - - - - - - - - - - -

-Classes

struct  Face
 
struct  ModelType
 
struct  Normal
 
struct  TempVertexType
 
struct  Texture
 
struct  VectorType
 
struct  Vertex
 
struct  VertexType
 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

-Public Member Functions

model_class (const model_class &)=delete
 
-model_classoperator= (const model_class &)=delete
 
bool Initialize (ID3D11Device *, ID3D11DeviceContext *, char *, const TextureContainer &)
 
bool Initialize (ID3D11Device *, ID3D11DeviceContext *, char *)
 
void Shutdown ()
 
void Render (ID3D11DeviceContext *)
 
int GetIndexCount ()
 
int GetVertexCount () const
 
ID3D11ShaderResourceView * GetTexture (TextureType type, int index) const
 
bool ChangeTexture (ID3D11Device *device, ID3D11DeviceContext *deviceContext, std::wstring filename, TextureType type, int index)
 
bool AddTexture (ID3D11Device *device, ID3D11DeviceContext *deviceContext, std::wstring filename, TextureType type)
 
bool AddTexture (ID3D11ShaderResourceView *texture, TextureType type)
 
void SetTextureContainer (TextureContainer &texturesContainer)
 
TextureContainer GetTextureContainer () const
 
bool PreloadTextures (ID3D11Device *device, ID3D11DeviceContext *deviceContext, TextureContainer &textureContainer)
 
- - - - - - - - - -

-Protected Attributes

int m_vertexCount
 
int m_indexCount
 
ID3D11Buffer * m_vertexBuffer
 
ID3D11Buffer * m_indexBuffer
 
-

Detailed Description

-
-

Definition at line 150 of file model_class.h.

-

Constructor & Destructor Documentation

- -

◆ model_class()

- -
-
- - - - - - - -
model_class::model_class ()
-
- -

Definition at line 4 of file model_class.cpp.

-
5{
-
6 m_vertexBuffer = 0;
-
7 m_indexBuffer = 0;
-
8 m_model = 0;
-
9 m_vertexCount = 0;
-
10 m_indexCount = 0;
-
11 m_Textures.diffuse.clear();
-
12 m_Textures.normal.clear();
-
13 m_Textures.specular.clear();
-
14 m_Textures.alpha.clear();
-
15 m_Textures.diffusePaths.clear();
-
16 m_Textures.normalPaths.clear();
-
17 m_Textures.specularPaths.clear();
-
18 m_Textures.alphaPaths.clear();
-
19}
-
-
-
- -

◆ ~model_class()

- -
-
- - - - - - - -
model_class::~model_class ()
-
- -

Definition at line 21 of file model_class.cpp.

-
22{
-
23
-
24 // Destructor
-
25 Shutdown();
-
26}
-
-
-
-

Member Function Documentation

- -

◆ AddTexture() [1/2]

- -
-
- - - - - - - - - - - - - - - - - - - - - -
bool model_class::AddTexture (ID3D11Device * device,
ID3D11DeviceContext * deviceContext,
std::wstring filename,
TextureType type )
-
- -

Definition at line 646 of file model_class.cpp.

-
646 {
-
647 Logger::Get().Log("Adding texture", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
648
-
649 HRESULT result;
-
650 ID3D11ShaderResourceView* newTexture = nullptr;
-
651
-
652 // Charger la nouvelle texture
-
653 result = DirectX::CreateWICTextureFromFile(device, deviceContext, filename.c_str(), nullptr, &newTexture);
-
654 if (FAILED(result)) {
-
655 Logger::Get().Log("Failed to load texture: " + std::string(filename.begin(), filename.end()), __FILE__, __LINE__, Logger::LogLevel::Error);
-
656 return false;
-
657 }
-
658
-
659 // Ajouter la texture au vecteur approprié selon le type
-
660 auto& textureVector = m_Textures.Get(type);
-
661 textureVector.push_back(newTexture);
-
662
-
663 // Ajouter le chemin de la texture au vecteur approprié selon le type
-
664 switch (type) {
-
665 case TextureType::Diffuse:
-
666 m_Textures.diffusePaths.push_back(filename);
-
667 break;
-
668 case TextureType::Normal:
-
669 m_Textures.normalPaths.push_back(filename);
-
670 break;
-
671 case TextureType::Specular:
-
672 m_Textures.specularPaths.push_back(filename);
-
673 break;
-
674 case TextureType::Alpha:
-
675 m_Textures.alphaPaths.push_back(filename);
-
676 break;
-
677 }
-
678
-
679 Logger::Get().Log("Texture added successfully", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
680 return true;
-
681}
-
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
-
-
-
- -

◆ AddTexture() [2/2]

- -
-
- - - - - - - - - - - -
bool model_class::AddTexture (ID3D11ShaderResourceView * texture,
TextureType type )
-
- -

Definition at line 683 of file model_class.cpp.

-
683 {
-
684 if (!texture) {
-
685 Logger::Get().Log("Cannot add null texture", __FILE__, __LINE__, Logger::LogLevel::Error);
-
686 return false;
-
687 }
-
688
-
689 // Ajouter la texture au vecteur approprié
-
690 auto& textureVector = m_Textures.Get(type);
-
691 textureVector.push_back(texture);
-
692
-
693 // Ajouter un chemin vide ou générique pour maintenir la synchronisation
-
694 switch (type) {
-
695 case TextureType::Diffuse:
-
696 m_Textures.diffusePaths.push_back(L"[texture préchargée]");
-
697 break;
-
698 case TextureType::Normal:
-
699 m_Textures.normalPaths.push_back(L"[texture préchargée]");
-
700 break;
-
701 case TextureType::Specular:
-
702 m_Textures.specularPaths.push_back(L"[texture préchargée]");
-
703 break;
-
704 case TextureType::Alpha:
-
705 m_Textures.alphaPaths.push_back(L"[texture préchargée]");
-
706 break;
-
707 }
-
708 return true;
-
709}
-
-
-
- -

◆ ChangeTexture()

- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - -
bool model_class::ChangeTexture (ID3D11Device * device,
ID3D11DeviceContext * deviceContext,
std::wstring filename,
TextureType type,
int index )
-
- -

Definition at line 585 of file model_class.cpp.

-
585 {
-
586 Logger::Get().Log("Changing texture", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
587
-
588 HRESULT result;
-
589 ID3D11ShaderResourceView* newTexture = nullptr;
-
590
-
591 // Charger la nouvelle texture
-
592 result = DirectX::CreateWICTextureFromFile(device, deviceContext, filename.c_str(), nullptr, &newTexture);
-
593 if (FAILED(result)) {
-
594 Logger::Get().Log("Failed to load texture: " + std::string(filename.begin(), filename.end()), __FILE__, __LINE__, Logger::LogLevel::Error);
-
595 return false;
-
596 }
-
597
-
598 // Récupérer le vecteur correspondant au type de texture
-
599 auto& textureVector = m_Textures.Get(type);
-
600
-
601 // Si l'index est hors limites, redimensionner le vecteur
-
602 if (index >= textureVector.size()) {
-
603 textureVector.resize(index + 1, nullptr);
-
604 }
-
605
-
606 // Libérer l'ancienne texture si elle existe
-
607 if (textureVector[index]) {
-
608 textureVector[index]->Release();
-
609 }
-
610
-
611 // Assigner la nouvelle texture
-
612 textureVector[index] = newTexture;
-
613
-
614 // Mettre à jour le chemin dans le conteneur approprié selon le type
-
615 switch (type) {
-
616 case TextureType::Diffuse:
-
617 if (index >= m_Textures.diffusePaths.size()) {
-
618 m_Textures.diffusePaths.resize(index + 1, L"");
-
619 }
-
620 m_Textures.diffusePaths[index] = filename;
-
621 break;
-
622 case TextureType::Normal:
-
623 if (index >= m_Textures.normalPaths.size()) {
-
624 m_Textures.normalPaths.resize(index + 1, L"");
-
625 }
-
626 m_Textures.normalPaths[index] = filename;
-
627 break;
-
628 case TextureType::Specular:
-
629 if (index >= m_Textures.specularPaths.size()) {
-
630 m_Textures.specularPaths.resize(index + 1, L"");
-
631 }
-
632 m_Textures.specularPaths[index] = filename;
-
633 break;
-
634 case TextureType::Alpha:
-
635 if (index >= m_Textures.alphaPaths.size()) {
-
636 m_Textures.alphaPaths.resize(index + 1, L"");
-
637 }
-
638 m_Textures.alphaPaths[index] = filename;
-
639 break;
-
640 }
-
641
-
642 Logger::Get().Log("Texture changed successfully", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
643 return true;
-
644}
-
-
-
- -

◆ GetIndexCount()

- -
-
- - - - - - - -
int model_class::GetIndexCount ()
-
- -

Definition at line 88 of file model_class.cpp.

-
89{
-
90 return m_indexCount;
-
91}
-
-
-
- -

◆ GetTexture()

- -
-
- - - - - - - - - - - -
ID3D11ShaderResourceView * model_class::GetTexture (TextureType type,
int index ) const
-
- -

Definition at line 93 of file model_class.cpp.

-
93 {
-
94 return m_Textures.GetTexture(type, index);
-
95}
-
-
-
- -

◆ GetTextureContainer()

- -
-
- - - - - -
- - - - - - - -
TextureContainer model_class::GetTextureContainer () const
-
-inline
-
- -

Definition at line 232 of file model_class.h.

-
232{ return m_Textures; }
-
-
-
- -

◆ GetVertexCount()

- -
-
- - - - - -
- - - - - - - -
int model_class::GetVertexCount () const
-
-inline
-
- -

Definition at line 217 of file model_class.h.

-
217{ return m_vertexCount; }
-
-
-
- -

◆ Initialize() [1/2]

- -
-
- - - - - - - - - - - - - - - - -
bool model_class::Initialize (ID3D11Device * device,
ID3D11DeviceContext * deviceContext,
char * modelFilename )
-
- -

Definition at line 40 of file model_class.cpp.

-
40 {
-
41
-
42 bool result;
-
43
-
44 // Load in the model data.
-
45 result = LoadModel(modelFilename);
-
46 if (!result) {
-
47 Logger::Get().Log("Failed to load model data", __FILE__, __LINE__, Logger::LogLevel::Error);
-
48 return false;
-
49 }
-
50
-
51 // Calculate the tangent and binormal vectors for the model.
-
52 CalculateModelVectors();
-
53
-
54 // Initialize the vertex and index buffers.
-
55 result = InitializeBuffers(device);
-
56 if (!result) {
-
57 Logger::Get().Log("Failed to initialize buffers", __FILE__, __LINE__, Logger::LogLevel::Error);
-
58 return false;
-
59 }
-
60
-
61 return true;
-
62}
-
-
-
- -

◆ Initialize() [2/2]

- -
-
- - - - - - - - - - - - - - - - - - - - - -
bool model_class::Initialize (ID3D11Device * device,
ID3D11DeviceContext * deviceContext,
char * modelFilename,
const TextureContainer & textures )
-
- -

Definition at line 28 of file model_class.cpp.

-
28 {
-
29
-
30 bool result = Initialize(device, deviceContext, modelFilename);
-
31 if (!result) {
-
32 return false;
-
33 }
-
34
-
35 m_Textures = textures; // Copie de la structure de textures
-
36
-
37 return true;
-
38}
-
-
-
- -

◆ PreloadTextures()

- -
-
- - - - - - - - - - - - - - - - -
bool model_class::PreloadTextures (ID3D11Device * device,
ID3D11DeviceContext * deviceContext,
TextureContainer & textureContainer )
-
- -

Definition at line 526 of file model_class.cpp.

-
527{
-
528 HRESULT hResult;
-
529
-
530 // Charger les textures diffuses
-
531 for (const auto& texturePath : textureContainer.diffusePaths)
-
532 {
-
533 ID3D11ShaderResourceView* texture = nullptr;
-
534 hResult = DirectX::CreateWICTextureFromFile(device, deviceContext, texturePath.c_str(), nullptr, &texture);
-
535 if (FAILED(hResult))
-
536 {
-
537 Logger::Get().Log("Échec du chargement de la texture diffuse: " + std::string(texturePath.begin(), texturePath.end()), __FILE__, __LINE__, Logger::LogLevel::Error);
-
538 return false;
-
539 }
-
540 textureContainer.diffuse.push_back(texture);
-
541 }
-
542
-
543 // Charger les textures normales
-
544 for (const auto& texturePath : textureContainer.normalPaths)
-
545 {
-
546 ID3D11ShaderResourceView* texture = nullptr;
-
547 hResult = DirectX::CreateWICTextureFromFile(device, deviceContext, texturePath.c_str(), nullptr, &texture);
-
548 if (FAILED(hResult))
-
549 {
-
550 Logger::Get().Log("Échec du chargement de la texture normale: " + std::string(texturePath.begin(), texturePath.end()), __FILE__, __LINE__, Logger::LogLevel::Error);
-
551 return false;
-
552 }
-
553 textureContainer.normal.push_back(texture);
-
554 }
-
555
-
556 // Charger les textures spéculaires
-
557 for (const auto& texturePath : textureContainer.specularPaths)
-
558 {
-
559 ID3D11ShaderResourceView* texture = nullptr;
-
560 hResult = DirectX::CreateWICTextureFromFile(device, deviceContext, texturePath.c_str(), nullptr, &texture);
-
561 if (FAILED(hResult))
-
562 {
-
563 Logger::Get().Log("Échec du chargement de la texture spéculaire: " + std::string(texturePath.begin(), texturePath.end()), __FILE__, __LINE__, Logger::LogLevel::Error);
-
564 return false;
-
565 }
-
566 textureContainer.specular.push_back(texture);
-
567 }
-
568
-
569 // Charger les textures alpha
-
570 for (const auto& texturePath : textureContainer.alphaPaths)
-
571 {
-
572 ID3D11ShaderResourceView* texture = nullptr;
-
573 hResult = DirectX::CreateWICTextureFromFile(device, deviceContext, texturePath.c_str(), nullptr, &texture);
-
574 if (FAILED(hResult))
-
575 {
-
576 Logger::Get().Log("Échec du chargement de la texture alpha: " + std::string(texturePath.begin(), texturePath.end()), __FILE__, __LINE__, Logger::LogLevel::Error);
-
577 return false;
-
578 }
-
579 textureContainer.alpha.push_back(texture);
-
580 }
-
581
-
582 return true;
-
583}
-
-
-
- -

◆ Render()

- -
-
- - - - - - - -
void model_class::Render (ID3D11DeviceContext * deviceContext)
-
- -

Definition at line 79 of file model_class.cpp.

-
80{
-
81 // Put the vertex and index buffers on the graphics pipeline to prepare them for drawing.
-
82 RenderBuffers(deviceContext);
-
83
-
84 return;
-
85}
-
-
-
- -

◆ SetTextureContainer()

- -
-
- - - - - -
- - - - - - - -
void model_class::SetTextureContainer (TextureContainer & texturesContainer)
-
-inline
-
- -

Definition at line 231 of file model_class.h.

-
231{ m_Textures = texturesContainer; }
-
-
-
- -

◆ Shutdown()

- -
-
- - - - - - - -
void model_class::Shutdown ()
-
- -

Definition at line 64 of file model_class.cpp.

-
65{
-
66 // Release the model textures.
-
67 ReleaseTextures();
-
68
-
69 // Shutdown the vertex and index buffers.
-
70 ShutdownBuffers();
-
71
-
72 // Release the model data.
-
73 ReleaseModel();
-
74
-
75 return;
-
76}
-
-
-
-

Member Data Documentation

- -

◆ m_indexBuffer

- -
-
- - - - - -
- - - - -
ID3D11Buffer * model_class::m_indexBuffer
-
-protected
-
- -

Definition at line 238 of file model_class.h.

- -
-
- -

◆ m_indexCount

- -
-
- - - - - -
- - - - -
int model_class::m_indexCount
-
-protected
-
- -

Definition at line 237 of file model_class.h.

- -
-
- -

◆ m_vertexBuffer

- -
-
- - - - - -
- - - - -
ID3D11Buffer* model_class::m_vertexBuffer
-
-protected
-
- -

Definition at line 238 of file model_class.h.

- -
-
- -

◆ m_vertexCount

- -
-
- - - - - -
- - - - -
int model_class::m_vertexCount
-
-protected
-
- -

Definition at line 237 of file model_class.h.

- -
-
-
The documentation for this class was generated from the following files: -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:19bba7411f498845c5a9ab65f9fc380b41e3c4b2bb1e04736957024c9aa3b0f0 +size 69611 diff --git a/doxygen_docs/html/classmodel__class.js b/doxygen_docs/html/classmodel__class.js index 8cdd3e3..c2e5699 100644 --- a/doxygen_docs/html/classmodel__class.js +++ b/doxygen_docs/html/classmodel__class.js @@ -1,11 +1,3 @@ -var classmodel__class = -[ - [ "Face", "structmodel__class_1_1_face.html", null ], - [ "ModelType", "structmodel__class_1_1_model_type.html", null ], - [ "Normal", "structmodel__class_1_1_normal.html", null ], - [ "TempVertexType", "structmodel__class_1_1_temp_vertex_type.html", null ], - [ "Texture", "structmodel__class_1_1_texture.html", null ], - [ "VectorType", "structmodel__class_1_1_vector_type.html", null ], - [ "Vertex", "structmodel__class_1_1_vertex.html", null ], - [ "VertexType", "structmodel__class_1_1_vertex_type.html", null ] -]; \ No newline at end of file +version https://git-lfs.github.com/spec/v1 +oid sha256:2b1edcd6cbd87a66c505e1b6443d920c90f37f68c8c02973598603d12df7136f +size 564 diff --git a/doxygen_docs/html/classmulti__texture__shader__class-members.html b/doxygen_docs/html/classmulti__texture__shader__class-members.html index d612b78..1e45e0a 100644 --- a/doxygen_docs/html/classmulti__texture__shader__class-members.html +++ b/doxygen_docs/html/classmulti__texture__shader__class-members.html @@ -1,120 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
multi_texture_shader_class Member List
-
-
- -

This is the complete list of members for multi_texture_shader_class, including all inherited members.

- - - - - - - -
initialize(ID3D11Device *, HWND) (defined in multi_texture_shader_class)multi_texture_shader_class
multi_texture_shader_class() (defined in multi_texture_shader_class)multi_texture_shader_class
multi_texture_shader_class(const multi_texture_shader_class &) (defined in multi_texture_shader_class)multi_texture_shader_class
render(ID3D11DeviceContext *, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView *, ID3D11ShaderResourceView *) (defined in multi_texture_shader_class)multi_texture_shader_class
shutdown() (defined in multi_texture_shader_class)multi_texture_shader_class
~multi_texture_shader_class() (defined in multi_texture_shader_class)multi_texture_shader_class
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:d755e37c5ab47b5e43d8bb9a54bcba4ac840e8d2f8c374dd94bdd679d46a2f5f +size 6584 diff --git a/doxygen_docs/html/classmulti__texture__shader__class.html b/doxygen_docs/html/classmulti__texture__shader__class.html index e6fb6ff..146e971 100644 --- a/doxygen_docs/html/classmulti__texture__shader__class.html +++ b/doxygen_docs/html/classmulti__texture__shader__class.html @@ -1,355 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: multi_texture_shader_class Class Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
- -
multi_texture_shader_class Class Reference
-
-
- - - - - - - - - - -

-Public Member Functions

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

Detailed Description

-
-

Definition at line 23 of file multi_texture_shader_class.h.

-

Constructor & Destructor Documentation

- -

◆ multi_texture_shader_class() [1/2]

- -
-
- - - - - - - -
multi_texture_shader_class::multi_texture_shader_class ()
-
- -

Definition at line 7 of file multi_texture_shader_class.cpp.

-
8{
-
9 vertex_shader_ = 0;
-
10 pixel_shader_ = 0;
-
11 layout_ = 0;
-
12 matrix_buffer_ = 0;
-
13 sample_state_ = 0;
-
14}
-
-
-
- -

◆ multi_texture_shader_class() [2/2]

- -
-
- - - - - - - -
multi_texture_shader_class::multi_texture_shader_class (const multi_texture_shader_class & other)
-
- -

Definition at line 17 of file multi_texture_shader_class.cpp.

-
18{
-
19}
-
-
-
- -

◆ ~multi_texture_shader_class()

- -
-
- - - - - - - -
multi_texture_shader_class::~multi_texture_shader_class ()
-
- -

Definition at line 22 of file multi_texture_shader_class.cpp.

-
23{
-
24}
-
-
-
-

Member Function Documentation

- -

◆ initialize()

- -
-
- - - - - - - - - - - -
bool multi_texture_shader_class::initialize (ID3D11Device * device,
HWND hwnd )
-
- -

Definition at line 27 of file multi_texture_shader_class.cpp.

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

Definition at line 73 of file multi_texture_shader_class.cpp.

-
75{
-
76 bool result;
-
77
-
78
-
79 // Set the shader parameters that it will use for rendering.
-
80 result = set_shader_parameters(deviceContext, worldMatrix, viewMatrix, projectionMatrix, texture1, texture2);
-
81 if (!result)
-
82 {
-
83 Logger::Get().Log("Failed to set the shader parameters that it will use for rendering", __FILE__, __LINE__, Logger::LogLevel::Error);
-
84 return false;
-
85 }
-
86
-
87 // Now render the prepared buffers with the shader.
-
88 render_shader(deviceContext, indexCount);
-
89
-
90 return true;
-
91}
-
-
-
- -

◆ shutdown()

- -
-
- - - - - - - -
void multi_texture_shader_class::shutdown ()
-
- -

Definition at line 65 of file multi_texture_shader_class.cpp.

-
66{
-
67 // shutdown the vertex and pixel shaders as well as the related objects.
-
68 shutdown_shader();
-
69
-
70 return;
-
71}
-
-
-
-
The documentation for this class was generated from the following files: -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:ac0256acf2db43ada90e31ab3cb688c8d3faddd05a878b38ed109dd214702bd5 +size 23620 diff --git a/doxygen_docs/html/classnormal__map__shader__class-members.html b/doxygen_docs/html/classnormal__map__shader__class-members.html index a747c9a..984713a 100644 --- a/doxygen_docs/html/classnormal__map__shader__class-members.html +++ b/doxygen_docs/html/classnormal__map__shader__class-members.html @@ -1,120 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
normal_map_shader_class Member List
-
-
- -

This is the complete list of members for normal_map_shader_class, including all inherited members.

- - - - - - - -
initialize(ID3D11Device *, HWND) (defined in normal_map_shader_class)normal_map_shader_class
normal_map_shader_class() (defined in normal_map_shader_class)normal_map_shader_class
normal_map_shader_class(const normal_map_shader_class &) (defined in normal_map_shader_class)normal_map_shader_class
render(ID3D11DeviceContext *, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView *, ID3D11ShaderResourceView *, XMFLOAT3, XMFLOAT4) (defined in normal_map_shader_class)normal_map_shader_class
shutdown() (defined in normal_map_shader_class)normal_map_shader_class
~normal_map_shader_class() (defined in normal_map_shader_class)normal_map_shader_class
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:445807fe1934b1cb63e6f236db2080d2de5803017fff6d2959c639c3c9e8fc59 +size 6508 diff --git a/doxygen_docs/html/classnormal__map__shader__class.html b/doxygen_docs/html/classnormal__map__shader__class.html index 366703f..746517b 100644 --- a/doxygen_docs/html/classnormal__map__shader__class.html +++ b/doxygen_docs/html/classnormal__map__shader__class.html @@ -1,366 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: normal_map_shader_class Class Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
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.

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

◆ 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.

-
16{
-
17}
-
-
-
- -

◆ ~normal_map_shader_class()

- -
-
- - - - - - - -
normal_map_shader_class::~normal_map_shader_class ()
-
- -

Definition at line 20 of file normal_map_shader_class.cpp.

-
21{
-
22}
-
-
-
-

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.

-
26{
-
27 Logger::Get().Log("Initializing normal map shader", __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/normalmap.vs");
-
36 if (error != 0)
-
37 {
-
38 Logger::Get().Log("Failed to set the filename of the vertex shader", __FILE__, __LINE__);
-
39 return false;
-
40 }
-
41
-
42 // Set the filename of the pixel shader.
-
43 error = wcscpy_s(psFilename, 128, L"src/hlsl/normalmap.ps");
-
44 if (error != 0)
-
45 {
-
46 Logger::Get().Log("Failed to set the filename of the pixel shader", __FILE__, __LINE__);
-
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 the vertex and pixel shaders", __FILE__, __LINE__);
-
55 return false;
-
56 }
-
57
-
58 Logger::Get().Log("Successfully initialized normal map shader", __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 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.

-
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, texture1, texture2, lightDirection, diffuseColor);
-
80 if (!result)
-
81 {
-
82 Logger::Get().Log("Failed to set the shader parameters that will be used for rendering", __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 normal_map_shader_class::shutdown ()
-
- -

Definition at line 64 of file normal_map_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: -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:c17e08acf70ac0e2aa8296fe33c2427aa2c7029b6cffc5162f7799bf99a2e314 +size 23965 diff --git a/doxygen_docs/html/classobject-members.html b/doxygen_docs/html/classobject-members.html index 766f229..02e5823 100644 --- a/doxygen_docs/html/classobject-members.html +++ b/doxygen_docs/html/classobject-members.html @@ -1,195 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
object Member List
-
-
- -

This is the complete list of members for object, including all inherited members.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AddVelocity(float deltaTime) (defined in object)object
EnableInstancing(bool enabled) (defined in object)object
get_model() const (defined in object)objectinline
GetAcceleration() const (defined in object)object
GetActiveShader() const (defined in object)objectinline
GetAlpha() const (defined in object)objectinline
GetBoundingRadius() const (defined in object)object
GetId() const (defined in object)object
GetInitialStretch() const (defined in object)objectinline
GetInstanceBuffer() const (defined in object)object
GetInstanceCount() const (defined in object)object
GetMass() const (defined in object)object
GetModelPath() (defined in object)objectinline
GetName() (defined in object)object
GetPosition() (defined in object)object
GetRotateMatrix() const (defined in object)object
GetRotation() (defined in object)object
GetScale() (defined in object)object
GetScaleMatrix() const (defined in object)object
GetSpringConstant() const (defined in object)objectinline
GetSRMatrix() const (defined in object)object
GetTranslateMatrix() const (defined in object)object
GetType() const (defined in object)objectinline
GetVelocity() const (defined in object)object
GetWorldMatrix() const (defined in object)object
Initialize(ID3D11Device *device, ID3D11DeviceContext *deviceContext, char *modelFilename, TextureContainer &texturesContainer) (defined in object)object
IsGravityEnabled() const (defined in object)objectinline
IsGrounded() const (defined in object)object
IsInstancingEnabled() const (defined in object)object
IsPhysicsEnabled() const (defined in object)object
IsVisible() const (defined in object)objectinline
LaunchObject() (defined in object)object
LoadTexturesFromPath(std::vector< std::wstring > &texturePaths, TextureContainer &texturesContainer, d_3d_class *m_Direct3D) (defined in object)object
m_demoSpinning (defined in object)object
m_gravityEnabled (defined in object)object
m_id (defined in object)object
m_previousPosition (defined in object)object
m_velocity (defined in object)object
object(application_class &app) (defined in object)object
object() (defined in object)object
object(const object &)=delete (defined in object)object
ObjectTypeToString(ObjectType objectType) (defined in object)object
operator=(const object &)=delete (defined in object)object
SetAcceleration(XMVECTOR) (defined in object)object
SetActiveShader(ShaderType activeShader) (defined in object)objectinline
SetAlpha(float alpha) (defined in object)objectinline
SetBoundingRadius(float radius) (defined in object)objectinline
SetGravityEnabled(bool state) (defined in object)objectinline
SetGrounded(bool) (defined in object)object
SetId(int id) (defined in object)object
SetInitialStretch(float initialStretch) (defined in object)objectinline
SetInstanceCount(int count) (defined in object)object
SetMass(float) (defined in object)object
SetModel(std::shared_ptr< model_class > model) (defined in object)objectinline
SetModelPath(std::wstring &path) (defined in object)objectinline
SetName(std::string name) (defined in object)object
SetPhysicsEnabled(bool state) (defined in object)object
SetPosition(XMVECTOR position) (defined in object)object
SetRotateMatrix(XMMATRIX rotateMatrix) (defined in object)object
SetRotation(XMVECTOR rotation) (defined in object)object
SetScale(XMVECTOR scale) (defined in object)object
SetScaleMatrix(XMMATRIX scaleMatrix) (defined in object)object
SetSpringConstant(float springConstant) (defined in object)objectinline
SetSRMatrix(XMMATRIX srMatrix) (defined in object)object
SetTranslateMatrix(XMMATRIX translateMatrix) (defined in object)object
SetType(ObjectType type) (defined in object)object
SetupInstancing(ID3D11Device *device, const std::vector< XMMATRIX > &instanceTransforms) (defined in object)object
SetVelocity(XMVECTOR) (defined in object)object
SetVisible(bool state) (defined in object)objectinline
SetWorldMatrix(XMMATRIX worldMatrix) (defined in object)object
ShaderTypeToString(ShaderType shaderType) (defined in object)object
StringToObjectType(const std::string &objectType) (defined in object)object
StringToShaderType(const std::string &shaderType) (defined in object)object
Update() (defined in object)object
UpdatePosition(float deltaTime) (defined in object)object
UpdateRotateMatrix() (defined in object)object
UpdateScaleMatrix() (defined in object)object
UpdateSRMatrix() (defined in object)object
UpdateTranslateMatrix() (defined in object)object
UpdateWorldMatrix() (defined in object)object
~object() (defined in object)object
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:2958ab4a2c27dc9c5669d04e4911c3bf7015bd19db7395946adf6f349f74d02f +size 25709 diff --git a/doxygen_docs/html/classobject.html b/doxygen_docs/html/classobject.html index 70df7fd..e2d23b0 100644 --- a/doxygen_docs/html/classobject.html +++ b/doxygen_docs/html/classobject.html @@ -1,2197 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: object Class Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
- -
object Class Reference
-
-
-
-Inheritance diagram for object:
-
-
- - -physics - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

-Public Member Functions

 object (application_class &app)
 
object (const object &)=delete
 
-objectoperator= (const object &)=delete
 
bool Initialize (ID3D11Device *device, ID3D11DeviceContext *deviceContext, char *modelFilename, TextureContainer &texturesContainer)
 
void SetScaleMatrix (XMMATRIX scaleMatrix)
 
void SetRotateMatrix (XMMATRIX rotateMatrix)
 
void SetTranslateMatrix (XMMATRIX translateMatrix)
 
void SetSRMatrix (XMMATRIX srMatrix)
 
void SetWorldMatrix (XMMATRIX worldMatrix)
 
void SetPosition (XMVECTOR position)
 
void SetRotation (XMVECTOR rotation)
 
void SetScale (XMVECTOR scale)
 
XMMATRIX GetScaleMatrix () const
 
XMMATRIX GetRotateMatrix () const
 
XMMATRIX GetTranslateMatrix () const
 
XMMATRIX GetSRMatrix () const
 
XMMATRIX GetWorldMatrix () const
 
XMVECTOR GetPosition ()
 
XMVECTOR GetRotation ()
 
XMVECTOR GetScale ()
 
void SetVelocity (XMVECTOR)
 
void AddVelocity (float deltaTime)
 
XMVECTOR GetVelocity () const
 
void SetAcceleration (XMVECTOR)
 
XMVECTOR GetAcceleration () const
 
void SetMass (float)
 
float GetMass () const
 
void SetGrounded (bool)
 
bool IsGrounded () const
 
bool IsPhysicsEnabled () const
 
void SetPhysicsEnabled (bool state)
 
void SetVisible (bool state)
 
bool IsVisible () const
 
void UpdateWorldMatrix ()
 
void UpdateSRMatrix ()
 
void UpdateScaleMatrix ()
 
void UpdateRotateMatrix ()
 
void UpdateTranslateMatrix ()
 
void UpdatePosition (float deltaTime)
 
void Update ()
 
std::string GetName ()
 
void SetName (std::string name)
 
int SetId (int id)
 
int GetId () const
 
void SetType (ObjectType type)
 
ObjectType GetType () const
 
ShaderType GetActiveShader () const
 
void SetActiveShader (ShaderType activeShader)
 
float GetBoundingRadius () const
 
void SetBoundingRadius (float radius)
 
void SetModelPath (std::wstring &path)
 
std::wstring & GetModelPath ()
 
ShaderType StringToShaderType (const std::string &shaderType)
 
std::string ShaderTypeToString (ShaderType shaderType)
 
ObjectType StringToObjectType (const std::string &objectType)
 
std::string ObjectTypeToString (ObjectType objectType)
 
void LaunchObject ()
 
bool LoadTexturesFromPath (std::vector< std::wstring > &texturePaths, TextureContainer &texturesContainer, d_3d_class *m_Direct3D)
 
-bool SetupInstancing (ID3D11Device *device, const std::vector< XMMATRIX > &instanceTransforms)
 
-void EnableInstancing (bool enabled)
 
-void SetInstanceCount (int count)
 
-bool IsInstancingEnabled () const
 
-int GetInstanceCount () const
 
-ID3D11Buffer * GetInstanceBuffer () const
 
void SetAlpha (float alpha)
 
float GetAlpha () const
 
void SetInitialStretch (float initialStretch)
 
float GetInitialStretch () const
 
void SetSpringConstant (float springConstant)
 
float GetSpringConstant () const
 
bool IsGravityEnabled () const
 
void SetGravityEnabled (bool state)
 
std::shared_ptr< model_classget_model () const
 
void SetModel (std::shared_ptr< model_class > model)
 
- - - - - - - - - - - -

-Public Attributes

bool m_demoSpinning = false
 
XMVECTOR m_previousPosition
 
XMVECTOR m_velocity
 
int m_id
 
bool m_gravityEnabled = true
 
-

Detailed Description

-
-

Definition at line 29 of file object.h.

-

Constructor & Destructor Documentation

- -

◆ object() [1/2]

- -
-
- - - - - - - -
object::object (application_class & app)
-
- -

Definition at line 8 of file object.cpp.

-
8 : m_Application(app)// initialize the reference here
-
9{
-
10 m_scaleMatrix = XMMatrixIdentity();
-
11 m_rotateMatrix = XMMatrixIdentity();
-
12 m_translateMatrix = XMMatrixIdentity();
-
13 m_srMatrix = XMMatrixIdentity();
-
14 m_worldMatrix = XMMatrixIdentity();
-
15 m_previousPosition = XMVectorZero();
-
16 m_velocity = XMVectorZero();
-
17 m_acceleration = XMVectorZero();
-
18 m_mass = NULL;
-
19 m_isGrounded = false;
-
20 m_id = NULL;
-
21 m_boundingRadius = 1.0f;
-
22}
-
-
-
- -

◆ object() [2/2]

- -
-
- - - - - - - -
object::object ()
-
- -

Definition at line 24 of file object.cpp.

-
25 : m_Application(*static_cast<application_class*>(nullptr)) // Remplacer suivant votre logique
-
26{
-
27 m_scaleMatrix = XMMatrixIdentity();
-
28 m_rotateMatrix = XMMatrixIdentity();
-
29 m_translateMatrix = XMMatrixIdentity();
-
30 m_srMatrix = XMMatrixIdentity();
-
31 m_worldMatrix = XMMatrixIdentity();
-
32 m_previousPosition = XMVectorZero();
-
33 m_velocity = XMVectorZero();
-
34 m_acceleration = XMVectorZero();
-
35 m_mass = NULL;
-
36 m_isGrounded = false;
-
37 m_id = NULL;
-
38 m_boundingRadius = 1.0f;
-
39}
- -
-
-
- -

◆ ~object()

- -
-
- - - - - - - -
object::~object ()
-
- -

Definition at line 41 of file object.cpp.

-
42{
-
43}
-
-
-
-

Member Function Documentation

- -

◆ AddVelocity()

- -
-
- - - - - - - -
void object::AddVelocity (float deltaTime)
-
- -

Definition at line 240 of file object.cpp.

-
241{
-
242 m_velocity += m_acceleration * deltaTime;
-
243}
-
-
-
- -

◆ get_model()

- -
-
- - - - - -
- - - - - - - -
std::shared_ptr< model_class > object::get_model () const
-
-inline
-
- -

Definition at line 130 of file object.h.

-
130{ return m_model_; }
-
-
-
- -

◆ GetAcceleration()

- -
-
- - - - - - - -
XMVECTOR object::GetAcceleration () const
-
- -

Definition at line 255 of file object.cpp.

-
256{
-
257 return m_acceleration;
-
258}
-
-
-
- -

◆ GetActiveShader()

- -
-
- - - - - -
- - - - - - - -
ShaderType object::GetActiveShader () const
-
-inline
-
- -

Definition at line 97 of file object.h.

-
97{ return m_activeShader; };
-
-
-
- -

◆ GetAlpha()

- -
-
- - - - - -
- - - - - - - -
float object::GetAlpha () const
-
-inline
-
- -

Definition at line 121 of file object.h.

-
121{ return m_alpha; }
-
-
-
- -

◆ GetBoundingRadius()

- -
-
- - - - - - - -
float object::GetBoundingRadius () const
-
- -

Definition at line 300 of file object.cpp.

-
301{
-
302 return m_boundingRadius;
-
303}
-
-
-
- -

◆ GetId()

- -
-
- - - - - - - -
int object::GetId () const
-
- -

Definition at line 285 of file object.cpp.

-
286{
-
287 return m_id;
-
288}
-
-
-
- -

◆ GetInitialStretch()

- -
-
- - - - - -
- - - - - - - -
float object::GetInitialStretch () const
-
-inline
-
- -

Definition at line 123 of file object.h.

-
123{ return m_initialStretch; }
-
-
-
- -

◆ GetMass()

- -
-
- - - - - - - -
float object::GetMass () const
-
- -

Definition at line 265 of file object.cpp.

-
266{
-
267 return m_mass;
-
268}
-
-
-
- -

◆ GetModelPath()

- -
-
- - - - - -
- - - - - - - -
std::wstring & object::GetModelPath ()
-
-inline
-
- -

Definition at line 104 of file object.h.

-
104{ return m_modelPath; }
-
-
-
- -

◆ GetName()

- -
-
- - - - - - - -
std::string object::GetName ()
-
- -

Definition at line 225 of file object.cpp.

-
226{
-
227 return m_name;
-
228}
-
-
-
- -

◆ GetPosition()

- -
-
- - - - - - - -
XMVECTOR object::GetPosition ()
-
- -

Definition at line 123 of file object.cpp.

-
124{
-
125 XMFLOAT4X4 matrix;
-
126 XMStoreFloat4x4(&matrix, m_translateMatrix);
-
127 return XMVectorSet(matrix._41, matrix._42, matrix._43, 0.0f);
-
128}
-
-
-
- -

◆ GetRotateMatrix()

- -
-
- - - - - - - -
XMMATRIX object::GetRotateMatrix () const
-
- -

Definition at line 103 of file object.cpp.

-
104{
-
105 return m_rotateMatrix;
-
106}
-
-
-
- -

◆ GetRotation()

- -
-
- - - - - - - -
XMVECTOR object::GetRotation ()
-
- -

Definition at line 130 of file object.cpp.

-
131{
-
132 XMFLOAT4X4 matrix;
-
133 XMStoreFloat4x4(&matrix, m_rotateMatrix);
-
134 float rotationX = atan2f(matrix._32, matrix._33);
-
135 float rotationY = atan2f(-matrix._31, sqrtf(matrix._32 * matrix._32 + matrix._33 * matrix._33));
-
136 float rotationZ = atan2f(matrix._21, matrix._11);
-
137 return XMVectorSet(rotationX, rotationY, rotationZ, 0.0f);
-
138}
-
-
-
- -

◆ GetScale()

- -
-
- - - - - - - -
XMVECTOR object::GetScale ()
-
- -

Definition at line 140 of file object.cpp.

-
141{
-
142 XMFLOAT4X4 matrix;
-
143 XMStoreFloat4x4(&matrix, m_scaleMatrix);
-
144
-
145 // Utiliser des vecteurs pour les lignes de la matrice
-
146 XMVECTOR row1 = XMLoadFloat3(reinterpret_cast<XMFLOAT3*>(&matrix._11));
-
147 XMVECTOR row2 = XMLoadFloat3(reinterpret_cast<XMFLOAT3*>(&matrix._21));
-
148 XMVECTOR row3 = XMLoadFloat3(reinterpret_cast<XMFLOAT3*>(&matrix._31));
-
149
-
150 // Calculer les longueurs des vecteurs
-
151 XMVECTOR scale = XMVectorSet(
-
152 XMVectorGetX(XMVector3Length(row1)),
-
153 XMVectorGetX(XMVector3Length(row2)),
-
154 XMVectorGetX(XMVector3Length(row3)),
-
155 0.0f
-
156 );
-
157
-
158 return scale;
-
159}
-
-
-
- -

◆ GetScaleMatrix()

- -
-
- - - - - - - -
XMMATRIX object::GetScaleMatrix () const
-
- -

Definition at line 98 of file object.cpp.

-
99{
-
100 return m_scaleMatrix;
-
101}
-
-
-
- -

◆ GetSpringConstant()

- -
-
- - - - - -
- - - - - - - -
float object::GetSpringConstant () const
-
-inline
-
- -

Definition at line 125 of file object.h.

-
125{ return m_springConstant; }
-
-
-
- -

◆ GetSRMatrix()

- -
-
- - - - - - - -
XMMATRIX object::GetSRMatrix () const
-
- -

Definition at line 113 of file object.cpp.

-
114{
-
115 return m_srMatrix;
-
116}
-
-
-
- -

◆ GetTranslateMatrix()

- -
-
- - - - - - - -
XMMATRIX object::GetTranslateMatrix () const
-
- -

Definition at line 108 of file object.cpp.

-
109{
-
110 return m_translateMatrix;
-
111}
-
-
-
- -

◆ GetType()

- -
-
- - - - - -
- - - - - - - -
ObjectType object::GetType () const
-
-inline
-
- -

Definition at line 95 of file object.h.

-
95{ return m_type; };
-
-
-
- -

◆ GetVelocity()

- -
-
- - - - - - - -
XMVECTOR object::GetVelocity () const
-
- -

Definition at line 245 of file object.cpp.

-
246{
-
247 return m_velocity;
-
248}
-
-
-
- -

◆ GetWorldMatrix()

- -
-
- - - - - - - -
XMMATRIX object::GetWorldMatrix () const
-
- -

Definition at line 118 of file object.cpp.

-
119{
-
120 return m_worldMatrix;
-
121}
-
-
-
- -

◆ Initialize()

- -
-
- - - - - - - - - - - - - - - - - - - - - -
bool object::Initialize (ID3D11Device * device,
ID3D11DeviceContext * deviceContext,
char * modelFilename,
TextureContainer & texturesContainer )
-
- -

Definition at line 45 of file object.cpp.

-
51{
-
52
-
53 std::string filename(modelFilename);
-
54 auto it = g_model_cache.find(filename);
-
55 if (it != g_model_cache.end())
-
56 {
-
57 m_model_ = it->second;
-
58 }
-
59 else
-
60 {
-
61 auto new_model = std::make_shared<model_class>();
-
62 if (!new_model->Initialize(device, deviceContext, modelFilename, texturesContainer))
-
63 {
-
64 return false;
-
65 }
-
66 g_model_cache[filename] = new_model;
-
67 m_model_ = new_model;
-
68 }
-
69
-
70 return true;
-
71}
-
-
-
- -

◆ IsGravityEnabled()

- -
-
- - - - - -
- - - - - - - -
bool object::IsGravityEnabled () const
-
-inline
-
- -

Definition at line 127 of file object.h.

-
127{ return m_gravityEnabled; }
-
-
-
- -

◆ IsGrounded()

- -
-
- - - - - - - -
bool object::IsGrounded () const
-
- -

Definition at line 275 of file object.cpp.

-
276{
-
277 return m_isGrounded;
-
278}
-
-
-
- -

◆ IsPhysicsEnabled()

- -
-
- - - - - - - -
bool object::IsPhysicsEnabled () const
-
- -

Definition at line 290 of file object.cpp.

-
291{
-
292 return m_isPhysicsEnabled;
-
293}
-
-
-
- -

◆ IsVisible()

- -
-
- - - - - -
- - - - - - - -
bool object::IsVisible () const
-
-inline
-
- -

Definition at line 78 of file object.h.

-
78{ return m_isVisible; }
-
-
-
- -

◆ LaunchObject()

- -
-
- - - - - - - -
void object::LaunchObject ()
-
- -

Definition at line 359 of file object.cpp.

-
360{
-
361 // Constants
-
362 const float gravity = -9.81f;
-
363
-
364 // Convert alpha from degrees to radians if needed
-
365 float alphaRadians = m_alpha * (XM_PI / 180.0f);
-
366
-
367 // Scale factors to make the physics simulation more visible
-
368 float scaleFactor = 200.0f; // Adjust this based on your world scale
-
369
-
370 // Calculate initial velocity magnitude using the same formula as the Python code
-
371 // v_eject = l1 * sqrt(k/m) * sqrt(1 - (m*g*sin(alpha)/(k*l1))^2)
-
372 float velocityMagnitude = m_initialStretch * sqrtf(m_springConstant / m_mass) *
-
373 sqrtf(1.0f - powf((m_mass * gravity * sinf(alphaRadians) / (m_springConstant * m_initialStretch)), 2.0f));
-
374
-
375 // Apply scale factor
-
376 velocityMagnitude *= scaleFactor;
-
377
-
378 // Calculate velocity components
-
379 XMVECTOR velocity = XMVectorSet(
-
380 velocityMagnitude * cosf(alphaRadians), // vx = v0 * cos(alpha)
-
381 velocityMagnitude * sinf(alphaRadians), // vy = v0 * sin(alpha)
-
382 0.0f, // z-component (0 for 2D trajectory)
-
383 0.0f
-
384 );
-
385
-
386 // Apply velocity to object
-
387 SetVelocity(velocity);
-
388
-
389 // Enable physics for the object to handle the trajectory
-
390 SetPhysicsEnabled(true);
-
391
-
392 // Reset grounded state
-
393 SetGrounded(false);
-
394
-
395 // Debug output
-
396 char buffer[256];
-
397 sprintf_s(buffer, "Launch velocity: %f m/s at angle %f degrees", XMVectorGetX(XMVector3Length(velocity)), m_alpha);
-
398 OutputDebugStringA(buffer);
-
399}
-
-
-
- -

◆ LoadTexturesFromPath()

- -
-
- - - - - - - - - - - - - - - - -
bool object::LoadTexturesFromPath (std::vector< std::wstring > & texturePaths,
TextureContainer & texturesContainer,
d_3d_class * m_Direct3D )
-
- -

Definition at line 401 of file object.cpp.

-
403{
-
404
-
405 HRESULT result;
-
406
-
407 int i = 0;
-
408 TextureType type;
-
409 for (const auto& texturePath : texturePaths)
-
410 {
-
411 ID3D11ShaderResourceView* texture = nullptr;
-
412 result = DirectX::CreateWICTextureFromFile(m_Direct3D->get_device(), m_Direct3D->get_device_context(), texturePath.c_str(), nullptr, &texture);
-
413 if (FAILED(result))
-
414 {
-
415
-
416 // Utiliser _com_error pour obtenir des informations détaillées sur l'erreur
-
417 _com_error err(result);
-
418 LPCTSTR errMsg = err.ErrorMessage();
-
419
-
420 //convertie errMessage en std::wstring
-
421 std::wstring ws(errMsg);
-
422 std::string str(ws.begin(), ws.end());
-
423
-
424 Logger::Get().Log("Failed to load texture: " + std::string(texturePath.begin(), texturePath.end()) +
-
425 "\nError: " + std::to_string(result) +
-
426 "\nDescription: " + str,
-
427 __FILE__, __LINE__, Logger::LogLevel::Error);
-
428 return false; // Assurez-vous de retourner false ou de gérer l'erreur de manière appropriée
-
429 }
-
430 texturesContainer.AssignTexture(texturesContainer, texture,texturePath , i);
-
431 i++;
-
432
-
433 }
-
434
-
435 return true;
-
436}
-
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
-
ID3D11Device * get_device()
Gets the Direct3D device.
-
ID3D11DeviceContext * get_device_context()
Gets the Direct3D device context.
-
-
-
- -

◆ ObjectTypeToString()

- -
-
- - - - - - - -
std::string object::ObjectTypeToString (ObjectType objectType)
-
- -

Definition at line 317 of file object.cpp.

-
317 {
-
318 switch (type) {
-
319 case ObjectType::Cube: return "Cube";
-
320 case ObjectType::Sphere: return "Sphere";
-
321 // Ajoutez d'autres cas si nécessaire
-
322 default: return "Unknown";
-
323 }
-
324}
-
-
-
- -

◆ SetAcceleration()

- -
-
- - - - - - - -
void object::SetAcceleration (XMVECTOR acceleration)
-
- -

Definition at line 250 of file object.cpp.

-
251{
-
252 m_acceleration = acceleration;
-
253}
-
-
-
- -

◆ SetActiveShader()

- -
-
- - - - - -
- - - - - - - -
void object::SetActiveShader (ShaderType activeShader)
-
-inline
-
- -

Definition at line 98 of file object.h.

-
98{ m_activeShader = activeShader; };
-
-
-
- -

◆ SetAlpha()

- -
-
- - - - - -
- - - - - - - -
void object::SetAlpha (float alpha)
-
-inline
-
- -

Definition at line 120 of file object.h.

-
120{ m_alpha = alpha; }
-
-
-
- -

◆ SetBoundingRadius()

- -
-
- - - - - -
- - - - - - - -
void object::SetBoundingRadius (float radius)
-
-inline
-
- -

Definition at line 101 of file object.h.

-
101{ m_boundingRadius = radius; }
-
-
-
- -

◆ SetGravityEnabled()

- -
-
- - - - - -
- - - - - - - -
void object::SetGravityEnabled (bool state)
-
-inline
-
- -

Definition at line 128 of file object.h.

-
128{ m_gravityEnabled = state; }
-
-
-
- -

◆ SetGrounded()

- -
-
- - - - - - - -
void object::SetGrounded (bool isGrounded)
-
- -

Definition at line 270 of file object.cpp.

-
271{
-
272 m_isGrounded = isGrounded;
-
273}
-
-
-
- -

◆ SetId()

- -
-
- - - - - - - -
int object::SetId (int id)
-
- -

Definition at line 280 of file object.cpp.

-
281{
-
282 return m_id = id;
-
283}
-
-
-
- -

◆ SetInitialStretch()

- -
-
- - - - - -
- - - - - - - -
void object::SetInitialStretch (float initialStretch)
-
-inline
-
- -

Definition at line 122 of file object.h.

-
122{ m_initialStretch = initialStretch; }
-
-
-
- -

◆ SetMass()

- -
-
- - - - - - - -
void object::SetMass (float mass)
-
- -

Definition at line 260 of file object.cpp.

-
261{
-
262 m_mass = mass;
-
263}
-
-
-
- -

◆ SetModel()

- -
-
- - - - - -
- - - - - - - -
void object::SetModel (std::shared_ptr< model_class > model)
-
-inline
-
- -

Definition at line 131 of file object.h.

-
131{ m_model_ = model; }
-
-
-
- -

◆ SetModelPath()

- -
-
- - - - - -
- - - - - - - -
void object::SetModelPath (std::wstring & path)
-
-inline
-
- -

Definition at line 103 of file object.h.

-
103{ m_modelPath = path; }
-
-
-
- -

◆ SetName()

- -
-
- - - - - - - -
void object::SetName (std::string name)
-
- -

Definition at line 230 of file object.cpp.

-
231{
-
232 m_name = name;
-
233}
-
-
-
- -

◆ SetPhysicsEnabled()

- -
-
- - - - - - - -
void object::SetPhysicsEnabled (bool state)
-
- -

Definition at line 295 of file object.cpp.

-
296{
-
297 m_isPhysicsEnabled = state;
-
298}
-
-
-
- -

◆ SetPosition()

- -
-
- - - - - - - -
void object::SetPosition (XMVECTOR position)
-
- -

Definition at line 163 of file object.cpp.

-
164{
-
165 XMFLOAT4X4 matrix;
-
166 XMStoreFloat4x4(&matrix, m_translateMatrix);
-
167 matrix._41 = XMVectorGetX(position);
-
168 matrix._42 = XMVectorGetY(position);
-
169 matrix._43 = XMVectorGetZ(position);
-
170 m_translateMatrix = XMLoadFloat4x4(&matrix);
-
171}
-
-
-
- -

◆ SetRotateMatrix()

- -
-
- - - - - - - -
void object::SetRotateMatrix (XMMATRIX rotateMatrix)
-
- -

Definition at line 78 of file object.cpp.

-
79{
-
80 m_rotateMatrix = rotateMatrix;
-
81}
-
-
-
- -

◆ SetRotation()

- -
-
- - - - - - - -
void object::SetRotation (XMVECTOR rotation)
-
- -

Definition at line 173 of file object.cpp.

-
174{
-
175 XMFLOAT4X4 matrix;
-
176 XMStoreFloat4x4(&matrix, m_rotateMatrix);
-
177 XMMATRIX rotationMatrix = XMMatrixRotationRollPitchYaw(XMVectorGetX(rotation), XMVectorGetY(rotation), XMVectorGetZ(rotation));
-
178 m_rotateMatrix = rotationMatrix;
-
179}
-
-
-
- -

◆ SetScale()

- -
-
- - - - - - - -
void object::SetScale (XMVECTOR scale)
-
- -

Definition at line 181 of file object.cpp.

-
182{
-
183 XMFLOAT4X4 matrix;
-
184 XMStoreFloat4x4(&matrix, m_scaleMatrix);
-
185 matrix._11 = XMVectorGetX(scale);
-
186 matrix._22 = XMVectorGetY(scale);
-
187 matrix._33 = XMVectorGetZ(scale);
-
188 m_scaleMatrix = XMLoadFloat4x4(&matrix);
-
189}
-
-
-
- -

◆ SetScaleMatrix()

- -
-
- - - - - - - -
void object::SetScaleMatrix (XMMATRIX scaleMatrix)
-
- -

Definition at line 73 of file object.cpp.

-
74{
-
75 m_scaleMatrix = scaleMatrix;
-
76}
-
-
-
- -

◆ SetSpringConstant()

- -
-
- - - - - -
- - - - - - - -
void object::SetSpringConstant (float springConstant)
-
-inline
-
- -

Definition at line 124 of file object.h.

-
124{ m_springConstant = springConstant; }
-
-
-
- -

◆ SetSRMatrix()

- -
-
- - - - - - - -
void object::SetSRMatrix (XMMATRIX srMatrix)
-
- -

Definition at line 88 of file object.cpp.

-
89{
-
90 m_srMatrix = srMatrix;
-
91}
-
-
-
- -

◆ SetTranslateMatrix()

- -
-
- - - - - - - -
void object::SetTranslateMatrix (XMMATRIX translateMatrix)
-
- -

Definition at line 83 of file object.cpp.

-
84{
-
85 m_translateMatrix = translateMatrix;
-
86}
-
-
-
- -

◆ SetType()

- -
-
- - - - - - - -
void object::SetType (ObjectType type)
-
- -

Definition at line 312 of file object.cpp.

-
313{
-
314 m_type = type;
-
315}
-
-
-
- -

◆ SetVelocity()

- -
-
- - - - - - - -
void object::SetVelocity (XMVECTOR velocity)
-
- -

Definition at line 235 of file object.cpp.

-
236{
-
237 m_velocity = velocity;
-
238}
-
-
-
- -

◆ SetVisible()

- -
-
- - - - - -
- - - - - - - -
void object::SetVisible (bool state)
-
-inline
-
- -

Definition at line 77 of file object.h.

-
77{ m_isVisible = state; }
-
-
-
- -

◆ SetWorldMatrix()

- -
-
- - - - - - - -
void object::SetWorldMatrix (XMMATRIX worldMatrix)
-
- -

Definition at line 93 of file object.cpp.

-
94{
-
95 m_worldMatrix = worldMatrix;
-
96}
-
-
-
- -

◆ ShaderTypeToString()

- -
-
- - - - - - - -
std::string object::ShaderTypeToString (ShaderType shaderType)
-
- -

Definition at line 333 of file object.cpp.

-
333 {
-
334 switch (type) {
-
335 case ShaderType::ALPHA_MAPPING: return "ALPHA_MAPPING";
-
336 case ShaderType::CEL_SHADING: return "CEL_SHADING";
-
337 case ShaderType::NORMAL_MAPPING: return "NORMAL_MAPPING";
-
338 case ShaderType::SPECULAR_MAPPING: return "SPECULAR_MAPPING";
-
339 case ShaderType::TEXTURE: return "TEXTURE";
-
340 case ShaderType::LIGHTING: return "LIGHTING";
-
341 case ShaderType::SUNLIGHT: return "SUNLIGHT";
-
342 // Ajoutez d'autres cas si nécessaire
-
343 default: return "Unknown";
-
344 }
-
345}
-
-
-
- -

◆ StringToObjectType()

- -
-
- - - - - - - -
ObjectType object::StringToObjectType (const std::string & objectType)
-
- -

Definition at line 326 of file object.cpp.

-
326 {
-
327 if (str == "Cube") return ObjectType::Cube;
-
328 if (str == "Sphere") return ObjectType::Sphere;
-
329 // Add other cases as needed
-
330 return ObjectType::Unknown;
-
331}
-
-
-
- -

◆ StringToShaderType()

- -
-
- - - - - - - -
ShaderType object::StringToShaderType (const std::string & shaderType)
-
- -

Definition at line 347 of file object.cpp.

-
347 {
-
348 if (str == "ALPHA_MAPPING") return ShaderType::ALPHA_MAPPING;
-
349 if (str == "CEL_SHADING") return ShaderType::CEL_SHADING;
-
350 if (str == "NORMAL_MAPPING") return ShaderType::NORMAL_MAPPING;
-
351 if (str == "SPECULAR_MAPPING") return ShaderType::SPECULAR_MAPPING;
-
352 if (str == "TEXTURE") return ShaderType::TEXTURE;
-
353 if (str == "LIGHTING") return ShaderType::LIGHTING;
-
354 if (str == "SUNLIGHT") return ShaderType::SUNLIGHT;
-
355 // Add other cases as needed
-
356 return ShaderType::TEXTURE;
-
357}
-
-
-
- -

◆ Update()

- -
-
- - - - - - - -
void object::Update ()
-
- -

Definition at line 216 of file object.cpp.

-
217{
-
218 UpdateWorldMatrix();
-
219 UpdateSRMatrix();
-
220 UpdateTranslateMatrix();
-
221 UpdateRotateMatrix();
-
222 UpdateScaleMatrix();
-
223}
-
-
-
- -

◆ UpdatePosition()

- -
-
- - - - - - - -
void object::UpdatePosition (float deltaTime)
-
- -

Definition at line 305 of file object.cpp.

-
306{
-
307 XMVECTOR position = GetPosition();
-
308 position = position + GetVelocity() * deltaTime;
-
309 SetPosition(position);
-
310}
-
-
-
- -

◆ UpdateRotateMatrix()

- -
-
- - - - - - - -
void object::UpdateRotateMatrix ()
-
- -

Definition at line 206 of file object.cpp.

-
207{
-
208 m_rotateMatrix = XMMatrixRotationRollPitchYawFromVector(GetRotation());
-
209}
-
-
-
- -

◆ UpdateScaleMatrix()

- -
-
- - - - - - - -
void object::UpdateScaleMatrix ()
-
- -

Definition at line 211 of file object.cpp.

-
212{
-
213 m_scaleMatrix = XMMatrixScalingFromVector(GetScale());
-
214}
-
-
-
- -

◆ UpdateSRMatrix()

- -
-
- - - - - - - -
void object::UpdateSRMatrix ()
-
- -

Definition at line 196 of file object.cpp.

-
197{
-
198 m_srMatrix = m_scaleMatrix * m_rotateMatrix;
-
199}
-
-
-
- -

◆ UpdateTranslateMatrix()

- -
-
- - - - - - - -
void object::UpdateTranslateMatrix ()
-
- -

Definition at line 201 of file object.cpp.

-
202{
-
203 m_translateMatrix = XMMatrixTranslationFromVector(GetPosition());
-
204}
-
-
-
- -

◆ UpdateWorldMatrix()

- -
-
- - - - - - - -
void object::UpdateWorldMatrix ()
-
- -

Definition at line 191 of file object.cpp.

-
192{
-
193 m_worldMatrix = m_scaleMatrix * m_rotateMatrix * m_translateMatrix;
-
194}
-
-
-
-

Member Data Documentation

- -

◆ m_demoSpinning

- -
-
- - - - -
bool object::m_demoSpinning = false
-
- -

Definition at line 134 of file object.h.

- -
-
- -

◆ m_gravityEnabled

- -
-
- - - - -
bool object::m_gravityEnabled = true
-
- -

Definition at line 138 of file object.h.

- -
-
- -

◆ m_id

- -
-
- - - - -
int object::m_id
-
- -

Definition at line 137 of file object.h.

- -
-
- -

◆ m_previousPosition

- -
-
- - - - -
XMVECTOR object::m_previousPosition
-
- -

Definition at line 135 of file object.h.

- -
-
- -

◆ m_velocity

- -
-
- - - - -
XMVECTOR object::m_velocity
-
- -

Definition at line 136 of file object.h.

- -
-
-
The documentation for this class was generated from the following files: -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:b34911e47361eae95c30a2ca2ca765238c73ade9a6ac73f655f1eb81d8135571 +size 140365 diff --git a/doxygen_docs/html/classobject.png b/doxygen_docs/html/classobject.png index bd68884..40445e6 100644 Binary files a/doxygen_docs/html/classobject.png and b/doxygen_docs/html/classobject.png differ diff --git a/doxygen_docs/html/classphysics-members.html b/doxygen_docs/html/classphysics-members.html index af7c86c..30ac3ba 100644 --- a/doxygen_docs/html/classphysics-members.html +++ b/doxygen_docs/html/classphysics-members.html @@ -1,206 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
physics Member List
-
-
- -

This is the complete list of members for physics, including all inherited members.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AddForce(object *, XMVECTOR) (defined in physics)physics
AddVelocity(float deltaTime) (defined in object)object
ApplyGravity(object *, float) (defined in physics)physics
CubesOverlap(object *, object *) (defined in physics)physics
EnableInstancing(bool enabled) (defined in object)object
get_model() const (defined in object)objectinline
GetAcceleration() const (defined in object)object
GetActiveShader() const (defined in object)objectinline
GetAlpha() const (defined in object)objectinline
GetBoundingRadius() const (defined in object)object
GetGravity() const (defined in physics)physics
GetId() const (defined in object)object
GetInitialStretch() const (defined in object)objectinline
GetInstanceBuffer() const (defined in object)object
GetInstanceCount() const (defined in object)object
GetMass() const (defined in object)object
GetModelPath() (defined in object)objectinline
GetName() (defined in object)object
GetPosition() (defined in object)object
GetRotateMatrix() const (defined in object)object
GetRotation() (defined in object)object
GetScale() (defined in object)object
GetScaleMatrix() const (defined in object)object
GetSpringConstant() const (defined in object)objectinline
GetSRMatrix() const (defined in object)object
GetTranslateMatrix() const (defined in object)object
GetType() const (defined in object)objectinline
GetVelocity() const (defined in object)object
GetWorldMatrix() const (defined in object)object
Initialize(ID3D11Device *device, ID3D11DeviceContext *deviceContext, char *modelFilename, TextureContainer &texturesContainer) (defined in object)object
IsColliding(object *, object *) (defined in physics)physics
IsGravityEnabled() const (defined in object)objectinline
IsGrounded() const (defined in object)object
IsInstancingEnabled() const (defined in object)object
IsPhysicsEnabled() const (defined in object)object
IsVisible() const (defined in object)objectinline
LaunchObject() (defined in object)object
LoadTexturesFromPath(std::vector< std::wstring > &texturePaths, TextureContainer &texturesContainer, d_3d_class *m_Direct3D) (defined in object)object
m_demoSpinning (defined in object)object
m_gravityEnabled (defined in object)object
m_id (defined in object)object
m_previousPosition (defined in object)object
m_velocity (defined in object)object
object(application_class &app) (defined in object)object
object() (defined in object)object
object(const object &)=delete (defined in object)object
ObjectTypeToString(ObjectType objectType) (defined in object)object
operator=(const object &)=delete (defined in object)object
physics() (defined in physics)physics
physics(const physics &) (defined in physics)physicsexplicit
SetAcceleration(XMVECTOR) (defined in object)object
SetActiveShader(ShaderType activeShader) (defined in object)objectinline
SetAlpha(float alpha) (defined in object)objectinline
SetBoundingRadius(float radius) (defined in object)objectinline
SetGravity(XMVECTOR gravity) (defined in physics)physics
SetGravityEnabled(bool state) (defined in object)objectinline
SetGrounded(bool) (defined in object)object
SetId(int id) (defined in object)object
SetInitialStretch(float initialStretch) (defined in object)objectinline
SetInstanceCount(int count) (defined in object)object
SetMass(float) (defined in object)object
SetModel(std::shared_ptr< model_class > model) (defined in object)objectinline
SetModelPath(std::wstring &path) (defined in object)objectinline
SetName(std::string name) (defined in object)object
SetPhysicsEnabled(bool state) (defined in object)object
SetPosition(XMVECTOR position) (defined in object)object
SetRotateMatrix(XMMATRIX rotateMatrix) (defined in object)object
SetRotation(XMVECTOR rotation) (defined in object)object
SetScale(XMVECTOR scale) (defined in object)object
SetScaleMatrix(XMMATRIX scaleMatrix) (defined in object)object
SetSpringConstant(float springConstant) (defined in object)objectinline
SetSRMatrix(XMMATRIX srMatrix) (defined in object)object
SetTranslateMatrix(XMMATRIX translateMatrix) (defined in object)object
SetType(ObjectType type) (defined in object)object
SetupInstancing(ID3D11Device *device, const std::vector< XMMATRIX > &instanceTransforms) (defined in object)object
SetVelocity(XMVECTOR) (defined in object)object
SetVisible(bool state) (defined in object)objectinline
SetWorldMatrix(XMMATRIX worldMatrix) (defined in object)object
ShaderTypeToString(ShaderType shaderType) (defined in object)object
SphereCubeOverlap(object *, object *) (defined in physics)physics
SpheresOverlap(object *, object *) (defined in physics)physics
StringToObjectType(const std::string &objectType) (defined in object)object
StringToShaderType(const std::string &shaderType) (defined in object)object
Update() (defined in object)object
UpdatePosition(float deltaTime) (defined in object)object
UpdateRotateMatrix() (defined in object)object
UpdateScaleMatrix() (defined in object)object
UpdateSRMatrix() (defined in object)object
UpdateTranslateMatrix() (defined in object)object
UpdateWorldMatrix() (defined in object)object
~object() (defined in object)object
~physics() (defined in physics)physics
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:a63655ee1d2ffa621223c2ec1ae9948588de2a7a046d6c00e73b0aa1eb2a5fa3 +size 28590 diff --git a/doxygen_docs/html/classphysics.html b/doxygen_docs/html/classphysics.html index 08e9aa3..c437b3f 100644 --- a/doxygen_docs/html/classphysics.html +++ b/doxygen_docs/html/classphysics.html @@ -1,719 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: physics Class Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
- -
physics Class Reference
-
-
-
-Inheritance diagram for physics:
-
-
- - -object - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

-Public Member Functions

 physics (const physics &)
 
XMVECTOR GetGravity () const
 
void SetGravity (XMVECTOR gravity)
 
void ApplyGravity (object *, float)
 
void AddForce (object *, XMVECTOR)
 
bool IsColliding (object *, object *)
 
bool CubesOverlap (object *, object *)
 
bool SpheresOverlap (object *, object *)
 
bool SphereCubeOverlap (object *, object *)
 
- Public Member Functions inherited from object
 object (application_class &app)
 
object (const object &)=delete
 
-objectoperator= (const object &)=delete
 
bool Initialize (ID3D11Device *device, ID3D11DeviceContext *deviceContext, char *modelFilename, TextureContainer &texturesContainer)
 
void SetScaleMatrix (XMMATRIX scaleMatrix)
 
void SetRotateMatrix (XMMATRIX rotateMatrix)
 
void SetTranslateMatrix (XMMATRIX translateMatrix)
 
void SetSRMatrix (XMMATRIX srMatrix)
 
void SetWorldMatrix (XMMATRIX worldMatrix)
 
void SetPosition (XMVECTOR position)
 
void SetRotation (XMVECTOR rotation)
 
void SetScale (XMVECTOR scale)
 
XMMATRIX GetScaleMatrix () const
 
XMMATRIX GetRotateMatrix () const
 
XMMATRIX GetTranslateMatrix () const
 
XMMATRIX GetSRMatrix () const
 
XMMATRIX GetWorldMatrix () const
 
XMVECTOR GetPosition ()
 
XMVECTOR GetRotation ()
 
XMVECTOR GetScale ()
 
void SetVelocity (XMVECTOR)
 
void AddVelocity (float deltaTime)
 
XMVECTOR GetVelocity () const
 
void SetAcceleration (XMVECTOR)
 
XMVECTOR GetAcceleration () const
 
void SetMass (float)
 
float GetMass () const
 
void SetGrounded (bool)
 
bool IsGrounded () const
 
bool IsPhysicsEnabled () const
 
void SetPhysicsEnabled (bool state)
 
void SetVisible (bool state)
 
bool IsVisible () const
 
void UpdateWorldMatrix ()
 
void UpdateSRMatrix ()
 
void UpdateScaleMatrix ()
 
void UpdateRotateMatrix ()
 
void UpdateTranslateMatrix ()
 
void UpdatePosition (float deltaTime)
 
void Update ()
 
std::string GetName ()
 
void SetName (std::string name)
 
int SetId (int id)
 
int GetId () const
 
void SetType (ObjectType type)
 
ObjectType GetType () const
 
ShaderType GetActiveShader () const
 
void SetActiveShader (ShaderType activeShader)
 
float GetBoundingRadius () const
 
void SetBoundingRadius (float radius)
 
void SetModelPath (std::wstring &path)
 
std::wstring & GetModelPath ()
 
ShaderType StringToShaderType (const std::string &shaderType)
 
std::string ShaderTypeToString (ShaderType shaderType)
 
ObjectType StringToObjectType (const std::string &objectType)
 
std::string ObjectTypeToString (ObjectType objectType)
 
void LaunchObject ()
 
bool LoadTexturesFromPath (std::vector< std::wstring > &texturePaths, TextureContainer &texturesContainer, d_3d_class *m_Direct3D)
 
-bool SetupInstancing (ID3D11Device *device, const std::vector< XMMATRIX > &instanceTransforms)
 
-void EnableInstancing (bool enabled)
 
-void SetInstanceCount (int count)
 
-bool IsInstancingEnabled () const
 
-int GetInstanceCount () const
 
-ID3D11Buffer * GetInstanceBuffer () const
 
void SetAlpha (float alpha)
 
float GetAlpha () const
 
void SetInitialStretch (float initialStretch)
 
float GetInitialStretch () const
 
void SetSpringConstant (float springConstant)
 
float GetSpringConstant () const
 
bool IsGravityEnabled () const
 
void SetGravityEnabled (bool state)
 
std::shared_ptr< model_classget_model () const
 
void SetModel (std::shared_ptr< model_class > model)
 
- - - - - - - - - - - - -

-Additional Inherited Members

- Public Attributes inherited from object
bool m_demoSpinning = false
 
XMVECTOR m_previousPosition
 
XMVECTOR m_velocity
 
int m_id
 
bool m_gravityEnabled = true
 
-

Detailed Description

-
-

Definition at line 7 of file physics.h.

-

Constructor & Destructor Documentation

- -

◆ physics() [1/2]

- -
-
- - - - - - - -
physics::physics ()
-
- -

Definition at line 4 of file physics.cpp.

-
5{
-
6 m_gravity = XMVectorSet(0.0f, -9.81f, 0.0f, 0.0f); // initialize the gravity vector
-
7}
-
-
-
- -

◆ physics() [2/2]

- -
-
- - - - - -
- - - - - - - -
physics::physics (const physics & other)
-
-explicit
-
- -

Definition at line 9 of file physics.cpp.

-
10{
-
11 m_gravity = other.m_gravity; // Copy the gravity value
-
12}
-
-
-
- -

◆ ~physics()

- -
-
- - - - - - - -
physics::~physics ()
-
- -

Definition at line 14 of file physics.cpp.

-
15{
-
16}
-
-
-
-

Member Function Documentation

- -

◆ AddForce()

- -
-
- - - - - - - - - - - -
void physics::AddForce (object * object,
XMVECTOR force )
-
- -

Definition at line 63 of file physics.cpp.

-
64{
-
65 if (object == nullptr) // Verify if the object is not null
-
66 {
-
67 return;
-
68 }
-
69
-
70 // Get the mass of the object
-
71 float mass = object->GetMass();
-
72
-
73 // Calculate the acceleration caused by the force
-
74 XMVECTOR acceleration = force / mass;
-
75
-
76 // Add the acceleration to the object's current acceleration
-
77 object->SetAcceleration(object->GetAcceleration() + acceleration);
-
78}
- -
-
-
- -

◆ ApplyGravity()

- -
-
- - - - - - - - - - - -
void physics::ApplyGravity (object * object,
float dragValue )
-
- -

Definition at line 31 of file physics.cpp.

-
32{
-
33 if (this == nullptr || object == nullptr) // Verify if 'this' and 'object' are not null
-
34 {
-
35 return;
-
36 }
-
37
-
38 if (!object->IsGrounded()) // Verify if the object is grounded
-
39 {
-
40 // Calculate the acceleration caused by gravity
-
41 XMVECTOR gravityAcceleration = m_gravity / object->GetMass();
-
42
-
43 // Add the gravity acceleration to the object's current acceleration
-
44 object->SetAcceleration(object->GetAcceleration() + gravityAcceleration);
-
45
-
46 // Calculate the acceleration caused by drag
-
47 XMVECTOR dragAcceleration = -object->GetVelocity() * dragValue / object->GetMass();
-
48
-
49 // Add the drag acceleration to the object's current acceleration
-
50 object->SetAcceleration(object->GetAcceleration() + dragAcceleration);
-
51
-
52 // Get the object velocity
-
53 XMVECTOR velocity = object->GetVelocity();
-
54
-
55 // Update the velocity with the object's acceleration
-
56 velocity += object->GetAcceleration();
-
57
-
58 // Set the new velocity
-
59 object->SetVelocity(velocity);
-
60 }
-
61}
-
-
-
- -

◆ CubesOverlap()

- -
-
- - - - - - - - - - - -
bool physics::CubesOverlap (object * cube1,
object * cube2 )
-
- -

Definition at line 119 of file physics.cpp.

-
120{
-
121 XMVECTOR position1 = cube1->GetPosition();
-
122 XMVECTOR position2 = cube2->GetPosition();
-
123
-
124 XMVECTOR scale1 = cube1->GetScale();
-
125 XMVECTOR scale2 = cube2->GetScale();
-
126
-
127 XMVECTOR min1 = position1 - scale1;
-
128 XMVECTOR max1 = position1 + scale1;
-
129 XMVECTOR min2 = position2 - scale2;
-
130 XMVECTOR max2 = position2 + scale2;
-
131
-
132 return (min1.m128_f32[0] <= max2.m128_f32[0] && max1.m128_f32[0] >= min2.m128_f32[0] &&
-
133 min1.m128_f32[1] <= max2.m128_f32[1] && max1.m128_f32[1] >= min2.m128_f32[1] &&
-
134 min1.m128_f32[2] <= max2.m128_f32[2] && max1.m128_f32[2] >= min2.m128_f32[2]);
-
135}
-
-
-
- -

◆ GetGravity()

- -
-
- - - - - - - -
XMVECTOR physics::GetGravity () const
-
- -

Definition at line 19 of file physics.cpp.

-
20{
-
21 return m_gravity;
-
22}
-
-
-
- -

◆ IsColliding()

- -
-
- - - - - - - - - - - -
bool physics::IsColliding (object * object1,
object * object2 )
-
- -

Definition at line 80 of file physics.cpp.

-
81{
-
82 ObjectType type1 = object1->GetType();
-
83 ObjectType type2 = object2->GetType();
-
84
-
85 if (type1 == ObjectType::Unknown || type2 == ObjectType::Unknown)
-
86 {
-
87 return false;
-
88 }
-
89
-
90 if (type1 == ObjectType::Sphere && type2 == ObjectType::Sphere)
-
91 {
-
92 return SpheresOverlap(object1, object2);
-
93 }
-
94 if ((type1 == ObjectType::Cube && type2 == ObjectType::Sphere) ||
-
95 (type1 == ObjectType::Sphere && type2 == ObjectType::Cube))
-
96 {
-
97 if (type1 == ObjectType::Cube)
-
98 {
-
99 return SphereCubeOverlap(object1, object2);
-
100 }
-
101 else if (type1 == ObjectType::Sphere)
-
102 {
-
103 return SphereCubeOverlap(object2, object1);
-
104 }
-
105 }
-
106 else
-
107 {
-
108 return CubesOverlap(object1, object2);
-
109 }
-
110
-
111 return false;
-
112}
-
-
-
- -

◆ SetGravity()

- -
-
- - - - - - - -
void physics::SetGravity (XMVECTOR gravity)
-
- -

Definition at line 25 of file physics.cpp.

-
26{
-
27 m_gravity = gravity;
-
28}
-
-
-
- -

◆ SphereCubeOverlap()

- -
-
- - - - - - - - - - - -
bool physics::SphereCubeOverlap (object * cube,
object * sphere )
-
- -

Definition at line 157 of file physics.cpp.

-
158{
-
159 XMVECTOR position1 = cube->GetPosition();
-
160 XMVECTOR position2 = sphere->GetPosition();
-
161
-
162 XMVECTOR scale1 = cube->GetScale();
-
163 XMVECTOR scale2 = XMVectorScale(sphere->GetScale(), 0.5f);
-
164
-
165 XMVECTOR min1 = position1 - scale1;
-
166 XMVECTOR max1 = position1 + scale1;
-
167
-
168 // Get box closest point to sphere center by clamping
-
169 float x = max(min1.m128_f32[0], min(position2.m128_f32[0], max1.m128_f32[0]));
-
170 float y = max(min1.m128_f32[1], min(position2.m128_f32[1], max1.m128_f32[1]));
-
171 float z = max(min1.m128_f32[2], min(position2.m128_f32[2], max1.m128_f32[2]));
-
172
-
173 // This is the same as SpheresOverlap
-
174 float distance = sqrt(
-
175 (x - position2.m128_f32[0]) * (x - position2.m128_f32[0]) +
-
176 (y - position2.m128_f32[1]) * (y - position2.m128_f32[1]) +
-
177 (z - position2.m128_f32[2]) * (z - position2.m128_f32[2])
-
178 );
-
179
-
180 float radius = XMVectorGetX(XMVector3Length(scale2));
-
181
-
182 return distance < radius;
-
183}
-
-
-
- -

◆ SpheresOverlap()

- -
-
- - - - - - - - - - - -
bool physics::SpheresOverlap (object * sphere1,
object * sphere2 )
-
- -

Definition at line 137 of file physics.cpp.

-
138{
-
139 XMVECTOR position1 = sphere1->GetPosition();
-
140 XMVECTOR position2 = sphere2->GetPosition();
-
141
-
142 XMVECTOR scale1 = sphere1->GetScale() / 2;
-
143 XMVECTOR scale2 = sphere2->GetScale() / 2;
-
144
-
145 float distance = sqrt(
-
146 (position1.m128_f32[0] - position2.m128_f32[0]) * (position1.m128_f32[0] - position2.m128_f32[0]) +
-
147 (position1.m128_f32[1] - position2.m128_f32[1]) * (position1.m128_f32[1] - position2.m128_f32[1]) +
-
148 (position1.m128_f32[2] - position2.m128_f32[2]) * (position1.m128_f32[2] - position2.m128_f32[2])
-
149 );
-
150
-
151 float radius1 = XMVectorGetX(XMVector3Length(scale1));
-
152 float radius2 = XMVectorGetX(XMVector3Length(scale2));
-
153
-
154 return distance < radius1 + radius2;
-
155}
-
-
-
-
The documentation for this class was generated from the following files: -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:810d43f02eecb17d42b0c767b82173f578068f4c52875fe9623954746093dcb9 +size 76568 diff --git a/doxygen_docs/html/classphysics.png b/doxygen_docs/html/classphysics.png index 83b14f8..8c629e3 100644 Binary files a/doxygen_docs/html/classphysics.png and b/doxygen_docs/html/classphysics.png differ diff --git a/doxygen_docs/html/classposition__class-members.html b/doxygen_docs/html/classposition__class-members.html index 3642921..31b5054 100644 --- a/doxygen_docs/html/classposition__class-members.html +++ b/doxygen_docs/html/classposition__class-members.html @@ -1,124 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
position_class Member List
-
-
- -

This is the complete list of members for position_class, including all inherited members.

- - - - - - - - - - - -
GetPosition(float &, float &, float &) const (defined in position_class)position_class
GetRotation(float &, float &) const (defined in position_class)position_class
MoveCamera(bool, bool, bool, bool, bool, bool, bool, bool, bool) (defined in position_class)position_class
position_class() (defined in position_class)position_class
position_class(const position_class &) (defined in position_class)position_class
SetFrameTime(float) (defined in position_class)position_class
TurnLeft(bool) (defined in position_class)position_class
TurnMouse(float, float, float, bool) (defined in position_class)position_class
TurnRight(bool) (defined in position_class)position_class
~position_class() (defined in position_class)position_class
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:9dc170f6ea69b99ce7e5651336682dec57cc9f5af18d9c7b8f10985f3a346259 +size 7307 diff --git a/doxygen_docs/html/classposition__class.html b/doxygen_docs/html/classposition__class.html index a5708d7..f0ff9a3 100644 --- a/doxygen_docs/html/classposition__class.html +++ b/doxygen_docs/html/classposition__class.html @@ -1,615 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: position_class Class Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
- -
position_class Class Reference
-
-
- - - - - - - - - - - - - - - - - - -

-Public Member Functions

 position_class (const position_class &)
 
void SetFrameTime (float)
 
void GetRotation (float &, float &) const
 
void GetPosition (float &, float &, float &) const
 
void TurnLeft (bool)
 
void TurnRight (bool)
 
void TurnMouse (float, float, float, bool)
 
void MoveCamera (bool, bool, bool, bool, bool, bool, bool, bool, bool)
 
-

Detailed Description

-
-

Definition at line 14 of file position_class.h.

-

Constructor & Destructor Documentation

- -

◆ position_class() [1/2]

- -
-
- - - - - - - -
position_class::position_class ()
-
- -

Definition at line 3 of file position_class.cpp.

-
4{
-
5 m_frameTime = 0.0f;
-
6 m_rotationY = 0.0f;
-
7 m_rotationX = 0.0f;
-
8 m_positionX = 0.0f;
-
9 m_positionY = 0.0f;
-
10 m_positionZ = 0.0f;
-
11 m_leftTurnSpeed = 0.0f;
-
12 m_rightTurnSpeed = 0.0f;
-
13 m_horizontalTurnSpeed = 0.0f;
-
14 m_verticalTurnSpeed = 0.0f;
-
15 m_cameraSpeed = 4.0f;
-
16 m_speed = m_cameraSpeed;
-
17}
-
-
-
- -

◆ position_class() [2/2]

- -
-
- - - - - - - -
position_class::position_class (const position_class & other)
-
- -

Definition at line 20 of file position_class.cpp.

-
21{
-
22}
-
-
-
- -

◆ ~position_class()

- -
-
- - - - - - - -
position_class::~position_class ()
-
- -

Definition at line 25 of file position_class.cpp.

-
26{
-
27}
-
-
-
-

Member Function Documentation

- -

◆ GetPosition()

- -
-
- - - - - - - - - - - - - - - - -
void position_class::GetPosition (float & x,
float & y,
float & z ) const
-
- -

Definition at line 42 of file position_class.cpp.

-
43{
-
44 x = m_positionX;
-
45 y = m_positionY;
-
46 z = m_positionZ;
-
47 return;
-
48}
-
-
-
- -

◆ GetRotation()

- -
-
- - - - - - - - - - - -
void position_class::GetRotation (float & y,
float & x ) const
-
- -

Definition at line 35 of file position_class.cpp.

-
36{
-
37 y = m_rotationY;
-
38 x = m_rotationX;
-
39 return;
-
40}
-
-
-
- -

◆ MoveCamera()

- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void position_class::MoveCamera (bool forward,
bool backward,
bool left,
bool right,
bool up,
bool down,
bool scrollUp,
bool scrollDown,
bool rightClick )
-
- -

Definition at line 150 of file position_class.cpp.

-
151{
-
152 float radiansY, radiansX, speed;
-
153
-
154 // Set the speed of the camera if the right click is down.
-
155 if (scrollUp && rightClick)
-
156 {
-
157 m_cameraSpeed *= 1.1f;
-
158 }
-
159 if (scrollDown && rightClick)
-
160 {
-
161 m_cameraSpeed *= 0.9f;
-
162
-
163 if (m_cameraSpeed < 0.25f) // Minimum speed.
-
164 {
-
165 m_cameraSpeed = 0.25f;
-
166 }
-
167 }
-
168
-
169 // Convert degrees to radians.
-
170 radiansY = m_rotationY * 0.0174532925f;
-
171 radiansX = m_rotationX * 0.0174532925f;
-
172
-
174 // Update the position. //
-
176
-
177 // Moves the camera forward on a greater scale than the arrows.
-
178 if (scrollUp && !rightClick)
-
179 {
-
180 speed = m_speed * 20 * m_frameTime;
-
181 m_positionX += sinf(radiansY) * cosf(radiansX) * speed;
-
182 m_positionZ += cosf(radiansY) * cosf(radiansX) * speed;
-
183 m_positionY -= sinf(radiansX) * speed;
-
184 }
-
185
-
186 // Moves the camera backward on a greater scale than the arrows.
-
187 if (scrollDown && !rightClick)
-
188 {
-
189 speed = m_speed * 20 * m_frameTime;
-
190 m_positionX -= sinf(radiansY) * cosf(radiansX) * speed;
-
191 m_positionZ -= cosf(radiansY) * cosf(radiansX) * speed;
-
192 m_positionY += sinf(radiansX) * speed;
-
193 }
-
194
-
195 // Set the speed of the camera.
-
196 speed = m_cameraSpeed * m_frameTime;
-
197
-
198 // If moving forward, the position moves in the direction of the camera and accordingly to its angle.
-
199 if (forward)
-
200 {
-
201 m_positionX += sinf(radiansY) * cosf(radiansX) * speed;
-
202 m_positionZ += cosf(radiansY) * cosf(radiansX) * speed;
-
203 m_positionY -= sinf(radiansX) * speed;
-
204 }
-
205
-
206 // If moving backward, the position moves in the opposite direction of the camera and accordingly to its angle.
-
207 if (backward)
-
208 {
-
209 m_positionX -= sinf(radiansY) * cosf(radiansX) * speed;
-
210 m_positionZ -= cosf(radiansY) * cosf(radiansX) * speed;
-
211 m_positionY += sinf(radiansX) * speed;
-
212 }
-
213
-
214 // If moving left, the position moves to the left of the camera and accordingly to its angle.
-
215 if (left)
-
216 {
-
217 m_positionX -= cosf(radiansY) * speed;
-
218 m_positionZ += sinf(radiansY) * speed;
-
219 }
-
220
-
221 // If moving right, the position moves to the right of the camera and accordingly to its angle.
-
222 if (right)
-
223 {
-
224 m_positionX += cosf(radiansY) * speed;
-
225 m_positionZ -= sinf(radiansY) * speed;
-
226 }
-
227
-
228 // If moving up, the position moves up.
-
229 if (up)
-
230 {
-
231 m_positionY += speed;
-
232 }
-
233
-
234 // If moving down, the position moves down.
-
235 if (down)
-
236 {
-
237 m_positionY -= speed;
-
238 }
-
239
-
240 return;
-
241}
-
-
-
- -

◆ SetFrameTime()

- -
-
- - - - - - - -
void position_class::SetFrameTime (float time)
-
- -

Definition at line 29 of file position_class.cpp.

-
30{
-
31 m_frameTime = time;
-
32 return;
-
33}
-
-
-
- -

◆ TurnLeft()

- -
-
- - - - - - - -
void position_class::TurnLeft (bool keydown)
-
- -

Definition at line 50 of file position_class.cpp.

-
51{
-
52 // If the key is pressed increase the speed at which the camera turns left. If not slow down the turn speed.
-
53 if (keydown)
-
54 {
-
55 m_leftTurnSpeed += m_frameTime * 1.5f;
-
56
-
57 if (m_leftTurnSpeed > (m_frameTime * 200.0f))
-
58 {
-
59 m_leftTurnSpeed = m_frameTime * 200.0f;
-
60 }
-
61 }
-
62 else
-
63 {
-
64 m_leftTurnSpeed -= m_frameTime * 1.0f;
-
65
-
66 if (m_leftTurnSpeed < 0.0f)
-
67 {
-
68 m_leftTurnSpeed = 0.0f;
-
69 }
-
70 }
-
71
-
72 // Update the rotation using the turning speed.
-
73 m_rotationY -= m_leftTurnSpeed;
-
74 if (m_rotationY < 0.0f)
-
75 {
-
76 m_rotationY += 360.0f;
-
77 }
-
78
-
79 return;
-
80}
-
-
-
- -

◆ TurnMouse()

- -
-
- - - - - - - - - - - - - - - - - - - - - -
void position_class::TurnMouse (float deltaX,
float deltaY,
float sensitivity,
bool rightMouseDown )
-
- -

Definition at line 115 of file position_class.cpp.

-
116{
-
117 // The turning speed is proportional to the horizontal mouse movement
-
118 m_horizontalTurnSpeed = deltaX * sensitivity;
-
119
-
120 if (rightMouseDown)
-
121 {
-
122 // Update the rotation using the turning speed
-
123 m_rotationY += m_horizontalTurnSpeed;
-
124 if (m_rotationY < 0.0f)
-
125 {
-
126 m_rotationY += 360.0f;
-
127 }
-
128 else if (m_rotationY > 360.0f)
-
129 {
-
130 m_rotationY -= 360.0f;
-
131 }
-
132
-
133 // The turning speed is proportional to the vertical mouse movement
-
134 m_verticalTurnSpeed = deltaY * sensitivity;
-
135
-
136 // Update the rotation using the turning speed
-
137 m_rotationX += m_verticalTurnSpeed;
-
138 if (m_rotationX < -90.0f)
-
139 {
-
140 m_rotationX = -90.0f;
-
141 }
-
142 else if (m_rotationX > 90.0f)
-
143 {
-
144 m_rotationX = 90.0f;
-
145 }
-
146 }
-
147 return;
-
148}
-
-
-
- -

◆ TurnRight()

- -
-
- - - - - - - -
void position_class::TurnRight (bool keydown)
-
- -

Definition at line 83 of file position_class.cpp.

-
84{
-
85 // If the key is pressed increase the speed at which the camera turns right. If not slow down the turn speed.
-
86 if (keydown)
-
87 {
-
88 m_rightTurnSpeed += m_frameTime * 1.5f;
-
89
-
90 if (m_rightTurnSpeed > (m_frameTime * 200.0f))
-
91 {
-
92 m_rightTurnSpeed = m_frameTime * 200.0f;
-
93 }
-
94 }
-
95 else
-
96 {
-
97 m_rightTurnSpeed -= m_frameTime * 1.0f;
-
98
-
99 if (m_rightTurnSpeed < 0.0f)
-
100 {
-
101 m_rightTurnSpeed = 0.0f;
-
102 }
-
103 }
-
104
-
105 // Update the rotation using the turning speed.
-
106 m_rotationY += m_rightTurnSpeed;
-
107 if (m_rotationY > 360.0f)
-
108 {
-
109 m_rotationY -= 360.0f;
-
110 }
-
111
-
112 return;
-
113}
-
-
-
-
The documentation for this class was generated from the following files: -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:5593700fa96aedbfaa4791bb1c035643f631063d3eb5fe4aa2a27875056c6bcd +size 39849 diff --git a/doxygen_docs/html/classreflection__shader__class-members.html b/doxygen_docs/html/classreflection__shader__class-members.html index 123f4f7..1b5f906 100644 --- a/doxygen_docs/html/classreflection__shader__class-members.html +++ b/doxygen_docs/html/classreflection__shader__class-members.html @@ -1,120 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
reflection_shader_class Member List
-
-
- -

This is the complete list of members for reflection_shader_class, including all inherited members.

- - - - - - - -
initialize(ID3D11Device *, HWND) (defined in reflection_shader_class)reflection_shader_class
reflection_shader_class() (defined in reflection_shader_class)reflection_shader_class
reflection_shader_class(const reflection_shader_class &) (defined in reflection_shader_class)reflection_shader_class
render(ID3D11DeviceContext *, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView *, ID3D11ShaderResourceView *, XMMATRIX) (defined in reflection_shader_class)reflection_shader_class
shutdown() (defined in reflection_shader_class)reflection_shader_class
~reflection_shader_class() (defined in reflection_shader_class)reflection_shader_class
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:65ca47bf8b575351ab6ebee47dd7383ec1439e60a0d47ff996266493b2a70303 +size 6484 diff --git a/doxygen_docs/html/classreflection__shader__class.html b/doxygen_docs/html/classreflection__shader__class.html index 7c22cbd..01b0297 100644 --- a/doxygen_docs/html/classreflection__shader__class.html +++ b/doxygen_docs/html/classreflection__shader__class.html @@ -1,362 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: reflection_shader_class Class Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
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: -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:780205f8b41c961e1b417774954ce6207ed5524e58529db7226d1f469024b6ad +size 23734 diff --git a/doxygen_docs/html/classrefraction__shader__class-members.html b/doxygen_docs/html/classrefraction__shader__class-members.html index 6b85dc6..634aa0b 100644 --- a/doxygen_docs/html/classrefraction__shader__class-members.html +++ b/doxygen_docs/html/classrefraction__shader__class-members.html @@ -1,120 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
refraction_shader_class Member List
-
-
- -

This is the complete list of members for refraction_shader_class, including all inherited members.

- - - - - - - -
initialize(ID3D11Device *, HWND) (defined in refraction_shader_class)refraction_shader_class
refraction_shader_class() (defined in refraction_shader_class)refraction_shader_class
refraction_shader_class(const refraction_shader_class &) (defined in refraction_shader_class)refraction_shader_class
render(ID3D11DeviceContext *, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView *, XMFLOAT3, XMFLOAT4[], XMFLOAT4[], XMFLOAT4[], XMFLOAT4) (defined in refraction_shader_class)refraction_shader_class
shutdown() (defined in refraction_shader_class)refraction_shader_class
~refraction_shader_class() (defined in refraction_shader_class)refraction_shader_class
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:15c1c8b5d88914e802542fefce13650d14830a0f817d1b87b3d8e25545acf31a +size 6502 diff --git a/doxygen_docs/html/classrefraction__shader__class.html b/doxygen_docs/html/classrefraction__shader__class.html index be67edc..489a2c3 100644 --- a/doxygen_docs/html/classrefraction__shader__class.html +++ b/doxygen_docs/html/classrefraction__shader__class.html @@ -1,367 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: refraction_shader_class Class Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
- -
refraction_shader_class Class Reference
-
-
- - - - - - - - - - -

-Public Member Functions

 refraction_shader_class (const refraction_shader_class &)
 
bool initialize (ID3D11Device *, HWND)
 
void shutdown ()
 
bool render (ID3D11DeviceContext *, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView *, XMFLOAT3, XMFLOAT4[], XMFLOAT4[], XMFLOAT4[], XMFLOAT4)
 
-

Detailed Description

-
-

Definition at line 19 of file refraction_shader_class.h.

-

Constructor & Destructor Documentation

- -

◆ refraction_shader_class() [1/2]

- -
-
- - - - - - - -
refraction_shader_class::refraction_shader_class ()
-
- -

Definition at line 4 of file refraction_shader_class.cpp.

-
5{
-
6 vertex_shader_ = 0;
-
7 pixel_shader_ = 0;
-
8 layout_ = 0;
-
9 matrix_buffer_ = 0;
-
10 sample_state_ = 0;
-
11 light_buffer_ = 0;
-
12 clip_plane_buffer_ = 0;
-
13}
-
-
-
- -

◆ refraction_shader_class() [2/2]

- -
-
- - - - - - - -
refraction_shader_class::refraction_shader_class (const refraction_shader_class & other)
-
- -

Definition at line 16 of file refraction_shader_class.cpp.

-
17{
-
18}
-
-
-
- -

◆ ~refraction_shader_class()

- -
-
- - - - - - - -
refraction_shader_class::~refraction_shader_class ()
-
- -

Definition at line 21 of file refraction_shader_class.cpp.

-
22{
-
23}
-
-
-
-

Member Function Documentation

- -

◆ initialize()

- -
-
- - - - - - - - - - - -
bool refraction_shader_class::initialize (ID3D11Device * device,
HWND hwnd )
-
- -

Definition at line 26 of file refraction_shader_class.cpp.

-
27{
-
28 bool result;
-
29 wchar_t vsFilename[128];
-
30 wchar_t psFilename[128];
-
31 int error;
-
32
-
33 // Set the filename of the vertex shader.
-
34 error = wcscpy_s(vsFilename, 128, L"src/hlsl/refraction.vs");
-
35 if (error != 0)
-
36 {
-
37 return false;
-
38 }
-
39
-
40 // Set the filename of the pixel shader.
-
41 error = wcscpy_s(psFilename, 128, L"src/hlsl/refraction.ps");
-
42 if (error != 0)
-
43 {
-
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 return false;
-
52 }
-
53
-
54 return true;
-
55}
-
-
-
- -

◆ render()

- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool refraction_shader_class::render (ID3D11DeviceContext * deviceContext,
int indexCount,
XMMATRIX worldMatrix,
XMMATRIX viewMatrix,
XMMATRIX projectionMatrix,
ID3D11ShaderResourceView * texture,
XMFLOAT3 lightDirection,
XMFLOAT4 ambientColor[],
XMFLOAT4 diffuseColor[],
XMFLOAT4 lightPosition[],
XMFLOAT4 clipPlane )
-
- -

Definition at line 66 of file refraction_shader_class.cpp.

-
68{
-
69 bool result;
-
70
-
71
-
72 // Set the shader parameters that it will use for rendering.
-
73 result = set_shader_parameters(deviceContext, worldMatrix, viewMatrix, projectionMatrix, texture, lightDirection, ambientColor, diffuseColor, lightPosition, clipPlane);
-
74 if (!result)
-
75 {
-
76 return false;
-
77 }
-
78
-
79 // Now render the prepared buffers with the shader.
-
80 render_shader(deviceContext, indexCount);
-
81
-
82 return true;
-
83}
-
-
-
- -

◆ shutdown()

- -
-
- - - - - - - -
void refraction_shader_class::shutdown ()
-
- -

Definition at line 58 of file refraction_shader_class.cpp.

-
59{
-
60 // shutdown the vertex and pixel shaders as well as the related objects.
-
61 shutdown_shader();
-
62
-
63 return;
-
64}
-
-
-
-
The documentation for this class was generated from the following files: -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:c538c6e58c5a785d679de1d1b953c4021831f4bcaf4aa2509a6d5215239609cc +size 21249 diff --git a/doxygen_docs/html/classrender__texture__class-members.html b/doxygen_docs/html/classrender__texture__class-members.html index 878bac1..eade750 100644 --- a/doxygen_docs/html/classrender__texture__class-members.html +++ b/doxygen_docs/html/classrender__texture__class-members.html @@ -1,126 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
render_texture_class Member List
-
-
- -

This is the complete list of members for render_texture_class, including all inherited members.

- - - - - - - - - - - - - -
ClearRenderTarget(ID3D11DeviceContext *, float, float, float, float) (defined in render_texture_class)render_texture_class
GetOrthoMatrix(XMMATRIX &) (defined in render_texture_class)render_texture_class
GetProjectionMatrix(XMMATRIX &) (defined in render_texture_class)render_texture_class
GetShaderResourceView() (defined in render_texture_class)render_texture_class
GetTextureHeight() (defined in render_texture_class)render_texture_class
GetTextureWidth() (defined in render_texture_class)render_texture_class
Initialize(ID3D11Device *, int, int, float, float, int) (defined in render_texture_class)render_texture_class
render_texture_class() (defined in render_texture_class)render_texture_class
render_texture_class(const render_texture_class &) (defined in render_texture_class)render_texture_class
SetRenderTarget(ID3D11DeviceContext *) (defined in render_texture_class)render_texture_class
Shutdown() (defined in render_texture_class)render_texture_class
~render_texture_class() (defined in render_texture_class)render_texture_class
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:ac4e160479e987163d3f5013a82d6f41203e12b5d33217ca0555d80f0bb0ccf5 +size 8241 diff --git a/doxygen_docs/html/classrender__texture__class.html b/doxygen_docs/html/classrender__texture__class.html index 1a569b1..5f5268a 100644 --- a/doxygen_docs/html/classrender__texture__class.html +++ b/doxygen_docs/html/classrender__texture__class.html @@ -1,652 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: render_texture_class Class Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
- -
render_texture_class Class Reference
-
-
- - - - - - - - - - - - - - - - - - - - - - -

-Public Member Functions

 render_texture_class (const render_texture_class &)
 
bool Initialize (ID3D11Device *, int, int, float, float, int)
 
void Shutdown ()
 
void SetRenderTarget (ID3D11DeviceContext *)
 
void ClearRenderTarget (ID3D11DeviceContext *, float, float, float, float)
 
ID3D11ShaderResourceView * GetShaderResourceView ()
 
void GetProjectionMatrix (XMMATRIX &)
 
void GetOrthoMatrix (XMMATRIX &)
 
int GetTextureWidth ()
 
int GetTextureHeight ()
 
-

Detailed Description

-
-

Definition at line 20 of file render_texture_class.h.

-

Constructor & Destructor Documentation

- -

◆ render_texture_class() [1/2]

- -
-
- - - - - - - -
render_texture_class::render_texture_class ()
-
- -

Definition at line 3 of file render_texture_class.cpp.

-
4{
-
5 m_renderTargetTexture = 0;
-
6 m_renderTargetView = 0;
-
7 m_shaderResourceView = 0;
-
8 m_depthStencilBuffer = 0;
-
9 m_depthStencilView = 0;
-
10}
-
-
-
- -

◆ render_texture_class() [2/2]

- -
-
- - - - - - - -
render_texture_class::render_texture_class (const render_texture_class & other)
-
- -

Definition at line 13 of file render_texture_class.cpp.

-
14{
-
15}
-
-
-
- -

◆ ~render_texture_class()

- -
-
- - - - - - - -
render_texture_class::~render_texture_class ()
-
- -

Definition at line 18 of file render_texture_class.cpp.

-
19{
-
20}
-
-
-
-

Member Function Documentation

- -

◆ ClearRenderTarget()

- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - -
void render_texture_class::ClearRenderTarget (ID3D11DeviceContext * deviceContext,
float red,
float green,
float blue,
float alpha )
-
- -

Definition at line 213 of file render_texture_class.cpp.

-
214{
-
215 float color[4];
-
216
-
217
-
218 // Setup the color to clear the buffer to.
-
219 color[0] = red;
-
220 color[1] = green;
-
221 color[2] = blue;
-
222 color[3] = alpha;
-
223
-
224 // Clear the back buffer.
-
225 deviceContext->ClearRenderTargetView(m_renderTargetView, color);
-
226
-
227 // Clear the depth buffer.
-
228 deviceContext->ClearDepthStencilView(m_depthStencilView, D3D11_CLEAR_DEPTH, 1.0f, 0);
-
229
-
230 return;
-
231}
-
-
-
- -

◆ GetOrthoMatrix()

- -
-
- - - - - - - -
void render_texture_class::GetOrthoMatrix (XMMATRIX & orthoMatrix)
-
- -

Definition at line 245 of file render_texture_class.cpp.

-
246{
-
247 orthoMatrix = m_orthoMatrix;
-
248 return;
-
249}
-
-
-
- -

◆ GetProjectionMatrix()

- -
-
- - - - - - - -
void render_texture_class::GetProjectionMatrix (XMMATRIX & projectionMatrix)
-
- -

Definition at line 238 of file render_texture_class.cpp.

-
239{
-
240 projectionMatrix = m_projectionMatrix;
-
241 return;
-
242}
-
-
-
- -

◆ GetShaderResourceView()

- -
-
- - - - - - - -
ID3D11ShaderResourceView * render_texture_class::GetShaderResourceView ()
-
- -

Definition at line 233 of file render_texture_class.cpp.

-
234{
-
235 return m_shaderResourceView;
-
236}
-
-
-
- -

◆ GetTextureHeight()

- -
-
- - - - - - - -
int render_texture_class::GetTextureHeight ()
-
- -

Definition at line 258 of file render_texture_class.cpp.

-
259{
-
260 return m_textureHeight;
-
261}
-
-
-
- -

◆ GetTextureWidth()

- -
-
- - - - - - - -
int render_texture_class::GetTextureWidth ()
-
- -

Definition at line 252 of file render_texture_class.cpp.

-
253{
-
254 return m_textureWidth;
-
255}
-
-
-
- -

◆ Initialize()

- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool render_texture_class::Initialize (ID3D11Device * device,
int textureWidth,
int textureHeight,
float screenDepth,
float screenNear,
int format )
-
- -

Definition at line 22 of file render_texture_class.cpp.

-
23{
-
24 Logger::Get().Log("Initializing render_texture_class", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
25
-
26 D3D11_TEXTURE2D_DESC textureDesc;
-
27 HRESULT result;
-
28 D3D11_RENDER_TARGET_VIEW_DESC renderTargetViewDesc;
-
29 D3D11_SHADER_RESOURCE_VIEW_DESC shaderResourceViewDesc;
-
30 D3D11_TEXTURE2D_DESC depthBufferDesc;
-
31 D3D11_DEPTH_STENCIL_VIEW_DESC depthStencilViewDesc;
-
32 DXGI_FORMAT textureFormat;
-
33
-
34
-
35 // Set the texture format.
-
36 switch (format)
-
37 {
-
38 case 1:
-
39 {
-
40 textureFormat = DXGI_FORMAT_R8G8B8A8_UNORM;
-
41 break;
-
42 }
-
43 default:
-
44 {
-
45 textureFormat = DXGI_FORMAT_R8G8B8A8_UNORM;
-
46 break;
-
47 }
-
48 }
-
49
-
50 // Store the width and height of the render texture.
-
51 m_textureWidth = textureWidth;
-
52 m_textureHeight = textureHeight;
-
53
-
54 // Initialize the render target texture description.
-
55 ZeroMemory(&textureDesc, sizeof(textureDesc));
-
56
-
57 // Setup the render target texture description.
-
58 textureDesc.Width = textureWidth;
-
59 textureDesc.Height = textureHeight;
-
60 textureDesc.MipLevels = 1;
-
61 textureDesc.ArraySize = 1;
-
62 textureDesc.Format = textureFormat;
-
63 textureDesc.SampleDesc.Count = 1;
-
64 textureDesc.Usage = D3D11_USAGE_DEFAULT;
-
65 textureDesc.BindFlags = D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE;
-
66 textureDesc.CPUAccessFlags = 0;
-
67 textureDesc.MiscFlags = 0;
-
68
-
69 // Create the render target texture.
-
70 result = device->CreateTexture2D(&textureDesc, NULL, &m_renderTargetTexture);
-
71 if (FAILED(result))
-
72 {
-
73 Logger::Get().Log("Failed to create render target texture", __FILE__, __LINE__, Logger::LogLevel::Error);
-
74 return false;
-
75 }
-
76
-
77 // Setup the description of the render target view.
-
78 renderTargetViewDesc.Format = textureDesc.Format;
-
79 renderTargetViewDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
-
80 renderTargetViewDesc.Texture2D.MipSlice = 0;
-
81
-
82 // Create the render target view.
-
83 result = device->CreateRenderTargetView(m_renderTargetTexture, &renderTargetViewDesc, &m_renderTargetView);
-
84 if (FAILED(result))
-
85 {
-
86 Logger::Get().Log("Failed to create render target view", __FILE__, __LINE__, Logger::LogLevel::Error);
-
87 return false;
-
88 }
-
89
-
90 // Setup the description of the shader resource view.
-
91 shaderResourceViewDesc.Format = textureDesc.Format;
-
92 shaderResourceViewDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
-
93 shaderResourceViewDesc.Texture2D.MostDetailedMip = 0;
-
94 shaderResourceViewDesc.Texture2D.MipLevels = 1;
-
95
-
96 // Create the shader resource view.
-
97 result = device->CreateShaderResourceView(m_renderTargetTexture, &shaderResourceViewDesc, &m_shaderResourceView);
-
98 if (FAILED(result))
-
99 {
-
100 Logger::Get().Log("Failed to create shader resource view", __FILE__, __LINE__, Logger::LogLevel::Error);
-
101 return false;
-
102 }
-
103
-
104 // Initialize the description of the depth buffer.
-
105 ZeroMemory(&depthBufferDesc, sizeof(depthBufferDesc));
-
106
-
107 // Set up the description of the depth buffer.
-
108 depthBufferDesc.Width = textureWidth;
-
109 depthBufferDesc.Height = textureHeight;
-
110 depthBufferDesc.MipLevels = 1;
-
111 depthBufferDesc.ArraySize = 1;
-
112 depthBufferDesc.Format = DXGI_FORMAT_D24_UNORM_S8_UINT;
-
113 depthBufferDesc.SampleDesc.Count = 1;
-
114 depthBufferDesc.SampleDesc.Quality = 0;
-
115 depthBufferDesc.Usage = D3D11_USAGE_DEFAULT;
-
116 depthBufferDesc.BindFlags = D3D11_BIND_DEPTH_STENCIL;
-
117 depthBufferDesc.CPUAccessFlags = 0;
-
118 depthBufferDesc.MiscFlags = 0;
-
119
-
120 // Create the texture for the depth buffer using the filled out description.
-
121 result = device->CreateTexture2D(&depthBufferDesc, NULL, &m_depthStencilBuffer);
-
122 if (FAILED(result))
-
123 {
-
124 Logger::Get().Log("Failed to create depth buffer texture", __FILE__, __LINE__, Logger::LogLevel::Error);
-
125 return false;
-
126 }
-
127
-
128 // Initailze the depth stencil view description.
-
129 ZeroMemory(&depthStencilViewDesc, sizeof(depthStencilViewDesc));
-
130
-
131 // Set up the depth stencil view description.
-
132 depthStencilViewDesc.Format = DXGI_FORMAT_D24_UNORM_S8_UINT;
-
133 depthStencilViewDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D;
-
134 depthStencilViewDesc.Texture2D.MipSlice = 0;
-
135
-
136 // Create the depth stencil view.
-
137 result = device->CreateDepthStencilView(m_depthStencilBuffer, &depthStencilViewDesc, &m_depthStencilView);
-
138 if (FAILED(result))
-
139 {
-
140 Logger::Get().Log("Failed to create depth stencil view", __FILE__, __LINE__, Logger::LogLevel::Error);
-
141 return false;
-
142 }
-
143
-
144 // Setup the viewport for rendering.
-
145 m_viewport.Width = (float)textureWidth;
-
146 m_viewport.Height = (float)textureHeight;
-
147 m_viewport.MinDepth = 0.0f;
-
148 m_viewport.MaxDepth = 1.0f;
-
149 m_viewport.TopLeftX = 0;
-
150 m_viewport.TopLeftY = 0;
-
151
-
152 // Setup the projection matrix.
-
153 m_projectionMatrix = XMMatrixPerspectiveFovLH((3.141592654f / 4.0f), ((float)textureWidth / (float)textureHeight), screenNear, screenDepth);
-
154
-
155 // Create an orthographic projection matrix for 2D rendering.
-
156 m_orthoMatrix = XMMatrixOrthographicLH((float)textureWidth, (float)textureHeight, screenNear, screenDepth);
-
157
-
158 Logger::Get().Log("render_texture_class initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
159
-
160 return true;
-
161}
-
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
-
-
-
- -

◆ SetRenderTarget()

- -
-
- - - - - - - -
void render_texture_class::SetRenderTarget (ID3D11DeviceContext * deviceContext)
-
- -

Definition at line 202 of file render_texture_class.cpp.

-
203{
-
204 // Bind the render target view and depth stencil buffer to the output render pipeline.
-
205 deviceContext->OMSetRenderTargets(1, &m_renderTargetView, m_depthStencilView);
-
206
-
207 // Set the viewport.
-
208 deviceContext->RSSetViewports(1, &m_viewport);
-
209
-
210 return;
-
211}
-
-
-
- -

◆ Shutdown()

- -
-
- - - - - - - -
void render_texture_class::Shutdown ()
-
- -

Definition at line 163 of file render_texture_class.cpp.

-
164{
-
165 Logger::Get().Log("Shutting down render_texture_class", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
166
-
167 if (m_depthStencilView)
-
168 {
-
169 m_depthStencilView->Release();
-
170 m_depthStencilView = 0;
-
171 }
-
172
-
173 if (m_depthStencilBuffer)
-
174 {
-
175 m_depthStencilBuffer->Release();
-
176 m_depthStencilBuffer = 0;
-
177 }
-
178
-
179 if (m_shaderResourceView)
-
180 {
-
181 m_shaderResourceView->Release();
-
182 m_shaderResourceView = 0;
-
183 }
-
184
-
185 if (m_renderTargetView)
-
186 {
-
187 m_renderTargetView->Release();
-
188 m_renderTargetView = 0;
-
189 }
-
190
-
191 if (m_renderTargetTexture)
-
192 {
-
193 m_renderTargetTexture->Release();
-
194 m_renderTargetTexture = 0;
-
195 }
-
196
-
197 Logger::Get().Log("render_texture_class shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
198
-
199 return;
-
200}
-
-
-
-
The documentation for this class was generated from the following files: -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:f3d59d1b6ec4509d8f70e29135206c55851d99ca1e80f86e81c77eeae2cd3295 +size 47736 diff --git a/doxygen_docs/html/classscene__manager-members.html b/doxygen_docs/html/classscene__manager-members.html index 7682f0a..1d12554 100644 --- a/doxygen_docs/html/classscene__manager-members.html +++ b/doxygen_docs/html/classscene__manager-members.html @@ -1,123 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
scene_manager Member List
-
-
- -

This is the complete list of members for scene_manager, including all inherited members.

- - - - - - - - - - -
convert_w_string_to_string(const std::wstring &w_str)scene_manager
get_scene_path()scene_manager
initialize(application_class *app)scene_manager
load_scene()scene_manager
save_scene()scene_manager
save_scene_as()scene_manager
scene_manager() (defined in scene_manager)scene_manager
shutdown()scene_manager
~scene_manager() (defined in scene_manager)scene_manager
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:111eb4740cb202b7365c9c6e28c3bf2c8362d3dc05bf3e5e8cf8bf4f96d39f14 +size 6744 diff --git a/doxygen_docs/html/classscene__manager.html b/doxygen_docs/html/classscene__manager.html index c4c7a12..8f1b6de 100644 --- a/doxygen_docs/html/classscene__manager.html +++ b/doxygen_docs/html/classscene__manager.html @@ -1,801 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: scene_manager Class Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
- -
scene_manager Class Reference
-
-
- - - - - - - - - - - - - - - - -

-Public Member Functions

bool initialize (application_class *app)
 
bool shutdown ()
 
bool save_scene_as ()
 
bool save_scene ()
 
bool load_scene ()
 
std::wstring get_scene_path ()
 
std::string convert_w_string_to_string (const std::wstring &w_str)
 
-

Detailed Description

-
-

Definition at line 12 of file scene_manager.h.

-

Constructor & Destructor Documentation

- -

◆ scene_manager()

- -
-
- - - - - - - -
scene_manager::scene_manager ()
-
- -

Definition at line 4 of file scene_manager.cpp.

-
5{
-
6}
-
-
-
- -

◆ ~scene_manager()

- -
-
- - - - - - - -
scene_manager::~scene_manager ()
-
- -

Definition at line 8 of file scene_manager.cpp.

-
9{
-
10 shutdown();
-
11}
- -
-
-
-

Member Function Documentation

- -

◆ convert_w_string_to_string()

- -
-
- - - - - - - -
std::string scene_manager::convert_w_string_to_string (const std::wstring & w_str)
-
-

Convert a wide string to a standard string.

Parameters
- - -
w_str
-
-
-
Returns
The converted string.
- -

Definition at line 444 of file scene_manager.cpp.

-
445{
-
446 if (wstr.empty()) return std::string();
-
447
-
448 int size_needed = WideCharToMultiByte(CP_UTF8, 0, &wstr[0], (int)wstr.size(), NULL, 0, NULL, NULL);
-
449 std::string str(size_needed, 0);
-
450 WideCharToMultiByte(CP_UTF8, 0, &wstr[0], (int)wstr.size(), &str[0], size_needed, NULL, NULL);
-
451 return str;
-
452}
-
-
-
- -

◆ get_scene_path()

- -
-
- - - - - - - -
std::wstring scene_manager::get_scene_path ()
-
-

Get the current scene path.

Returns
The path to the current scene as a string.
- -

Definition at line 418 of file scene_manager.cpp.

-
419{
-
420 OPENFILENAME ofn;
-
421 wchar_t szFile[260];
-
422
-
423 ZeroMemory(&ofn, sizeof(ofn));
-
424 ofn.lStructSize = sizeof(ofn);
-
425 ofn.hwndOwner = app_->get_hwnd();
-
426 ofn.lpstrFile = szFile;
-
427 ofn.lpstrFile[0] = '\0';
-
428 ofn.nMaxFile = sizeof(szFile);
-
429 ofn.lpstrFilter = L"Ker Scene\0*.ker\0";
-
430 ofn.nFilterIndex = 1;
-
431 ofn.lpstrFileTitle = NULL;
-
432 ofn.nMaxFileTitle = 0;
-
433 ofn.lpstrInitialDir = NULL;
-
434 ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
-
435
-
436 if (GetOpenFileName(&ofn) == TRUE)
-
437 {
-
438 std::filesystem::path filepath = ofn.lpstrFile;
-
439 return filepath.wstring();
-
440 }
-
441 return L"";
-
442}
- -
-
-
- -

◆ initialize()

- -
-
- - - - - - - -
bool scene_manager::initialize (application_class * app)
-
-

Initialize the scene manager with the application instance.

Parameters
- - -
appPointer to the application class instance.
-
-
-
Returns
True if initialization is successful, otherwise false.
- -

Definition at line 13 of file scene_manager.cpp.

-
14{
-
15 if (!app) {
-
16 Logger::Get().Log("Application pointer is null", __FILE__, __LINE__, Logger::LogLevel::Error);
-
17 return false;
-
18 }
-
19
-
20 app_ = app;
-
21 return true;
-
22}
-
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
-
-
-
- -

◆ load_scene()

- -
-
- - - - - - - -
bool scene_manager::load_scene ()
-
-

Function to load a scene from a file. This function will prompt the user to choose a file to load.

Returns
True if the scene was loaded successfully, otherwise false.
- -

Definition at line 67 of file scene_manager.cpp.

-
67 {
-
68 Logger::Get().Log("Loading scene from " , __FILE__, __LINE__, Logger::LogLevel::Info);
-
69
-
70 object_id_ = app_->get_object_id();
-
71 w_folder_ = app_->get_w_folder();
-
72 direct_3d_ = app_->get_direct_3d();
-
73 std::wstring scenePath = get_scene_path();
-
74
-
75 if (!scenePath.empty()) {
-
76 scene_path_ = convert_w_string_to_string(scenePath);
-
77 }
-
78
-
79 std::ifstream inFile(scene_path_);
-
80 if (!inFile.is_open()) {
-
81 Logger::Get().Log("Failed to open file for loading scene: " + scene_path_, __FILE__, __LINE__, Logger::LogLevel::Error);
-
82 return false;
-
83 }
-
84
-
85 // Réinitialiser l'ID d'objet le plus élevé
-
86 object_id_ = 0;
-
87
-
88 // Récupérer l'EntityManager pour créer de nouvelles entités
-
89 auto entity_manager = app_->get_entity_manager();
-
90
-
91 // Supprimer toutes les entités existantes
-
92 entity_manager->Clear();
-
93
-
94 // Sauvegarder le répertoire de travail actuel
-
95 std::wstring currentDirectory = w_folder_;
-
96
-
97 std::string line;
-
98 while (std::getline(inFile, line)) {
-
99 std::istringstream iss(line);
-
100 int id;
-
101 std::string name;
-
102 XMFLOAT3 position, rotation, scale;
-
103 std::string modelPath;
-
104 std::string shaderTypeStr;
-
105 float boundingRadius;
-
106 std::string objectTypeStr;
-
107 float mass;
-
108 bool physicsEnabled;
-
109
-
110 // Lire les données de base de l'entité
-
111 iss >> id >> name
-
112 >> position.x >> position.y >> position.z
-
113 >> rotation.x >> rotation.y >> rotation.z
-
114 >> scale.x >> scale.y >> scale.z;
-
115
-
116 // Lire le chemin du modèle - vérifier s'il est vide
-
117 iss >> modelPath;
-
118
-
119 // Si le chemin du modèle est vide ou commence par une lettre majuscule (probablement un type de shader),
-
120 // c'est qu'il a été omis - utilisez une valeur par défaut
-
121 if (modelPath.empty() || (modelPath[0] >= 'A' && modelPath[0] <= 'Z')) {
-
122 // Reculer le curseur de lecture pour lire le type de shader à la place
-
123 iss.seekg(-static_cast<int>(modelPath.length()), std::ios::cur);
-
124 modelPath = "assets/Model/TXT/cube.txt"; // Valeur par défaut
-
125 }
-
126
-
127 iss >> shaderTypeStr
-
128 >> boundingRadius >> objectTypeStr
-
129 >> mass >> physicsEnabled;
-
130
-
131 if (iss.fail()) {
-
132 Logger::Get().Log("Failed to parse entity data: " + line, __FILE__, __LINE__, Logger::LogLevel::Error);
-
133 continue;
-
134 }
-
135
-
136 // Mettre à jour l'ID d'objet le plus élevé si nécessaire
-
137 if (id >= object_id_) {
-
138 object_id_ = id + 1;
-
139 }
-
140
-
141 // Convertir le chemin du modèle en wstring
-
142 std::wstring wModelPath(modelPath.begin(), modelPath.end());
-
143
-
144 // Vérifier si le chemin est relatif
-
145 if (modelPath != "NoModel" && modelPath.length() > 1 && modelPath[1] != ':') {
-
146 // C'est un chemin relatif, préfixer avec le répertoire de travail
-
147 if (currentDirectory.back() != L'/' && currentDirectory.back() != L'\\') {
-
148 // Ajouter un séparateur si nécessaire
-
149 wModelPath = currentDirectory + L"\\" + wModelPath;
-
150 } else {
-
151 wModelPath = currentDirectory + wModelPath;
-
152 }
-
153 }
-
154
-
155 // Créer le conteneur de textures pour stocker les chemins
-
156 TextureContainer objectTextures;
-
157
-
158 // Vider les conteneurs de chemins de textures
-
159 objectTextures.diffusePaths.clear();
-
160 objectTextures.normalPaths.clear();
-
161 objectTextures.specularPaths.clear();
-
162 objectTextures.alphaPaths.clear();
-
163
-
164 // Lire les chemins des textures diffuses
-
165 int diffuseTextureCount;
-
166 iss >> diffuseTextureCount;
-
167 for (int i = 0; i < diffuseTextureCount; i++) {
-
168 std::string texturePath;
-
169 iss >> texturePath;
-
170 std::wstring wTexturePath(texturePath.begin(), texturePath.end());
-
171 objectTextures.diffusePaths.push_back(wTexturePath);
-
172 }
-
173
-
174 // Lire les chemins des textures normales
-
175 int normalTextureCount;
-
176 iss >> normalTextureCount;
-
177 for (int i = 0; i < normalTextureCount; i++) {
-
178 std::string texturePath;
-
179 iss >> texturePath;
-
180 std::wstring wTexturePath(texturePath.begin(), texturePath.end());
-
181 objectTextures.normalPaths.push_back(wTexturePath);
-
182 }
-
183
-
184 // Lire les chemins des textures spéculaires
-
185 int specularTextureCount;
-
186 iss >> specularTextureCount;
-
187 for (int i = 0; i < specularTextureCount; i++) {
-
188 std::string texturePath;
-
189 iss >> texturePath;
-
190 std::wstring wTexturePath(texturePath.begin(), texturePath.end());
-
191 objectTextures.specularPaths.push_back(wTexturePath);
-
192 }
-
193
-
194 // Lire les chemins des textures alpha
-
195 int alphaTextureCount;
-
196 iss >> alphaTextureCount;
-
197 for (int i = 0; i < alphaTextureCount; i++) {
-
198 std::string texturePath;
-
199 iss >> texturePath;
-
200 std::wstring wTexturePath(texturePath.begin(), texturePath.end());
-
201 objectTextures.alphaPaths.push_back(wTexturePath);
-
202 }
-
203
-
204 // Vérifier si on a un modèle à charger
-
205 if (modelPath == "NoModel") {
-
206 Logger::Get().Log("Skipping entity without model: " + name, __FILE__, __LINE__, Logger::LogLevel::Warning);
-
207 continue;
-
208 }
-
209
-
210 // Récupérer le cache de modèles de l'application
-
211 auto& modelCache = app_->get_model_cache();
-
212 std::shared_ptr<model_class> sharedModel;
-
213
-
214 // Vérifier si le modèle existe déjà dans le cache
-
215 std::string modelKey = modelPath;
-
216 auto it = modelCache.find(modelKey);
-
217 if (it != modelCache.end()) {
-
218 // Utiliser le modèle existant du cache
-
219 Logger::Get().Log("Using cached model for: " + modelKey, __FILE__, __LINE__, Logger::LogLevel::Info);
-
220 sharedModel = it->second;
-
221 } else {
-
222 // Créer un nouveau modèle
-
223 char modelFilename[256];
-
224 size_t convertedChars = 0;
-
225 wcstombs_s(&convertedChars, modelFilename, sizeof(modelFilename), wModelPath.c_str(), _TRUNCATE);
-
226
-
227 Logger::Get().Log("Loading model: " + std::string(modelFilename), __FILE__, __LINE__, Logger::LogLevel::Info);
-
228
-
229 // Créer et initialiser le modèle
-
230 auto newModel = std::make_shared<model_class>();
-
231
-
232 // Précharger les textures
-
233 if (!newModel->PreloadTextures(direct_3d_->get_device(), direct_3d_->get_device_context(), objectTextures)) {
-
234 Logger::Get().Log("Failed to preload textures for: " + name, __FILE__, __LINE__, Logger::LogLevel::Error);
-
235 continue;
-
236 }
-
237
-
238 if (!newModel->Initialize(direct_3d_->get_device(), direct_3d_->get_device_context(), modelFilename, objectTextures)) {
-
239 Logger::Get().Log("Failed to initialize model: " + name, __FILE__, __LINE__, Logger::LogLevel::Error);
-
240 continue;
-
241 }
-
242
-
243 // Ajouter le modèle au cache
-
244 modelCache[modelKey] = newModel;
-
245 sharedModel = newModel;
-
246 }
-
247
-
248 // Créer une nouvelle entité avec l'EntityManager
-
249 auto entity = entity_manager->CreateEntity();
-
250
-
251 // Ajouter un composant d'identité
-
252 auto identityComponent = entity->AddComponent<ecs::IdentityComponent>(id);
-
253 identityComponent->SetName(name);
-
254 identityComponent->SetType(ecs::IdentityComponent::StringToObjectType(objectTypeStr));
-
255
-
256 // Ajouter un composant de transformation
-
257 auto transformComponent = entity->AddComponent<ecs::TransformComponent>();
-
258 transformComponent->SetPosition(XMLoadFloat3(&position));
-
259 transformComponent->SetRotation(XMLoadFloat3(&rotation));
-
260 transformComponent->SetScale(XMLoadFloat3(&scale));
-
261 transformComponent->UpdateWorldMatrix();
-
262
-
263 // Ajouter un composant de rendu avec le modèle
-
264 auto renderComponent = entity->AddComponent<ecs::RenderComponent>();
-
265 renderComponent->InitializeWithModel(sharedModel);
-
266
-
267 // Ajouter un composant de shader
-
268 auto shaderComponent = entity->AddComponent<ecs::ShaderComponent>();
-
269 shaderComponent->SetActiveShader(ecs::ShaderComponent::StringToShaderType(shaderTypeStr));
-
270
-
271 // Ajouter un composant de chemin de modèle
-
272 auto modelPathComponent = entity->AddComponent<ecs::ModelPathComponent>();
-
273 modelPathComponent->SetPath(wModelPath);
-
274
-
275 // Ajouter un composant de physique si nécessaire
-
276 auto physicsComponent = entity->AddComponent<ecs::PhysicsComponent>();
-
277 physicsComponent->Initialize();
-
278 physicsComponent->SetMass(mass);
-
279 physicsComponent->SetBoundingRadius(boundingRadius);
-
280 physicsComponent->SetPhysicsEnabled(physicsEnabled);
-
281
-
282 Logger::Get().Log("Entity loaded: " + name + " with ID: " + std::to_string(id), __FILE__, __LINE__, Logger::LogLevel::Info);
-
283 }
-
284
-
285 // Mettre à jour l'ID global dans l'application
-
286 app_->set_object_id(object_id_);
-
287
-
288 // Mettre à jour les statistiques après le chargement
- -
290
-
291 Logger::Get().Log("Scene loaded successfully from " + scene_path_, __FILE__, __LINE__, Logger::LogLevel::Info);
-
292 return true;
-
293}
-
std::filesystem::path get_w_folder() const
- -
std::map< std::string, std::shared_ptr< model_class > > & get_model_cache()
- -
ecs::EntityManager * get_entity_manager() const
-
void set_object_id(int object_id)
-
ID3D11Device * get_device()
Gets the Direct3D device.
-
ID3D11DeviceContext * get_device_context()
Gets the Direct3D device context.
- - -
static ObjectType StringToObjectType(const std::string &str)
-
void SetName(const std::string &name)
- -
void SetPath(const std::wstring &path)
- -
void Initialize() override
- -
bool InitializeWithModel(std::shared_ptr< model_class > model)
- -
void SetActiveShader(ShaderType shader)
-
static ShaderType StringToShaderType(const std::string &str)
- -
void SetPosition(XMVECTOR position)
-
std::string convert_w_string_to_string(const std::wstring &w_str)
-
std::wstring get_scene_path()
- -
-
-
- -

◆ save_scene()

- -
-
- - - - - - - -
bool scene_manager::save_scene ()
-
-

Function to save the current scene. This function will save the current scene to the path specified in scene_path_. If the scene_path_ is empty, it will call save_scene_as() to prompt the user for a file location.

Returns
True if the scene was saved successfully, otherwise false.
- -

Definition at line 295 of file scene_manager.cpp.

-
295 {
-
296
-
297 entity_ = app_->get_entity_manager()->GetAllEntities();
-
298
-
299 if (scene_path_.empty()) {
-
300 // Si le chemin de la scène est vide, fallback vers la fonction de sauvegarde as
-
301 if (!save_scene_as()) {
-
302 Logger::Get().Log("Scene save cancelled by user", __FILE__, __LINE__, Logger::LogLevel::Info);
-
303 return false;
-
304 }
-
305 }
-
306
-
307 std::ofstream outFile(scene_path_);
-
308 if (!outFile.is_open()) {
-
309 Logger::Get().Log("Failed to open file for saving scene", __FILE__, __LINE__, Logger::LogLevel::Error);
-
310 return false;
-
311 }
-
312
-
313 for (const auto& object : entity_) {
-
314 XMFLOAT3 position, scale, rotation;
-
315 int id = 0;
-
316 int mass = 0;
-
317 float boundingRadius = 0;
-
318 std::string name = "NONE";
-
319 std::string shaderType = "NONE";
-
320 std::string objectType = "NONE";
-
321 std::wstring model_path = L"";
-
322 bool physics_enabled = false;
-
323
-
324 auto transform = object->GetComponent<ecs::TransformComponent>();
-
325 if (transform) {
-
326 // convert XMVECTOR to XMFLOAT3
-
327 XMStoreFloat3(&position, transform->GetPosition());
-
328 XMStoreFloat3(&rotation, transform->GetRotation());
-
329 XMStoreFloat3(&scale, transform->GetScale());
-
330 }
-
331
-
332
-
333 auto identity = object->GetComponent<ecs::IdentityComponent>();
-
334 if (identity) {
-
335
-
336 id = identity->GetId();
-
337 name = identity->GetName();
-
338 objectType = identity->ObjectTypeToString(identity->GetType());
-
339
-
340 }
-
341
-
342 auto model_path_component = object->GetComponent<ecs::ModelPathComponent>();
-
343 if (model_path_component) {
-
344
-
345 model_path = model_path_component->GetPath();
-
346 }
-
347
-
348 auto shader = object->GetComponent<ecs::ShaderComponent>();
-
349 if (shader)
-
350 {
-
351 shaderType = shader->ShaderTypeToString(shader->GetActiveShader());
-
352 }
-
353
-
354 auto physics = object->GetComponent<ecs::PhysicsComponent>();
-
355 if (physics) {
-
356 physics_enabled = physics->IsPhysicsEnabled();
-
357 mass = physics->GetMass();
-
358 boundingRadius = physics->GetBoundingRadius();
-
359 }
-
360
-
361 // Écrire les données de base de l'objet
-
362 outFile << id << " "
-
363 << name << " "
-
364 << position.x << " " << position.y << " " << position.z << " "
-
365 << rotation.x << " " << rotation.y << " " << rotation.z << " "
-
366 << scale.x << " " << scale.y << " " << scale.z << " "
-
367 << convert_w_string_to_string(model_path) << " "
-
368 << shaderType << " "
-
369 << boundingRadius << " "
-
370 << objectType << " "
-
371 << mass << " "
-
372 << physics_enabled;
-
373
-
374 // Sauvegarder les chemins des textures_
-
375 // Format: nombre de textures_ diffuses, puis les chemins
-
376 // Même chose pour les autres types de textures_
-
377
-
378
-
379 auto render = object->GetComponent<ecs::RenderComponent>();
-
380 if (render)
-
381 {
-
382 const auto& model = render->GetModel();
-
383
-
384 const auto& textureContainer = model->GetTextureContainer();
-
385
-
386 const auto& diffusePaths = textureContainer.GetPaths(TextureType::Diffuse);
-
387 outFile << " " << diffusePaths.size();
-
388 for (const auto& path : diffusePaths) {
-
389 outFile << " " << convert_w_string_to_string(path);
-
390 }
-
391
-
392 const auto& normalPaths = textureContainer.GetPaths(TextureType::Normal);
-
393 outFile << " " << normalPaths.size();
-
394 for (const auto& path : normalPaths) {
-
395 outFile << " " << convert_w_string_to_string(path);
-
396 }
-
397 const auto& specularPaths = textureContainer.GetPaths(TextureType::Specular);
-
398 outFile << " " << specularPaths.size();
-
399 for (const auto& path : specularPaths) {
-
400 outFile << " " << convert_w_string_to_string(path);
-
401 }
-
402 const auto& alphaPaths = textureContainer.GetPaths(TextureType::Alpha);
-
403 outFile << " " << alphaPaths.size();
-
404 for (const auto& path : alphaPaths) {
-
405 outFile << " " << convert_w_string_to_string(path);
-
406 }
-
407 }
-
408
-
409
-
410 outFile << std::endl;
-
411 }
-
412
-
413 outFile.close();
-
414 Logger::Get().Log("Scene saved successfully to " + scene_path_, __FILE__, __LINE__, Logger::LogLevel::Info);
-
415 return true;
-
416}
-
std::vector< std::shared_ptr< Entity > > GetAllEntities()
- - -
-
-
- -

◆ save_scene_as()

- -
-
- - - - - - - -
bool scene_manager::save_scene_as ()
-
-

Function to save the current scene as a new file. The scene is saved in a .ker file format. This function will prompt the user to choose a file location and name. Then it will call the save_scene function to perform the actual saving.

Returns
- -

Definition at line 30 of file scene_manager.cpp.

-
30 {
-
31
-
32 Logger::Get().Log("Saving scene as...", __FILE__, __LINE__, Logger::LogLevel::Info);
-
33
-
34 OPENFILENAME ofn;
-
35 wchar_t szFile[260] = { 0 };
-
36
-
37 ZeroMemory(&ofn, sizeof(ofn));
-
38 ofn.lStructSize = sizeof(ofn);
-
39 ofn.hwndOwner = app_->get_hwnd();
-
40 ofn.lpstrFile = szFile;
-
41 ofn.nMaxFile = sizeof(szFile);
-
42 ofn.lpstrFilter = L"Ker Scene\0*.ker\0";
-
43 ofn.nFilterIndex = 1;
-
44 ofn.lpstrFileTitle = NULL;
-
45 ofn.nMaxFileTitle = 0;
-
46 ofn.lpstrInitialDir = NULL;
-
47 ofn.Flags = OFN_PATHMUSTEXIST | OFN_OVERWRITEPROMPT;
-
48 ofn.lpstrDefExt = L"ker";
-
49
-
50 if (GetSaveFileName(&ofn) == TRUE) {
-
51 std::filesystem::path filepath = ofn.lpstrFile;
-
52
-
53 // Mettre à jour le chemin de scène
-
54 scene_path_ = convert_w_string_to_string(filepath.wstring());
-
55 //object_vec_ = app_->get_kobjects(); // TODO
-
56
-
57 // Sauvegarder la scène avec le nouveau chemin
-
58 save_scene();
-
59
-
60 Logger::Get().Log("Scene saved as: " + scene_path_, __FILE__, __LINE__, Logger::LogLevel::Info);
-
61 return false;
-
62 }
-
63
-
64 return true;
-
65}
- -
-
-
- -

◆ shutdown()

- -
-
- - - - - - - -
bool scene_manager::shutdown ()
-
-

Shutdown the scene manager and release resources.

Returns
True if shutdown is successful, otherwise false.
- -

Definition at line 24 of file scene_manager.cpp.

-
25{
-
26 app_ = nullptr;
-
27 return true;
-
28}
-
-
-
-
The documentation for this class was generated from the following files: -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:ccff39051e98c2b24f58431271f197d5a416552eb177fd51562524fe9b6b682a +size 88953 diff --git a/doxygen_docs/html/classscene__manager.js b/doxygen_docs/html/classscene__manager.js index a63bc96..17828eb 100644 --- a/doxygen_docs/html/classscene__manager.js +++ b/doxygen_docs/html/classscene__manager.js @@ -1,10 +1,3 @@ -var classscene__manager = -[ - [ "convert_w_string_to_string", "classscene__manager.html#acfa372b48d1b5119177fe985508cab18", null ], - [ "get_scene_path", "classscene__manager.html#ad47f7f853f78ac866a566e6d224066a2", null ], - [ "initialize", "classscene__manager.html#a005af8b21eabedba5230c1c6266794c6", null ], - [ "load_scene", "classscene__manager.html#a3dbd419184dd60e2ce0d3c660c4fdff2", null ], - [ "save_scene", "classscene__manager.html#a7c221340be779b7e1cac9a54ec7a87d0", null ], - [ "save_scene_as", "classscene__manager.html#aa09ff2f050320a30b65bda4f162ace2c", null ], - [ "shutdown", "classscene__manager.html#aa7f5a91b60edcbee862b5a2b173b8713", null ] -]; \ No newline at end of file +version https://git-lfs.github.com/spec/v1 +oid sha256:ef229e8755c9d1aa4866f926b6957d6ee6df8da0d731ce9b02afe82876c95f8d +size 680 diff --git a/doxygen_docs/html/classscene_manager-members.html b/doxygen_docs/html/classscene_manager-members.html index 202375d..99952f3 100644 --- a/doxygen_docs/html/classscene_manager-members.html +++ b/doxygen_docs/html/classscene_manager-members.html @@ -1,121 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
sceneManager Member List
-
-
- -

This is the complete list of members for sceneManager, including all inherited members.

- - - - - - - - -
Get() (defined in sceneManager)sceneManagerinlinestatic
LoadScene() (defined in sceneManager)sceneManagerinline
operator=(sceneManager const &)=delete (defined in sceneManager)sceneManager
SaveScene() (defined in sceneManager)sceneManagerinline
sceneManager(sceneManager const &)=delete (defined in sceneManager)sceneManager
SetSceneFileName(const std::string &name) (defined in sceneManager)sceneManagerinline
SetSceneFilePath(const std::string &path) (defined in sceneManager)sceneManagerinline
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:0390ca9c033c6a9847ba0784be75bfdbd2ac8e36cb70e8a4409dde3f7a5fd3a2 +size 6542 diff --git a/doxygen_docs/html/classscene_manager.html b/doxygen_docs/html/classscene_manager.html index e293037..0fb1316 100644 --- a/doxygen_docs/html/classscene_manager.html +++ b/doxygen_docs/html/classscene_manager.html @@ -1,298 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: sceneManager Class Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
- -
sceneManager Class Reference
-
-
- - - - - - - - - - - - - - -

-Public Member Functions

sceneManager (sceneManager const &)=delete
 
-void operator= (sceneManager const &)=delete
 
void SetSceneFilePath (const std::string &path)
 
void SetSceneFileName (const std::string &name)
 
bool SaveScene ()
 
bool LoadScene ()
 
- - - -

-Static Public Member Functions

static sceneManagerGet ()
 
-

Detailed Description

-
-

Definition at line 4 of file sceneManager.h.

-

Member Function Documentation

- -

◆ Get()

- -
-
- - - - - -
- - - - - - - -
static sceneManager & sceneManager::Get ()
-
-inlinestatic
-
- -

Definition at line 7 of file sceneManager.h.

-
8 {
-
9 static sceneManager instance;
-
10 return instance;
-
11 }
- -
-
-
- -

◆ LoadScene()

- -
-
- - - - - -
- - - - - - - -
bool sceneManager::LoadScene ()
-
-inline
-
- -

Definition at line 25 of file sceneManager.h.

-
26 {
-
27
-
28
-
29 // Implement the load scene logic here
-
30 return true;
-
31 }
-
-
-
- -

◆ SaveScene()

- -
-
- - - - - -
- - - - - - - -
bool sceneManager::SaveScene ()
-
-inline
-
- -

Definition at line 19 of file sceneManager.h.

-
20 {
-
21 // Implement the save scene logic here
-
22 return true;
-
23 }
-
-
-
- -

◆ SetSceneFileName()

- -
-
- - - - - -
- - - - - - - -
void sceneManager::SetSceneFileName (const std::string & name)
-
-inline
-
- -

Definition at line 17 of file sceneManager.h.

-
17{ m_sceneFileName = name; }
-
-
-
- -

◆ SetSceneFilePath()

- -
-
- - - - - -
- - - - - - - -
void sceneManager::SetSceneFilePath (const std::string & path)
-
-inline
-
- -

Definition at line 16 of file sceneManager.h.

-
16{ m_sceneFilePath = path; }
-
-
-
-
The documentation for this class was generated from the following file: -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:8063cb54aad158d88993d2931f93e75d9f360af5c2f1e815f10cccc91a7cd9ff +size 15526 diff --git a/doxygen_docs/html/classshader__manager__class-members.html b/doxygen_docs/html/classshader__manager__class-members.html index c6852ba..e4f84c5 100644 --- a/doxygen_docs/html/classshader__manager__class-members.html +++ b/doxygen_docs/html/classshader__manager__class-members.html @@ -1,134 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
shader_manager_class Member List
-
-
- -

This is the complete list of members for shader_manager_class, including all inherited members.

- - - - - - - - - - - - - - - - - - - - - -
initialize(ID3D11Device *, HWND) (defined in shader_manager_class)shader_manager_class
render_alpha_map_shader(ID3D11DeviceContext *, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView *, ID3D11ShaderResourceView *, ID3D11ShaderResourceView *) (defined in shader_manager_class)shader_manager_class
render_cel_shading_shader(ID3D11DeviceContext *, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView *, XMFLOAT4, XMFLOAT4, XMFLOAT3, float) (defined in shader_manager_class)shader_manager_class
render_depth_shader(ID3D11DeviceContext *context, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix, ID3D11ShaderResourceView *texture) (defined in shader_manager_class)shader_manager_class
render_multitexture_shader(ID3D11DeviceContext *, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView *, ID3D11ShaderResourceView *) (defined in shader_manager_class)shader_manager_class
render_normal_map_shader(ID3D11DeviceContext *, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView *, ID3D11ShaderResourceView *, XMFLOAT3, XMFLOAT4) (defined in shader_manager_class)shader_manager_class
render_refraction_shader(ID3D11DeviceContext *, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView *, XMFLOAT3, XMFLOAT4[], XMFLOAT4[], XMFLOAT4[], XMFLOAT4) (defined in shader_manager_class)shader_manager_class
render_skybox_shader(ID3D11DeviceContext *, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView *, XMFLOAT4, XMFLOAT4, XMFLOAT3, float) (defined in shader_manager_class)shader_manager_class
render_spec_map_shader(ID3D11DeviceContext *, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView *, ID3D11ShaderResourceView *, ID3D11ShaderResourceView *, XMFLOAT3, XMFLOAT4, XMFLOAT3, XMFLOAT4, float) (defined in shader_manager_class)shader_manager_class
render_sunlight_shader(ID3D11DeviceContext *, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView *, XMFLOAT4, XMFLOAT4, XMFLOAT3, float) (defined in shader_manager_class)shader_manager_class
render_texture_shader(ID3D11DeviceContext *, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView *) (defined in shader_manager_class)shader_manager_class
render_translate_shader(ID3D11DeviceContext *, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView *, float) (defined in shader_manager_class)shader_manager_class
render_transparent_shader(ID3D11DeviceContext *, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView *, float) (defined in shader_manager_class)shader_manager_class
render_water_shader(ID3D11DeviceContext *, int, XMMATRIX, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView *, ID3D11ShaderResourceView *, ID3D11ShaderResourceView *, float, float) (defined in shader_manager_class)shader_manager_class
renderlight_map_shader(ID3D11DeviceContext *, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView *, ID3D11ShaderResourceView *) (defined in shader_manager_class)shader_manager_class
renderlight_shader(ID3D11DeviceContext *, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView *, XMFLOAT4[], XMFLOAT4[], XMFLOAT4[]) (defined in shader_manager_class)shader_manager_class
shader_manager_class() (defined in shader_manager_class)shader_manager_class
shader_manager_class(const shader_manager_class &) (defined in shader_manager_class)shader_manager_class
shutdown() (defined in shader_manager_class)shader_manager_class
~shader_manager_class() (defined in shader_manager_class)shader_manager_class
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:53b75b73548984c5d256b20358f4cef49c4e5cf59a2c8bd0d8bfff7202bafb52 +size 12545 diff --git a/doxygen_docs/html/classshader__manager__class.html b/doxygen_docs/html/classshader__manager__class.html index c3c6e8b..aaa7457 100644 --- a/doxygen_docs/html/classshader__manager__class.html +++ b/doxygen_docs/html/classshader__manager__class.html @@ -1,1584 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: shader_manager_class Class Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
- -
shader_manager_class Class Reference
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

-Public Member Functions

 shader_manager_class (const shader_manager_class &)
 
bool initialize (ID3D11Device *, HWND)
 
void shutdown ()
 
bool render_texture_shader (ID3D11DeviceContext *, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView *)
 
bool render_normal_map_shader (ID3D11DeviceContext *, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView *, ID3D11ShaderResourceView *, XMFLOAT3, XMFLOAT4)
 
bool render_multitexture_shader (ID3D11DeviceContext *, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView *, ID3D11ShaderResourceView *)
 
bool render_translate_shader (ID3D11DeviceContext *, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView *, float)
 
bool render_alpha_map_shader (ID3D11DeviceContext *, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView *, ID3D11ShaderResourceView *, ID3D11ShaderResourceView *)
 
bool render_spec_map_shader (ID3D11DeviceContext *, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView *, ID3D11ShaderResourceView *, ID3D11ShaderResourceView *, XMFLOAT3, XMFLOAT4, XMFLOAT3, XMFLOAT4, float)
 
bool render_transparent_shader (ID3D11DeviceContext *, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView *, float)
 
bool renderlight_shader (ID3D11DeviceContext *, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView *, XMFLOAT4[], XMFLOAT4[], XMFLOAT4[])
 
bool renderlight_map_shader (ID3D11DeviceContext *, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView *, ID3D11ShaderResourceView *)
 
bool render_refraction_shader (ID3D11DeviceContext *, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView *, XMFLOAT3, XMFLOAT4[], XMFLOAT4[], XMFLOAT4[], XMFLOAT4)
 
bool render_water_shader (ID3D11DeviceContext *, int, XMMATRIX, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView *, ID3D11ShaderResourceView *, ID3D11ShaderResourceView *, float, float)
 
bool render_cel_shading_shader (ID3D11DeviceContext *, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView *, XMFLOAT4, XMFLOAT4, XMFLOAT3, float)
 
bool render_sunlight_shader (ID3D11DeviceContext *, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView *, XMFLOAT4, XMFLOAT4, XMFLOAT3, float)
 
bool render_skybox_shader (ID3D11DeviceContext *, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView *, XMFLOAT4, XMFLOAT4, XMFLOAT3, float)
 
bool render_depth_shader (ID3D11DeviceContext *context, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix, ID3D11ShaderResourceView *texture)
 
-

Detailed Description

-
-

Definition at line 27 of file shader_manager_class.h.

-

Constructor & Destructor Documentation

- -

◆ shader_manager_class() [1/2]

- -
-
- - - - - - - -
shader_manager_class::shader_manager_class ()
-
- -

Definition at line 3 of file shader_manager_class.cpp.

-
4{
-
5 texture_shader_ = 0;
-
6 normal_map_shader_ = 0;
-
7 multitexture_shader_ = 0;
-
8 translate_shader_ = 0;
-
9 alpha_map_shader_ = 0;
-
10 spec_map_shader_ = 0;
-
11 transparent_shader_ = 0;
-
12 light_shader_ = 0;
-
13 light_map_shader_ = 0;
-
14 refraction_shader_ = 0;
-
15 water_shader_ = 0;
-
16 cel_shading_shader_ = 0;
-
17 sunlight_shader_ = 0;
-
18 skybox_shader_ = 0;
-
19 refraction_shader_ = 0;
-
20 depth_shader_ = 0;
-
21}
-
-
-
- -

◆ shader_manager_class() [2/2]

- -
-
- - - - - - - -
shader_manager_class::shader_manager_class (const shader_manager_class & other)
-
- -

Definition at line 23 of file shader_manager_class.cpp.

-
24{
-
25}
-
-
-
- -

◆ ~shader_manager_class()

- -
-
- - - - - - - -
shader_manager_class::~shader_manager_class ()
-
- -

Definition at line 27 of file shader_manager_class.cpp.

-
28{
-
29}
-
-
-
-

Member Function Documentation

- -

◆ initialize()

- -
-
- - - - - - - - - - - -
bool shader_manager_class::initialize (ID3D11Device * device,
HWND hwnd )
-
- -

Definition at line 31 of file shader_manager_class.cpp.

-
32{
-
33 Logger::Get().Log("Initializing shader_manager_class", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
34
-
35 bool result;
-
36
-
37 // Create and initialize the texture shader object.
-
38 texture_shader_ = new texture_shader_class;
-
39 result = texture_shader_->initialize(device, hwnd);
-
40 if (!result)
-
41 {
-
42 Logger::Get().Log("Error initializing texture_shader_class", __FILE__, __LINE__, Logger::LogLevel::Error);
-
43 return false;
-
44 }
-
45
-
46 // Create and initialize the normal map shader object.
-
47 normal_map_shader_ = new normal_map_shader_class;
-
48 result = normal_map_shader_->initialize(device, hwnd);
-
49 if (!result)
-
50 {
-
51 Logger::Get().Log("Error initializing normal_map_shader_class", __FILE__, __LINE__, Logger::LogLevel::Error);
-
52 return false;
-
53 }
-
54
-
55 // Create and initialize the multitexture shader object.
-
56 multitexture_shader_ = new multi_texture_shader_class;
-
57 result = multitexture_shader_->initialize(device, hwnd);
-
58 if (!result)
-
59 {
-
60 Logger::Get().Log("Error initializing multi_texture_shader_class", __FILE__, __LINE__, Logger::LogLevel::Error);
-
61 return false;
-
62 }
-
63
-
64 // Create and initialize the translate shader object.
-
65 translate_shader_ = new translate_shader_class;
-
66 result = translate_shader_->initialize(device, hwnd);
-
67 if (!result)
-
68 {
-
69 Logger::Get().Log("Error initializing translate_shader_class", __FILE__, __LINE__, Logger::LogLevel::Error);
-
70 return false;
-
71 }
-
72
-
73 // Create and initialize the alpha map shader object.
-
74 alpha_map_shader_ = new alpha_map_shader_class;
-
75 result = alpha_map_shader_->initialize(device, hwnd);
-
76 if (!result)
-
77 {
-
78 Logger::Get().Log("Error initializing alpha_map_shader_class", __FILE__, __LINE__, Logger::LogLevel::Error);
-
79 return false;
-
80 }
-
81
-
82 // Create and initialize the specular map shader object.
-
83 spec_map_shader_ = new spec_map_shader_class;
-
84 result = spec_map_shader_->initialize(device, hwnd);
-
85 if (!result)
-
86 {
-
87 Logger::Get().Log("Error initializing spec_map_shader_class", __FILE__, __LINE__, Logger::LogLevel::Error);
-
88 return false;
-
89 }
-
90
-
91 // Create and initialize the transparent shader object.
-
92 transparent_shader_ = new transparent_shader_class;
-
93 result = transparent_shader_->initialize(device, hwnd);
-
94 if (!result)
-
95 {
-
96 Logger::Get().Log("Error initializing transparent_shader_class", __FILE__, __LINE__, Logger::LogLevel::Error);
-
97 return false;
-
98 }
-
99
-
100 // Create and initialize the light shader object.
-
101 light_shader_ = new light_shader_class;
-
102 result = light_shader_->initialize(device, hwnd);
-
103 if (!result)
-
104 {
-
105 Logger::Get().Log("Error initializing light_shader_class", __FILE__, __LINE__, Logger::LogLevel::Error);
-
106 return false;
-
107 }
-
108
-
109 // Create and initialize the light map shader object.
-
110 light_map_shader_ = new light_map_shader_class;
-
111 result = light_map_shader_->initialize(device, hwnd);
-
112 if (!result)
-
113 {
-
114 Logger::Get().Log("Error initializing light_map_shader_class", __FILE__, __LINE__, Logger::LogLevel::Error);
-
115 return false;
-
116 }
-
117
-
118 // Create and initialize the refraction shader object.
-
119 refraction_shader_ = new refraction_shader_class;
-
120 result = refraction_shader_->initialize(device, hwnd);
-
121 if (!result)
-
122 {
-
123 return false;
-
124 }
-
125
-
126 // Create and initialize the water shader object.
-
127 water_shader_ = new water_shader_class;
-
128 result = water_shader_->initialize(device, hwnd);
-
129 if (!result)
-
130 {
-
131 return false;
-
132 }
-
133
-
134 cel_shading_shader_ = new celshade_class;
-
135 result = cel_shading_shader_->initialize(device, hwnd);
-
136 if (!result)
-
137 {
-
138 return false;
-
139 }
-
140
-
141 sunlight_shader_ = new sunlight_shader_class;
-
142 result = sunlight_shader_->initialize(device, hwnd);
-
143 if (!result)
-
144 {
-
145 return false;
-
146 }
-
147
-
148 skybox_shader_ = new skybox_shader_class;
-
149 result = skybox_shader_->Initialize(device, hwnd);
-
150 if (!result)
-
151 {
-
152 Logger::Get().Log("Error initializing skybox_shader_class", __FILE__, __LINE__, Logger::LogLevel::Error);
-
153 return false;
-
154 }
-
155
-
156 depth_shader_ = new depth_shader_class;
-
157 result = depth_shader_->initialize(device, hwnd);
-
158 if (!result)
-
159 {
-
160 Logger::Get().Log("Error initializing depth_shader_class", __FILE__, __LINE__, Logger::LogLevel::Error);
-
161 return false;
-
162 }
-
163
-
164 Logger::Get().Log("shader_manager_class initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
165
-
166 return true;
-
167}
-
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_alpha_map_shader()

- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool shader_manager_class::render_alpha_map_shader (ID3D11DeviceContext * deviceContext,
int indexCount,
XMMATRIX worldMatrix,
XMMATRIX viewMatrix,
XMMATRIX projectionMatrix,
ID3D11ShaderResourceView * texture1,
ID3D11ShaderResourceView * texture2,
ID3D11ShaderResourceView * texture3 )
-
- -

Definition at line 353 of file shader_manager_class.cpp.

-
355{
-
356 bool result;
-
357
-
358 result = alpha_map_shader_->render(deviceContext, indexCount, worldMatrix, viewMatrix, projectionMatrix, texture1, texture2, texture3);
-
359 if (!result)
-
360 {
-
361 Logger::Get().Log("Error rendering alpha_map_shader_class", __FILE__, __LINE__, Logger::LogLevel::Error);
-
362 return false;
-
363 }
-
364
-
365 return true;
-
366}
-
-
-
- -

◆ render_cel_shading_shader()

- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool shader_manager_class::render_cel_shading_shader (ID3D11DeviceContext * deviceContext,
int indexCount,
XMMATRIX worldMatrix,
XMMATRIX viewMatrix,
XMMATRIX projectionMatrix,
ID3D11ShaderResourceView * texture,
XMFLOAT4 diffuseColor,
XMFLOAT4 ambientColor,
XMFLOAT3 sunDirection,
float sunIntensity )
-
- -

Definition at line 458 of file shader_manager_class.cpp.

-
460{
-
461 bool result;
-
462
-
463 result = cel_shading_shader_->render(deviceContext, indexCount, worldMatrix, viewMatrix, projectionMatrix, texture, diffuseColor, ambientColor, sunDirection, sunIntensity);
-
464 if (!result)
-
465 {
-
466 return false;
-
467 }
-
468
-
469 return true;
-
470}
-
-
-
- -

◆ render_depth_shader()

- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool shader_manager_class::render_depth_shader (ID3D11DeviceContext * context,
int indexCount,
XMMATRIX worldMatrix,
XMMATRIX viewMatrix,
XMMATRIX projectionMatrix,
ID3D11ShaderResourceView * texture )
-
- -

Definition at line 500 of file shader_manager_class.cpp.

-
508{
-
509 bool result;
-
510
-
511 result = depth_shader_->render(context, indexCount, worldMatrix, viewMatrix, projectionMatrix, texture);
-
512 if (!result)
-
513 {
-
514 return false;
-
515 }
-
516
-
517 return true;
-
518}
-
-
-
- -

◆ render_multitexture_shader()

- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool shader_manager_class::render_multitexture_shader (ID3D11DeviceContext * deviceContext,
int indexCount,
XMMATRIX worldMatrix,
XMMATRIX viewMatrix,
XMMATRIX projectionMatrix,
ID3D11ShaderResourceView * texture1,
ID3D11ShaderResourceView * texture2 )
-
- -

Definition at line 323 of file shader_manager_class.cpp.

-
325{
-
326 bool result;
-
327
-
328 result = multitexture_shader_->render(deviceContext, indexCount, worldMatrix, viewMatrix, projectionMatrix, texture1, texture2);
-
329 if (!result)
-
330 {
-
331 Logger::Get().Log("Error rendering multi_texture_shader_class", __FILE__, __LINE__, Logger::LogLevel::Error);
-
332 return false;
-
333 }
-
334
-
335 return true;
-
336}
-
-
-
- -

◆ render_normal_map_shader()

- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool shader_manager_class::render_normal_map_shader (ID3D11DeviceContext * deviceContext,
int indexCount,
XMMATRIX worldMatrix,
XMMATRIX viewMatrix,
XMMATRIX projectionMatrix,
ID3D11ShaderResourceView * colorTexture,
ID3D11ShaderResourceView * normalTexture,
XMFLOAT3 lightDirection,
XMFLOAT4 diffuseColor )
-
- -

Definition at line 308 of file shader_manager_class.cpp.

-
310{
-
311 bool result;
-
312
-
313 result = normal_map_shader_->render(deviceContext, indexCount, worldMatrix, viewMatrix, projectionMatrix, colorTexture, normalTexture, lightDirection, diffuseColor);
-
314 if (!result)
-
315 {
-
316 Logger::Get().Log("Error rendering normal_map_shader_class", __FILE__, __LINE__, Logger::LogLevel::Error);
-
317 return false;
-
318 }
-
319
-
320 return true;
-
321}
-
-
-
- -

◆ render_refraction_shader()

- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool shader_manager_class::render_refraction_shader (ID3D11DeviceContext * deviceContext,
int indexCount,
XMMATRIX worldMatrix,
XMMATRIX viewMatrix,
XMMATRIX projectionMatrix,
ID3D11ShaderResourceView * texture,
XMFLOAT3 lightDirection,
XMFLOAT4 ambientColor[],
XMFLOAT4 diffuseColor[],
XMFLOAT4 lightPosition[],
XMFLOAT4 clipPlane )
-
- -

Definition at line 428 of file shader_manager_class.cpp.

-
430{
-
431 bool result;
-
432
-
433 result = refraction_shader_->render(deviceContext, indexCount, worldMatrix, viewMatrix, projectionMatrix, texture, lightDirection, ambientColor, diffuseColor, lightPosition, clipPlane);
-
434 if (!result)
-
435 {
-
436 return false;
-
437 }
-
438
-
439 return true;
-
440}
-
-
-
- -

◆ render_skybox_shader()

- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool shader_manager_class::render_skybox_shader (ID3D11DeviceContext * deviceContext,
int indexCount,
XMMATRIX worldMatrix,
XMMATRIX viewMatrix,
XMMATRIX projectionMatrix,
ID3D11ShaderResourceView * texture,
XMFLOAT4 diffuseColor,
XMFLOAT4 ambientColor,
XMFLOAT3 sunDirection,
float sunIntensity )
-
- -

Definition at line 486 of file shader_manager_class.cpp.

-
488{
-
489 bool result;
-
490
-
491 result = skybox_shader_->Render(deviceContext, indexCount, worldMatrix, viewMatrix, projectionMatrix, texture, diffuseColor, ambientColor, sunDirection, sunIntensity);
-
492 if (!result)
-
493 {
-
494 return false;
-
495 }
-
496
-
497 return true;
-
498}
-
-
-
- -

◆ render_spec_map_shader()

- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool shader_manager_class::render_spec_map_shader (ID3D11DeviceContext * deviceContext,
int indexCount,
XMMATRIX worldMatrix,
XMMATRIX viewMatrix,
XMMATRIX projectionMatrix,
ID3D11ShaderResourceView * texture1,
ID3D11ShaderResourceView * texture2,
ID3D11ShaderResourceView * texture3,
XMFLOAT3 lightDirection,
XMFLOAT4 diffuseColor,
XMFLOAT3 cameraPosition,
XMFLOAT4 specularColor,
float specularPower )
-
- -

Definition at line 368 of file shader_manager_class.cpp.

-
371{
-
372 bool result;
-
373
-
374 result = spec_map_shader_->render(deviceContext, indexCount, worldMatrix, viewMatrix, projectionMatrix, texture1, texture2, texture3, lightDirection,
-
375 diffuseColor, cameraPosition, specularColor, specularPower);
-
376 if (!result)
-
377 {
-
378 Logger::Get().Log("Error rendering spec_map_shader_class", __FILE__, __LINE__, Logger::LogLevel::Error);
-
379 return false;
-
380 }
-
381
-
382 return true;
-
383}
-
-
-
- -

◆ render_sunlight_shader()

- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool shader_manager_class::render_sunlight_shader (ID3D11DeviceContext * deviceContext,
int indexCount,
XMMATRIX worldMatrix,
XMMATRIX viewMatrix,
XMMATRIX projectionMatrix,
ID3D11ShaderResourceView * texture,
XMFLOAT4 diffuseColor,
XMFLOAT4 ambientColor,
XMFLOAT3 sunDirection,
float sunIntensity )
-
- -

Definition at line 472 of file shader_manager_class.cpp.

-
474{
-
475 bool result;
-
476
-
477 result = sunlight_shader_->render(deviceContext, indexCount, worldMatrix, viewMatrix, projectionMatrix, texture, diffuseColor, ambientColor, sunDirection, sunIntensity);
-
478 if (!result)
-
479 {
-
480 return false;
-
481 }
-
482
-
483 return true;
-
484}
-
-
-
- -

◆ render_texture_shader()

- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool shader_manager_class::render_texture_shader (ID3D11DeviceContext * deviceContext,
int indexCount,
XMMATRIX worldMatrix,
XMMATRIX viewMatrix,
XMMATRIX projectionMatrix,
ID3D11ShaderResourceView * texture )
-
- -

Definition at line 293 of file shader_manager_class.cpp.

-
295{
-
296 bool result;
-
297
-
298 result = texture_shader_->render(deviceContext, indexCount, worldMatrix, viewMatrix, projectionMatrix, texture);
-
299 if (!result)
-
300 {
-
301 Logger::Get().Log("Error rendering texture_shader_class", __FILE__, __LINE__, Logger::LogLevel::Error);
-
302 return false;
-
303 }
-
304
-
305 return true;
-
306}
-
-
-
- -

◆ render_translate_shader()

- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool shader_manager_class::render_translate_shader (ID3D11DeviceContext * deviceContext,
int indexCount,
XMMATRIX worldMatrix,
XMMATRIX viewMatrix,
XMMATRIX projectionMatrix,
ID3D11ShaderResourceView * texture1,
float valeur )
-
- -

Definition at line 338 of file shader_manager_class.cpp.

-
340{
-
341 bool result;
-
342
-
343 result = translate_shader_->render(deviceContext, indexCount, worldMatrix, viewMatrix, projectionMatrix, texture1, valeur);
-
344 if (!result)
-
345 {
-
346 Logger::Get().Log("Error rendering translate_shader_class", __FILE__, __LINE__, Logger::LogLevel::Error);
-
347 return false;
-
348 }
-
349
-
350 return true;
-
351}
-
-
-
- -

◆ render_transparent_shader()

- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool shader_manager_class::render_transparent_shader (ID3D11DeviceContext * deviceContext,
int indexCount,
XMMATRIX worldMatrix,
XMMATRIX viewMatrix,
XMMATRIX projectionMatrix,
ID3D11ShaderResourceView * texture1,
float blendAmount )
-
- -

Definition at line 385 of file shader_manager_class.cpp.

-
387{
-
388 bool result;
-
389
-
390 result = transparent_shader_->render(deviceContext, indexCount, worldMatrix, viewMatrix, projectionMatrix, texture1, blendAmount);
-
391 if (!result)
-
392 {
-
393 Logger::Get().Log("Error rendering transparent_shader_class", __FILE__, __LINE__, Logger::LogLevel::Error);
-
394 return false;
-
395 }
-
396
-
397 return true;
-
398}
-
-
-
- -

◆ render_water_shader()

- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool shader_manager_class::render_water_shader (ID3D11DeviceContext * deviceContext,
int indexCount,
XMMATRIX worldMatrix,
XMMATRIX viewMatrix,
XMMATRIX projectionMatrix,
XMMATRIX reflectionMatrix,
ID3D11ShaderResourceView * reflectionTexture,
ID3D11ShaderResourceView * refractionTexture,
ID3D11ShaderResourceView * normalTexture,
float waterTranslation,
float reflectRefractScale )
-
- -

Definition at line 442 of file shader_manager_class.cpp.

-
445{
-
446 bool result;
-
447
-
448 result = water_shader_->render(deviceContext, indexCount, worldMatrix, viewMatrix, projectionMatrix, reflectionMatrix, reflectionTexture,
-
449 refractionTexture, normalTexture, waterTranslation, reflectRefractScale);
-
450 if (!result)
-
451 {
-
452 return false;
-
453 }
-
454
-
455 return true;
-
456}
-
-
-
- -

◆ renderlight_map_shader()

- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool shader_manager_class::renderlight_map_shader (ID3D11DeviceContext * deviceContext,
int indexCount,
XMMATRIX worldMatrix,
XMMATRIX viewMatrix,
XMMATRIX projectionMatrix,
ID3D11ShaderResourceView * texture1,
ID3D11ShaderResourceView * texture2 )
-
- -

Definition at line 414 of file shader_manager_class.cpp.

-
416{
-
417 bool result;
-
418
-
419 result = light_map_shader_->render(deviceContext, indexCount, worldMatrix, viewMatrix, projectionMatrix, texture1, texture2);
-
420 if (!result)
-
421 {
-
422 return false;
-
423 }
-
424
-
425 return true;
-
426}
-
-
-
- -

◆ renderlight_shader()

- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool shader_manager_class::renderlight_shader (ID3D11DeviceContext * deviceContext,
int indexCount,
XMMATRIX worldMatrix,
XMMATRIX viewMatrix,
XMMATRIX projectionMatrix,
ID3D11ShaderResourceView * texture,
XMFLOAT4 diffuseColor[],
XMFLOAT4 lightPosition[],
XMFLOAT4 ambientColor[] )
-
- -

Definition at line 400 of file shader_manager_class.cpp.

-
402{
-
403 bool result;
-
404
-
405 result = light_shader_->render(deviceContext, indexCount, worldMatrix, viewMatrix, projectionMatrix, texture, diffuseColor, lightPosition, ambientColor);
-
406 if (!result)
-
407 {
-
408 return false;
-
409 }
-
410
-
411 return true;
-
412}
-
-
-
- -

◆ shutdown()

- -
-
- - - - - - - -
void shader_manager_class::shutdown ()
-
- -

Definition at line 169 of file shader_manager_class.cpp.

-
170{
-
171 Logger::Get().Log("Shutting down shader_manager_class", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
172
-
173 // Release the normal map shader object.
-
174 if (normal_map_shader_)
-
175 {
-
176 normal_map_shader_->shutdown();
-
177 delete normal_map_shader_;
-
178 normal_map_shader_ = 0;
-
179 }
-
180
-
181 // Release the texture shader object.
-
182 if (texture_shader_)
-
183 {
-
184 texture_shader_->shutdown();
-
185 delete texture_shader_;
-
186 texture_shader_ = 0;
-
187 }
-
188
-
189 // Release the multitexture shader object.
-
190 if (multitexture_shader_)
-
191 {
-
192 multitexture_shader_->shutdown();
-
193 delete multitexture_shader_;
-
194 multitexture_shader_ = 0;
-
195 }
-
196
-
197 // Release the translate shader object.
-
198 if (translate_shader_)
-
199 {
-
200 translate_shader_->shutdown();
-
201 delete translate_shader_;
-
202 translate_shader_ = 0;
-
203 }
-
204
-
205 // Release the alpha map shader object.
-
206 if (alpha_map_shader_)
-
207 {
-
208 alpha_map_shader_->shutdown();
-
209 delete alpha_map_shader_;
-
210 alpha_map_shader_ = 0;
-
211 }
-
212
-
213 // Release the specular map shader object.
-
214 if (spec_map_shader_)
-
215 {
-
216 spec_map_shader_->shutdown();
-
217 delete spec_map_shader_;
-
218 spec_map_shader_ = 0;
-
219 }
-
220
-
221 // Release the transparent shader object.
-
222 if (transparent_shader_)
-
223 {
-
224 transparent_shader_->shutdown();
-
225 delete transparent_shader_;
-
226 transparent_shader_ = 0;
-
227 }
-
228
-
229 // Release the light shader object.
-
230 if (light_shader_)
-
231 {
-
232 light_shader_->shutdown();
-
233 delete light_shader_;
-
234 light_shader_ = 0;
-
235 }
-
236
-
237 // Release the light map shader object.
-
238 if (light_map_shader_)
-
239 {
-
240 light_map_shader_->shutdown();
-
241 delete light_map_shader_;
-
242 light_map_shader_ = 0;
-
243 }
-
244
-
245 // Release the refraction shader object.
-
246 if (refraction_shader_)
-
247 {
-
248 refraction_shader_->shutdown();
-
249 delete refraction_shader_;
-
250 refraction_shader_ = 0;
-
251 }
-
252
-
253 // Release the water shader object.
-
254 if (water_shader_)
-
255 {
-
256 water_shader_->shutdown();
-
257 delete water_shader_;
-
258 water_shader_ = 0;
-
259 }
-
260
-
261 // Release the cel shading shader object.
-
262 if (cel_shading_shader_)
-
263 {
-
264 cel_shading_shader_->shutdown();
-
265 delete cel_shading_shader_;
-
266 cel_shading_shader_ = 0;
-
267 }
-
268
-
269 if (sunlight_shader_)
-
270 {
-
271 sunlight_shader_->shutdown();
-
272 delete sunlight_shader_;
-
273 sunlight_shader_ = 0;
-
274 }
-
275
-
276 if (skybox_shader_)
-
277 {
-
278 skybox_shader_->Shutdown();
-
279 delete skybox_shader_;
-
280 skybox_shader_ = 0;
-
281 }
-
282
-
283 if (depth_shader_)
-
284 {
-
285 depth_shader_->shutdown();
-
286 delete depth_shader_;
-
287 depth_shader_ = 0;
-
288 }
-
289
-
290 Logger::Get().Log("shader_manager_class shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
291}
-
-
-
-
The documentation for this class was generated from the following files: -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:2a1953ce3816cc8e037d45250d6b3244e209929770e9080e8fa1a982af215991 +size 115255 diff --git a/doxygen_docs/html/classshadow__map-members.html b/doxygen_docs/html/classshadow__map-members.html index d2d6a6c..b205ee3 100644 --- a/doxygen_docs/html/classshadow__map-members.html +++ b/doxygen_docs/html/classshadow__map-members.html @@ -1,121 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
shadow_map Member List
-
-
- -

This is the complete list of members for shadow_map, including all inherited members.

- - - - - - - - -
clear_render_target(ID3D11DeviceContext *context, float depth=1.0f) (defined in shadow_map)shadow_map
get_shader_resource_view() (defined in shadow_map)shadow_map
initialize(ID3D11Device *device, int width, int height) (defined in shadow_map)shadow_map
set_render_target(ID3D11DeviceContext *context) (defined in shadow_map)shadow_map
shadow_map() (defined in shadow_map)shadow_map
shutdown() (defined in shadow_map)shadow_map
~shadow_map() (defined in shadow_map)shadow_map
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:b1f34454970f85e8403a792ebe377ce39f110ab00eb1a99bb18c1472ddd25df0 +size 6300 diff --git a/doxygen_docs/html/classshadow__map.html b/doxygen_docs/html/classshadow__map.html index 377b60d..8005b9f 100644 --- a/doxygen_docs/html/classshadow__map.html +++ b/doxygen_docs/html/classshadow__map.html @@ -1,337 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: shadow_map Class Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
- -
shadow_map Class Reference
-
-
- - - - - - - - - - - - -

-Public Member Functions

bool initialize (ID3D11Device *device, int width, int height)
 
void shutdown ()
 
void set_render_target (ID3D11DeviceContext *context)
 
void clear_render_target (ID3D11DeviceContext *context, float depth=1.0f)
 
ID3D11ShaderResourceView * get_shader_resource_view ()
 
-

Detailed Description

-
-

Definition at line 5 of file shadow_map.h.

-

Constructor & Destructor Documentation

- -

◆ shadow_map()

- -
-
- - - - - - - -
shadow_map::shadow_map ()
-
- -

Definition at line 3 of file shadow_map.cpp.

-
4 : depth_texture_(nullptr), depth_stencil_view_(nullptr), shader_resource_view_(nullptr), width_(0), height_(0) {}
-
-
-
- -

◆ ~shadow_map()

- -
-
- - - - - - - -
shadow_map::~shadow_map ()
-
- -

Definition at line 6 of file shadow_map.cpp.

-
6 {
-
7 shutdown();
-
8}
-
-
-
-

Member Function Documentation

- -

◆ clear_render_target()

- -
-
- - - - - - - - - - - -
void shadow_map::clear_render_target (ID3D11DeviceContext * context,
float depth = 1.0f )
-
- -

Definition at line 56 of file shadow_map.cpp.

-
56 {
-
57 context->ClearDepthStencilView(depth_stencil_view_, D3D11_CLEAR_DEPTH, depth, 0);
-
58}
-
-
-
- -

◆ get_shader_resource_view()

- -
-
- - - - - - - -
ID3D11ShaderResourceView * shadow_map::get_shader_resource_view ()
-
- -

Definition at line 60 of file shadow_map.cpp.

-
60 {
-
61 return shader_resource_view_;
-
62}
-
-
-
- -

◆ initialize()

- -
-
- - - - - - - - - - - - - - - - -
bool shadow_map::initialize (ID3D11Device * device,
int width,
int height )
-
- -

Definition at line 10 of file shadow_map.cpp.

-
10 {
-
11 width_ = width;
-
12 height_ = height;
-
13
-
14 D3D11_TEXTURE2D_DESC texDesc = {};
-
15 texDesc.Width = width;
-
16 texDesc.Height = height;
-
17 texDesc.MipLevels = 1;
-
18 texDesc.ArraySize = 1;
-
19 texDesc.Format = DXGI_FORMAT_R24G8_TYPELESS;
-
20 texDesc.SampleDesc.Count = 1;
-
21 texDesc.Usage = D3D11_USAGE_DEFAULT;
-
22 texDesc.BindFlags = D3D11_BIND_DEPTH_STENCIL | D3D11_BIND_SHADER_RESOURCE;
-
23
-
24 if (FAILED(device->CreateTexture2D(&texDesc, nullptr, &depth_texture_)))
-
25 return false;
-
26
-
27 D3D11_DEPTH_STENCIL_VIEW_DESC dsvDesc = {};
-
28 dsvDesc.Format = DXGI_FORMAT_D24_UNORM_S8_UINT;
-
29 dsvDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D;
-
30 dsvDesc.Texture2D.MipSlice = 0;
-
31
-
32 if (FAILED(device->CreateDepthStencilView(depth_texture_, &dsvDesc, &depth_stencil_view_)))
-
33 return false;
-
34
-
35 D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc = {};
-
36 srvDesc.Format = DXGI_FORMAT_R24_UNORM_X8_TYPELESS;
-
37 srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
-
38 srvDesc.Texture2D.MipLevels = 1;
-
39
-
40 if (FAILED(device->CreateShaderResourceView(depth_texture_, &srvDesc, &shader_resource_view_)))
-
41 return false;
-
42
-
43 return true;
-
44}
-
-
-
- -

◆ set_render_target()

- -
-
- - - - - - - -
void shadow_map::set_render_target (ID3D11DeviceContext * context)
-
- -

Definition at line 52 of file shadow_map.cpp.

-
52 {
-
53 context->OMSetRenderTargets(0, nullptr, depth_stencil_view_);
-
54}
-
-
-
- -

◆ shutdown()

- -
-
- - - - - - - -
void shadow_map::shutdown ()
-
- -

Definition at line 46 of file shadow_map.cpp.

-
46 {
-
47 if (shader_resource_view_) { shader_resource_view_->Release(); shader_resource_view_ = nullptr; }
-
48 if (depth_stencil_view_) { depth_stencil_view_->Release(); depth_stencil_view_ = nullptr; }
-
49 if (depth_texture_) { depth_texture_->Release(); depth_texture_ = nullptr; }
-
50}
-
-
-
-
The documentation for this class was generated from the following files: -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:05de6d1781ca647092474acc71699c7cb362a9161205fabf6ea0c9bd0a9d6c10 +size 19921 diff --git a/doxygen_docs/html/classskybox__shader__class-members.html b/doxygen_docs/html/classskybox__shader__class-members.html index 6adcb0e..c9890ed 100644 --- a/doxygen_docs/html/classskybox__shader__class-members.html +++ b/doxygen_docs/html/classskybox__shader__class-members.html @@ -1,120 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
skybox_shader_class Member List
-
-
- -

This is the complete list of members for skybox_shader_class, including all inherited members.

- - - - - - - -
Initialize(ID3D11Device *, HWND) (defined in skybox_shader_class)skybox_shader_class
Render(ID3D11DeviceContext *, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView *, XMFLOAT4, XMFLOAT4, XMFLOAT3, float) (defined in skybox_shader_class)skybox_shader_class
Shutdown() (defined in skybox_shader_class)skybox_shader_class
skybox_shader_class() (defined in skybox_shader_class)skybox_shader_class
skybox_shader_class(const skybox_shader_class &) (defined in skybox_shader_class)skybox_shader_class
~skybox_shader_class() (defined in skybox_shader_class)skybox_shader_class
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:d867b289817c0c8077aa8b482cd5cb9dfc818106076f48f4eb0fa552b9be9fdf +size 6355 diff --git a/doxygen_docs/html/classskybox__shader__class.html b/doxygen_docs/html/classskybox__shader__class.html index 19f2366..6964bed 100644 --- a/doxygen_docs/html/classskybox__shader__class.html +++ b/doxygen_docs/html/classskybox__shader__class.html @@ -1,373 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: skybox_shader_class Class Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
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: -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:b4ff06b018f14d747870a97eb0adfa1a835bf5250ffa734ded85c6dae5600c64 +size 24105 diff --git a/doxygen_docs/html/classspec__map__shader__class-members.html b/doxygen_docs/html/classspec__map__shader__class-members.html index 9dc887d..9a1cc77 100644 --- a/doxygen_docs/html/classspec__map__shader__class-members.html +++ b/doxygen_docs/html/classspec__map__shader__class-members.html @@ -1,120 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
spec_map_shader_class Member List
-
-
- -

This is the complete list of members for spec_map_shader_class, including all inherited members.

- - - - - - - -
initialize(ID3D11Device *, HWND) (defined in spec_map_shader_class)spec_map_shader_class
render(ID3D11DeviceContext *, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView *, ID3D11ShaderResourceView *, ID3D11ShaderResourceView *, XMFLOAT3, XMFLOAT4, XMFLOAT3, XMFLOAT4, float) (defined in spec_map_shader_class)spec_map_shader_class
shutdown() (defined in spec_map_shader_class)spec_map_shader_class
spec_map_shader_class() (defined in spec_map_shader_class)spec_map_shader_class
spec_map_shader_class(const spec_map_shader_class &) (defined in spec_map_shader_class)spec_map_shader_class
~spec_map_shader_class() (defined in spec_map_shader_class)spec_map_shader_class
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:47436bc5de2404d97188e890d69da8b19ac01c1da870549fa9b475310897e871 +size 6499 diff --git a/doxygen_docs/html/classspec__map__shader__class.html b/doxygen_docs/html/classspec__map__shader__class.html index a1c559b..1722a9e 100644 --- a/doxygen_docs/html/classspec__map__shader__class.html +++ b/doxygen_docs/html/classspec__map__shader__class.html @@ -1,378 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: spec_map_shader_class Class Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
- -
spec_map_shader_class Class Reference
-
-
- - - - - - - - - - -

-Public Member Functions

 spec_map_shader_class (const spec_map_shader_class &)
 
bool initialize (ID3D11Device *, HWND)
 
void shutdown ()
 
bool render (ID3D11DeviceContext *, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView *, ID3D11ShaderResourceView *, ID3D11ShaderResourceView *, XMFLOAT3, XMFLOAT4, XMFLOAT3, XMFLOAT4, float)
 
-

Detailed Description

-
-

Definition at line 19 of file spec_map_shader_class.h.

-

Constructor & Destructor Documentation

- -

◆ spec_map_shader_class() [1/2]

- -
-
- - - - - - - -
spec_map_shader_class::spec_map_shader_class ()
-
- -

Definition at line 4 of file spec_map_shader_class.cpp.

-
5{
-
6 vertex_shader_ = 0;
-
7 pixel_shader_ = 0;
-
8 layout_ = 0;
-
9 matrix_buffer_ = 0;
-
10 sample_state_ = 0;
-
11 light_buffer_ = 0;
-
12 camera_buffer_ = 0;
-
13}
-
-
-
- -

◆ spec_map_shader_class() [2/2]

- -
-
- - - - - - - -
spec_map_shader_class::spec_map_shader_class (const spec_map_shader_class & other)
-
- -

Definition at line 16 of file spec_map_shader_class.cpp.

-
17{
-
18}
-
-
-
- -

◆ ~spec_map_shader_class()

- -
-
- - - - - - - -
spec_map_shader_class::~spec_map_shader_class ()
-
- -

Definition at line 21 of file spec_map_shader_class.cpp.

-
22{
-
23}
-
-
-
-

Member Function Documentation

- -

◆ initialize()

- -
-
- - - - - - - - - - - -
bool spec_map_shader_class::initialize (ID3D11Device * device,
HWND hwnd )
-
- -

Definition at line 26 of file spec_map_shader_class.cpp.

-
27{
-
28 bool result;
-
29 wchar_t vsFilename[128];
-
30 wchar_t psFilename[128];
-
31 int error;
-
32
-
33 // Set the filename of the vertex shader.
-
34 error = wcscpy_s(vsFilename, 128, L"src/hlsl/specmap.vs");
-
35 if (error != 0)
-
36 {
-
37 return false;
-
38 }
-
39
-
40 // Set the filename of the pixel shader.
-
41 error = wcscpy_s(psFilename, 128, L"src/hlsl/specmap.ps");
-
42 if (error != 0)
-
43 {
-
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 return false;
-
52 }
-
53
-
54 return true;
-
55}
-
-
-
- -

◆ render()

- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool spec_map_shader_class::render (ID3D11DeviceContext * deviceContext,
int indexCount,
XMMATRIX worldMatrix,
XMMATRIX viewMatrix,
XMMATRIX projectionMatrix,
ID3D11ShaderResourceView * texture1,
ID3D11ShaderResourceView * texture2,
ID3D11ShaderResourceView * texture3,
XMFLOAT3 lightDirection,
XMFLOAT4 diffuseColor,
XMFLOAT3 cameraPosition,
XMFLOAT4 specularColor,
float specularPower )
-
- -

Definition at line 66 of file spec_map_shader_class.cpp.

-
69{
-
70 bool result;
-
71
-
72
-
73 // Set the shader parameters that it will use for rendering.
-
74 result = set_shader_parameters(deviceContext, worldMatrix, viewMatrix, projectionMatrix, texture1, texture2, texture3, lightDirection, diffuseColor,
-
75 cameraPosition, specularColor, specularPower);
-
76 if (!result)
-
77 {
-
78 return false;
-
79 }
-
80
-
81 // Now render the prepared buffers with the shader.
-
82 render_shader(deviceContext, indexCount);
-
83
-
84 return true;
-
85}
-
-
-
- -

◆ shutdown()

- -
-
- - - - - - - -
void spec_map_shader_class::shutdown ()
-
- -

Definition at line 58 of file spec_map_shader_class.cpp.

-
59{
-
60 // shutdown the vertex and pixel shaders as well as the related objects.
-
61 shutdown_shader();
-
62
-
63 return;
-
64}
-
-
-
-
The documentation for this class was generated from the following files: -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:c77188f26cd4d2d54b24f676cabe02bf8305568ee275defb7b3ae9662ccd6347 +size 21771 diff --git a/doxygen_docs/html/classsprite__class-members.html b/doxygen_docs/html/classsprite__class-members.html index ff16a21..586b15f 100644 --- a/doxygen_docs/html/classsprite__class-members.html +++ b/doxygen_docs/html/classsprite__class-members.html @@ -1,124 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
sprite_class Member List
-
-
- -

This is the complete list of members for sprite_class, including all inherited members.

- - - - - - - - - - - -
GetIndexCount() (defined in sprite_class)sprite_class
GetTexture() (defined in sprite_class)sprite_class
Initialize(ID3D11Device *, ID3D11DeviceContext *, int, int, char *, int, int) (defined in sprite_class)sprite_class
Render(ID3D11DeviceContext *) (defined in sprite_class)sprite_class
SetRenderLocation(int, int) (defined in sprite_class)sprite_class
Shutdown() (defined in sprite_class)sprite_class
sprite_class() (defined in sprite_class)sprite_class
sprite_class(const sprite_class &) (defined in sprite_class)sprite_class
Update(float) (defined in sprite_class)sprite_class
~sprite_class() (defined in sprite_class)sprite_class
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:59def267752c389dde7e5199df56e1822b5c4747aef407b06d4d82e9a562ed47 +size 7147 diff --git a/doxygen_docs/html/classsprite__class.html b/doxygen_docs/html/classsprite__class.html index c97eac4..b9b61a6 100644 --- a/doxygen_docs/html/classsprite__class.html +++ b/doxygen_docs/html/classsprite__class.html @@ -1,464 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: sprite_class Class Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
- -
sprite_class Class Reference
-
-
- - - - - - - - - - - - - - - - - - -

-Public Member Functions

 sprite_class (const sprite_class &)
 
bool Initialize (ID3D11Device *, ID3D11DeviceContext *, int, int, char *, int, int)
 
void Shutdown ()
 
bool Render (ID3D11DeviceContext *)
 
void Update (float)
 
int GetIndexCount ()
 
ID3D11ShaderResourceView * GetTexture ()
 
void SetRenderLocation (int, int)
 
-

Detailed Description

-
-

Definition at line 22 of file sprite_class.h.

-

Constructor & Destructor Documentation

- -

◆ sprite_class() [1/2]

- -
-
- - - - - - - -
sprite_class::sprite_class ()
-
- -

Definition at line 4 of file sprite_class.cpp.

-
5{
-
6 m_vertexBuffer = 0;
-
7 m_indexBuffer = 0;
-
8 m_Textures = 0;
-
9}
-
-
-
- -

◆ sprite_class() [2/2]

- -
-
- - - - - - - -
sprite_class::sprite_class (const sprite_class & other)
-
- -

Definition at line 12 of file sprite_class.cpp.

-
13{
-
14}
-
-
-
- -

◆ ~sprite_class()

- -
-
- - - - - - - -
sprite_class::~sprite_class ()
-
- -

Definition at line 17 of file sprite_class.cpp.

-
18{
-
19}
-
-
-
-

Member Function Documentation

- -

◆ GetIndexCount()

- -
-
- - - - - - - -
int sprite_class::GetIndexCount ()
-
- -

Definition at line 109 of file sprite_class.cpp.

-
110{
-
111 return m_indexCount;
-
112}
-
-
-
- -

◆ GetTexture()

- -
-
- - - - - - - -
ID3D11ShaderResourceView * sprite_class::GetTexture ()
-
- -

Definition at line 114 of file sprite_class.cpp.

-
115{
-
116 return m_Textures[m_currentTexture].GetTexture();
-
117}
-
-
-
- -

◆ Initialize()

- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool sprite_class::Initialize (ID3D11Device * device,
ID3D11DeviceContext * deviceContext,
int screenWidth,
int screenHeight,
char * spriteFilename,
int renderX,
int renderY )
-
- -

Definition at line 21 of file sprite_class.cpp.

-
22{
-
23 bool result;
-
24
-
25
-
26 // Store the screen size.
-
27 m_screenWidth = screenWidth;
-
28 m_screenHeight = screenHeight;
-
29
-
30 // Store where the sprite should be rendered to.
-
31 m_renderX = renderX;
-
32 m_renderY = renderY;
-
33
-
34 // Initialize the frame time for this sprite object.
-
35 m_frameTime = 0;
-
36
-
37 // Initialize the vertex and index buffer that hold the geometry for the sprite bitmap.
-
38 result = InitializeBuffers(device);
-
39 if (!result)
-
40 {
-
41 return false;
-
42 }
-
43
-
44 // Load the textures for this sprite.
-
45 result = LoadTextures(device, deviceContext, spriteFilename);
-
46 if (!result)
-
47 {
-
48 return false;
-
49 }
-
50
-
51 return true;
-
52}
-
-
-
- -

◆ Render()

- -
-
- - - - - - - -
bool sprite_class::Render (ID3D11DeviceContext * deviceContext)
-
- -

Definition at line 67 of file sprite_class.cpp.

-
68{
-
69 bool result;
-
70
-
71
-
72 // Update the buffers if the position of the sprite has changed from its original position.
-
73 result = UpdateBuffers(deviceContext);
-
74 if (!result)
-
75 {
-
76 return false;
-
77 }
-
78
-
79 // Put the vertex and index buffers on the graphics pipeline to prepare them for drawing.
-
80 RenderBuffers(deviceContext);
-
81
-
82 return true;
-
83}
-
-
-
- -

◆ SetRenderLocation()

- -
-
- - - - - - - - - - - -
void sprite_class::SetRenderLocation (int x,
int y )
-
- -

Definition at line 416 of file sprite_class.cpp.

-
417{
-
418 m_renderX = x;
-
419 m_renderY = y;
-
420 return;
-
421}
-
-
-
- -

◆ Shutdown()

- -
-
- - - - - - - -
void sprite_class::Shutdown ()
-
- -

Definition at line 55 of file sprite_class.cpp.

-
56{
-
57 // Release the textures used for this sprite.
-
58 ReleaseTextures();
-
59
-
60 // Release the vertex and index buffers.
-
61 ShutdownBuffers();
-
62
-
63 return;
-
64}
-
-
-
- -

◆ Update()

- -
-
- - - - - - - -
void sprite_class::Update (float frameTime)
-
- -

Definition at line 85 of file sprite_class.cpp.

-
86{
-
87 // Increment the frame time each frame.
-
88 m_frameTime += frameTime;
-
89
-
90 // Check if the frame time has reached the cycle time.
-
91 if (m_frameTime >= m_cycleTime)
-
92 {
-
93 // If it has then reset the frame time and cycle to the next sprite in the texture array.
-
94 m_frameTime -= m_cycleTime;
-
95
-
96 m_currentTexture++;
-
97
-
98 // If we are at the last sprite texture then go back to the beginning of the texture array to the first texture again.
-
99 if (m_currentTexture == m_textureCount)
-
100 {
-
101 m_currentTexture = 0;
-
102 }
-
103 }
-
104
-
105 return;
-
106}
-
-
-
-
The documentation for this class was generated from the following files: -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:879077660d2a838699ebeca975f1bf95a8dfbab14d6d67416ba64032d573ccd4 +size 27383 diff --git a/doxygen_docs/html/classstats-members.html b/doxygen_docs/html/classstats-members.html index 843c647..f86121e 100644 --- a/doxygen_docs/html/classstats-members.html +++ b/doxygen_docs/html/classstats-members.html @@ -1,134 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
stats Member List
-
-
- -

This is the complete list of members for stats, including all inherited members.

- - - - - - - - - - - - - - - - - - - - - -
get_cpu_name() (defined in stats)stats
get_current_fps() const (defined in stats)statsinline
get_draw_calls() const (defined in stats)statsinline
get_frame_time() const (defined in stats)statsinline
get_gpu_driver_version(ID3D11Device *device) (defined in stats)stats
get_max_fps() const (defined in stats)statsinline
get_min_fps() const (defined in stats)statsinline
get_total_triangle_count() const (defined in stats)stats
get_total_vertex_count() const (defined in stats)stats
get_triangle_count_ptr() (defined in stats)statsinline
get_vertex_count_ptr() (defined in stats)statsinline
get_visible_triangle_count() const (defined in stats)stats
increment_draw_call_count() (defined in stats)statsinline
initialize(application_class *app) (defined in stats)stats
reset_draw_call_count() (defined in stats)statsinline
stats() (defined in stats)stats
update_display_stats() (defined in stats)stats
update_geometric_stats() (defined in stats)stats
update_visible_count() (defined in stats)stats
~stats() (defined in stats)stats
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:22c4e2e10e82f5c5df8640e662a05c3784d4474241aa8af7ad6e23696ebb4f1d +size 9590 diff --git a/doxygen_docs/html/classstats.html b/doxygen_docs/html/classstats.html index 6016d31..00aea2b 100644 --- a/doxygen_docs/html/classstats.html +++ b/doxygen_docs/html/classstats.html @@ -1,890 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: stats Class Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
- -
stats Class Reference
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

-Public Member Functions

bool initialize (application_class *app)
 
void update_geometric_stats ()
 
void update_visible_count ()
 
void update_display_stats ()
 
int get_total_vertex_count () const
 
int get_total_triangle_count () const
 
int get_visible_triangle_count () const
 
int get_current_fps () const
 
int get_min_fps () const
 
int get_max_fps () const
 
float get_frame_time () const
 
int get_draw_calls () const
 
void increment_draw_call_count ()
 
void reset_draw_call_count ()
 
std::string get_cpu_name ()
 
std::string get_gpu_driver_version (ID3D11Device *device)
 
std::shared_ptr< int > & get_vertex_count_ptr ()
 
std::shared_ptr< int > & get_triangle_count_ptr ()
 
-

Detailed Description

-
-

Definition at line 12 of file stats.h.

-

Constructor & Destructor Documentation

- -

◆ stats()

- -
-
- - - - - - - -
stats::stats ()
-
- -

Definition at line 4 of file stats.cpp.

-
4 : fps_(nullptr), drawcalls_(0)
-
5{
-
6 total_triangle_count_ = std::make_shared<int>(0);
-
7 total_vertex_count_ = std::make_shared<int>(0);
-
8}
-
-
-
- -

◆ ~stats()

- -
-
- - - - - - - -
stats::~stats ()
-
- -

Definition at line 10 of file stats.cpp.

-
11{
-
12 fps_ = nullptr;
-
13}
-
-
-
-

Member Function Documentation

- -

◆ get_cpu_name()

- -
-
- - - - - - - -
std::string stats::get_cpu_name ()
-
- -

Definition at line 209 of file stats.cpp.

-
210{
-
211 char CPUBrandString[0x40] = {0};
-
212 int CPUInfo[4] = {-1};
-
213
-
214 // Fonction CPUID pour récupérer le nom du CPU
-
215 __cpuid(CPUInfo, 0x80000000);
-
216 unsigned int nExIds = CPUInfo[0];
-
217
-
218 for (unsigned int i = 0x80000000; i <= nExIds; ++i)
-
219 {
-
220 __cpuid(CPUInfo, i);
-
221
-
222 if (i == 0x80000002)
-
223 memcpy(CPUBrandString, CPUInfo, sizeof(CPUInfo));
-
224 else if (i == 0x80000003)
-
225 memcpy(CPUBrandString + 16, CPUInfo, sizeof(CPUInfo));
-
226 else if (i == 0x80000004)
-
227 memcpy(CPUBrandString + 32, CPUInfo, sizeof(CPUInfo));
-
228 }
-
229
-
230 std::string result = CPUBrandString;
-
231
-
232 // Nettoyer les caractères non-ASCII ou problématiques
-
233 result.erase(std::remove_if(result.begin(), result.end(),
-
234 [](unsigned char c) { return c < 32 || c > 126; }),
-
235 result.end());
-
236
-
237 // Supprimer les espaces multiples consécutifs
-
238 std::string::iterator new_end = std::unique(result.begin(), result.end(),
-
239 [](char a, char b) { return a == ' ' && b == ' '; });
-
240 result.erase(new_end, result.end());
-
241
-
242 // Supprimer les espaces au début et à la fin
-
243 result.erase(0, result.find_first_not_of(' '));
-
244 result.erase(result.find_last_not_of(' ') + 1);
-
245
-
246 return result;
-
247}
-
-
-
- -

◆ get_current_fps()

- -
-
- - - - - -
- - - - - - - -
int stats::get_current_fps () const
-
-inline
-
- -

Definition at line 28 of file stats.h.

-
28{ return current_fps_; };
-
-
-
- -

◆ get_draw_calls()

- -
-
- - - - - -
- - - - - - - -
int stats::get_draw_calls () const
-
-inline
-
- -

Definition at line 32 of file stats.h.

-
32{ return drawcalls_; };
-
-
-
- -

◆ get_frame_time()

- -
-
- - - - - -
- - - - - - - -
float stats::get_frame_time () const
-
-inline
-
- -

Definition at line 31 of file stats.h.

-
31{ return current_frame_time_;};
-
-
-
- -

◆ get_gpu_driver_version()

- -
-
- - - - - - - -
std::string stats::get_gpu_driver_version (ID3D11Device * device)
-
- -

Definition at line 249 of file stats.cpp.

-
250{
-
251 IDXGIDevice* dxgiDevice = nullptr;
-
252 IDXGIAdapter* adapter = nullptr;
-
253 std::string driverVersion = "Inconnu";
-
254
-
255 if (SUCCEEDED(device->QueryInterface(__uuidof(IDXGIDevice), (void**)&dxgiDevice)))
-
256 {
-
257 if (SUCCEEDED(dxgiDevice->GetAdapter(&adapter)))
-
258 {
-
259 DXGI_ADAPTER_DESC desc;
-
260 if (SUCCEEDED(adapter->GetDesc(&desc)))
-
261 {
-
262 // Conversion correcte de WCHAR (UTF-16) vers UTF-8
-
263 int size_needed = WideCharToMultiByte(CP_UTF8, 0, desc.Description, -1, nullptr, 0, nullptr, nullptr);
-
264 std::string deviceName;
-
265 if (size_needed > 0) {
-
266 std::vector<char> buffer(size_needed);
-
267 WideCharToMultiByte(CP_UTF8, 0, desc.Description, -1, buffer.data(), size_needed, nullptr, nullptr);
-
268 deviceName = buffer.data();
-
269 }
-
270
-
271 char driverVersionStr[256];
-
272 sprintf_s(driverVersionStr, "%s (ID: %04X:%04X)", deviceName.c_str(), desc.VendorId, desc.DeviceId);
-
273
-
274 driverVersion = driverVersionStr;
-
275 }
-
276 adapter->Release();
-
277 }
-
278 dxgiDevice->Release();
-
279 }
-
280
-
281 return driverVersion;
-
282}
-
-
-
- -

◆ get_max_fps()

- -
-
- - - - - -
- - - - - - - -
int stats::get_max_fps () const
-
-inline
-
- -

Definition at line 30 of file stats.h.

-
30{ return max_fps_; };
-
-
-
- -

◆ get_min_fps()

- -
-
- - - - - -
- - - - - - - -
int stats::get_min_fps () const
-
-inline
-
- -

Definition at line 29 of file stats.h.

-
29{ return min_fps_; };
-
-
-
- -

◆ get_total_triangle_count()

- -
-
- - - - - - - -
int stats::get_total_triangle_count () const
-
- -

Definition at line 113 of file stats.cpp.

-
114{
-
115 int totalTriangles = 0;
-
116
-
117 // Utiliser le système ECS pour accéder aux entités avec des composants de rendu
-
118 if (app_ && app_->get_entity_manager())
-
119 {
- -
121
-
122 for (const auto& entity : entities)
-
123 {
-
124 auto renderComponent = entity->GetComponent<ecs::RenderComponent>();
-
125 if (renderComponent && renderComponent->GetModel())
-
126 {
-
127 // Dans une topologie de liste de triangles, chaque triangle utilise 3 indices
-
128 totalTriangles += renderComponent->GetModel()->GetIndexCount() / 3;
-
129 }
-
130 }
-
131 }
-
132
-
133 // Ajouter également les éventuels objets restants de l'ancien système
-
134 for (const auto& obj : object_vec_)
-
135 {
-
136 if (obj && obj->get_model())
-
137 {
-
138 totalTriangles += obj->get_model()->GetIndexCount() / 3;
-
139 }
-
140 }
-
141
-
142 for (const auto& cube : cubes_vec_)
-
143 {
-
144 if (cube && cube->get_model())
-
145 {
-
146 totalTriangles += cube->get_model()->GetIndexCount() / 3;
-
147 }
-
148 }
-
149
-
150 for (const auto& chunk : terrain_chunk_vec_)
-
151 {
-
152 if (chunk && chunk->get_model())
-
153 {
-
154 totalTriangles += chunk->get_model()->GetIndexCount() / 3;
-
155 }
-
156 }
-
157
-
158 return totalTriangles;
-
159}
-
ecs::EntityManager * get_entity_manager() const
-
std::vector< std::shared_ptr< Entity > > GetEntitiesWithComponent()
- -
-
-
- -

◆ get_total_vertex_count()

- -
-
- - - - - - - -
int stats::get_total_vertex_count () const
-
- -

Definition at line 66 of file stats.cpp.

-
67{
-
68 int totalVertices = 0;
-
69
-
70 // Utiliser le système ECS pour accéder aux entités avec des composants de rendu
-
71 if (app_ && app_->get_entity_manager())
-
72 {
- -
74
-
75 for (const auto& entity : entities)
-
76 {
-
77 auto renderComponent = entity->GetComponent<ecs::RenderComponent>();
-
78 if (renderComponent && renderComponent->GetModel())
-
79 {
-
80 totalVertices += renderComponent->GetModel()->GetVertexCount();
-
81 }
-
82 }
-
83 }
-
84
-
85 // Ajouter également les éventuels objets restants de l'ancien système
-
86 for (const auto& obj : object_vec_)
-
87 {
-
88 if (obj && obj->get_model())
-
89 {
-
90 totalVertices += obj->get_model()->GetVertexCount();
-
91 }
-
92 }
-
93
-
94 for (const auto& cube : cubes_vec_)
-
95 {
-
96 if (cube && cube->get_model())
-
97 {
-
98 totalVertices += cube->get_model()->GetVertexCount();
-
99 }
-
100 }
-
101
-
102 for (const auto& chunk : terrain_chunk_vec_)
-
103 {
-
104 if (chunk && chunk->get_model())
-
105 {
-
106 totalVertices += chunk->get_model()->GetVertexCount();
-
107 }
-
108 }
-
109
-
110 return totalVertices;
-
111}
-
-
-
- -

◆ get_triangle_count_ptr()

- -
-
- - - - - -
- - - - - - - -
std::shared_ptr< int > & stats::get_triangle_count_ptr ()
-
-inline
-
- -

Definition at line 41 of file stats.h.

-
41{ return total_triangle_count_; }
-
-
-
- -

◆ get_vertex_count_ptr()

- -
-
- - - - - -
- - - - - - - -
std::shared_ptr< int > & stats::get_vertex_count_ptr ()
-
-inline
-
- -

Definition at line 40 of file stats.h.

-
40{ return total_vertex_count_; }
-
-
-
- -

◆ get_visible_triangle_count()

- -
-
- - - - - - - -
int stats::get_visible_triangle_count () const
-
- -

Definition at line 161 of file stats.cpp.

-
162{
-
163 int visibleTriangles = 0;
-
164
-
165 // Utiliser le système ECS pour accéder aux entités avec des composants de rendu
-
166 if (app_ && app_->get_entity_manager())
-
167 {
- -
169
-
170 for (const auto& entity : entities)
-
171 {
-
172 auto renderComponent = entity->GetComponent<ecs::RenderComponent>();
-
173 if (renderComponent && renderComponent->GetModel() && renderComponent->IsVisible())
-
174 {
-
175 // Dans une topologie de liste de triangles, chaque triangle utilise 3 indices
-
176 visibleTriangles += renderComponent->GetModel()->GetIndexCount() / 3;
-
177 }
-
178 }
-
179 }
-
180
-
181 // Ajouter également les éventuels objets restants de l'ancien système
-
182 for (const auto& obj : object_vec_)
-
183 {
-
184 if (obj && obj->get_model() && obj->IsVisible())
-
185 {
-
186 visibleTriangles += obj->get_model()->GetIndexCount() / 3;
-
187 }
-
188 }
-
189
-
190 for (const auto& cube : cubes_vec_)
-
191 {
-
192 if (cube && cube->get_model() && cube->IsVisible())
-
193 {
-
194 visibleTriangles += cube->get_model()->GetIndexCount() / 3;
-
195 }
-
196 }
-
197
-
198 for (const auto& chunk : terrain_chunk_vec_)
-
199 {
-
200 if (chunk && chunk->get_model() && chunk->IsVisible())
-
201 {
-
202 visibleTriangles += chunk->get_model()->GetIndexCount() / 3;
-
203 }
-
204 }
-
205
-
206 return visibleTriangles;
-
207}
-
-
-
- -

◆ increment_draw_call_count()

- -
-
- - - - - -
- - - - - - - -
void stats::increment_draw_call_count ()
-
-inline
-
- -

Definition at line 34 of file stats.h.

-
34{ drawcalls_++; };
-
-
-
- -

◆ initialize()

- -
-
- - - - - - - -
bool stats::initialize (application_class * app)
-
- -

Definition at line 15 of file stats.cpp.

-
16{
-
17 if (!app) {
-
18 Logger::Get().Log("Application pointer is null", __FILE__, __LINE__, Logger::LogLevel::Error);
-
19 return false;
-
20 }
-
21
-
22 drawcalls_ = 0;
-
23 app_ = app;
-
24
-
25 fps_ = app_->get_fps();
-
26
-
27 if (!fps_) {
-
28 Logger::Get().Log("FPS object is null", __FILE__, __LINE__, Logger::LogLevel::Error);
-
29 return false;
-
30 }
-
31
-
32 Logger::Get().Log("Stats initialized successfully", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
33
-
34 return true;
-
35}
-
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
-
fps_class * get_fps() const
-
-
-
- -

◆ reset_draw_call_count()

- -
-
- - - - - -
- - - - - - - -
void stats::reset_draw_call_count ()
-
-inline
-
- -

Definition at line 35 of file stats.h.

-
35{ drawcalls_ = 0; };
-
-
-
- -

◆ update_display_stats()

- -
-
- - - - - - - -
void stats::update_display_stats ()
-
- -

Definition at line 56 of file stats.cpp.

-
57{
-
58
-
59 current_fps_ = fps_->GetFps();
-
60 min_fps_ = fps_->GetMinFps();
-
61 max_fps_ = fps_->GetMaxFps();
-
62 drawcalls_ = get_draw_calls();
-
63 current_frame_time_ = fps_->GetFrameTime();
-
64}
-
-
-
- -

◆ update_geometric_stats()

- -
-
- - - - - - - -
void stats::update_geometric_stats ()
-
- -

Definition at line 37 of file stats.cpp.

-
38{
-
39 // Utiliser le système ECS pour accéder aux entités avec des composants de rendu
-
40 if (app_ && app_->get_entity_manager())
-
41 {
-
42 *total_vertex_count_ = get_total_vertex_count();
-
43 *total_triangle_count_ = get_total_triangle_count();
-
44
-
45 update_visible_count();
-
46
-
47 Logger::Get().Log("Statistics updated: " + std::to_string(*total_vertex_count_) + " vertices, " + std::to_string(*total_triangle_count_) + " triangles", __FILE__, __LINE__, Logger::LogLevel::Debug);
-
48 }
-
49}
-
-
-
- -

◆ update_visible_count()

- -
-
- - - - - - - -
void stats::update_visible_count ()
-
- -

Definition at line 51 of file stats.cpp.

-
52{
-
53 visible_triangle_count_ = get_visible_triangle_count();
-
54}
-
-
-
-
The documentation for this class was generated from the following files: -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:dd5d4f7cc21a998c04620cd416ca113ffb35f7e72f8b3e341ee02892701e1f20 +size 63936 diff --git a/doxygen_docs/html/classsunlight__shader__class-members.html b/doxygen_docs/html/classsunlight__shader__class-members.html index 33114de..5a885dd 100644 --- a/doxygen_docs/html/classsunlight__shader__class-members.html +++ b/doxygen_docs/html/classsunlight__shader__class-members.html @@ -1,120 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
sunlight_shader_class Member List
-
-
- -

This is the complete list of members for sunlight_shader_class, including all inherited members.

- - - - - - - -
initialize(ID3D11Device *, HWND) (defined in sunlight_shader_class)sunlight_shader_class
render(ID3D11DeviceContext *, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView *, XMFLOAT4, XMFLOAT4, XMFLOAT3, float) (defined in sunlight_shader_class)sunlight_shader_class
shutdown() (defined in sunlight_shader_class)sunlight_shader_class
sunlight_shader_class() (defined in sunlight_shader_class)sunlight_shader_class
sunlight_shader_class(const sunlight_shader_class &) (defined in sunlight_shader_class)sunlight_shader_class
~sunlight_shader_class() (defined in sunlight_shader_class)sunlight_shader_class
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:3ae435cc5cef310fb7322acb9f4239729af7dad37169c3bea92aad5267f39780 +size 6419 diff --git a/doxygen_docs/html/classsunlight__shader__class.html b/doxygen_docs/html/classsunlight__shader__class.html index 1e6afae..6164d4a 100644 --- a/doxygen_docs/html/classsunlight__shader__class.html +++ b/doxygen_docs/html/classsunlight__shader__class.html @@ -1,373 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: sunlight_shader_class Class Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
- -
sunlight_shader_class Class Reference
-
-
- - - - - - - - - - -

-Public Member Functions

 sunlight_shader_class (const sunlight_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 sunlight_shader_class.h.

-

Constructor & Destructor Documentation

- -

◆ sunlight_shader_class() [1/2]

- -
-
- - - - - - - -
sunlight_shader_class::sunlight_shader_class ()
-
- -

Definition at line 7 of file sunlight_shader_class.cpp.

-
8{
-
9 vertex_shader_ = 0;
-
10 pixel_shader_ = 0;
-
11 layout_ = 0;
-
12 sample_state_ = 0;
-
13 matrix_buffer_ = 0;
-
14 camera_buffer_ = 0;
-
15 sunlight_buffer_ = 0;
-
16 sunlight_color_buffer_ = 0;
-
17 sunlight_position_buffer_ = 0;
-
18}
-
-
-
- -

◆ sunlight_shader_class() [2/2]

- -
-
- - - - - - - -
sunlight_shader_class::sunlight_shader_class (const sunlight_shader_class & other)
-
- -

Definition at line 21 of file sunlight_shader_class.cpp.

-
22{
-
23}
-
-
-
- -

◆ ~sunlight_shader_class()

- -
-
- - - - - - - -
sunlight_shader_class::~sunlight_shader_class ()
-
- -

Definition at line 26 of file sunlight_shader_class.cpp.

-
27{
-
28}
-
-
-
-

Member Function Documentation

- -

◆ initialize()

- -
-
- - - - - - - - - - - -
bool sunlight_shader_class::initialize (ID3D11Device * device,
HWND hwnd )
-
- -

Definition at line 31 of file sunlight_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/sunlight.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/sunlight.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 = initialize_shader(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("SunLightShaderClass 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 sunlight_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 sunlight_shader_class.cpp.

-
79{
-
80 bool result;
-
81
-
82
-
83 // Set the shader parameters that it will use for rendering.
-
84 result = set_shader_parameters(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 render_shader(deviceContext, indexCount);
-
93
-
94 return true;
-
95}
-
-
-
- -

◆ shutdown()

- -
-
- - - - - - - -
void sunlight_shader_class::shutdown ()
-
- -

Definition at line 69 of file sunlight_shader_class.cpp.

-
70{
-
71 // shutdown the vertex and pixel shaders as well as the related objects.
-
72 shutdown_shader();
-
73
-
74 return;
-
75}
-
-
-
-
The documentation for this class was generated from the following files: -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:7a9597f81eb2a261bcdebb92e6b5cc8374352a858b207a24175b7f1a5e1d9790 +size 24211 diff --git a/doxygen_docs/html/classsystem__class-members.html b/doxygen_docs/html/classsystem__class-members.html index b85dce8..ab74e79 100644 --- a/doxygen_docs/html/classsystem__class-members.html +++ b/doxygen_docs/html/classsystem__class-members.html @@ -1,131 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
system_class Member List
-
-
- -

This is the complete list of members for system_class, including all inherited members.

- - - - - - - - - - - - - - - - - - -
frame() (defined in system_class)system_classprotected
get_application_class() const (defined in system_class)system_classinline
get_hwnd() const (defined in system_class)system_classinline
get_input_class() const (defined in system_class)system_classinline
initialize() (defined in system_class)system_class
initialize_windows(int &, int &) (defined in system_class)system_classprotected
message_handler(HWND, UINT, WPARAM, LPARAM) (defined in system_class)system_class
run() (defined in system_class)system_class
send_path(wchar_t *path, std::filesystem::path w_folder) (defined in system_class)system_class
set_application_class(std::shared_ptr< application_class > application) (defined in system_class)system_classinline
set_d_3D_mock(d_3d_class *mock) (defined in system_class)system_classinline
set_input(std::shared_ptr< input_class > input) (defined in system_class)system_classinline
shutdown() (defined in system_class)system_class
shutdown_windows() (defined in system_class)system_classprotected
system_class() (defined in system_class)system_class
system_class(const system_class &) (defined in system_class)system_class
~system_class() (defined in system_class)system_class
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:44d783470788fd662d49f741efac38677f17af9cbc57109f3f420682a8cdd23c +size 9481 diff --git a/doxygen_docs/html/classsystem__class.html b/doxygen_docs/html/classsystem__class.html index eda4eb4..edebc85 100644 --- a/doxygen_docs/html/classsystem__class.html +++ b/doxygen_docs/html/classsystem__class.html @@ -1,963 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: system_class Class Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
- -
system_class Class Reference
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - -

-Public Member Functions

system_class (const system_class &)
 
bool initialize ()
 
void shutdown ()
 
void run ()
 
LRESULT CALLBACK message_handler (HWND, UINT, WPARAM, LPARAM)
 
void send_path (wchar_t *path, std::filesystem::path w_folder)
 
std::shared_ptr< application_classget_application_class () const
 
void set_application_class (std::shared_ptr< application_class > application)
 
std::shared_ptr< input_classget_input_class () const
 
void set_input (std::shared_ptr< input_class > input)
 
HWND get_hwnd () const
 
void set_d_3D_mock (d_3d_class *mock)
 
- - - - - - - -

-Protected Member Functions

bool frame ()
 
void initialize_windows (int &, int &)
 
void shutdown_windows ()
 
-

Detailed Description

-
-

Definition at line 20 of file system_class.h.

-

Constructor & Destructor Documentation

- -

◆ system_class()

- -
-
- - - - - - - -
system_class::system_class ()
-
- -

Definition at line 7 of file system_class.cpp.

-
8{
-
9 input_ = 0;
-
10 application_ = 0;
-
11 imgui_manager_ = 0;
-
12 application_name_ = 0;
-
13 hinstance_ = 0;
-
14 hwnd_ = 0;
-
15 initial_window_width_ = 0;
-
16 initial_window_height_ = 0;
-
17 is_direct_3d_initialized_ = false;
-
18
-
19}
-
-
-
- -

◆ ~system_class()

- -
-
- - - - - - - -
system_class::~system_class ()
-
- -

Definition at line 21 of file system_class.cpp.

-
22{
-
23}
-
-
-
-

Member Function Documentation

- -

◆ frame()

- -
-
- - - - - -
- - - - - - - -
bool system_class::frame ()
-
-protected
-
- -

Definition at line 152 of file system_class.cpp.

-
153{
-
154 // Clear the buffers to begin the scene.
-
155 application_->get_direct_3d()->begin_scene(0.0f, 0.0f, 0.0f, 1.0f);
-
156
-
157 std::lock_guard<std::mutex> guard(render_mutex_);
-
158 bool result;
-
159
-
160 result = input_->Frame();
-
161 if (!result)
-
162 {
-
163 Logger::Get().Log("Failed to process input frame", __FILE__, __LINE__, Logger::LogLevel::Error);
-
164 return false;
-
165 }
-
166
-
167 // Do the frame processing for the application class object.
-
168 result = application_->frame(input_.get());
-
169 if (!result)
-
170 {
-
171 Logger::Get().Log("Failed to process application frame", __FILE__, __LINE__, Logger::LogLevel::Error);
-
172 return false;
-
173 }
-
174
-
175 if(!input_->IsKeyDown(222))
-
176 {
-
177 //log the key press
-
178 is_debug_key_pressed_ = false;
-
179 }
-
180 else if (input_->IsKeyDown(222) && !is_debug_key_pressed_)
-
181 {
-
182 // Log the key release state
-
183 is_debug_key_pressed_ = true;
-
184 DEBUG_MODE = !DEBUG_MODE;
-
185 }
-
186
-
187 if (DEBUG_MODE)
-
188 {
-
189 // render ImGui
-
190 result = imgui_manager_->ImGuiWidgetRenderer();
-
191 if (!result)
-
192 {
-
193 Logger::Get().Log("Failed to render ImGui widgets", __FILE__, __LINE__, Logger::LogLevel::Error);
-
194 return false;
-
195 }
-
196 }
-
197
-
198 application_->get_direct_3d()->end_scene();
-
199
-
200 return true;
-
201}
-
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
-
-
-
- -

◆ get_application_class()

- -
-
- - - - - -
- - - - - - - -
std::shared_ptr< application_class > system_class::get_application_class () const
-
-inline
-
- -

Definition at line 35 of file system_class.h.

-
35{ return application_; }
-
-
-
- -

◆ get_hwnd()

- -
-
- - - - - -
- - - - - - - -
HWND system_class::get_hwnd () const
-
-inline
-
- -

Definition at line 41 of file system_class.h.

-
41{ return hwnd_; }
-
-
-
- -

◆ get_input_class()

- -
-
- - - - - -
- - - - - - - -
std::shared_ptr< input_class > system_class::get_input_class () const
-
-inline
-
- -

Definition at line 38 of file system_class.h.

-
38{ return input_; }
-
-
-
- -

◆ initialize()

- -
-
- - - - - - - -
bool system_class::initialize ()
-
- -

Definition at line 25 of file system_class.cpp.

-
26{
-
27 int screenHeight, screenWidth = 0;
-
28 bool result;
-
29
-
30 Logger::Get().Log("Initializing system class", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
31
-
32 try
-
33 {
-
34 // initialize the windows api.
-
35 initialize_windows(screenWidth, screenHeight);
-
36
-
37 // Create and initialize the input object. This object will be used to handle reading the keyboard input from the user.
-
38 input_ = std::make_shared<input_class>();
-
39
-
40 result = input_->Initialize(hinstance_, hwnd_, screenWidth, screenHeight);
-
41 if (!result)
-
42 {
-
43 Logger::Get().Log("Failed to initialize input class", __FILE__, __LINE__, Logger::LogLevel::Error);
-
44 return false;
-
45 }
-
46
-
47 // Create and initialize the application class object. This object will handle rendering all the graphics for this application.
-
48 application_ = std::make_shared<application_class>();
-
49
-
50 result = application_->initialize(screenWidth, screenHeight, hwnd_, false);
-
51 if (!result)
-
52 {
-
53 return false;
-
54 }
-
55
-
56 is_direct_3d_initialized_ = true;
-
57
-
58 // If we received a WM_SIZE message before Direct3D was initialized, resize the swap chain now
-
59 if (initial_window_width_ > 0 && initial_window_height_ > 0)
-
60 {
-
61 application_->get_direct_3d()->resize_swap_chain(initial_window_width_, initial_window_height_);
-
62 }
-
63
-
64 // initialize imgui
-
65 if(DEBUG_MODE)
-
66 {
-
67 imgui_manager_ = std::make_shared<imguiManager>();
-
68 imgui_manager_->SetApp(application_);
-
69 result = imgui_manager_->Initialize(hwnd_, application_->get_direct_3d()->get_device(), application_->get_direct_3d()->get_device_context());
-
70 if (!result)
-
71 {
-
72 return false;
-
73 }
-
74 }
-
75
-
76 }
-
77 catch (const std::exception& e)
-
78 {
-
79 Logger::Get().Log(std::string("Exception caught during initialization: ") + e.what(), __FILE__, __LINE__, Logger::LogLevel::Error);
-
80 return false;
-
81 }
-
82
-
83 Logger::Get().Log("System class initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
84
-
85 return true;
-
86}
-
-
-
- -

◆ initialize_windows()

- -
-
- - - - - -
- - - - - - - - - - - -
void system_class::initialize_windows (int & screenWidth,
int & screenHeight )
-
-protected
-
- -

Definition at line 304 of file system_class.cpp.

-
305{
-
306 WNDCLASSEX wc;
-
307 DEVMODE dmScreenSettings;
-
308 int posX, posY;
-
309
-
310 Logger::Get().Log("Initializing windows", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
311 // Get an external pointer to this object.
-
312 application_handle = this;
-
313
-
314 // Get the instance of this application.
-
315 hinstance_ = GetModuleHandle(NULL);
-
316
-
317 // Give the application a name.
-
318 application_name_ = L"Khaotic Engine";
-
319
-
320 // Setup the windows class with default settings.
-
321 wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
-
322 wc.lpfnWndProc = wnd_proc;
-
323 wc.cbClsExtra = 0;
-
324 wc.cbWndExtra = 0;
-
325 wc.hInstance = hinstance_;
-
326 wc.hIcon = LoadIcon(hinstance_,MAKEINTRESOURCE(IDI_ICON1));
-
327 wc.hIconSm = LoadIcon(hinstance_, MAKEINTRESOURCE(IDI_ICON1));
-
328 wc.hCursor = LoadCursor(NULL, IDC_ARROW);
-
329 wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
-
330 wc.lpszMenuName = NULL;
-
331 wc.lpszClassName = application_name_;
-
332 wc.cbSize = sizeof(WNDCLASSEX);
-
333
-
334 // Register the window class.
-
335 RegisterClassEx(&wc);
-
336
-
337 // Determine the resolution of the clients desktop screen.
-
338 screenWidth = GetSystemMetrics(SM_CXSCREEN);
-
339 screenHeight = GetSystemMetrics(SM_CYSCREEN);
-
340
-
341 // Setup the screen settings depending on whether it is running in full screen or in windowed mode.
-
342 if (full_screen)
-
343 {
-
344 // If full screen set the screen to maximum size of the users desktop and 32bit.
-
345 memset(&dmScreenSettings, 0, sizeof(dmScreenSettings));
-
346 dmScreenSettings.dmSize = sizeof(dmScreenSettings);
-
347 dmScreenSettings.dmPelsWidth = (unsigned long)screenWidth;
-
348 dmScreenSettings.dmPelsHeight = (unsigned long)screenHeight;
-
349 dmScreenSettings.dmBitsPerPel = 32;
-
350 dmScreenSettings.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
-
351
-
352 // Change the display settings to full screen.
-
353 ChangeDisplaySettings(&dmScreenSettings, CDS_FULLSCREEN);
-
354
-
355 // Set the position of the window to the top left corner.
-
356 posX = posY = 0;
-
357 }
-
358 else
-
359 {
-
360 // If windowed then set it to 1600x900 resolution.
-
361 screenWidth = 1600;
-
362 screenHeight = 900;
-
363
-
364 // Place the window in the middle of the screen.
-
365 posX = (GetSystemMetrics(SM_CXSCREEN) - screenWidth) / 2;
-
366 posY = (GetSystemMetrics(SM_CYSCREEN) - screenHeight) / 2;
-
367 }
-
368
-
369 // Create the window with the screen settings and get the handle to it.
-
370 hwnd_ = CreateWindowEx(WS_EX_APPWINDOW, application_name_, application_name_,
-
371 WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX,
-
372 posX, posY, screenWidth, screenHeight, NULL, NULL, hinstance_, NULL);
-
373
-
374 // Bring the window up on the screen and set it as main focus.
-
375 ShowWindow(hwnd_, SW_SHOW);
-
376 SetForegroundWindow(hwnd_);
-
377 SetFocus(hwnd_);
-
378
-
379 // Hide the mouse cursor.
-
380 ShowCursor(true);
-
381
-
382 //drag and drop
-
383 DragAcceptFiles(hwnd_, TRUE);
-
384
-
385 return;
-
386}
-
-
-
- -

◆ message_handler()

- -
-
- - - - - - - - - - - - - - - - - - - - - -
LRESULT CALLBACK system_class::message_handler (HWND hwnd,
UINT umsg,
WPARAM wparam,
LPARAM lparam )
-
- -

Definition at line 203 of file system_class.cpp.

-
204{
-
205
-
206 if (ImGui_ImplWin32_WndProcHandler(hwnd, umsg, wparam, lparam))
-
207 {
-
208 return true;
-
209 }
-
210
-
211 switch (umsg)
-
212 {
-
213 // Check if a key has been pressed on the keyboard.
-
214 case WM_KEYDOWN:
-
215 {
-
216 // If a key is pressed send it to the input object so it can record that state.
-
217 input_->KeyDown((unsigned int)wparam);
-
218 return 0;
-
219 }
-
220
-
221 // Check if a key has been released on the keyboard.
-
222 case WM_KEYUP:
-
223 {
-
224 // If a key is released then send it to the input object so it can unset the state for that key.
-
225 input_->KeyUp((unsigned int)wparam);
-
226 return 0;
-
227 }
-
228 case WM_SIZE:
-
229 {
-
230 int newWidth = LOWORD(lparam);
-
231 int newHeight = HIWORD(lparam);
-
232
-
233 // If Direct3D is initialized, update the swap chain. Otherwise, store the window dimensions
-
234 if (is_direct_3d_initialized_ && application_ && application_->get_direct_3d())
-
235 {
-
236 application_->set_screen_width(newWidth);
-
237 application_->set_screen_height(newHeight);
-
238 application_->get_direct_3d()->resize_swap_chain(newWidth, newHeight);
-
239 }
-
240 else
-
241 {
-
242 initial_window_width_ = newWidth;
-
243 initial_window_height_ = newHeight;
-
244 }
-
245 return 0;
-
246 }
-
247 case WM_ENTERSIZEMOVE:
-
248 {
-
249 is_resizing_ = true;
-
250 break;
-
251 }
-
252 case WM_EXITSIZEMOVE:
-
253 {
-
254 is_resizing_ = false;
-
255 break;
-
256 }
-
257 case WM_DROPFILES:
-
258 {
-
259 HDROP hDrop = reinterpret_cast<HDROP>(wparam);
-
260 UINT numFiles = DragQueryFile(hDrop, 0xFFFFFFFF, nullptr, 0);
-
261
-
262 if (numFiles > 0) {
-
263 for (UINT i = 0; i < numFiles; ++i) {
-
264 WCHAR filePath[MAX_PATH];
-
265 DragQueryFile(hDrop, i, filePath, MAX_PATH);
-
266
-
267 // Get the file extension
-
268 std::wstring fileName = filePath;
-
269 std::wstring extension = fileName.substr(fileName.find_last_of(L".") + 1);
-
270
-
271 // Check if the file has a valid extension
-
272 if (extension == L"txt" || extension == L"kobj") {
-
273 // Handle dropped files with valid extensions
-
274 std::wcout << L"File dropped: " << filePath << std::endl;
-
275 application_->add_kobject(fileName);
-
276 }
-
277 else {
-
278 // Handle files with invalid extensions (optional)
-
279 std::wcout << L"Ignored file: " << filePath << std::endl;
-
280 }
-
281 }
-
282 }
-
283
-
284 DragFinish(hDrop);
-
285 return 0;
-
286 }
-
287 case WM_CLOSE:
-
288 {
-
289 Logger::Get().Log("WM_CLOSE message received", __FILE__, __LINE__);
-
290 application_->set_should_quit(true);
-
291 return 0;
-
292 }
-
293 // Any other messages send to the default message handler as our application won't make use of them.
-
294 default:
-
295 {
-
296 return DefWindowProc(hwnd, umsg, wparam, lparam);
-
297 }
-
298
-
299 }
-
300
-
301 return 0;
-
302}
-
-
-
- -

◆ run()

- -
-
- - - - - - - -
void system_class::run ()
-
- -

Definition at line 101 of file system_class.cpp.

-
102{
-
103 MSG msg;
-
104 bool done, result;
-
105
-
106 Logger::Get().Log("Running the system", __FILE__, __LINE__);
-
107
-
108 // initialize the message structure.
-
109 ZeroMemory(&msg, sizeof(MSG));
-
110
-
111 // Loop until there is a quit message from the window or the user.
-
112 done = false;
-
113
-
114 while (!done)
-
115 {
-
116 // Handle the windows messages.
-
117 if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
-
118 {
-
119 if(msg.message == WM_QUIT)
-
120 {
-
121 done = true;
-
122 }
-
123 else
-
124 {
-
125 TranslateMessage(&msg);
-
126 DispatchMessage(&msg);
-
127 }
-
128 }
-
129
-
130 // If windows signals to end the application then exit out.
-
131 if (application_ != nullptr && application_->get_should_quit())
-
132 {
-
133 Logger::Get().Log("Received quit signal from application", __FILE__, __LINE__);
-
134 done = true;
-
135 }
-
136 else
-
137 {
-
138 // Otherwise do the frame processing.
-
139 result = frame();
-
140 if (!result)
-
141 {
-
142 Logger::Get().Log("Failed to process frame", __FILE__, __LINE__, Logger::LogLevel::Error);
-
143 done = true;
-
144 }
-
145 }
-
146
-
147 }
-
148
-
149 return;
-
150}
-
-
-
- -

◆ send_path()

- -
-
- - - - - - - - - - - -
void system_class::send_path (wchar_t * path,
std::filesystem::path w_folder )
-
- -

Definition at line 446 of file system_class.cpp.

-
447{
-
448 application_->set_path(path);
-
449 application_->set_w_folder(w_folder);
-
450}
-
-
-
- -

◆ set_application_class()

- -
-
- - - - - -
- - - - - - - -
void system_class::set_application_class (std::shared_ptr< application_class > application)
-
-inline
-
- -

Definition at line 36 of file system_class.h.

-
36{ application_ = std::move(application); }
-
-
-
- -

◆ set_d_3D_mock()

- -
-
- - - - - -
- - - - - - - -
void system_class::set_d_3D_mock (d_3d_class * mock)
-
-inline
-
- -

Definition at line 43 of file system_class.h.

-
43{application_->set_direct_3d(mock);}
-
-
-
- -

◆ set_input()

- -
-
- - - - - -
- - - - - - - -
void system_class::set_input (std::shared_ptr< input_class > input)
-
-inline
-
- -

Definition at line 39 of file system_class.h.

-
39{ input_ = std::move(input); }
- -
-
-
- -

◆ shutdown()

- -
-
- - - - - - - -
void system_class::shutdown ()
-
- -

Definition at line 88 of file system_class.cpp.

-
89{
-
90 Logger::Get().Log("Shutting down system class", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
91
-
92 std::lock_guard<std::mutex> guard(render_mutex_);
-
93
-
94 // shutdown the window.
-
95 shutdown_windows();
-
96
-
97 Logger::Get().Log("System class shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
98
-
99}
-
-
-
- -

◆ shutdown_windows()

- -
-
- - - - - -
- - - - - - - -
void system_class::shutdown_windows ()
-
-protected
-
- -

Definition at line 388 of file system_class.cpp.

-
389{
-
390 Logger::Get().Log("Shutting down the windows", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
391 // Show the mouse cursor.
-
392 ShowCursor(true);
-
393
-
394 // Fix the display settings if leaving full screen mode.
-
395 if (full_screen)
-
396 {
-
397 ChangeDisplaySettings(NULL, 0);
-
398 }
-
399
-
400 // Remove the window.
-
401 DestroyWindow(hwnd_);
-
402 hwnd_ = NULL;
-
403
-
404 // Remove the application instance.
-
405 UnregisterClass(application_name_, hinstance_);
-
406 hinstance_ = NULL;
-
407
-
408 // Release the pointer to this class.
-
409 application_handle = NULL;
-
410
-
411 return;
-
412}
-
-
-
-
The documentation for this class was generated from the following files: -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:1915829bf5175bfd4b2d8e03453f58c8f9a3483b4f3cbeeeae1249f3bc59546d +size 73781 diff --git a/doxygen_docs/html/classtext__class-members.html b/doxygen_docs/html/classtext__class-members.html index 3f05e8f..a2306c1 100644 --- a/doxygen_docs/html/classtext__class-members.html +++ b/doxygen_docs/html/classtext__class-members.html @@ -1,123 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
text_class Member List
-
-
- -

This is the complete list of members for text_class, including all inherited members.

- - - - - - - - - - -
GetIndexCount() (defined in text_class)text_class
GetPixelColor() (defined in text_class)text_class
Initialize(ID3D11Device *, ID3D11DeviceContext *, int, int, int, font_class *, char *, int, int, float, float, float) (defined in text_class)text_class
Render(ID3D11DeviceContext *) (defined in text_class)text_class
Shutdown() (defined in text_class)text_class
text_class() (defined in text_class)text_class
text_class(const text_class &) (defined in text_class)text_class
UpdateText(ID3D11DeviceContext *, font_class *, char *, int, int, float, float, float) (defined in text_class)text_class
~text_class() (defined in text_class)text_class
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:2085f23950b585ba04888d324fa0a81cc5e58afec651558d34133f2b9f5c6143 +size 6894 diff --git a/doxygen_docs/html/classtext__class.html b/doxygen_docs/html/classtext__class.html index 0a3721b..40caa5c 100644 --- a/doxygen_docs/html/classtext__class.html +++ b/doxygen_docs/html/classtext__class.html @@ -1,502 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: text_class Class Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
- -
text_class Class Reference
-
-
- - - - - - - - - - - - - - - - -

-Public Member Functions

 text_class (const text_class &)
 
bool Initialize (ID3D11Device *, ID3D11DeviceContext *, int, int, int, font_class *, char *, int, int, float, float, float)
 
void Shutdown ()
 
void Render (ID3D11DeviceContext *)
 
int GetIndexCount ()
 
bool UpdateText (ID3D11DeviceContext *, font_class *, char *, int, int, float, float, float)
 
XMFLOAT4 GetPixelColor ()
 
-

Detailed Description

-
-

Definition at line 12 of file text_class.h.

-

Constructor & Destructor Documentation

- -

◆ text_class() [1/2]

- -
-
- - - - - - - -
text_class::text_class ()
-
- -

Definition at line 4 of file text_class.cpp.

-
5{
-
6 m_vertexBuffer = 0;
-
7 m_indexBuffer = 0;
-
8}
-
-
-
- -

◆ text_class() [2/2]

- -
-
- - - - - - - -
text_class::text_class (const text_class & other)
-
- -

Definition at line 11 of file text_class.cpp.

-
12{
-
13}
-
-
-
- -

◆ ~text_class()

- -
-
- - - - - - - -
text_class::~text_class ()
-
- -

Definition at line 16 of file text_class.cpp.

-
17{
-
18}
-
-
-
-

Member Function Documentation

- -

◆ GetIndexCount()

- -
-
- - - - - - - -
int text_class::GetIndexCount ()
-
- -

Definition at line 59 of file text_class.cpp.

-
60{
-
61 return m_indexCount;
-
62}
-
-
-
- -

◆ GetPixelColor()

- -
-
- - - - - - - -
XMFLOAT4 text_class::GetPixelColor ()
-
- -

Definition at line 247 of file text_class.cpp.

-
248{
-
249 return m_pixelColor;
-
250}
-
-
-
- -

◆ Initialize()

- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool text_class::Initialize (ID3D11Device * device,
ID3D11DeviceContext * deviceContext,
int screenWidth,
int screenHeight,
int maxLength,
font_class * Font,
char * text,
int positionX,
int positionY,
float red,
float green,
float blue )
-
- -

Definition at line 20 of file text_class.cpp.

-
22{
-
23 bool result;
-
24
-
25
-
26 // Store the screen width and height.
-
27 m_screenWidth = screenWidth;
-
28 m_screenHeight = screenHeight;
-
29
-
30 // Store the maximum length of the sentence.
-
31 m_maxLength = maxLength;
-
32
-
33 // Initalize the sentence.
-
34 result = InitializeBuffers(device, deviceContext, Font, text, positionX, positionY, red, green, blue);
-
35 if (!result)
-
36 {
-
37 return false;
-
38 }
-
39
-
40 return true;
-
41}
-
-
-
- -

◆ Render()

- -
-
- - - - - - - -
void text_class::Render (ID3D11DeviceContext * deviceContext)
-
- -

Definition at line 51 of file text_class.cpp.

-
52{
-
53 // Put the vertex and index buffers on the graphics pipeline to prepare them for drawing.
-
54 RenderBuffers(deviceContext);
-
55
-
56 return;
-
57}
-
-
-
- -

◆ Shutdown()

- -
-
- - - - - - - -
void text_class::Shutdown ()
-
- -

Definition at line 43 of file text_class.cpp.

-
44{
-
45 // Release the vertex and index buffers.
-
46 ShutdownBuffers();
-
47
-
48 return;
-
49}
-
-
-
- -

◆ UpdateText()

- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool text_class::UpdateText (ID3D11DeviceContext * deviceContext,
font_class * Font,
char * text,
int positionX,
int positionY,
float red,
float green,
float blue )
-
- -

Definition at line 169 of file text_class.cpp.

-
170{
-
171 int numLetters;
-
172 VertexType* vertices;
-
173 float drawX, drawY;
-
174 HRESULT result;
-
175 D3D11_MAPPED_SUBRESOURCE mappedResource;
-
176 VertexType* verticesPtr;
-
177
-
178 // Store the color of the sentence.
-
179 m_pixelColor = XMFLOAT4(red, green, blue, 1.0f);
-
180
-
181 // Get the number of letters in the sentence.
-
182 numLetters = (int)strlen(text);
-
183
-
184 // Check for possible buffer overflow.
-
185 if (numLetters > m_maxLength)
-
186 {
-
187 return false;
-
188 }
-
189
-
190 // Create the vertex array.
-
191 vertices = new VertexType[m_vertexCount];
-
192
-
193 // Initialize vertex array to zeros at first.
-
194 memset(vertices, 0, (sizeof(VertexType) * m_vertexCount));
-
195
-
196 // Calculate the X and Y pixel position on the screen to start drawing to.
-
197 drawX = (float)(((m_screenWidth / 2) * -1) + positionX);
-
198 drawY = (float)((m_screenHeight / 2) - positionY);
-
199
-
200 // Use the font class to build the vertex array from the sentence text and sentence draw location.
-
201 Font->BuildVertexArray((void*)vertices, text, drawX, drawY);
-
202
-
203 // Lock the vertex buffer so it can be written to.
-
204 result = deviceContext->Map(m_vertexBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
-
205 if (FAILED(result))
-
206 {
-
207 return false;
-
208 }
-
209
-
210 // Get a pointer to the data in the vertex buffer.
-
211 verticesPtr = (VertexType*)mappedResource.pData;
-
212
-
213 // Copy the data into the vertex buffer.
-
214 memcpy(verticesPtr, (void*)vertices, (sizeof(VertexType) * m_vertexCount));
-
215
-
216 // Unlock the vertex buffer.
-
217 deviceContext->Unmap(m_vertexBuffer, 0);
-
218
-
219 // Release the vertex array as it is no longer needed.
-
220 delete[] vertices;
-
221 vertices = 0;
-
222
-
223 return true;
-
224}
-
-
-
-
The documentation for this class was generated from the following files: -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:c4cc9c2389c337df25e5c1fdd1171b19ad95be0677a547ca0abcba782fa10f90 +size 29526 diff --git a/doxygen_docs/html/classtexture__class-members.html b/doxygen_docs/html/classtexture__class-members.html index c5df73d..d54c936 100644 --- a/doxygen_docs/html/classtexture__class-members.html +++ b/doxygen_docs/html/classtexture__class-members.html @@ -1,122 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
texture_class Member List
-
-
- -

This is the complete list of members for texture_class, including all inherited members.

- - - - - - - - - -
GetHeight() (defined in texture_class)texture_class
GetTexture() (defined in texture_class)texture_class
GetWidth() (defined in texture_class)texture_class
Initialize(ID3D11Device *, ID3D11DeviceContext *, std::string) (defined in texture_class)texture_class
Shutdown() (defined in texture_class)texture_class
texture_class() (defined in texture_class)texture_class
texture_class(const texture_class &) (defined in texture_class)texture_class
~texture_class() (defined in texture_class)texture_class
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:6da9ca91f204ba2237af0b16e374ef0ed123297bdf26a7e139088522e11f495b +size 6600 diff --git a/doxygen_docs/html/classtexture__class.html b/doxygen_docs/html/classtexture__class.html index 15f1f8b..7d268fe 100644 --- a/doxygen_docs/html/classtexture__class.html +++ b/doxygen_docs/html/classtexture__class.html @@ -1,414 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: texture_class Class Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
- -
texture_class Class Reference
-
-
- - - - - - - - - - - - - - -

-Public Member Functions

 texture_class (const texture_class &)
 
bool Initialize (ID3D11Device *, ID3D11DeviceContext *, std::string)
 
void Shutdown ()
 
ID3D11ShaderResourceView * GetTexture ()
 
int GetWidth ()
 
int GetHeight ()
 
-

Detailed Description

-
-

Definition at line 16 of file texture_class.h.

-

Constructor & Destructor Documentation

- -

◆ texture_class() [1/2]

- -
-
- - - - - - - -
texture_class::texture_class ()
-
- -

Definition at line 3 of file texture_class.cpp.

-
4{
-
5 m_targaData = 0;
-
6 m_texture = 0;
-
7 m_textureView = 0;
-
8}
-
-
-
- -

◆ texture_class() [2/2]

- -
-
- - - - - - - -
texture_class::texture_class (const texture_class & other)
-
- -

Definition at line 11 of file texture_class.cpp.

-
12{
-
13}
-
-
-
- -

◆ ~texture_class()

- -
-
- - - - - - - -
texture_class::~texture_class ()
-
- -

Definition at line 16 of file texture_class.cpp.

-
17{
-
18}
-
-
-
-

Member Function Documentation

- -

◆ GetHeight()

- -
-
- - - - - - - -
int texture_class::GetHeight ()
-
- -

Definition at line 239 of file texture_class.cpp.

-
240{
-
241 return m_height;
-
242}
-
-
-
- -

◆ GetTexture()

- -
-
- - - - - - - -
ID3D11ShaderResourceView * texture_class::GetTexture ()
-
- -

Definition at line 117 of file texture_class.cpp.

-
118{
-
119 return m_textureView;
-
120}
-
-
-
- -

◆ GetWidth()

- -
-
- - - - - - - -
int texture_class::GetWidth ()
-
- -

Definition at line 233 of file texture_class.cpp.

-
234{
-
235 return m_width;
-
236}
-
-
-
- -

◆ Initialize()

- -
-
- - - - - - - - - - - - - - - - -
bool texture_class::Initialize (ID3D11Device * device,
ID3D11DeviceContext * deviceContext,
std::string filename )
-
- -

Definition at line 20 of file texture_class.cpp.

-
21{
-
22 Logger::Get().Log(("Iinitializing texture: %s", filename), __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
23
-
24 bool result;
-
25 D3D11_TEXTURE2D_DESC textureDesc;
-
26 HRESULT hResult;
-
27 unsigned int rowPitch;
-
28 D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
-
29 // Load the targa image data into memory.
-
30 result = LoadTarga(filename);
-
31 if (!result)
-
32 {
-
33 Logger::Get().Log("Failed to load targa data", __FILE__, __LINE__, Logger::LogLevel::Error);
-
34 return false;
-
35 }
-
36 // Setup the description of the texture.
-
37 textureDesc.Height = m_height;
-
38 textureDesc.Width = m_width;
-
39 textureDesc.MipLevels = 0;
-
40 textureDesc.ArraySize = 1;
-
41 textureDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
-
42 textureDesc.SampleDesc.Count = 1;
-
43 textureDesc.SampleDesc.Quality = 0;
-
44 textureDesc.Usage = D3D11_USAGE_DEFAULT;
-
45 textureDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET;
-
46 textureDesc.CPUAccessFlags = 0;
-
47 textureDesc.MiscFlags = D3D11_RESOURCE_MISC_GENERATE_MIPS;
-
48
-
49 // Create the empty texture.
-
50 hResult = device->CreateTexture2D(&textureDesc, NULL, &m_texture);
-
51 if (FAILED(hResult))
-
52 {
-
53 Logger::Get().Log("Failed to create texture", __FILE__, __LINE__, Logger::LogLevel::Error);
-
54 return false;
-
55 }
-
56
-
57 // Set the row pitch of the targa image data.
-
58 rowPitch = (m_width * 4) * sizeof(unsigned char);
-
59 // Copy the targa image data into the texture.
-
60 deviceContext->UpdateSubresource(m_texture, 0, NULL, m_targaData, rowPitch, 0);
-
61 // Setup the shader resource view description.
-
62 srvDesc.Format = textureDesc.Format;
-
63 srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
-
64 srvDesc.Texture2D.MostDetailedMip = 0;
-
65 srvDesc.Texture2D.MipLevels = -1;
-
66
-
67 // Create the shader resource view for the texture.
-
68 hResult = device->CreateShaderResourceView(m_texture, &srvDesc, &m_textureView);
-
69 if (FAILED(hResult))
-
70 {
-
71 Logger::Get().Log("Failed to create shader resource view", __FILE__, __LINE__, Logger::LogLevel::Error);
-
72 return false;
-
73 }
-
74
-
75 // Generate mipmaps for this texture.
-
76 deviceContext->GenerateMips(m_textureView);
-
77
-
78 // Release the targa image data now that the image data has been loaded into the texture.
-
79 delete[] m_targaData;
-
80 m_targaData = 0;
-
81
-
82 Logger::Get().Log("Texture initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
83
-
84 return true;
-
85}
-
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
-
-
-
- -

◆ Shutdown()

- -
-
- - - - - - - -
void texture_class::Shutdown ()
-
- -

Definition at line 87 of file texture_class.cpp.

-
88{
-
89
-
90 Logger::Get().Log("Shutting down texture", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
91 // Release the texture view resource.
-
92 if (m_textureView)
-
93 {
-
94 m_textureView->Release();
-
95 m_textureView = 0;
-
96 }
-
97
-
98 // Release the texture.
-
99 if (m_texture)
-
100 {
-
101 m_texture->Release();
-
102 m_texture = 0;
-
103 }
-
104
-
105 // Release the targa data.
-
106 if (m_targaData)
-
107 {
-
108 delete[] m_targaData;
-
109 m_targaData = 0;
-
110 }
-
111
-
112 Logger::Get().Log("Texture shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
113
-
114 return;
-
115}
-
-
-
-
The documentation for this class was generated from the following files: -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:0f56bbd3d6c175f52eab4ff7bb70ca4fa837c325a0b164a3ae516caab2069138 +size 28192 diff --git a/doxygen_docs/html/classtexture__shader__class-members.html b/doxygen_docs/html/classtexture__shader__class-members.html index 4c082cd..88d7998 100644 --- a/doxygen_docs/html/classtexture__shader__class-members.html +++ b/doxygen_docs/html/classtexture__shader__class-members.html @@ -1,120 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
texture_shader_class Member List
-
-
- -

This is the complete list of members for texture_shader_class, including all inherited members.

- - - - - - - -
initialize(ID3D11Device *, HWND) (defined in texture_shader_class)texture_shader_class
render(ID3D11DeviceContext *, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView *) (defined in texture_shader_class)texture_shader_class
shutdown() (defined in texture_shader_class)texture_shader_class
texture_shader_class() (defined in texture_shader_class)texture_shader_class
texture_shader_class(const texture_shader_class &) (defined in texture_shader_class)texture_shader_class
~texture_shader_class() (defined in texture_shader_class)texture_shader_class
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:80cc2b31590b6edb9c71d09e4a21310fdb2f611d8d40e558b2c023439707bfb3 +size 6350 diff --git a/doxygen_docs/html/classtexture__shader__class.html b/doxygen_docs/html/classtexture__shader__class.html index 76a4961..7f93558 100644 --- a/doxygen_docs/html/classtexture__shader__class.html +++ b/doxygen_docs/html/classtexture__shader__class.html @@ -1,349 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: texture_shader_class Class Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
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.

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

◆ 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.

-
15{
-
16}
-
-
-
- -

◆ ~texture_shader_class()

- -
-
- - - - - - - -
texture_shader_class::~texture_shader_class ()
-
- -

Definition at line 19 of file texture_shader_class.cpp.

-
20{
-
21}
-
-
-
-

Member Function Documentation

- -

◆ initialize()

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

Definition at line 24 of file texture_shader_class.cpp.

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

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

◆ shutdown()

- -
-
- - - - - - - -
void texture_shader_class::shutdown ()
-
- -

Definition at line 61 of file texture_shader_class.cpp.

-
62{
-
63 // shutdown the vertex and pixel shaders as well as the related objects.
-
64 shutdown_shader();
-
65
-
66 return;
-
67}
-
-
-
-
The documentation for this class was generated from the following files: -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:d077ad2382aa270b7bdbcc285ce01729c809e532156b22b898890b28c525385e +size 22831 diff --git a/doxygen_docs/html/classtimer__class-members.html b/doxygen_docs/html/classtimer__class-members.html index c63f0a7..58e0de5 100644 --- a/doxygen_docs/html/classtimer__class-members.html +++ b/doxygen_docs/html/classtimer__class-members.html @@ -1,120 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
timer_class Member List
-
-
- -

This is the complete list of members for timer_class, including all inherited members.

- - - - - - - -
Frame() (defined in timer_class)timer_class
GetTime() (defined in timer_class)timer_class
Initialize() (defined in timer_class)timer_class
timer_class() (defined in timer_class)timer_class
timer_class(const timer_class &) (defined in timer_class)timer_class
~timer_class() (defined in timer_class)timer_class
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:28e57969a80a156d5dec410cd34735058d1e8a3f251d7fe78259cbca070035c7 +size 5942 diff --git a/doxygen_docs/html/classtimer__class.html b/doxygen_docs/html/classtimer__class.html index bec4066..039f45b 100644 --- a/doxygen_docs/html/classtimer__class.html +++ b/doxygen_docs/html/classtimer__class.html @@ -1,304 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: timer_class Class Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
- -
timer_class Class Reference
-
-
- - - - - - - - - - -

-Public Member Functions

 timer_class (const timer_class &)
 
bool Initialize ()
 
void Frame ()
 
float GetTime ()
 
-

Detailed Description

-
-

Definition at line 15 of file timer_class.h.

-

Constructor & Destructor Documentation

- -

◆ timer_class() [1/2]

- -
-
- - - - - - - -
timer_class::timer_class ()
-
- -

Definition at line 4 of file timer_class.cpp.

-
5{
-
6}
-
-
-
- -

◆ timer_class() [2/2]

- -
-
- - - - - - - -
timer_class::timer_class (const timer_class & other)
-
- -

Definition at line 9 of file timer_class.cpp.

-
10{
-
11}
-
-
-
- -

◆ ~timer_class()

- -
-
- - - - - - - -
timer_class::~timer_class ()
-
- -

Definition at line 14 of file timer_class.cpp.

-
15{
-
16}
-
-
-
-

Member Function Documentation

- -

◆ Frame()

- -
-
- - - - - - - -
void timer_class::Frame ()
-
- -

Definition at line 44 of file timer_class.cpp.

-
45{
-
46 INT64 currentTime;
-
47 INT64 elapsedTicks;
-
48
-
49
-
50 // Query the current time.
-
51 QueryPerformanceCounter((LARGE_INTEGER*)&currentTime);
-
52
-
53 // Calculate the difference in time since the last time we queried for the current time.
-
54 elapsedTicks = currentTime - m_startTime;
-
55
-
56 // Calculate the frame time.
-
57 m_frameTime = (float)elapsedTicks / m_frequency;
-
58
-
59 // Restart the timer.
-
60 m_startTime = currentTime;
-
61
-
62 return;
-
63}
-
-
-
- -

◆ GetTime()

- -
-
- - - - - - - -
float timer_class::GetTime ()
-
- -

Definition at line 65 of file timer_class.cpp.

-
66{
-
67 return m_frameTime;
-
68}
-
-
-
- -

◆ Initialize()

- -
-
- - - - - - - -
bool timer_class::Initialize ()
-
- -

Definition at line 18 of file timer_class.cpp.

-
19{
-
20 Logger::Get().Log("Initilazing timer class", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
21
-
22 INT64 frequency;
-
23
-
24
-
25 // Get the cycles per second speed for this system.
-
26 QueryPerformanceFrequency((LARGE_INTEGER*)&frequency);
-
27 if (frequency == 0)
-
28 {
-
29 Logger::Get().Log("QueryPerformanceFrequency failed", __FILE__, __LINE__, Logger::LogLevel::Error);
-
30 return false;
-
31 }
-
32
-
33 // Store it in floating point.
-
34 m_frequency = (float)frequency;
-
35
-
36 // Get the initial start time.
-
37 QueryPerformanceCounter((LARGE_INTEGER*)&m_startTime);
-
38
-
39 Logger::Get().Log("Timer class initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
40
-
41 return true;
-
42}
-
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
-
-
-
-
The documentation for this class was generated from the following files: -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:0c665b5e84f7389114a523d5825d01e6be71a126688dbacab7c6c912e29a957e +size 18047 diff --git a/doxygen_docs/html/classtranslate__shader__class-members.html b/doxygen_docs/html/classtranslate__shader__class-members.html index 1087dd7..22a5719 100644 --- a/doxygen_docs/html/classtranslate__shader__class-members.html +++ b/doxygen_docs/html/classtranslate__shader__class-members.html @@ -1,120 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
translate_shader_class Member List
-
-
- -

This is the complete list of members for translate_shader_class, including all inherited members.

- - - - - - - -
initialize(ID3D11Device *, HWND) (defined in translate_shader_class)translate_shader_class
render(ID3D11DeviceContext *, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView *, float) (defined in translate_shader_class)translate_shader_class
shutdown() (defined in translate_shader_class)translate_shader_class
translate_shader_class() (defined in translate_shader_class)translate_shader_class
translate_shader_class(const translate_shader_class &) (defined in translate_shader_class)translate_shader_class
~translate_shader_class() (defined in translate_shader_class)translate_shader_class
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:46963af5017b9586b57206b382c8a507150149ec07d3af9408275807fc7c6f36 +size 6421 diff --git a/doxygen_docs/html/classtranslate__shader__class.html b/doxygen_docs/html/classtranslate__shader__class.html index e202ea5..3e6129a 100644 --- a/doxygen_docs/html/classtranslate__shader__class.html +++ b/doxygen_docs/html/classtranslate__shader__class.html @@ -1,356 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: translate_shader_class Class Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
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: -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:11d341f03c840c0fde46a33c0fbd6c50fc32c0badc014893c2f59fb8d36d07d7 +size 23339 diff --git a/doxygen_docs/html/classtransparent__shader__class-members.html b/doxygen_docs/html/classtransparent__shader__class-members.html index cf502a7..1cafe8c 100644 --- a/doxygen_docs/html/classtransparent__shader__class-members.html +++ b/doxygen_docs/html/classtransparent__shader__class-members.html @@ -1,120 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
transparent_shader_class Member List
-
-
- -

This is the complete list of members for transparent_shader_class, including all inherited members.

- - - - - - - -
initialize(ID3D11Device *, HWND) (defined in transparent_shader_class)transparent_shader_class
render(ID3D11DeviceContext *, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView *, float) (defined in transparent_shader_class)transparent_shader_class
shutdown() (defined in transparent_shader_class)transparent_shader_class
transparent_shader_class() (defined in transparent_shader_class)transparent_shader_class
transparent_shader_class(const transparent_shader_class &) (defined in transparent_shader_class)transparent_shader_class
~transparent_shader_class() (defined in transparent_shader_class)transparent_shader_class
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:d95019cf77d1c72b40218895f23b8c382b1225e13d2633ba197b5a3293583dcc +size 6485 diff --git a/doxygen_docs/html/classtransparent__shader__class.html b/doxygen_docs/html/classtransparent__shader__class.html index 451c42d..bde487f 100644 --- a/doxygen_docs/html/classtransparent__shader__class.html +++ b/doxygen_docs/html/classtransparent__shader__class.html @@ -1,356 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: transparent_shader_class Class Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
- -
transparent_shader_class Class Reference
-
-
- - - - - - - - - - -

-Public Member Functions

 transparent_shader_class (const transparent_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 transparent_shader_class.h.

-

Constructor & Destructor Documentation

- -

◆ transparent_shader_class() [1/2]

- -
-
- - - - - - - -
transparent_shader_class::transparent_shader_class ()
-
- -

Definition at line 4 of file transparent_shader_class.cpp.

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

◆ transparent_shader_class() [2/2]

- -
-
- - - - - - - -
transparent_shader_class::transparent_shader_class (const transparent_shader_class & other)
-
- -

Definition at line 15 of file transparent_shader_class.cpp.

-
16{
-
17}
-
-
-
- -

◆ ~transparent_shader_class()

- -
-
- - - - - - - -
transparent_shader_class::~transparent_shader_class ()
-
- -

Definition at line 20 of file transparent_shader_class.cpp.

-
21{
-
22}
-
-
-
-

Member Function Documentation

- -

◆ initialize()

- -
-
- - - - - - - - - - - -
bool transparent_shader_class::initialize (ID3D11Device * device,
HWND hwnd )
-
- -

Definition at line 25 of file transparent_shader_class.cpp.

-
26{
-
27 Logger::Get().Log("Initializing transparent_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/transparent.vs");
-
36 if (error != 0)
-
37 {
-
38 Logger::Get().Log("Failed to copy vertex shader filename", __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/transparent.ps");
-
44 if (error != 0)
-
45 {
-
46 Logger::Get().Log("Failed to copy pixel shader filename", __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("transparent_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 transparent_shader_class::render (ID3D11DeviceContext * deviceContext,
int indexCount,
XMMATRIX worldMatrix,
XMMATRIX viewMatrix,
XMMATRIX projectionMatrix,
ID3D11ShaderResourceView * texture,
float blend )
-
- -

Definition at line 72 of file transparent_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, blend);
-
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 transparent_shader_class::shutdown ()
-
- -

Definition at line 64 of file transparent_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: -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:d4a39c68cbf4cfa59e2542fa7477a98912e75a4075250be25402fbebf9454ddd +size 23456 diff --git a/doxygen_docs/html/classwater__shader__class-members.html b/doxygen_docs/html/classwater__shader__class-members.html index fdb15b1..b879df4 100644 --- a/doxygen_docs/html/classwater__shader__class-members.html +++ b/doxygen_docs/html/classwater__shader__class-members.html @@ -1,120 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
water_shader_class Member List
-
-
- -

This is the complete list of members for water_shader_class, including all inherited members.

- - - - - - - -
initialize(ID3D11Device *, HWND) (defined in water_shader_class)water_shader_class
render(ID3D11DeviceContext *, int, XMMATRIX, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView *, ID3D11ShaderResourceView *, ID3D11ShaderResourceView *, float, float) (defined in water_shader_class)water_shader_class
shutdown() (defined in water_shader_class)water_shader_class
water_shader_class() (defined in water_shader_class)water_shader_class
water_shader_class(const water_shader_class &) (defined in water_shader_class)water_shader_class
~water_shader_class() (defined in water_shader_class)water_shader_class
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:4531802223d164e679a34c829d0169cdf6edb87bba440cb3bcdfb00cdd96abda +size 6366 diff --git a/doxygen_docs/html/classwater__shader__class.html b/doxygen_docs/html/classwater__shader__class.html index fb03a7d..58a7f1b 100644 --- a/doxygen_docs/html/classwater__shader__class.html +++ b/doxygen_docs/html/classwater__shader__class.html @@ -1,368 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: water_shader_class Class Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
- -
water_shader_class Class Reference
-
-
- - - - - - - - - - -

-Public Member Functions

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

Detailed Description

-
-

Definition at line 19 of file water_shader_class.h.

-

Constructor & Destructor Documentation

- -

◆ water_shader_class() [1/2]

- -
-
- - - - - - - -
water_shader_class::water_shader_class ()
-
- -

Definition at line 4 of file water_shader_class.cpp.

-
5{
-
6 vertex_shader_ = 0;
-
7 pixel_shader_ = 0;
-
8 layout_ = 0;
-
9 sample_state_ = 0;
-
10 matrix_buffer_ = 0;
-
11 reflection_buffer_ = 0;
-
12 water_buffer_ = 0;
-
13}
-
-
-
- -

◆ water_shader_class() [2/2]

- -
-
- - - - - - - -
water_shader_class::water_shader_class (const water_shader_class & other)
-
- -

Definition at line 16 of file water_shader_class.cpp.

-
17{
-
18}
-
-
-
- -

◆ ~water_shader_class()

- -
-
- - - - - - - -
water_shader_class::~water_shader_class ()
-
- -

Definition at line 21 of file water_shader_class.cpp.

-
22{
-
23}
-
-
-
-

Member Function Documentation

- -

◆ initialize()

- -
-
- - - - - - - - - - - -
bool water_shader_class::initialize (ID3D11Device * device,
HWND hwnd )
-
- -

Definition at line 26 of file water_shader_class.cpp.

-
27{
-
28 bool result;
-
29 wchar_t vsFilename[128];
-
30 wchar_t psFilename[128];
-
31 int error;
-
32
-
33 // Set the filename of the vertex shader.
-
34 error = wcscpy_s(vsFilename, 128, L"src/hlsl/water.vs");
-
35 if (error != 0)
-
36 {
-
37 return false;
-
38 }
-
39
-
40 // Set the filename of the pixel shader.
-
41 error = wcscpy_s(psFilename, 128, L"src/hlsl/water.ps");
-
42 if (error != 0)
-
43 {
-
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 return false;
-
52 }
-
53
-
54 return true;
-
55}
-
-
-
- -

◆ render()

- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool water_shader_class::render (ID3D11DeviceContext * deviceContext,
int indexCount,
XMMATRIX worldMatrix,
XMMATRIX viewMatrix,
XMMATRIX projectionMatrix,
XMMATRIX reflectionMatrix,
ID3D11ShaderResourceView * reflectionTexture,
ID3D11ShaderResourceView * refractionTexture,
ID3D11ShaderResourceView * normalTexture,
float waterTranslation,
float reflectRefractScale )
-
- -

Definition at line 66 of file water_shader_class.cpp.

-
69{
-
70 bool result;
-
71
-
72
-
73 // Set the shader parameters that it will use for rendering.
-
74 result = set_shader_parameters(deviceContext, worldMatrix, viewMatrix, projectionMatrix, reflectionMatrix, reflectionTexture,
-
75 refractionTexture, normalTexture, waterTranslation, reflectRefractScale);
-
76 if (!result)
-
77 {
-
78 return false;
-
79 }
-
80
-
81 // Now render the prepared buffers with the shader.
-
82 render_shader(deviceContext, indexCount);
-
83
-
84 return true;
-
85}
-
-
-
- -

◆ shutdown()

- -
-
- - - - - - - -
void water_shader_class::shutdown ()
-
- -

Definition at line 58 of file water_shader_class.cpp.

-
59{
-
60 // shutdown the vertex and pixel shaders as well as the related objects.
-
61 shutdown_shader();
-
62
-
63 return;
-
64}
-
-
-
-
The documentation for this class was generated from the following files: -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:4d57a302235f79304ca0a6b6bf60264307e415046998c06f6c1373bb9f4ccc4d +size 21174 diff --git a/doxygen_docs/html/clipboard.js b/doxygen_docs/html/clipboard.js index 42c1fb0..de05c8e 100644 --- a/doxygen_docs/html/clipboard.js +++ b/doxygen_docs/html/clipboard.js @@ -1,61 +1,3 @@ -/** - -The code below is based on the Doxygen Awesome project, see -https://github.com/jothepro/doxygen-awesome-css - -MIT License - -Copyright (c) 2021 - 2022 jothepro - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - -*/ - -let clipboard_title = "Copy to clipboard" -let clipboard_icon = `` -let clipboard_successIcon = `` -let clipboard_successDuration = 1000 - -$(function() { - if(navigator.clipboard) { - const fragments = document.getElementsByClassName("fragment") - for(const fragment of fragments) { - const clipboard_div = document.createElement("div") - clipboard_div.classList.add("clipboard") - clipboard_div.innerHTML = clipboard_icon - clipboard_div.title = clipboard_title - $(clipboard_div).click(function() { - const content = this.parentNode.cloneNode(true) - // filter out line number and folded fragments from file listings - content.querySelectorAll(".lineno, .ttc, .foldclosed").forEach((node) => { node.remove() }) - let text = content.textContent - // remove trailing newlines and trailing spaces from empty lines - text = text.replace(/^\s*\n/gm,'\n').replace(/\n*$/,'') - navigator.clipboard.writeText(text); - this.classList.add("success") - this.innerHTML = clipboard_successIcon - window.setTimeout(() => { // switch back to normal icon after timeout - this.classList.remove("success") - this.innerHTML = clipboard_icon - }, clipboard_successDuration); - }) - fragment.insertBefore(clipboard_div, fragment.firstChild) - } - } -}) +version https://git-lfs.github.com/spec/v1 +oid sha256:d0a8422963b3f575ec8ef4083414b055d21820ce97c5102d1930db506f689a5a +size 3004 diff --git a/doxygen_docs/html/closed.png b/doxygen_docs/html/closed.png index 98cc2c9..7b3198f 100644 Binary files a/doxygen_docs/html/closed.png and b/doxygen_docs/html/closed.png differ diff --git a/doxygen_docs/html/color__shader__class_8cpp_source.html b/doxygen_docs/html/color__shader__class_8cpp_source.html index 1171007..9b66888 100644 --- a/doxygen_docs/html/color__shader__class_8cpp_source.html +++ b/doxygen_docs/html/color__shader__class_8cpp_source.html @@ -1,471 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/src/shader/color_shader_class.cpp Source File - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
color_shader_class.cpp
-
-
-
1
-
2// Filename: colorshaderclass.cpp
-
4#include "color_shader_class.h"
-
5
-
6color_shader_class::color_shader_class()
-
7{
-
8 vertex_shader_ = 0;
-
9 pixel_shader_ = 0;
-
10 layout_ = 0;
-
11 matrix_buffer_ = 0;
-
12}
-
13
-
14
-
15color_shader_class::color_shader_class(const color_shader_class& other)
-
16{
-
17}
-
18
-
19
-
20color_shader_class::~color_shader_class()
-
21{
-
22}
-
23
-
24bool color_shader_class::initialize(ID3D11Device* device, HWND hwnd)
-
25{
-
26 Logger::Get().Log("Initializing color_shader_class", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
27
-
28 bool result;
-
29 wchar_t vsFilename[128];
-
30 wchar_t psFilename[128];
-
31 int error;
-
32
-
33
-
34 // Set the filename of the vertex shader.
-
35 error = wcscpy_s(vsFilename, 128, L"src/hlsl/Color.vs");
-
36 if (error != 0)
-
37 {
-
38 Logger::Get().Log("Error copying string", __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/Color.ps");
-
44 if (error != 0)
-
45 {
-
46 Logger::Get().Log("Error copying string", __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("Error initializing shader", __FILE__, __LINE__, Logger::LogLevel::Error);
-
55 return false;
-
56 }
-
57
-
58 Logger::Get().Log("color_shader_class initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
59
-
60 return true;
-
61}
-
62
-
63void color_shader_class::shutdown()
-
64{
-
65 // shutdown the vertex and pixel shaders as well as the related objects.
-
66 shutdown_shader();
-
67
-
68 return;
-
69}
-
70
-
71bool color_shader_class::render(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix,
-
72 XMMATRIX projectionMatrix)
-
73{
-
74 bool result;
-
75
-
76
-
77 // Set the shader parameters that it will use for rendering.
-
78 result = set_shader_parameters(deviceContext, worldMatrix, viewMatrix, projectionMatrix);
-
79 if (!result)
-
80 {
-
81 Logger::Get().Log("Error setting shader parameters", __FILE__, __LINE__, Logger::LogLevel::Error);
-
82 return false;
-
83 }
-
84
-
85 // Now render the prepared buffers with the shader.
-
86 render_shader(deviceContext, indexCount);
-
87
-
88 return true;
-
89}
-
90
-
91bool color_shader_class::initialize_shader(ID3D11Device* device, HWND hwnd, WCHAR* vsFilename, WCHAR* psFilename)
-
92{
-
93 Logger::Get().Log("Initializing shader", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
94
-
95 HRESULT result;
-
96 ID3D10Blob* errorMessage;
-
97 ID3D10Blob* vertexShaderBuffer;
-
98 ID3D10Blob* pixelShaderBuffer;
-
99 D3D11_INPUT_ELEMENT_DESC polygonLayout[2];
-
100 unsigned int numElements;
-
101 D3D11_BUFFER_DESC matrixBufferDesc;
-
102
-
103
-
104 // initialize the pointers this function will use to null.
-
105 errorMessage = 0;
-
106 vertexShaderBuffer = 0;
-
107 pixelShaderBuffer = 0;
-
108
-
109 // Compile the vertex shader code.
-
110 result = D3DCompileFromFile(vsFilename, NULL, NULL, "ColorVertexShader", "vs_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0,
-
111 &vertexShaderBuffer, &errorMessage);
-
112 if (FAILED(result))
-
113 {
-
114 // If the shader failed to compile it should have writen something to the error message.
-
115 if (errorMessage)
-
116 {
-
117 output_shader_error_message(errorMessage, hwnd, vsFilename);
-
118 }
-
119 // If there was nothing in the error message then it simply could not find the shader file itself.
-
120 else
-
121 {
-
122 Logger::Get().Log("Error compiling shader", __FILE__, __LINE__, Logger::LogLevel::Error);
-
123 }
-
124
-
125 return false;
-
126 }
-
127
-
128 // Compile the pixel shader code.
-
129 result = D3DCompileFromFile(psFilename, NULL, NULL, "ColorPixelShader", "ps_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0,
-
130 &pixelShaderBuffer, &errorMessage);
-
131 if (FAILED(result))
-
132 {
-
133 // If the shader failed to compile it should have writen something to the error message.
-
134 if (errorMessage)
-
135 {
-
136 output_shader_error_message(errorMessage, hwnd, psFilename);
-
137 }
-
138 // If there was nothing in the error message then it simply could not find the file itself.
-
139 else
-
140 {
-
141 Logger::Get().Log("Error compiling shader", __FILE__, __LINE__, Logger::LogLevel::Error);
-
142 }
-
143
-
144 return false;
-
145 }
-
146
-
147 // Create the vertex shader from the buffer.
-
148 result = device->CreateVertexShader(vertexShaderBuffer->GetBufferPointer(), vertexShaderBuffer->GetBufferSize(), NULL, &vertex_shader_);
-
149 if (FAILED(result))
-
150 {
-
151 Logger::Get().Log("Error creating vertex shader", __FILE__, __LINE__, Logger::LogLevel::Error);
-
152 return false;
-
153 }
-
154
-
155 // Create the pixel shader from the buffer.
-
156 result = device->CreatePixelShader(pixelShaderBuffer->GetBufferPointer(), pixelShaderBuffer->GetBufferSize(), NULL, &pixel_shader_);
-
157 if (FAILED(result))
-
158 {
-
159 Logger::Get().Log("Error creating pixel shader", __FILE__, __LINE__, Logger::LogLevel::Error);
-
160 return false;
-
161 }
-
162
-
163 // Create the vertex input layout description.
-
164 // This setup needs to match the VertexType stucture in the ModelClass and in the shader.
-
165 polygonLayout[0].SemanticName = "POSITION";
-
166 polygonLayout[0].SemanticIndex = 0;
-
167 polygonLayout[0].Format = DXGI_FORMAT_R32G32B32_FLOAT;
-
168 polygonLayout[0].InputSlot = 0;
-
169 polygonLayout[0].AlignedByteOffset = 0;
-
170 polygonLayout[0].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
-
171 polygonLayout[0].InstanceDataStepRate = 0;
-
172
-
173 polygonLayout[1].SemanticName = "COLOR";
-
174 polygonLayout[1].SemanticIndex = 0;
-
175 polygonLayout[1].Format = DXGI_FORMAT_R32G32B32A32_FLOAT;
-
176 polygonLayout[1].InputSlot = 0;
-
177 polygonLayout[1].AlignedByteOffset = D3D11_APPEND_ALIGNED_ELEMENT;
-
178 polygonLayout[1].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
-
179 polygonLayout[1].InstanceDataStepRate = 0;
-
180
-
181 // Get a count of the elements in the layout.
-
182 numElements = sizeof(polygonLayout) / sizeof(polygonLayout[0]);
-
183
-
184 // Create the vertex input layout.
-
185 result = device->CreateInputLayout(polygonLayout, numElements, vertexShaderBuffer->GetBufferPointer(),
-
186 vertexShaderBuffer->GetBufferSize(), &layout_);
-
187 if (FAILED(result))
-
188 {
-
189 Logger::Get().Log("Error creating input layout", __FILE__, __LINE__, Logger::LogLevel::Error);
-
190 return false;
-
191 }
-
192
-
193 // Release the vertex shader buffer and pixel shader buffer since they are no longer needed.
-
194 vertexShaderBuffer->Release();
-
195 vertexShaderBuffer = 0;
-
196
-
197 pixelShaderBuffer->Release();
-
198 pixelShaderBuffer = 0;
-
199
-
200 // Setup the description of the dynamic matrix constant buffer that is in the vertex shader.
-
201 matrixBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
-
202 matrixBufferDesc.ByteWidth = sizeof(matrix_buffer_type);
-
203 matrixBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
-
204 matrixBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
-
205 matrixBufferDesc.MiscFlags = 0;
-
206 matrixBufferDesc.StructureByteStride = 0;
-
207
-
208 // Create the constant buffer pointer so we can access the vertex shader constant buffer from within this class.
-
209 result = device->CreateBuffer(&matrixBufferDesc, NULL, &matrix_buffer_);
-
210 if (FAILED(result))
-
211 {
-
212 Logger::Get().Log("Error creating constant buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
-
213 return false;
-
214 }
-
215
-
216 Logger::Get().Log("Shader initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
217
-
218 return true;
-
219}
-
220
-
221void color_shader_class::shutdown_shader()
-
222{
-
223 Logger::Get().Log("Shutting down shader", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
224
-
225 // Release the matrix constant buffer.
-
226 if (matrix_buffer_)
-
227 {
-
228 Logger::Get().Log("Releasing matrix buffer", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
229 matrix_buffer_->Release();
-
230 matrix_buffer_ = 0;
-
231 Logger::Get().Log("Matrix buffer released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
232 }
-
233
-
234 // Release the layout.
-
235 if (layout_)
-
236 {
-
237 Logger::Get().Log("Releasing layout", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
238 layout_->Release();
-
239 layout_ = 0;
-
240 Logger::Get().Log("Layout released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
241 }
-
242
-
243 // Release the pixel shader.
-
244 if (pixel_shader_)
-
245 {
-
246 Logger::Get().Log("Releasing pixel shader", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
247 pixel_shader_->Release();
-
248 pixel_shader_ = 0;
-
249 Logger::Get().Log("Pixel shader released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
250 }
-
251
-
252 // Release the vertex shader.
-
253 if (vertex_shader_)
-
254 {
-
255 Logger::Get().Log("Releasing vertex shader", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
256 vertex_shader_->Release();
-
257 vertex_shader_ = 0;
-
258 Logger::Get().Log("Vertex shader released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
259 }
-
260
-
261 Logger::Get().Log("Shader shut down", __FILE__, __LINE__);
-
262
-
263 return;
-
264}
-
265
-
266void color_shader_class::output_shader_error_message(ID3D10Blob* errorMessage, HWND hwnd, WCHAR* shaderFilename)
-
267{
-
268 char* compileErrors;
-
269 unsigned long long bufferSize, i;
-
270 ofstream fout;
-
271
-
272
-
273 // Get a pointer to the error message text buffer.
-
274 compileErrors = (char*)(errorMessage->GetBufferPointer());
-
275
-
276 // Get the length of the message.
-
277 bufferSize = errorMessage->GetBufferSize();
-
278
-
279 // Open a file to write the error message to.
-
280 fout.open("shader-error.txt");
-
281
-
282 // Write out the error message.
-
283 for (i = 0; i < bufferSize; i++)
-
284 {
-
285 fout << compileErrors[i];
-
286 }
-
287
-
288 // Close the file.
-
289 fout.close();
-
290
-
291 // Release the error message.
-
292 errorMessage->Release();
-
293 errorMessage = 0;
-
294
-
295 // Pop a message up on the screen to notify the user to check the text file for compile errors.
-
296 MessageBox(hwnd, L"Error compiling shader. Check shader-error.txt for message.", shaderFilename, MB_OK);
-
297
-
298 return;
-
299}
-
300
-
301bool color_shader_class::set_shader_parameters(ID3D11DeviceContext* deviceContext, XMMATRIX worldMatrix, XMMATRIX viewMatrix,
-
302 XMMATRIX projectionMatrix)
-
303{
-
304 Logger::Get().Log("Setting shader parameters", __FILE__, __LINE__);
-
305
-
306 HRESULT result;
-
307 D3D11_MAPPED_SUBRESOURCE mappedResource;
-
308 matrix_buffer_type* dataPtr;
-
309 unsigned int bufferNumber;
-
310
-
311 // Transpose the matrices to prepare them for the shader.
-
312 worldMatrix = XMMatrixTranspose(worldMatrix);
-
313 viewMatrix = XMMatrixTranspose(viewMatrix);
-
314 projectionMatrix = XMMatrixTranspose(projectionMatrix);
-
315
-
316 // Lock the constant buffer so it can be written to.
-
317 result = deviceContext->Map(matrix_buffer_, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
-
318 if (FAILED(result))
-
319 {
-
320 Logger::Get().Log("Error mapping constant buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
-
321 return false;
-
322 }
-
323
-
324 // Get a pointer to the data in the constant buffer.
-
325 dataPtr = (matrix_buffer_type*)mappedResource.pData;
-
326
-
327 // Copy the matrices into the constant buffer.
-
328 dataPtr->world = worldMatrix;
-
329 dataPtr->view = viewMatrix;
-
330 dataPtr->projection = projectionMatrix;
-
331
-
332 // Unlock the constant buffer.
-
333 deviceContext->Unmap(matrix_buffer_, 0);
-
334
-
335 // Set the position of the constant buffer in the vertex shader.
-
336 bufferNumber = 0;
-
337
-
338 // Finanly set the constant buffer in the vertex shader with the updated values.
-
339 deviceContext->VSSetConstantBuffers(bufferNumber, 1, &matrix_buffer_);
-
340
-
341 return true;
-
342}
-
343
-
344void color_shader_class::render_shader(ID3D11DeviceContext* deviceContext, int indexCount)
-
345{
-
346 // Set the vertex input layout.
-
347 deviceContext->IASetInputLayout(layout_);
-
348
-
349 // Set the vertex and pixel shaders that will be used to render this triangle.
-
350 deviceContext->VSSetShader(vertex_shader_, NULL, 0);
-
351 deviceContext->PSSetShader(pixel_shader_, NULL, 0);
-
352
-
353 // render the triangle.
-
354 deviceContext->DrawIndexed(indexCount, 0, 0);
-
355
-
356 return;
-
357}
-
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
- -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:7b382fa8cb6f6fa036e3bebd649e9481a898e80df6c21064e918e79eac748eff +size 60358 diff --git a/doxygen_docs/html/color__shader__class_8h_source.html b/doxygen_docs/html/color__shader__class_8h_source.html index 5c2daff..d6c453e 100644 --- a/doxygen_docs/html/color__shader__class_8h_source.html +++ b/doxygen_docs/html/color__shader__class_8h_source.html @@ -1,167 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/inc/shader/color_shader_class.h Source File - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
color_shader_class.h
-
-
-
1
-
2// Filename: colorshaderclass.h
-
4#ifndef _COLORSHADERCLASS_H_
-
5#define _COLORSHADERCLASS_H_
-
6
-
7
-
9// INCLUDES //
-
11#include "Logger.h"
-
12#include <d3d11.h>
-
13#include <d3dcompiler.h>
-
14#include <directxmath.h>
-
15#include <fstream>
-
16using namespace DirectX;
-
17using namespace std;
-
18
-
19
-
21// Class name: color_shader_class
-
- -
24{
-
25private:
-
26 struct matrix_buffer_type
-
27 {
-
28 XMMATRIX world;
-
29 XMMATRIX view;
-
30 XMMATRIX projection;
-
31 };
-
32
-
33public:
- - - -
37
-
38 bool initialize(ID3D11Device*, HWND);
-
39 void shutdown();
-
40 bool render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX);
-
41
-
42private:
-
43 bool initialize_shader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
-
44 void shutdown_shader();
-
45 void output_shader_error_message(ID3D10Blob*, HWND, WCHAR*);
-
46
-
47 bool set_shader_parameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX);
-
48 void render_shader(ID3D11DeviceContext*, int);
-
49
-
50private:
-
51 ID3D11VertexShader* vertex_shader_;
-
52 ID3D11PixelShader* pixel_shader_;
-
53 ID3D11InputLayout* layout_;
-
54 ID3D11Buffer* matrix_buffer_;
-
55};
-
-
56
-
57#endif
- -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:93222a0fa48bded6f318ba9bbd36f91f3281549ad522d31660d26f6789181c78 +size 12285 diff --git a/doxygen_docs/html/component_8h_source.html b/doxygen_docs/html/component_8h_source.html index 77f951d..e7abcdd 100644 --- a/doxygen_docs/html/component_8h_source.html +++ b/doxygen_docs/html/component_8h_source.html @@ -1,165 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/inc/system/ecs/component.h Source File - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
component.h
-
-
-
1#pragma once
-
2#include <memory>
-
3#include <typeindex>
-
4#include <typeinfo>
-
5
-
-
9namespace ecs {
-
10
-
11// Classe de base pour tous les composants
-
-
12class Component {
-
13public:
-
14 Component() = default;
-
15 virtual ~Component() = default;
-
16
-
17 // Empêcher la copie
-
18 Component(const Component&) = delete;
-
19 Component& operator=(const Component&) = delete;
-
20
-
21 // Permettre le déplacement
-
22 Component(Component&&) = default;
-
23 Component& operator=(Component&&) = default;
-
24
-
28 virtual void Initialize() {}
-
29
-
34 virtual void Update(float deltaTime) {}
-
35
-
36 // virtual std::string Serialize() {}
-
37 // virtual void Deserialize(const std::string& data) {}
-
38};
-
-
39
-
43using ComponentPtr = std::shared_ptr<Component>;
-
44
-
48using ComponentTypeID = std::type_index;
-
49
-
53template<typename T>
-
- -
55 static_assert(std::is_base_of<Component, T>::value, "T must derive from Component");
-
56 return std::type_index(typeid(T));
-
57}
-
-
58
-
59} // namespace ecs
-
- -
virtual void Update(float deltaTime)
Definition component.h:34
-
virtual void Initialize()
Definition component.h:28
-
Definition component.h:9
-
std::shared_ptr< Component > ComponentPtr
Definition component.h:43
-
std::type_index ComponentTypeID
Definition component.h:48
-
ComponentTypeID GetComponentTypeID()
Definition component.h:54
-
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:353895abb83596f65c0833a8d4d3e050c9ca9c07dd422e098ca9057e89214d21 +size 14702 diff --git a/doxygen_docs/html/cookie.js b/doxygen_docs/html/cookie.js index 53ad21d..11198d9 100644 --- a/doxygen_docs/html/cookie.js +++ b/doxygen_docs/html/cookie.js @@ -1,58 +1,3 @@ -/*! - Cookie helper functions - Copyright (c) 2023 Dimitri van Heesch - Released under MIT license. -*/ -let Cookie = { - cookie_namespace: 'doxygen_', - - readSetting(cookie,defVal) { - if (window.chrome) { - const val = localStorage.getItem(this.cookie_namespace+cookie) || - sessionStorage.getItem(this.cookie_namespace+cookie); - if (val) return val; - } else { - let myCookie = this.cookie_namespace+cookie+"="; - if (document.cookie) { - const index = document.cookie.indexOf(myCookie); - if (index != -1) { - const valStart = index + myCookie.length; - let valEnd = document.cookie.indexOf(";", valStart); - if (valEnd == -1) { - valEnd = document.cookie.length; - } - return document.cookie.substring(valStart, valEnd); - } - } - } - return defVal; - }, - - writeSetting(cookie,val,days=10*365) { // default days='forever', 0=session cookie, -1=delete - if (window.chrome) { - if (days==0) { - sessionStorage.setItem(this.cookie_namespace+cookie,val); - } else { - localStorage.setItem(this.cookie_namespace+cookie,val); - } - } else { - let date = new Date(); - date.setTime(date.getTime()+(days*24*60*60*1000)); - const expiration = days!=0 ? "expires="+date.toGMTString()+";" : ""; - document.cookie = this.cookie_namespace + cookie + "=" + - val + "; SameSite=Lax;" + expiration + "path=/"; - } - }, - - eraseSetting(cookie) { - if (window.chrome) { - if (localStorage.getItem(this.cookie_namespace+cookie)) { - localStorage.removeItem(this.cookie_namespace+cookie); - } else if (sessionStorage.getItem(this.cookie_namespace+cookie)) { - sessionStorage.removeItem(this.cookie_namespace+cookie); - } - } else { - this.writeSetting(cookie,'',-1); - } - }, -} +version https://git-lfs.github.com/spec/v1 +oid sha256:6f9da35eed772d69c37ff64eea68cf217e46afce266db7ca3b131a388f4c95fe +size 1874 diff --git a/doxygen_docs/html/d__3d__class_8cpp_source.html b/doxygen_docs/html/d__3d__class_8cpp_source.html index a66d308..93cb25f 100644 --- a/doxygen_docs/html/d__3d__class_8cpp_source.html +++ b/doxygen_docs/html/d__3d__class_8cpp_source.html @@ -1,945 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/src/system/d_3d_class.cpp Source File - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
d_3d_class.cpp
-
-
-
1
-
2// Filename: d3dclass.cpp
-
4#include "d_3d_class.h"
-
5
-
6
-
- -
8{
-
9 swap_chain = 0;
-
10 device_ = 0;
-
11 device_context_ = 0;
-
12 render_target_view_ = 0;
-
13 depth_stencil_buffer_ = 0;
-
14 depth_stencil_state_ = 0;
-
15 depth_stencil_view_ = 0;
-
16 raster_state_ = 0;
-
17 depth_disabled_stencil_state_ = 0;
-
18 alpha_enable_blending_state_ = 0;
-
19 alpha_disable_blending_state_ = 0;
-
20}
-
-
21
-
22
- -
24{
-
25}
-
26
-
27
-
28d_3d_class::~d_3d_class()
-
29{
-
30}
-
31
-
32
-
-
33bool d_3d_class::initialize(int screenWidth, int screenHeight, bool vsync, HWND hwnd, bool fullscreen, float screenDepth, float screenNear)
-
34{
-
35 Logger::Get().Log("Initializing D3Dclass", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
36
-
37 HRESULT result;
-
38 IDXGIFactory* factory;
-
39 IDXGIAdapter* adapter;
-
40 IDXGIOutput* adapterOutput;
-
41 unsigned int numModes, i, numerator, denominator;
-
42 unsigned long long stringLength;
-
43 DXGI_MODE_DESC* displayModeList;
-
44 DXGI_ADAPTER_DESC adapterDesc;
-
45 int error;
-
46 DXGI_SWAP_CHAIN_DESC swapChainDesc;
-
47 D3D_FEATURE_LEVEL featureLevel;
-
48 ID3D11Texture2D* backBufferPtr;
-
49 D3D11_TEXTURE2D_DESC depthBufferDesc;
-
50 D3D11_DEPTH_STENCIL_DESC depthStencilDesc;
-
51 D3D11_DEPTH_STENCIL_VIEW_DESC depthStencilViewDesc;
-
52 D3D11_RASTERIZER_DESC rasterDesc;
-
53 float fieldOfView, screenAspect;
-
54 D3D11_DEPTH_STENCIL_DESC depthDisabledStencilDesc;
-
55 D3D11_BLEND_DESC blendStateDescription;
-
56
-
57 // Store the vsync setting.
-
58 vsync_enabled_ = vsync;
-
59
-
60 // Create a DirectX graphics interface factory.
-
61 result = CreateDXGIFactory(__uuidof(IDXGIFactory), (void**)&factory);
-
62 if (FAILED(result))
-
63 {
-
64 Logger::Get().Log("Failed to create DXGIFactory", __FILE__, __LINE__, Logger::LogLevel::Error);
-
65 return false;
-
66 }
-
67
-
68 // Use the factory to create an adapter for the primary graphics interface (video card).
-
69 result = factory->EnumAdapters(0, &adapter);
-
70 if (FAILED(result))
-
71 {
-
72 Logger::Get().Log("Failed to create adapter", __FILE__, __LINE__, Logger::LogLevel::Error);
-
73 return false;
-
74 }
-
75
-
76 // Enumerate the primary adapter output (monitor).
-
77 result = adapter->EnumOutputs(0, &adapterOutput);
-
78 if (FAILED(result))
-
79 {
-
80 Logger::Get().Log("Failed to create adapter output", __FILE__, __LINE__, Logger::LogLevel::Error);
-
81 return false;
-
82 }
-
83
-
84 // Get the number of modes that fit the DXGI_FORMAT_R8G8B8A8_UNORM display format for the adapter output (monitor).
-
85 result = adapterOutput->GetDisplayModeList(DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_ENUM_MODES_INTERLACED, &numModes, NULL);
-
86 if (FAILED(result))
-
87 {
-
88 Logger::Get().Log("Failed to get display mode list", __FILE__, __LINE__, Logger::LogLevel::Error);
-
89 return false;
-
90 }
-
91
-
92 // Create a list to hold all the possible display modes for this monitor/video card combination.
-
93 displayModeList = new DXGI_MODE_DESC[numModes];
-
94 if (!displayModeList)
-
95 {
-
96 Logger::Get().Log("Failed to create display mode list", __FILE__, __LINE__, Logger::LogLevel::Error);
-
97 return false;
-
98 }
-
99
-
100 // Now fill the display mode list structures.
-
101 result = adapterOutput->GetDisplayModeList(DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_ENUM_MODES_INTERLACED, &numModes, displayModeList);
-
102 if (FAILED(result))
-
103 {
-
104 Logger::Get().Log("Failed to fill display mode list", __FILE__, __LINE__, Logger::LogLevel::Error);
-
105 return false;
-
106 }
-
107
-
108 // Now go through all the display modes and find the one that matches the screen width and height.
-
109 // When a match is found store the numerator and denominator of the refresh rate for that monitor.
-
110 for (i = 0; i < numModes; i++)
-
111 {
-
112 if (displayModeList[i].Width == (unsigned int)screenWidth)
-
113 {
-
114 if (displayModeList[i].Height == (unsigned int)screenHeight)
-
115 {
-
116 numerator = displayModeList[i].RefreshRate.Numerator;
-
117 denominator = displayModeList[i].RefreshRate.Denominator;
-
118 }
-
119 }
-
120 }
-
121
-
122 // Get the adapter (video card) description.
-
123 result = adapter->GetDesc(&adapterDesc);
-
124 if (FAILED(result))
-
125 {
-
126 Logger::Get().Log("Failed to get adapter description", __FILE__, __LINE__, Logger::LogLevel::Error);
-
127 return false;
-
128 }
-
129
-
130 // Store the dedicated video card memory in megabytes.
-
131 video_card_memory_ = (int)(adapterDesc.DedicatedVideoMemory / 1024 / 1024);
-
132
-
133 // Convert the name of the video card to a character array and store it.
-
134 error = wcstombs_s(&stringLength, video_card_description_, 128, adapterDesc.Description, 128);
-
135 if (error != 0)
-
136 {
-
137 Logger::Get().Log("Failed to convert video card name to character array", __FILE__, __LINE__, Logger::LogLevel::Error);
-
138 return false;
-
139 }
-
140
-
141 // Release the display mode list.
-
142 delete[] displayModeList;
-
143 displayModeList = 0;
-
144
-
145 // Release the adapter output.
-
146 adapterOutput->Release();
-
147 adapterOutput = 0;
-
148
-
149 // Release the adapter.
-
150 adapter->Release();
-
151 adapter = 0;
-
152
-
153 // Release the factory.
-
154 factory->Release();
-
155 factory = 0;
-
156
-
157 // initialize the swap chain description.
-
158 ZeroMemory(&swapChainDesc, sizeof(swapChainDesc));
-
159
-
160 // Set to a single back buffer.
-
161 swapChainDesc.BufferCount = 1;
-
162
-
163 // Set the width and height of the back buffer.
-
164 swapChainDesc.BufferDesc.Width = screenWidth;
-
165 swapChainDesc.BufferDesc.Height = screenHeight;
-
166
-
167 // Set regular 32-bit surface for the back buffer.
-
168 swapChainDesc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
-
169
-
170 // Set the refresh rate of the back buffer.
-
171 if (vsync_enabled_)
-
172 {
-
173 swapChainDesc.BufferDesc.RefreshRate.Numerator = numerator;
-
174 swapChainDesc.BufferDesc.RefreshRate.Denominator = denominator;
-
175 }
-
176 else
-
177 {
-
178 swapChainDesc.BufferDesc.RefreshRate.Numerator = 0;
-
179 swapChainDesc.BufferDesc.RefreshRate.Denominator = 1;
-
180 }
-
181
-
182 // Set the usage of the back buffer.
-
183 swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
-
184
-
185 // Set the handle for the window to render to.
-
186 swapChainDesc.OutputWindow = hwnd;
-
187
-
188 // Turn multisampling off.
-
189 swapChainDesc.SampleDesc.Count = 1;
-
190 swapChainDesc.SampleDesc.Quality = 0;
-
191
-
192 // Set to full screen or windowed mode.
-
193 if (fullscreen)
-
194 {
-
195 swapChainDesc.Windowed = false;
-
196 }
-
197 else
-
198 {
-
199 swapChainDesc.Windowed = true;
-
200 }
-
201
-
202 // Set the scan line ordering and scaling to unspecified.
-
203 swapChainDesc.BufferDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED;
-
204 swapChainDesc.BufferDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED;
-
205
-
206 // Discard the back buffer contents after presenting.
-
207 swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
-
208
-
209 // Don't set the advanced flags.
-
210 swapChainDesc.Flags = 0;
-
211
-
212 // Set the feature level to DirectX 11.
-
213 featureLevel = D3D_FEATURE_LEVEL_11_0;
-
214
-
215 // Create the swap chain, Direct3D device, and Direct3D device context.
-
216 result = D3D11CreateDeviceAndSwapChain(NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, 0, &featureLevel, 1,
-
217 D3D11_SDK_VERSION, &swapChainDesc, &swap_chain, &device_, NULL, &device_context_);
-
218 if (FAILED(result))
-
219 {
-
220 Logger::Get().Log("Failed to create swap chain, device and device context", __FILE__, __LINE__, Logger::LogLevel::Error);
-
221 return false;
-
222 }
-
223
-
224 // Get the pointer to the back buffer.
-
225 result = swap_chain->GetBuffer(0, __uuidof(ID3D11Texture2D), (LPVOID*)&backBufferPtr);
-
226 if (FAILED(result))
-
227 {
-
228 Logger::Get().Log("Failed to get pointer to back buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
-
229 return false;
-
230 }
-
231
-
232 // Create the render target view with the back buffer pointer.
-
233 result = device_->CreateRenderTargetView(backBufferPtr, NULL, &render_target_view_);
-
234 if (FAILED(result))
-
235 {
-
236 Logger::Get().Log("Failed to create render target view", __FILE__, __LINE__, Logger::LogLevel::Error);
-
237 return false;
-
238 }
-
239
-
240 // Release pointer to the back buffer as we no longer need it.
-
241 backBufferPtr->Release();
-
242 backBufferPtr = 0;
-
243
-
244 // initialize the description of the depth buffer.
-
245 ZeroMemory(&depthBufferDesc, sizeof(depthBufferDesc));
-
246
-
247 // Set up the description of the depth buffer.
-
248 depthBufferDesc.Width = screenWidth;
-
249 depthBufferDesc.Height = screenHeight;
-
250 depthBufferDesc.MipLevels = 1;
-
251 depthBufferDesc.ArraySize = 1;
-
252 depthBufferDesc.Format = DXGI_FORMAT_D24_UNORM_S8_UINT;
-
253 depthBufferDesc.SampleDesc.Count = 1;
-
254 depthBufferDesc.SampleDesc.Quality = 0;
-
255 depthBufferDesc.Usage = D3D11_USAGE_DEFAULT;
-
256 depthBufferDesc.BindFlags = D3D11_BIND_DEPTH_STENCIL;
-
257 depthBufferDesc.CPUAccessFlags = 0;
-
258 depthBufferDesc.MiscFlags = 0;
-
259
-
260 // Create the texture for the depth buffer using the filled out description.
-
261 result = device_->CreateTexture2D(&depthBufferDesc, NULL, &depth_stencil_buffer_);
-
262 if (FAILED(result))
-
263 {
-
264 Logger::Get().Log("Failed to create texture for depth buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
-
265 return false;
-
266 }
-
267
-
268 // initialize the description of the stencil state.
-
269 ZeroMemory(&depthStencilDesc, sizeof(depthStencilDesc));
-
270
-
271 // Set up the description of the stencil state.
-
272 depthStencilDesc.DepthEnable = true;
-
273 depthStencilDesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL;
-
274 depthStencilDesc.DepthFunc = D3D11_COMPARISON_LESS;
-
275
-
276 depthStencilDesc.StencilEnable = true;
-
277 depthStencilDesc.StencilReadMask = 0xFF;
-
278 depthStencilDesc.StencilWriteMask = 0xFF;
-
279
-
280 // Stencil operations if pixel is front-facing.
-
281 depthStencilDesc.FrontFace.StencilFailOp = D3D11_STENCIL_OP_KEEP;
-
282 depthStencilDesc.FrontFace.StencilDepthFailOp = D3D11_STENCIL_OP_INCR;
-
283 depthStencilDesc.FrontFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
-
284 depthStencilDesc.FrontFace.StencilFunc = D3D11_COMPARISON_ALWAYS;
-
285
-
286 // Stencil operations if pixel is back-facing.
-
287 depthStencilDesc.BackFace.StencilFailOp = D3D11_STENCIL_OP_KEEP;
-
288 depthStencilDesc.BackFace.StencilDepthFailOp = D3D11_STENCIL_OP_DECR;
-
289 depthStencilDesc.BackFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
-
290 depthStencilDesc.BackFace.StencilFunc = D3D11_COMPARISON_ALWAYS;
-
291
-
292 // Create the depth stencil state.
-
293 result = device_->CreateDepthStencilState(&depthStencilDesc, &depth_stencil_state_);
-
294 if (FAILED(result))
-
295 {
-
296 Logger::Get().Log("Failed to create depth stencil state", __FILE__, __LINE__, Logger::LogLevel::Error);
-
297 return false;
-
298 }
-
299
-
300 // Set the depth stencil state.
-
301 device_context_->OMSetDepthStencilState(depth_stencil_state_, 1);
-
302
-
303 // initialize the depth stencil view.
-
304 ZeroMemory(&depthStencilViewDesc, sizeof(depthStencilViewDesc));
-
305
-
306 // Set up the depth stencil view description.
-
307 depthStencilViewDesc.Format = DXGI_FORMAT_D24_UNORM_S8_UINT;
-
308 depthStencilViewDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D;
-
309 depthStencilViewDesc.Texture2D.MipSlice = 0;
-
310
-
311 // Create the depth stencil view.
-
312 result = device_->CreateDepthStencilView(depth_stencil_buffer_, &depthStencilViewDesc, &depth_stencil_view_);
-
313 if (FAILED(result))
-
314 {
-
315 Logger::Get().Log("Failed to create depth stencil view", __FILE__, __LINE__, Logger::LogLevel::Error);
-
316 return false;
-
317 }
-
318
-
319 // Bind the render target view and depth stencil buffer to the output render pipeline.
-
320 device_context_->OMSetRenderTargets(1, &render_target_view_, depth_stencil_view_);
-
321
-
322 // Setup the raster description which will determine how and what polygons will be drawn.
-
323 rasterDesc.AntialiasedLineEnable = false;
-
324 rasterDesc.CullMode = D3D11_CULL_BACK;
-
325 rasterDesc.DepthBias = 0;
-
326 rasterDesc.DepthBiasClamp = 0.0f;
-
327 rasterDesc.DepthClipEnable = true;
-
328 rasterDesc.FillMode = D3D11_FILL_SOLID;
-
329 rasterDesc.FrontCounterClockwise = false;
-
330 rasterDesc.MultisampleEnable = false;
-
331 rasterDesc.ScissorEnable = false;
-
332 rasterDesc.SlopeScaledDepthBias = 0.0f;
-
333
-
334 // Create the rasterizer state from the description we just filled out.
-
335 result = device_->CreateRasterizerState(&rasterDesc, &raster_state_);
-
336 if (FAILED(result))
-
337 {
-
338 Logger::Get().Log("Failed to create rasterizer state", __FILE__, __LINE__, Logger::LogLevel::Error);
-
339 return false;
-
340 }
-
341
-
342 // Now set the rasterizer state.
-
343 device_context_->RSSetState(raster_state_);
-
344
-
345 // Setup the viewport for rendering.
-
346 viewport_.Width = (float)screenWidth;
-
347 viewport_.Height = (float)screenHeight;
-
348 viewport_.MinDepth = 0.0f;
-
349 viewport_.MaxDepth = 1.0f;
-
350 viewport_.TopLeftX = 0.0f;
-
351 viewport_.TopLeftY = 0.0f;
-
352
-
353 // Create the viewport.
-
354 device_context_->RSSetViewports(1, &viewport_);
-
355
-
356 // Setup the projection matrix.
-
357 fieldOfView = 3.141592654f / 4.0f;
-
358 screenAspect = (float)screenWidth / (float)screenHeight;
-
359
-
360 // Create the projection matrix for 3D rendering.
-
361 projection_matrix_ = XMMatrixPerspectiveFovLH(fieldOfView, screenAspect, screenNear, screenDepth);
-
362
-
363 // initialize the world matrix to the identity matrix.
-
364 world_matrix_ = XMMatrixIdentity();
-
365
-
366 // Create an orthographic projection matrix for 2D rendering.
-
367 ortho_matrix_ = XMMatrixOrthographicLH((float)screenWidth, (float)screenHeight, screenNear, screenDepth);
-
368
-
369 // Clear the second depth stencil state before setting the parameters.
-
370 ZeroMemory(&depthDisabledStencilDesc, sizeof(depthDisabledStencilDesc));
-
371
-
372 // Now create a second depth stencil state which turns off the Z buffer for 2D rendering. The only difference is
-
373 // that DepthEnable is set to false, all other parameters are the same as the other depth stencil state.
-
374 depthDisabledStencilDesc.DepthEnable = false;
-
375 depthDisabledStencilDesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL;
-
376 depthDisabledStencilDesc.DepthFunc = D3D11_COMPARISON_LESS;
-
377 depthDisabledStencilDesc.StencilEnable = true;
-
378 depthDisabledStencilDesc.StencilReadMask = 0xFF;
-
379 depthDisabledStencilDesc.StencilWriteMask = 0xFF;
-
380 depthDisabledStencilDesc.FrontFace.StencilFailOp = D3D11_STENCIL_OP_KEEP;
-
381 depthDisabledStencilDesc.FrontFace.StencilDepthFailOp = D3D11_STENCIL_OP_INCR;
-
382 depthDisabledStencilDesc.FrontFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
-
383 depthDisabledStencilDesc.FrontFace.StencilFunc = D3D11_COMPARISON_ALWAYS;
-
384 depthDisabledStencilDesc.BackFace.StencilFailOp = D3D11_STENCIL_OP_KEEP;
-
385 depthDisabledStencilDesc.BackFace.StencilDepthFailOp = D3D11_STENCIL_OP_DECR;
-
386 depthDisabledStencilDesc.BackFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
-
387 depthDisabledStencilDesc.BackFace.StencilFunc = D3D11_COMPARISON_ALWAYS;
-
388
-
389 // Create the state using the device.
-
390 result = device_->CreateDepthStencilState(&depthDisabledStencilDesc, &depth_disabled_stencil_state_);
-
391 if (FAILED(result))
-
392 {
-
393 Logger::Get().Log("Failed to create depth disabled stencil state", __FILE__, __LINE__, Logger::LogLevel::Error);
-
394 return false;
-
395 }
-
396
-
397 // Clear the blend state description.
-
398 ZeroMemory(&blendStateDescription, sizeof(D3D11_BLEND_DESC));
-
399
-
400 // Create an alpha enabled blend state description.
-
401 blendStateDescription.RenderTarget[0].BlendEnable = TRUE;
-
402 blendStateDescription.RenderTarget[0].SrcBlend = D3D11_BLEND_ONE;
-
403 blendStateDescription.RenderTarget[0].DestBlend = D3D11_BLEND_INV_SRC_ALPHA;
-
404 blendStateDescription.RenderTarget[0].BlendOp = D3D11_BLEND_OP_ADD;
-
405 blendStateDescription.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_ONE;
-
406 blendStateDescription.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_ZERO;
-
407 blendStateDescription.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD;
-
408 blendStateDescription.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL;
-
409
-
410 // Create the blend state using the description.
-
411 result = device_->CreateBlendState(&blendStateDescription, &alpha_enable_blending_state_);
-
412 if (FAILED(result))
-
413 {
-
414 Logger::Get().Log("Failed to create alpha enabled blend state", __FILE__, __LINE__, Logger::LogLevel::Error);
-
415 return false;
-
416 }
-
417
-
418 // Modify the description to create an alpha disabled blend state description.
-
419 blendStateDescription.RenderTarget[0].BlendEnable = FALSE;
-
420
-
421 // Create the blend state using the description.
-
422 result = device_->CreateBlendState(&blendStateDescription, &alpha_disable_blending_state_);
-
423 if (FAILED(result))
-
424 {
-
425 Logger::Get().Log("Failed to create alpha disabled blend state", __FILE__, __LINE__, Logger::LogLevel::Error);
-
426 return false;
-
427 }
-
428
-
429 return true;
-
430}
-
-
431
-
432
-
- -
434{
-
435
-
436 Logger::Get().Log("Shutting down D3Dclass", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
437
-
438 // Before shutting down set to windowed mode or when you release the swap chain it will throw an exception.
-
439 if (swap_chain)
-
440 {
-
441 swap_chain->SetFullscreenState(false, NULL);
-
442 }
-
443
-
444 if (alpha_enable_blending_state_)
-
445 {
-
446 alpha_enable_blending_state_->Release();
-
447 alpha_enable_blending_state_ = 0;
-
448 }
-
449
-
450 if (alpha_disable_blending_state_)
-
451 {
-
452 alpha_disable_blending_state_->Release();
-
453 alpha_disable_blending_state_ = 0;
-
454 }
-
455
-
456 if (depth_disabled_stencil_state_)
-
457 {
-
458 depth_disabled_stencil_state_->Release();
-
459 depth_disabled_stencil_state_ = 0;
-
460 }
-
461
-
462 if (raster_state_)
-
463 {
-
464 raster_state_->Release();
-
465 raster_state_ = 0;
-
466 }
-
467
-
468 if (depth_stencil_view_)
-
469 {
-
470 depth_stencil_view_->Release();
-
471 depth_stencil_view_ = 0;
-
472 }
-
473
-
474 if (depth_stencil_state_)
-
475 {
-
476 depth_stencil_state_->Release();
-
477 depth_stencil_state_ = 0;
-
478 }
-
479
-
480 if (depth_stencil_buffer_)
-
481 {
-
482 depth_stencil_buffer_->Release();
-
483 depth_stencil_buffer_ = 0;
-
484 }
-
485
-
486 if (render_target_view_)
-
487 {
-
488 render_target_view_->Release();
-
489 render_target_view_ = 0;
-
490 }
-
491
-
492 if (device_context_)
-
493 {
-
494 device_context_->Release();
-
495 device_context_ = 0;
-
496 }
-
497
-
498 if (device_)
-
499 {
-
500 device_->Release();
-
501 device_ = 0;
-
502 }
-
503
-
504 if (swap_chain)
-
505 {
-
506 swap_chain->Release();
-
507 swap_chain = 0;
-
508 }
-
509
-
510 Logger::Get().Log("D3Dclass shutdown", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
511
-
512 return;
-
513}
-
-
514
-
515
-
-
516void d_3d_class::begin_scene(float red, float green, float blue, float alpha)
-
517{
-
518 float color[4];
-
519
-
520
-
521 // Setup the color to clear the buffer to.
-
522 color[0] = red;
-
523 color[1] = green;
-
524 color[2] = blue;
-
525 color[3] = alpha;
-
526
-
527 // Clear the back buffer.
-
528 device_context_->ClearRenderTargetView(render_target_view_, color);
-
529
-
530
-
531
-
532 // Clear the depth buffer.
-
533 device_context_->ClearDepthStencilView(depth_stencil_view_, D3D11_CLEAR_DEPTH, 1.0f, 0);
-
534
-
535 return;
-
536}
-
-
537
-
538
-
- -
540{
-
541 // Present the back buffer to the screen since rendering is complete.
-
542 if (vsync_enabled_)
-
543 {
-
544 // Lock to screen refresh rate.
-
545 swap_chain->Present(1, 0);
-
546 }
-
547 else
-
548 {
-
549 // Present as fast as possible.
-
550 swap_chain->Present(0, 0);
-
551 }
-
552
-
553 return;
-
554}
-
-
555
-
556
-
- -
558{
-
559 return device_;
-
560}
-
-
561
-
562
-
-
563ID3D11DeviceContext* d_3d_class::get_device_context()
-
564{
-
565 return device_context_;
-
566}
-
-
567
-
-
568void d_3d_class::get_video_card_info(char* cardName, int& memory)
-
569{
-
570 strcpy_s(cardName, 128, video_card_description_);
-
571 memory = video_card_memory_;
-
572 return;
-
573}
-
-
574
-
575
-
- -
577{
-
578 // Bind the render target view and depth stencil buffer to the output render pipeline.
-
579 device_context_->OMSetRenderTargets(1, &render_target_view_, depth_stencil_view_);
-
580
-
581 return;
-
582}
-
-
583
-
584
-
- -
586{
-
587 // Set the viewport.
-
588 device_context_->RSSetViewports(1, &viewport_);
-
589
-
590 return;
-
591}
-
-
592
-
- -
594{
-
595 Logger::Get().Log("Releasing D3D resources", __FILE__, __LINE__);
-
596
-
597 // libere la vue
-
598 if (render_target_view_)
-
599 {
-
600 render_target_view_->Release();
-
601 render_target_view_ = 0;
-
602 }
-
603
-
604 // libere le buffer de profondeur
-
605 if (depth_stencil_buffer_)
-
606 {
-
607 depth_stencil_buffer_->Release();
-
608 depth_stencil_buffer_ = 0;
-
609 }
-
610
-
611 // libere la vue de profondeur
-
612 if (depth_stencil_view_)
-
613 {
-
614 depth_stencil_view_->Release();
-
615 depth_stencil_view_ = 0;
-
616 }
-
617
-
618 Logger::Get().Log("D3D resources released", __FILE__, __LINE__);
-
619}
-
-
620
-
621// Reset the resources for the swap chain
-
-
622void d_3d_class::reset_resources(int newWidth, int newHeight)
-
623{
-
624 Logger::Get().Log("Resetting D3D resources", __FILE__, __LINE__);
-
625
-
626 HRESULT result;
-
627
-
628 ID3D11Texture2D* backBuffer;
-
629 result = swap_chain->GetBuffer(0, __uuidof(ID3D11Texture2D), (LPVOID*)&backBuffer);
-
630 if (FAILED(result))
-
631 {
-
632 Logger::Get().Log("Failed to get back buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
-
633 return;
-
634 }
-
635
-
636 result = device_->CreateRenderTargetView(backBuffer, NULL, &render_target_view_);
-
637 if (FAILED(result))
-
638 {
-
639 Logger::Get().Log("Failed to create render target view", __FILE__, __LINE__, Logger::LogLevel::Error);
-
640 return;
-
641 }
-
642
-
643 result = backBuffer->Release();
-
644 if (FAILED(result))
-
645 {
-
646 Logger::Get().Log("Failed to release back buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
-
647 return;
-
648 }
-
649
-
650 // Recreate the depth/stencil buffer and view
-
651 D3D11_TEXTURE2D_DESC depthBufferDesc;
-
652 ZeroMemory(&depthBufferDesc, sizeof(depthBufferDesc));
-
653 depthBufferDesc.Width = newWidth;
-
654 depthBufferDesc.Height = newHeight;
-
655 depthBufferDesc.MipLevels = 1;
-
656 depthBufferDesc.ArraySize = 1;
-
657 depthBufferDesc.Format = DXGI_FORMAT_D24_UNORM_S8_UINT;
-
658 depthBufferDesc.SampleDesc.Count = 1;
-
659 depthBufferDesc.SampleDesc.Quality = 0;
-
660 depthBufferDesc.Usage = D3D11_USAGE_DEFAULT;
-
661 depthBufferDesc.BindFlags = D3D11_BIND_DEPTH_STENCIL;
-
662 depthBufferDesc.CPUAccessFlags = 0;
-
663 depthBufferDesc.MiscFlags = 0;
-
664
-
665 D3D11_DEPTH_STENCIL_VIEW_DESC depthStencilViewDesc;
-
666 ZeroMemory(&depthStencilViewDesc, sizeof(depthStencilViewDesc));
-
667 depthStencilViewDesc.Format = depthBufferDesc.Format;
-
668 depthStencilViewDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D;
-
669 depthStencilViewDesc.Texture2D.MipSlice = 0;
-
670
-
671 // Other depthStencilDesc settings...
-
672 result = device_->CreateTexture2D(&depthBufferDesc, NULL, &depth_stencil_buffer_);
-
673 if (FAILED(result))
-
674 {
-
675 Logger::Get().Log("Failed to create depth stencil buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
-
676 return;
-
677 }
-
678
-
679 result = device_->CreateDepthStencilView(depth_stencil_buffer_, &depthStencilViewDesc, &depth_stencil_view_);
-
680 if (FAILED(result))
-
681 {
-
682 Logger::Get().Log("Failed to create depth stencil view", __FILE__, __LINE__, Logger::LogLevel::Error);
-
683 return;
-
684 }
-
685
-
686 // Set the new render target and depth/stencil views for rendering
-
687 device_context_->OMSetRenderTargets(1, &render_target_view_, depth_stencil_view_);
-
688}
-
-
689
-
- -
691{
-
692 return swap_chain;
-
693}
-
-
694
-
-
695void d_3d_class::resize_swap_chain(int newWidth, int newHeight)
-
696{
-
697
-
698 // log the new width and height
-
699 Logger::Get().Log("Resizing swap chain to " + std::to_string(newWidth) + "x" + std::to_string(newHeight), __FILE__, __LINE__);
-
700
-
701 HRESULT result;
-
702
-
703 // Release existing DirectX resources
- -
705 device_context_->Flush();
-
706
-
707 // Resize the swap chain
-
708 result = swap_chain->ResizeBuffers(0, newWidth, newHeight, DXGI_FORMAT_UNKNOWN, 0);
-
709 if (FAILED(result))
-
710 {
-
711 Logger::Get().Log("Failed to resize swap chain", __FILE__, __LINE__, Logger::LogLevel::Error);
-
712 return;
-
713 }
-
714
-
715 // Reset the resources
-
716 reset_resources(newWidth, newHeight);
-
717
-
718 // Update the viewport
-
719 viewport_.Width = static_cast<float>(newWidth);
-
720 viewport_.Height = static_cast<float>(newHeight);
-
721 device_context_->RSSetViewports(1, &viewport_);
-
722}
-
-
723
-
- -
725{
-
726 device_context_->OMSetDepthStencilState(depth_stencil_state_, 1);
-
727 return;
-
728}
-
-
729
-
730
-
- -
732{
-
733 device_context_->OMSetDepthStencilState(depth_disabled_stencil_state_, 1);
-
734 return;
-
735}
-
-
736
-
- -
738{
-
739 float blendFactor[4];
-
740
-
741
-
742 // Setup the blend factor.
-
743 blendFactor[0] = 0.0f;
-
744 blendFactor[1] = 0.0f;
-
745 blendFactor[2] = 0.0f;
-
746 blendFactor[3] = 0.0f;
-
747
-
748 // Turn on the alpha blending.
-
749 device_context_->OMSetBlendState(alpha_enable_blending_state_, blendFactor, 0xffffffff);
-
750
-
751 return;
-
752}
-
-
753
-
- -
755{
-
756 float blendFactor[4];
-
757
-
758
-
759 // Setup the blend factor.
-
760 blendFactor[0] = 0.0f;
-
761 blendFactor[1] = 0.0f;
-
762 blendFactor[2] = 0.0f;
-
763 blendFactor[3] = 0.0f;
-
764
-
765 // Turn off the alpha blending.
-
766 device_context_->OMSetBlendState(alpha_disable_blending_state_, blendFactor, 0xffffffff);
-
767
-
768 return;
-
769}
-
-
770
-
-
771void d_3d_class::set_vsync(bool vsync)
-
772{
-
773 vsync_enabled_ = vsync;
-
774}
-
-
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
- -
void turn_z_buffer_on()
-
ID3D11Device * get_device()
Gets the Direct3D device.
-
virtual void end_scene()
Ends the rendering process for the current frame.
-
void release_resources()
-
void reset_resources(int newWidth, int newHeight)
-
void set_back_buffer_render_target()
-
ID3D11DeviceContext * get_device_context()
Gets the Direct3D device context.
-
void reset_viewport()
-
void get_video_card_info(char *description, int &memory)
-
void enable_alpha_blending()
-
void resize_swap_chain(int width, int height)
-
void disable_alpha_blending()
-
d_3d_class()
Default constructor for d_3d_class.
Definition d_3d_class.cpp:7
-
IDXGISwapChain * get_swap_chain()
-
void set_vsync(bool vsync)
Sets the vertical sync state.
-
void shutdown()
Releases Direct3D resources.
-
virtual void begin_scene(float, float, float, float)
Begins the rendering process for a new frame.
-
virtual bool initialize(int, int, bool, HWND, bool, float, float)
Initializes the Direct3D device and related resources.
-
void turn_z_buffer_off()
-
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:985e00e59fe5f214f3e16298483f97f431d2a863ebf3b8f664d7a87a0dfb22f9 +size 128912 diff --git a/doxygen_docs/html/d__3d__class_8h_source.html b/doxygen_docs/html/d__3d__class_8h_source.html index 063ac30..d3c2bc3 100644 --- a/doxygen_docs/html/d__3d__class_8h_source.html +++ b/doxygen_docs/html/d__3d__class_8h_source.html @@ -1,219 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/inc/system/d_3d_class.h Source File - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
d_3d_class.h
-
-
-
1
-
2// Filename: d3dclass.h
-
4#ifndef _D3DCLASS_H_
-
5#define _D3DCLASS_H_
-
6
-
7
-
9// LINKING //
-
11#pragma comment(lib, "d3d11.lib")
-
12#pragma comment(lib, "dxgi.lib")
-
13#pragma comment(lib, "d3dcompiler.lib")
-
14
-
15
-
17// INCLUDES //
-
19#include "imguiManager.h"
-
20#include "d3d11.h"
-
21#include "font_shader_class.h"
-
22#include "font_class.h"
-
23#include "text_class.h"
-
24
-
25using namespace DirectX;
-
26
-
28// Class name: d_3d_class
-
- -
31{
-
32public:
-
36 d_3d_class();
-
37 d_3d_class(const d_3d_class&);
- -
39
-
52 virtual bool initialize(int, int, bool, HWND, bool, float, float);
-
56 void shutdown();
-
57
-
66 virtual void begin_scene(float, float, float, float);
-
70 virtual void end_scene();
-
71
-
77 ID3D11Device* get_device();
-
83 ID3D11DeviceContext* get_device_context();
-
84 //XMMATRIX get_projection_matrix(XMMATRIX& projectionMatrix);
-
85 IDXGISwapChain* swap_chain;
-
90 IDXGISwapChain* get_swap_chain();
-
96 void resize_swap_chain(int width, int height);
-
102 void set_vsync(bool vsync);
-
103
-
109 XMMATRIX get_projection_matrix() const { return projection_matrix_; };
-
115 XMMATRIX get_world_matrix() const { return world_matrix_;};
-
121 XMMATRIX get_ortho_matrix() const { return ortho_matrix_; };
-
122
-
128 void get_video_card_info(char* description, int& memory);
-
129
- -
137 void reset_viewport();
-
138
-
142 void release_resources();
-
148 void reset_resources(int newWidth, int newHeight);
-
149
-
153 void turn_z_buffer_on();
-
157 void turn_z_buffer_off();
-
158
- - -
167
-
168private:
-
169 bool vsync_enabled_;
-
170 int video_card_memory_;
-
171 char video_card_description_[128];
-
172 ID3D11Device* device_;
-
173 ID3D11DeviceContext* device_context_;
-
174 ID3D11RenderTargetView* render_target_view_;
-
175 ID3D11Texture2D* depth_stencil_buffer_;
-
176 ID3D11DepthStencilState* depth_stencil_state_;
-
177 ID3D11DepthStencilView* depth_stencil_view_;
-
178 ID3D11RasterizerState* raster_state_;
-
179 XMMATRIX projection_matrix_;
-
180 XMMATRIX world_matrix_;
-
181 XMMATRIX ortho_matrix_;
-
182 D3D11_VIEWPORT viewport_;
-
183 ID3D11DepthStencilState* depth_disabled_stencil_state_;
-
184 ID3D11BlendState* alpha_enable_blending_state_;
-
185 ID3D11BlendState* alpha_disable_blending_state_;
-
186};
-
-
187
-
188#endif
- -
void turn_z_buffer_on()
-
ID3D11Device * get_device()
Gets the Direct3D device.
-
virtual void end_scene()
Ends the rendering process for the current frame.
-
void release_resources()
-
void reset_resources(int newWidth, int newHeight)
-
XMMATRIX get_world_matrix() const
Definition d_3d_class.h:115
-
void set_back_buffer_render_target()
-
ID3D11DeviceContext * get_device_context()
Gets the Direct3D device context.
-
void reset_viewport()
-
XMMATRIX get_projection_matrix() const
Definition d_3d_class.h:109
-
void get_video_card_info(char *description, int &memory)
-
void enable_alpha_blending()
-
void resize_swap_chain(int width, int height)
-
void disable_alpha_blending()
-
d_3d_class()
Default constructor for d_3d_class.
Definition d_3d_class.cpp:7
-
XMMATRIX get_ortho_matrix() const
Definition d_3d_class.h:121
-
IDXGISwapChain * get_swap_chain()
-
void set_vsync(bool vsync)
Sets the vertical sync state.
-
void shutdown()
Releases Direct3D resources.
-
virtual void begin_scene(float, float, float, float)
Begins the rendering process for a new frame.
-
virtual bool initialize(int, int, bool, HWND, bool, float, float)
Initializes the Direct3D device and related resources.
-
void turn_z_buffer_off()
-
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:39b938e1af0be17f538cf432d67669444687e561b174a081bac840bc6583fedc +size 28292 diff --git a/doxygen_docs/html/depth__shader__class_8cpp_source.html b/doxygen_docs/html/depth__shader__class_8cpp_source.html index 5c9f898..71795a1 100644 --- a/doxygen_docs/html/depth__shader__class_8cpp_source.html +++ b/doxygen_docs/html/depth__shader__class_8cpp_source.html @@ -1,493 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/src/shader/depth_shader_class.cpp Source File - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
depth_shader_class.cpp
-
-
-
1#include "depth_shader_class.h"
-
2
-
3
-
4depth_shader_class::depth_shader_class()
-
5{
-
6 vertex_shader_ = 0;
-
7 pixel_shader_ = 0;
-
8 layout_ = 0;
-
9 matrix_buffer_ = 0;
-
10 sample_state_ = 0;
-
11}
-
12
-
13
-
14depth_shader_class::depth_shader_class(const depth_shader_class& other)
-
15{
-
16}
-
17
-
18
-
19depth_shader_class::~depth_shader_class()
-
20{
-
21}
-
22
-
23
-
24bool depth_shader_class::initialize(ID3D11Device* device, HWND hwnd)
-
25{
-
26 Logger::Get().Log("Initializing texture shader", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
27
-
28 bool result;
-
29 wchar_t vsFilename[128];
-
30 wchar_t psFilename[128];
-
31 int error;
-
32 // Set the filename of the vertex shader.
-
33 error = wcscpy_s(vsFilename, 128, L"src/hlsl/depth.vs");
-
34 if (error != 0)
-
35 {
-
36 Logger::Get().Log("Error copying stirng", __FILE__, __LINE__, Logger::LogLevel::Error);
-
37 return false;
-
38 }
-
39
-
40 // Set the filename of the pixel shader.
-
41 error = wcscpy_s(psFilename, 128, L"src/hlsl/depth.ps");
-
42 if (error != 0)
-
43 {
-
44 Logger::Get().Log("Error copying stirng", __FILE__, __LINE__, Logger::LogLevel::Error);
-
45 return false;
-
46 }
-
47
-
48 // initialize the vertex and pixel shaders.
-
49 result = initialize_shader(device, hwnd, vsFilename, psFilename);
-
50 if (!result)
-
51 {
-
52 Logger::Get().Log("Error initializing shader", __FILE__, __LINE__, Logger::LogLevel::Error);
-
53 return false;
-
54 }
-
55
-
56 Logger::Get().Log("Texture shader initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
57
-
58 return true;
-
59}
-
60
-
61void depth_shader_class::shutdown()
-
62{
-
63 // shutdown the vertex and pixel shaders as well as the related objects.
-
64 shutdown_shader();
-
65
-
66 return;
-
67}
-
68
-
69bool depth_shader_class::render(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix,
-
70 XMMATRIX projectionMatrix, ID3D11ShaderResourceView* texture)
-
71{
-
72 bool result;
-
73
-
74
-
75 // Set the shader parameters that it will use for rendering.
-
76 result = set_shader_parameters(deviceContext, worldMatrix, viewMatrix, projectionMatrix, texture);
-
77 if (!result)
-
78 {
-
79 Logger::Get().Log("Error setting shader parameters", __FILE__, __LINE__, Logger::LogLevel::Error);
-
80 return false;
-
81 }
-
82
-
83 // Now render the prepared buffers with the shader.
-
84 render_shader(deviceContext, indexCount);
-
85
-
86 return true;
-
87}
-
88
-
89bool depth_shader_class::initialize_shader(ID3D11Device* device, HWND hwnd, WCHAR* vsFilename, WCHAR* psFilename)
-
90{
-
91 Logger::Get().Log("Initializing shader", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
92
-
93 HRESULT result;
-
94 ID3D10Blob* errorMessage;
-
95 ID3D10Blob* vertexShaderBuffer;
-
96 ID3D10Blob* pixelShaderBuffer;
-
97 D3D11_INPUT_ELEMENT_DESC polygonLayout[2];
-
98 unsigned int numElements;
-
99 D3D11_BUFFER_DESC matrixBufferDesc;
-
100 D3D11_SAMPLER_DESC samplerDesc;
-
101
-
102
-
103 // initialize the pointers this function will use to null.
-
104 errorMessage = 0;
-
105 vertexShaderBuffer = 0;
-
106 pixelShaderBuffer = 0;
-
107 // Compile the vertex shader code.
-
108 result = D3DCompileFromFile(vsFilename, NULL, NULL, "DepthVertexShader", "vs_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0,
-
109 &vertexShaderBuffer, &errorMessage);
-
110 if (FAILED(result))
-
111 {
-
112 // If the shader failed to compile it should have writen something to the error message.
-
113 if (errorMessage)
-
114 {
-
115 output_shader_error_message(errorMessage, hwnd, vsFilename);
-
116 }
-
117 // If there was nothing in the error message then it simply could not find the shader file itself.
-
118 else
-
119 {
-
120 Logger::Get().Log("Error compiling shader", __FILE__, __LINE__, Logger::LogLevel::Error);
-
121 }
-
122
-
123 return false;
-
124 }
-
125
-
126 // Compile the pixel shader code.
-
127 result = D3DCompileFromFile(psFilename, NULL, NULL, "DepthPixelShader", "ps_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0,
-
128 &pixelShaderBuffer, &errorMessage);
-
129 if (FAILED(result))
-
130 {
-
131 // If the shader failed to compile it should have writen something to the error message.
-
132 if (errorMessage)
-
133 {
-
134 output_shader_error_message(errorMessage, hwnd, psFilename);
-
135 }
-
136 // If there was nothing in the error message then it simply could not find the file itself.
-
137 else
-
138 {
-
139 Logger::Get().Log("Error compiling shader", __FILE__, __LINE__, Logger::LogLevel::Error);
-
140 }
-
141
-
142 return false;
-
143 }
-
144
-
145 // Create the vertex shader from the buffer.
-
146 result = device->CreateVertexShader(vertexShaderBuffer->GetBufferPointer(), vertexShaderBuffer->GetBufferSize(), NULL, &vertex_shader_);
-
147 if (FAILED(result))
-
148 {
-
149 Logger::Get().Log("Error creating vertex shader", __FILE__, __LINE__, Logger::LogLevel::Error);
-
150 return false;
-
151 }
-
152
-
153 // Create the pixel shader from the buffer.
-
154 result = device->CreatePixelShader(pixelShaderBuffer->GetBufferPointer(), pixelShaderBuffer->GetBufferSize(), NULL, &pixel_shader_);
-
155 if (FAILED(result))
-
156 {
-
157 Logger::Get().Log("Error creating pixel shader", __FILE__, __LINE__, Logger::LogLevel::Error);
-
158 return false;
-
159 }
-
160 // Create the vertex input layout description.
-
161 // This setup needs to match the VertexType stucture in the ModelClass and in the shader.
-
162 polygonLayout[0].SemanticName = "POSITION";
-
163 polygonLayout[0].SemanticIndex = 0;
-
164 polygonLayout[0].Format = DXGI_FORMAT_R32G32B32_FLOAT;
-
165 polygonLayout[0].InputSlot = 0;
-
166 polygonLayout[0].AlignedByteOffset = 0;
-
167 polygonLayout[0].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
-
168 polygonLayout[0].InstanceDataStepRate = 0;
-
169
-
170 polygonLayout[1].SemanticName = "TEXCOORD";
-
171 polygonLayout[1].SemanticIndex = 0;
-
172 polygonLayout[1].Format = DXGI_FORMAT_R32G32_FLOAT;
-
173 polygonLayout[1].InputSlot = 0;
-
174 polygonLayout[1].AlignedByteOffset = D3D11_APPEND_ALIGNED_ELEMENT;
-
175 polygonLayout[1].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
-
176 polygonLayout[1].InstanceDataStepRate = 0;
-
177
-
178 // Get a count of the elements in the layout.
-
179 numElements = sizeof(polygonLayout) / sizeof(polygonLayout[0]);
-
180
-
181 // Create the vertex input layout.
-
182 result = device->CreateInputLayout(polygonLayout, numElements, vertexShaderBuffer->GetBufferPointer(),
-
183 vertexShaderBuffer->GetBufferSize(), &layout_);
-
184 if (FAILED(result))
-
185 {
-
186 Logger::Get().Log("Error creating input layout", __FILE__, __LINE__, Logger::LogLevel::Error);
-
187 return false;
-
188 }
-
189
-
190 // Release the vertex shader buffer and pixel shader buffer since they are no longer needed.
-
191 vertexShaderBuffer->Release();
-
192 vertexShaderBuffer = 0;
-
193
-
194 pixelShaderBuffer->Release();
-
195 pixelShaderBuffer = 0;
-
196
-
197 // Setup the description of the dynamic matrix constant buffer that is in the vertex shader.
-
198 matrixBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
-
199 matrixBufferDesc.ByteWidth = sizeof(matrix_buffer_type);
-
200 matrixBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
-
201 matrixBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
-
202 matrixBufferDesc.MiscFlags = 0;
-
203 matrixBufferDesc.StructureByteStride = 0;
-
204
-
205 // Create the constant buffer pointer so we can access the vertex shader constant buffer from within this class.
-
206 result = device->CreateBuffer(&matrixBufferDesc, NULL, &matrix_buffer_);
-
207 if (FAILED(result))
-
208 {
-
209 Logger::Get().Log("Error creating constant buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
-
210 return false;
-
211 }
-
212 // Create a texture sampler state description.
-
213 samplerDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR;
-
214 samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP;
-
215 samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP;
-
216 samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_WRAP;
-
217 samplerDesc.MipLODBias = 0.0f;
-
218 samplerDesc.MaxAnisotropy = 1;
-
219 samplerDesc.ComparisonFunc = D3D11_COMPARISON_ALWAYS;
-
220 samplerDesc.BorderColor[0] = 0;
-
221 samplerDesc.BorderColor[1] = 0;
-
222 samplerDesc.BorderColor[2] = 0;
-
223 samplerDesc.BorderColor[3] = 0;
-
224 samplerDesc.MinLOD = 0;
-
225 samplerDesc.MaxLOD = D3D11_FLOAT32_MAX;
-
226
-
227 // Create the texture sampler state.
-
228 result = device->CreateSamplerState(&samplerDesc, &sample_state_);
-
229 if (FAILED(result))
-
230 {
-
231 Logger::Get().Log("Error creating sampler state", __FILE__, __LINE__, Logger::LogLevel::Error);
-
232 return false;
-
233 }
-
234
-
235 Logger::Get().Log("Shader initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
236
-
237 return true;
-
238}
-
239
-
240void depth_shader_class::shutdown_shader()
-
241{
-
242 Logger::Get().Log("Shutting down shader", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
243
-
244 // Release the sampler state.
-
245 if (sample_state_)
-
246 {
-
247 sample_state_->Release();
-
248 sample_state_ = 0;
-
249 }
-
250
-
251 // Release the matrix constant buffer.
-
252 if (matrix_buffer_)
-
253 {
-
254 matrix_buffer_->Release();
-
255 matrix_buffer_ = 0;
-
256 }
-
257
-
258 // Release the layout.
-
259 if (layout_)
-
260 {
-
261 layout_->Release();
-
262 layout_ = 0;
-
263 }
-
264
-
265 // Release the pixel shader.
-
266 if (pixel_shader_)
-
267 {
-
268 pixel_shader_->Release();
-
269 pixel_shader_ = 0;
-
270 }
-
271
-
272 // Release the vertex shader.
-
273 if (vertex_shader_)
-
274 {
-
275 vertex_shader_->Release();
-
276 vertex_shader_ = 0;
-
277 }
-
278
-
279 Logger::Get().Log("Shader shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
280
-
281 return;
-
282}
-
283
-
284void depth_shader_class::output_shader_error_message(ID3D10Blob* errorMessage, HWND hwnd, WCHAR* shaderFilename)
-
285{
-
286 char* compileErrors;
-
287 unsigned long long bufferSize, i;
-
288 ofstream fout;
-
289
-
290
-
291 // Get a pointer to the error message text buffer.
-
292 compileErrors = (char*)(errorMessage->GetBufferPointer());
-
293
-
294 // Get the length of the message.
-
295 bufferSize = errorMessage->GetBufferSize();
-
296
-
297 // Open a file to write the error message to.
-
298 fout.open("shader-error.txt");
-
299
-
300 // Write out the error message.
-
301 for (i = 0; i < bufferSize; i++)
-
302 {
-
303 fout << compileErrors[i];
-
304 }
-
305
-
306 // Close the file.
-
307 fout.close();
-
308
-
309 // Release the error message.
-
310 errorMessage->Release();
-
311 errorMessage = 0;
-
312
-
313 // Pop a message up on the screen to notify the user to check the text file for compile errors.
-
314 MessageBox(hwnd, L"Error compiling shader. Check shader-error.txt for message.", shaderFilename, MB_OK);
-
315
-
316 return;
-
317}
-
318
-
319bool depth_shader_class::set_shader_parameters(ID3D11DeviceContext* deviceContext, XMMATRIX worldMatrix, XMMATRIX viewMatrix,
-
320 XMMATRIX projectionMatrix, ID3D11ShaderResourceView* texture)
-
321{
-
322 HRESULT result;
-
323 D3D11_MAPPED_SUBRESOURCE mappedResource;
-
324 matrix_buffer_type* dataPtr;
-
325 unsigned int bufferNumber;
-
326
-
327
-
328 // Transpose the matrices to prepare them for the shader.
-
329 worldMatrix = XMMatrixTranspose(worldMatrix);
-
330 viewMatrix = XMMatrixTranspose(viewMatrix);
-
331 projectionMatrix = XMMatrixTranspose(projectionMatrix);
-
332
-
333 // Lock the constant buffer so it can be written to.
-
334 result = deviceContext->Map(matrix_buffer_, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
-
335 if (FAILED(result))
-
336 {
-
337 Logger::Get().Log("Error mapping constant buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
-
338 return false;
-
339 }
-
340
-
341 // Get a pointer to the data in the constant buffer.
-
342 dataPtr = (matrix_buffer_type*)mappedResource.pData;
-
343
-
344 // Copy the matrices into the constant buffer.
-
345 dataPtr->world = worldMatrix;
-
346 dataPtr->view = viewMatrix;
-
347 dataPtr->projection = projectionMatrix;
-
348
-
349 // Unlock the constant buffer.
-
350 deviceContext->Unmap(matrix_buffer_, 0);
-
351
-
352 // Set the position of the constant buffer in the vertex shader.
-
353 bufferNumber = 0;
-
354
-
355 // Finanly set the constant buffer in the vertex shader with the updated values.
-
356 deviceContext->VSSetConstantBuffers(bufferNumber, 1, &matrix_buffer_);
-
357 // Set shader texture resource in the pixel shader.
-
358 deviceContext->PSSetShaderResources(0, 1, &texture);
-
359
-
360 return true;
-
361}
-
362
-
363void depth_shader_class::render_shader(ID3D11DeviceContext* deviceContext, int indexCount)
-
364{
-
365 // Set the vertex input layout.
-
366 deviceContext->IASetInputLayout(layout_);
-
367
-
368 // Set the vertex and pixel shaders that will be used to render this triangle.
-
369 deviceContext->VSSetShader(vertex_shader_, NULL, 0);
-
370 deviceContext->PSSetShader(pixel_shader_, NULL, 0);
-
371 // Set the sampler state in the pixel shader.
-
372 deviceContext->PSSetSamplers(0, 1, &sample_state_);
-
373
-
374 // render the triangle.
-
375 deviceContext->DrawIndexed(indexCount, 0, 0);
-
376
-
377 return;
-
378}
-
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
- -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:41e4405b3ba42eb5c13ec57dc40b61adb5f4fee58bd0865f55f924d1251f9468 +size 61285 diff --git a/doxygen_docs/html/depth__shader__class_8h_source.html b/doxygen_docs/html/depth__shader__class_8h_source.html index 76d800f..00c0fc0 100644 --- a/doxygen_docs/html/depth__shader__class_8h_source.html +++ b/doxygen_docs/html/depth__shader__class_8h_source.html @@ -1,167 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/inc/shader/depth_shader_class.h Source File - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
depth_shader_class.h
-
-
-
1#ifndef _DEPTH_SHADER_CLASS_H_
-
2#define _DEPTH_SHADER_CLASS_H_
-
3
-
4
-
6// INCLUDES //
-
8#include "Logger.h"
-
9#include <d3d11.h>
-
10#include <d3dcompiler.h>
-
11#include <directxmath.h>
-
12#include <fstream>
-
13using namespace DirectX;
-
14using namespace std;
-
15
-
16
-
18// Class name: depth_shader_class
-
- -
21{
-
22private:
-
23 struct matrix_buffer_type
-
24 {
-
25 XMMATRIX world;
-
26 XMMATRIX view;
-
27 XMMATRIX projection;
-
28 };
-
29
-
30public:
- - - -
34
-
35 bool initialize(ID3D11Device*, HWND);
-
36 void shutdown();
-
37 bool render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*);
-
38
-
39private:
-
40 bool initialize_shader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
-
41 void shutdown_shader();
-
42 void output_shader_error_message(ID3D10Blob*, HWND, WCHAR*);
-
43
-
44 bool set_shader_parameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*);
-
45 void render_shader(ID3D11DeviceContext*, int);
-
46
-
47private:
-
48 ID3D11VertexShader* vertex_shader_;
-
49 ID3D11PixelShader* pixel_shader_;
-
50 ID3D11InputLayout* layout_;
-
51 ID3D11Buffer* matrix_buffer_;
-
52 ID3D11SamplerState* sample_state_;
-
53
-
54};
-
-
55
-
56#endif
- -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:f4c16b906b4815e8bcf8e63f7d330dba1ac8ce68918fb570867f8d51276d438f +size 12321 diff --git a/doxygen_docs/html/dir_31afb4cde3071d47ca274e3f4ae3badb.html b/doxygen_docs/html/dir_31afb4cde3071d47ca274e3f4ae3badb.html index a1b01e1..7fb6a26 100644 --- a/doxygen_docs/html/dir_31afb4cde3071d47ca274e3f4ae3badb.html +++ b/doxygen_docs/html/dir_31afb4cde3071d47ca274e3f4ae3badb.html @@ -1,183 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/inc/system Directory Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
system Directory Reference
-
-
- - - - -

-Directories

 ecs
 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

-Files

 application_class.h
 
 bitmap_class.h
 
 camera_class.h
 
 d_3d_class.h
 
 display_plane_class.h
 
 font_class.h
 
 fps_class.h
 
 fps_limiter.h
 
 frustum.h
 
 frustumclass.h
 
 imguiManager.h
 
 input_class.h
 
 light_class.h
 
 Logger.h
 
 model_class.h
 
 Modellistclass.h
 
 object.h
 
 physics.h
 
 position_class.h
 
 render_texture_class.h
 
 scene_manager.h
 
 sceneManager.h
 
 shadow_map.h
 
 Skybox.h
 
 sprite_class.h
 
 stats.h
 
 system_class.h
 
 text_class.h
 
 texture_class.h
 
 timer_class.h
 
 vulkan.h
 
-
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:26b0eab1651d03bbc6ec0b4e33f9aa7b8825afb057cfa10d865f6d067f6b7919 +size 14640 diff --git a/doxygen_docs/html/dir_31afb4cde3071d47ca274e3f4ae3badb.js b/doxygen_docs/html/dir_31afb4cde3071d47ca274e3f4ae3badb.js index 03092fb..f3ce1bb 100644 --- a/doxygen_docs/html/dir_31afb4cde3071d47ca274e3f4ae3badb.js +++ b/doxygen_docs/html/dir_31afb4cde3071d47ca274e3f4ae3badb.js @@ -1,35 +1,3 @@ -var dir_31afb4cde3071d47ca274e3f4ae3badb = -[ - [ "ecs", "dir_7ee6018c7c0b4a651bf0164a61d07aa3.html", "dir_7ee6018c7c0b4a651bf0164a61d07aa3" ], - [ "application_class.h", "application__class_8h_source.html", null ], - [ "bitmap_class.h", "bitmap__class_8h_source.html", null ], - [ "camera_class.h", "camera__class_8h_source.html", null ], - [ "d_3d_class.h", "d__3d__class_8h_source.html", null ], - [ "display_plane_class.h", "display__plane__class_8h_source.html", null ], - [ "font_class.h", "font__class_8h_source.html", null ], - [ "fps_class.h", "fps__class_8h_source.html", null ], - [ "fps_limiter.h", "fps__limiter_8h_source.html", null ], - [ "frustum.h", "frustum_8h_source.html", null ], - [ "frustumclass.h", "frustumclass_8h_source.html", null ], - [ "imguiManager.h", "imgui_manager_8h_source.html", null ], - [ "input_class.h", "input__class_8h_source.html", null ], - [ "light_class.h", "light__class_8h_source.html", null ], - [ "Logger.h", "_logger_8h_source.html", null ], - [ "model_class.h", "model__class_8h_source.html", null ], - [ "Modellistclass.h", "_modellistclass_8h_source.html", null ], - [ "object.h", "object_8h_source.html", null ], - [ "physics.h", "physics_8h_source.html", null ], - [ "position_class.h", "position__class_8h_source.html", null ], - [ "render_texture_class.h", "render__texture__class_8h_source.html", null ], - [ "scene_manager.h", "scene__manager_8h_source.html", null ], - [ "sceneManager.h", "scene_manager_8h_source.html", null ], - [ "shadow_map.h", "shadow__map_8h_source.html", null ], - [ "Skybox.h", "_skybox_8h_source.html", null ], - [ "sprite_class.h", "sprite__class_8h_source.html", null ], - [ "stats.h", "stats_8h_source.html", null ], - [ "system_class.h", "system__class_8h_source.html", null ], - [ "text_class.h", "text__class_8h_source.html", null ], - [ "texture_class.h", "texture__class_8h_source.html", null ], - [ "timer_class.h", "timer__class_8h_source.html", null ], - [ "vulkan.h", "vulkan_8h_source.html", null ] -]; \ No newline at end of file +version https://git-lfs.github.com/spec/v1 +oid sha256:fe3aede2ffdb88dc28ce6beaea448803f8f9d5312ee2b391da793a0fac096154 +size 2065 diff --git a/doxygen_docs/html/dir_3aed71f4d8c8b4314dfb8ee0eb59e8a7.html b/doxygen_docs/html/dir_3aed71f4d8c8b4314dfb8ee0eb59e8a7.html index 575409e..833c72e 100644 --- a/doxygen_docs/html/dir_3aed71f4d8c8b4314dfb8ee0eb59e8a7.html +++ b/doxygen_docs/html/dir_3aed71f4d8c8b4314dfb8ee0eb59e8a7.html @@ -1,128 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/inc/system/ecs/components Directory Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
components Directory Reference
-
-
- - - - - - - - - - - - - - -

-Files

 identity_component.h
 
 model_path_component.h
 
 physics_component.h
 
 render_component.h
 
 shader_component.h
 
 transform_component.h
 
-
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:9e8633969f06bbee7721e25a11f812a8ac71cbe05e40d9a102a38c91126b5c5b +size 6891 diff --git a/doxygen_docs/html/dir_3aed71f4d8c8b4314dfb8ee0eb59e8a7.js b/doxygen_docs/html/dir_3aed71f4d8c8b4314dfb8ee0eb59e8a7.js index 033eff0..9c8cb73 100644 --- a/doxygen_docs/html/dir_3aed71f4d8c8b4314dfb8ee0eb59e8a7.js +++ b/doxygen_docs/html/dir_3aed71f4d8c8b4314dfb8ee0eb59e8a7.js @@ -1,9 +1,3 @@ -var dir_3aed71f4d8c8b4314dfb8ee0eb59e8a7 = -[ - [ "identity_component.h", "identity__component_8h_source.html", null ], - [ "model_path_component.h", "model__path__component_8h_source.html", null ], - [ "physics_component.h", "physics__component_8h_source.html", null ], - [ "render_component.h", "render__component_8h_source.html", null ], - [ "shader_component.h", "shader__component_8h_source.html", null ], - [ "transform_component.h", "transform__component_8h_source.html", null ] -]; \ No newline at end of file +version https://git-lfs.github.com/spec/v1 +oid sha256:e013ac92d67693ca73cac2ec5a9d8e16639095431411787ce3f2204a46e8f0d2 +size 499 diff --git a/doxygen_docs/html/dir_4288ac3ffb2af5f572fd6fdc04a1176b.html b/doxygen_docs/html/dir_4288ac3ffb2af5f572fd6fdc04a1176b.html index 9c5b681..5ffebda 100644 --- a/doxygen_docs/html/dir_4288ac3ffb2af5f572fd6fdc04a1176b.html +++ b/doxygen_docs/html/dir_4288ac3ffb2af5f572fd6fdc04a1176b.html @@ -1,112 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src Directory Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
src Directory Reference
-
-
-
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:24e628c4ada10871905f1568f2da16e5575166a5d552cd4abbc039c1d078156d +size 4419 diff --git a/doxygen_docs/html/dir_4288ac3ffb2af5f572fd6fdc04a1176b.js b/doxygen_docs/html/dir_4288ac3ffb2af5f572fd6fdc04a1176b.js index 2100117..0b86c96 100644 --- a/doxygen_docs/html/dir_4288ac3ffb2af5f572fd6fdc04a1176b.js +++ b/doxygen_docs/html/dir_4288ac3ffb2af5f572fd6fdc04a1176b.js @@ -1,5 +1,3 @@ -var dir_4288ac3ffb2af5f572fd6fdc04a1176b = -[ - [ "inc", "dir_fa382d1760f3c58d964524ef7c4d69c1.html", "dir_fa382d1760f3c58d964524ef7c4d69c1" ], - [ "src", "dir_9f969fb6181399983524402442d3614f.html", "dir_9f969fb6181399983524402442d3614f" ] -]; \ No newline at end of file +version https://git-lfs.github.com/spec/v1 +oid sha256:cd4e13f46bac7c383f36b1d709a10d75cd8d5841896027ac9f68d75cc1717470 +size 246 diff --git a/doxygen_docs/html/dir_7ee6018c7c0b4a651bf0164a61d07aa3.html b/doxygen_docs/html/dir_7ee6018c7c0b4a651bf0164a61d07aa3.html index 544c35b..3f103aa 100644 --- a/doxygen_docs/html/dir_7ee6018c7c0b4a651bf0164a61d07aa3.html +++ b/doxygen_docs/html/dir_7ee6018c7c0b4a651bf0164a61d07aa3.html @@ -1,129 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/inc/system/ecs Directory Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
ecs Directory Reference
-
-
- - - - - - -

-Directories

 components
 
 systems
 
- - - - - - - -

-Files

 component.h
 
 entity.h
 
 entity_manager.h
 
-
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:aabb6e75dad44c131e5793903212039f97f51e1f7871a241e72e647751dd51fd +size 6571 diff --git a/doxygen_docs/html/dir_7ee6018c7c0b4a651bf0164a61d07aa3.js b/doxygen_docs/html/dir_7ee6018c7c0b4a651bf0164a61d07aa3.js index 33fe164..1fdc51d 100644 --- a/doxygen_docs/html/dir_7ee6018c7c0b4a651bf0164a61d07aa3.js +++ b/doxygen_docs/html/dir_7ee6018c7c0b4a651bf0164a61d07aa3.js @@ -1,8 +1,3 @@ -var dir_7ee6018c7c0b4a651bf0164a61d07aa3 = -[ - [ "components", "dir_3aed71f4d8c8b4314dfb8ee0eb59e8a7.html", "dir_3aed71f4d8c8b4314dfb8ee0eb59e8a7" ], - [ "systems", "dir_8a9b2421cb22639bae9969128214bec3.html", "dir_8a9b2421cb22639bae9969128214bec3" ], - [ "component.h", "component_8h_source.html", null ], - [ "entity.h", "entity_8h_source.html", null ], - [ "entity_manager.h", "entity__manager_8h_source.html", null ] -]; \ No newline at end of file +version https://git-lfs.github.com/spec/v1 +oid sha256:99d147ba7bbc30b41cdc5f710cf2f6842d80730e9314f4e9acb74ee629cc3aef +size 433 diff --git a/doxygen_docs/html/dir_8a9b2421cb22639bae9969128214bec3.html b/doxygen_docs/html/dir_8a9b2421cb22639bae9969128214bec3.html index 8869333..15c1bd4 100644 --- a/doxygen_docs/html/dir_8a9b2421cb22639bae9969128214bec3.html +++ b/doxygen_docs/html/dir_8a9b2421cb22639bae9969128214bec3.html @@ -1,118 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/inc/system/ecs/systems Directory Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
systems Directory Reference
-
-
- - - - -

-Files

 render_system.h
 
-
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:cbfef429755b0c86df1a0572f7db047c160ea31461d36107ed0c4a74dc810069 +size 5290 diff --git a/doxygen_docs/html/dir_8a9b2421cb22639bae9969128214bec3.js b/doxygen_docs/html/dir_8a9b2421cb22639bae9969128214bec3.js index a00d01e..c2a071f 100644 --- a/doxygen_docs/html/dir_8a9b2421cb22639bae9969128214bec3.js +++ b/doxygen_docs/html/dir_8a9b2421cb22639bae9969128214bec3.js @@ -1,4 +1,3 @@ -var dir_8a9b2421cb22639bae9969128214bec3 = -[ - [ "render_system.h", "render__system_8h_source.html", null ] -]; \ No newline at end of file +version https://git-lfs.github.com/spec/v1 +oid sha256:c148a91e18faf76f6f1d1b3145c4d1d9e6ed2b5ceb17ca5c1077668a2f3baac8 +size 112 diff --git a/doxygen_docs/html/dir_9f969fb6181399983524402442d3614f.html b/doxygen_docs/html/dir_9f969fb6181399983524402442d3614f.html index e7ad457..c3dd483 100644 --- a/doxygen_docs/html/dir_9f969fb6181399983524402442d3614f.html +++ b/doxygen_docs/html/dir_9f969fb6181399983524402442d3614f.html @@ -1,120 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/src Directory Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
src Directory Reference
-
-
- - - - - - -

-Directories

 shader
 
 system
 
-
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:aef4c30afcf2aea8a6e6b7c1c514d30b393af56845a7226aa91736a60a47b432 +size 5314 diff --git a/doxygen_docs/html/dir_9f969fb6181399983524402442d3614f.js b/doxygen_docs/html/dir_9f969fb6181399983524402442d3614f.js index 8c69016..3de0705 100644 --- a/doxygen_docs/html/dir_9f969fb6181399983524402442d3614f.js +++ b/doxygen_docs/html/dir_9f969fb6181399983524402442d3614f.js @@ -1,5 +1,3 @@ -var dir_9f969fb6181399983524402442d3614f = -[ - [ "shader", "dir_b9b5903ed1b60456b17bbae9b6f189f3.html", "dir_b9b5903ed1b60456b17bbae9b6f189f3" ], - [ "system", "dir_eca5a6ecd54f1e6167f92aa8e37ec00f.html", "dir_eca5a6ecd54f1e6167f92aa8e37ec00f" ] -]; \ No newline at end of file +version https://git-lfs.github.com/spec/v1 +oid sha256:3fab1c2a580f70395129229c4afc60cb53d03cc37fae299197ff63acd030269e +size 252 diff --git a/doxygen_docs/html/dir_a77fd64253ed7da2e528f6b352f899d7.html b/doxygen_docs/html/dir_a77fd64253ed7da2e528f6b352f899d7.html index f07c5de..9592623 100644 --- a/doxygen_docs/html/dir_a77fd64253ed7da2e528f6b352f899d7.html +++ b/doxygen_docs/html/dir_a77fd64253ed7da2e528f6b352f899d7.html @@ -1,156 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/inc/shader Directory Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
shader Directory Reference
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

-Files

 alpha_map_shader_class.h
 
 celshade_class.h
 
 color_shader_class.h
 
 depth_shader_class.h
 
 font_shader_class.h
 
 light_map_shader_class.h
 
 light_shader_class.h
 
 master_shader.h
 
 multi_texture_shader_class.h
 
 normal_map_shader_class.h
 
 reflection_shader_class.h
 
 refraction_shader_class.h
 
 shader_manager_class.h
 
 skybox_shader_class.h
 
 spec_map_shader_class.h
 
 sunlight_shader_class.h
 
 texture_shader_class.h
 
 translate_shader_class.h
 
 transparent_shader_class.h
 
 water_shader_class.h
 
-
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:731704609497196ecdeb3a4be5771585422a37dfc7b022970e8e3c016b110c4f +size 11223 diff --git a/doxygen_docs/html/dir_a77fd64253ed7da2e528f6b352f899d7.js b/doxygen_docs/html/dir_a77fd64253ed7da2e528f6b352f899d7.js index 418c264..ca35f36 100644 --- a/doxygen_docs/html/dir_a77fd64253ed7da2e528f6b352f899d7.js +++ b/doxygen_docs/html/dir_a77fd64253ed7da2e528f6b352f899d7.js @@ -1,23 +1,3 @@ -var dir_a77fd64253ed7da2e528f6b352f899d7 = -[ - [ "alpha_map_shader_class.h", "alpha__map__shader__class_8h_source.html", null ], - [ "celshade_class.h", "celshade__class_8h_source.html", null ], - [ "color_shader_class.h", "color__shader__class_8h_source.html", null ], - [ "depth_shader_class.h", "depth__shader__class_8h_source.html", null ], - [ "font_shader_class.h", "font__shader__class_8h_source.html", null ], - [ "light_map_shader_class.h", "light__map__shader__class_8h_source.html", null ], - [ "light_shader_class.h", "light__shader__class_8h_source.html", null ], - [ "master_shader.h", "master__shader_8h_source.html", null ], - [ "multi_texture_shader_class.h", "multi__texture__shader__class_8h_source.html", null ], - [ "normal_map_shader_class.h", "normal__map__shader__class_8h_source.html", null ], - [ "reflection_shader_class.h", "reflection__shader__class_8h_source.html", null ], - [ "refraction_shader_class.h", "refraction__shader__class_8h_source.html", null ], - [ "shader_manager_class.h", "shader__manager__class_8h_source.html", null ], - [ "skybox_shader_class.h", "skybox__shader__class_8h_source.html", null ], - [ "spec_map_shader_class.h", "spec__map__shader__class_8h_source.html", null ], - [ "sunlight_shader_class.h", "sunlight__shader__class_8h_source.html", null ], - [ "texture_shader_class.h", "texture__shader__class_8h_source.html", null ], - [ "translate_shader_class.h", "translate__shader__class_8h_source.html", null ], - [ "transparent_shader_class.h", "transparent__shader__class_8h_source.html", null ], - [ "water_shader_class.h", "water__shader__class_8h_source.html", null ] -]; \ No newline at end of file +version https://git-lfs.github.com/spec/v1 +oid sha256:1078d667fb5c897b591457d2e775878a3eddf84de581da223fd3e3f72a790b1c +size 1673 diff --git a/doxygen_docs/html/dir_b9b5903ed1b60456b17bbae9b6f189f3.html b/doxygen_docs/html/dir_b9b5903ed1b60456b17bbae9b6f189f3.html index 8604a51..03c0599 100644 --- a/doxygen_docs/html/dir_b9b5903ed1b60456b17bbae9b6f189f3.html +++ b/doxygen_docs/html/dir_b9b5903ed1b60456b17bbae9b6f189f3.html @@ -1,156 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/src/shader Directory Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
shader Directory Reference
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

-Files

 alpha_map_shader_class.cpp
 
 celshade_class.cpp
 
 color_shader_class.cpp
 
 depth_shader_class.cpp
 
 font_shader_class.cpp
 
 light_map_shader_class.cpp
 
 light_shader_class.cpp
 
 master_shader.cpp
 
 multi_texture_shader_class.cpp
 
 normal_map_shader_class.cpp
 
 reflection_shader_class.cpp
 
 refraction_shader_class.cpp
 
 shader_manager_class.cpp
 
 skybox_shader_class.cpp
 
 spec_map_shader_class.cpp
 
 sunlight_shader_class.cpp
 
 texture_shader_class.cpp
 
 translate_shader_class.cpp
 
 transparent_shader_class.cpp
 
 water_shader_class.cpp
 
-
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:11ae65a96713137567f16ff6683c74c9bf675e57f52c5e37ccad0e137a16391d +size 11303 diff --git a/doxygen_docs/html/dir_b9b5903ed1b60456b17bbae9b6f189f3.js b/doxygen_docs/html/dir_b9b5903ed1b60456b17bbae9b6f189f3.js index 1a93f5b..3412a22 100644 --- a/doxygen_docs/html/dir_b9b5903ed1b60456b17bbae9b6f189f3.js +++ b/doxygen_docs/html/dir_b9b5903ed1b60456b17bbae9b6f189f3.js @@ -1,23 +1,3 @@ -var dir_b9b5903ed1b60456b17bbae9b6f189f3 = -[ - [ "alpha_map_shader_class.cpp", "alpha__map__shader__class_8cpp_source.html", null ], - [ "celshade_class.cpp", "celshade__class_8cpp_source.html", null ], - [ "color_shader_class.cpp", "color__shader__class_8cpp_source.html", null ], - [ "depth_shader_class.cpp", "depth__shader__class_8cpp_source.html", null ], - [ "font_shader_class.cpp", "font__shader__class_8cpp_source.html", null ], - [ "light_map_shader_class.cpp", "light__map__shader__class_8cpp_source.html", null ], - [ "light_shader_class.cpp", "light__shader__class_8cpp_source.html", null ], - [ "master_shader.cpp", "master__shader_8cpp_source.html", null ], - [ "multi_texture_shader_class.cpp", "multi__texture__shader__class_8cpp_source.html", null ], - [ "normal_map_shader_class.cpp", "normal__map__shader__class_8cpp_source.html", null ], - [ "reflection_shader_class.cpp", "reflection__shader__class_8cpp_source.html", null ], - [ "refraction_shader_class.cpp", "refraction__shader__class_8cpp_source.html", null ], - [ "shader_manager_class.cpp", "shader__manager__class_8cpp_source.html", null ], - [ "skybox_shader_class.cpp", "skybox__shader__class_8cpp_source.html", null ], - [ "spec_map_shader_class.cpp", "spec__map__shader__class_8cpp_source.html", null ], - [ "sunlight_shader_class.cpp", "sunlight__shader__class_8cpp_source.html", null ], - [ "texture_shader_class.cpp", "texture__shader__class_8cpp_source.html", null ], - [ "translate_shader_class.cpp", "translate__shader__class_8cpp_source.html", null ], - [ "transparent_shader_class.cpp", "transparent__shader__class_8cpp_source.html", null ], - [ "water_shader_class.cpp", "water__shader__class_8cpp_source.html", null ] -]; \ No newline at end of file +version https://git-lfs.github.com/spec/v1 +oid sha256:872a7b334ccd070e9b3c6dc90f7877b09efa510104670f9bb03941fe52432f2f +size 1753 diff --git a/doxygen_docs/html/dir_eca5a6ecd54f1e6167f92aa8e37ec00f.html b/doxygen_docs/html/dir_eca5a6ecd54f1e6167f92aa8e37ec00f.html index 4a0cf35..68a9899 100644 --- a/doxygen_docs/html/dir_eca5a6ecd54f1e6167f92aa8e37ec00f.html +++ b/doxygen_docs/html/dir_eca5a6ecd54f1e6167f92aa8e37ec00f.html @@ -1,174 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/src/system Directory Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
system Directory Reference
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

-Files

 application_class.cpp
 
 bitmap_class.cpp
 
 camera_class.cpp
 
 d_3d_class.cpp
 
 display_plane_class.cpp
 
 font_class.cpp
 
 fps_class.cpp
 
 frustum.cpp
 
 frustumclass.cpp
 
 imguiManager.cpp
 
 input_class.cpp
 
 light_class.cpp
 
 Main.cpp
 
 model_class.cpp
 
 Modellistclass.cpp
 
 object.cpp
 
 physics.cpp
 
 position_class.cpp
 
 render_texture_class.cpp
 
 scene_manager.cpp
 
 shadow_map.cpp
 
 Skybox.cpp
 
 sprite_class.cpp
 
 stats.cpp
 
 system_class.cpp
 
 text_class.cpp
 
 texture_class.cpp
 
 timer_class.cpp
 
 vulkan.cpp
 
-
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:b133f1046a2b82e402f7f390bbcac37304608b1f1b93144f6fb0079c3eaf097b +size 13670 diff --git a/doxygen_docs/html/dir_eca5a6ecd54f1e6167f92aa8e37ec00f.js b/doxygen_docs/html/dir_eca5a6ecd54f1e6167f92aa8e37ec00f.js index c862053..799528b 100644 --- a/doxygen_docs/html/dir_eca5a6ecd54f1e6167f92aa8e37ec00f.js +++ b/doxygen_docs/html/dir_eca5a6ecd54f1e6167f92aa8e37ec00f.js @@ -1,32 +1,3 @@ -var dir_eca5a6ecd54f1e6167f92aa8e37ec00f = -[ - [ "application_class.cpp", "application__class_8cpp_source.html", null ], - [ "bitmap_class.cpp", "bitmap__class_8cpp_source.html", null ], - [ "camera_class.cpp", "camera__class_8cpp_source.html", null ], - [ "d_3d_class.cpp", "d__3d__class_8cpp_source.html", null ], - [ "display_plane_class.cpp", "display__plane__class_8cpp_source.html", null ], - [ "font_class.cpp", "font__class_8cpp_source.html", null ], - [ "fps_class.cpp", "fps__class_8cpp_source.html", null ], - [ "frustum.cpp", "frustum_8cpp_source.html", null ], - [ "frustumclass.cpp", "frustumclass_8cpp_source.html", null ], - [ "imguiManager.cpp", "imgui_manager_8cpp_source.html", null ], - [ "input_class.cpp", "input__class_8cpp_source.html", null ], - [ "light_class.cpp", "light__class_8cpp_source.html", null ], - [ "Main.cpp", "_main_8cpp_source.html", null ], - [ "model_class.cpp", "model__class_8cpp_source.html", null ], - [ "Modellistclass.cpp", "_modellistclass_8cpp_source.html", null ], - [ "object.cpp", "object_8cpp_source.html", null ], - [ "physics.cpp", "physics_8cpp_source.html", null ], - [ "position_class.cpp", "position__class_8cpp_source.html", null ], - [ "render_texture_class.cpp", "render__texture__class_8cpp_source.html", null ], - [ "scene_manager.cpp", "scene__manager_8cpp_source.html", null ], - [ "shadow_map.cpp", "shadow__map_8cpp_source.html", null ], - [ "Skybox.cpp", "_skybox_8cpp_source.html", null ], - [ "sprite_class.cpp", "sprite__class_8cpp_source.html", null ], - [ "stats.cpp", "stats_8cpp_source.html", null ], - [ "system_class.cpp", "system__class_8cpp_source.html", null ], - [ "text_class.cpp", "text__class_8cpp_source.html", null ], - [ "texture_class.cpp", "texture__class_8cpp_source.html", null ], - [ "timer_class.cpp", "timer__class_8cpp_source.html", null ], - [ "vulkan.cpp", "vulkan_8cpp_source.html", null ] -]; \ No newline at end of file +version https://git-lfs.github.com/spec/v1 +oid sha256:0efa9b04c436747fab2f4b374b417ce2bf9bd1cb5679eada3bfcecc253119834 +size 1951 diff --git a/doxygen_docs/html/dir_f4a881938f04d9c04de7741e8b9c813b.html b/doxygen_docs/html/dir_f4a881938f04d9c04de7741e8b9c813b.html index aea6737..ce01ba8 100644 --- a/doxygen_docs/html/dir_f4a881938f04d9c04de7741e8b9c813b.html +++ b/doxygen_docs/html/dir_f4a881938f04d9c04de7741e8b9c813b.html @@ -1,112 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom Directory Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
enginecustom Directory Reference
-
-
-
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:77da74d8bfa5273e7832fc281dee9b6bbeb56b96607b8ab716d39e1a52927f56 +size 4329 diff --git a/doxygen_docs/html/dir_f4a881938f04d9c04de7741e8b9c813b.js b/doxygen_docs/html/dir_f4a881938f04d9c04de7741e8b9c813b.js index 6cfacf7..a4ee721 100644 --- a/doxygen_docs/html/dir_f4a881938f04d9c04de7741e8b9c813b.js +++ b/doxygen_docs/html/dir_f4a881938f04d9c04de7741e8b9c813b.js @@ -1,4 +1,3 @@ -var dir_f4a881938f04d9c04de7741e8b9c813b = -[ - [ "src", "dir_4288ac3ffb2af5f572fd6fdc04a1176b.html", "dir_4288ac3ffb2af5f572fd6fdc04a1176b" ] -]; \ No newline at end of file +version https://git-lfs.github.com/spec/v1 +oid sha256:1278f7674469423facb217f7c9df5cc647af3749c2cf0e3f6e459c151767318a +size 146 diff --git a/doxygen_docs/html/dir_fa382d1760f3c58d964524ef7c4d69c1.html b/doxygen_docs/html/dir_fa382d1760f3c58d964524ef7c4d69c1.html index 740e2df..d6a4777 100644 --- a/doxygen_docs/html/dir_fa382d1760f3c58d964524ef7c4d69c1.html +++ b/doxygen_docs/html/dir_fa382d1760f3c58d964524ef7c4d69c1.html @@ -1,120 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/inc Directory Reference - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
inc Directory Reference
-
-
- - - - - - -

-Directories

 shader
 
 system
 
-
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:4548bf217bb13b1de09169be6b2387d23f5685a7bcc716e0e7a517785fd5184e +size 5314 diff --git a/doxygen_docs/html/dir_fa382d1760f3c58d964524ef7c4d69c1.js b/doxygen_docs/html/dir_fa382d1760f3c58d964524ef7c4d69c1.js index 7decd8a..5a03045 100644 --- a/doxygen_docs/html/dir_fa382d1760f3c58d964524ef7c4d69c1.js +++ b/doxygen_docs/html/dir_fa382d1760f3c58d964524ef7c4d69c1.js @@ -1,5 +1,3 @@ -var dir_fa382d1760f3c58d964524ef7c4d69c1 = -[ - [ "shader", "dir_a77fd64253ed7da2e528f6b352f899d7.html", "dir_a77fd64253ed7da2e528f6b352f899d7" ], - [ "system", "dir_31afb4cde3071d47ca274e3f4ae3badb.html", "dir_31afb4cde3071d47ca274e3f4ae3badb" ] -]; \ No newline at end of file +version https://git-lfs.github.com/spec/v1 +oid sha256:f5e0f7d46bf6c284a8ef45e6a5f0961460f02d78c10b2bf7389a10362e815ece +size 252 diff --git a/doxygen_docs/html/display__plane__class_8cpp_source.html b/doxygen_docs/html/display__plane__class_8cpp_source.html index 1ffd3b7..083b638 100644 --- a/doxygen_docs/html/display__plane__class_8cpp_source.html +++ b/doxygen_docs/html/display__plane__class_8cpp_source.html @@ -1,326 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/src/system/display_plane_class.cpp Source File - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
display_plane_class.cpp
-
-
-
1#include "display_plane_class.h"
-
2
-
3
-
4display_plane_class::display_plane_class()
-
5{
-
6 m_vertexBuffer = 0;
-
7 m_indexBuffer = 0;
-
8}
-
9
-
10
-
11display_plane_class::display_plane_class(const display_plane_class& other)
-
12{
-
13}
-
14
-
15
-
16display_plane_class::~display_plane_class()
-
17{
-
18}
-
19
-
20bool display_plane_class::Initialize(ID3D11Device* device, float width, float height)
-
21{
-
22 Logger::Get().Log("Initializing display_plane_class, width: " + std::to_string(width) + ", height: " + std::to_string(height), __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
23 bool result;
-
24
-
25
-
26 // initialize the vertex and index buffer that hold the geometry for the button.
-
27 result = InitializeBuffers(device, width, height);
-
28 if (!result)
-
29 {
-
30 Logger::Get().Log("Could not initialize buffers", __FILE__, __LINE__, Logger::LogLevel::Error);
-
31 return false;
-
32 }
-
33
-
34 return true;
-
35}
-
36
-
37
-
38void display_plane_class::Shutdown()
-
39{
-
40 // Release the vertex and index buffers.
-
41 ShutdownBuffers();
-
42
-
43 return;
-
44}
-
45
-
46
-
47void display_plane_class::Render(ID3D11DeviceContext* deviceContext)
-
48{
-
49 // Put the vertex and index buffers on the graphics pipeline to prepare them for drawing.
-
50 RenderBuffers(deviceContext);
-
51
-
52 return;
-
53}
-
54
-
55
-
56int display_plane_class::GetIndexCount()
-
57{
-
58 return m_indexCount;
-
59}
-
60
-
61bool display_plane_class::InitializeBuffers(ID3D11Device* device, float width, float height)
-
62{
-
63 Logger::Get().Log("Initializing buffers", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
64
-
65 VertexType* vertices;
-
66 unsigned long* indices;
-
67 D3D11_BUFFER_DESC vertexBufferDesc, indexBufferDesc;
-
68 D3D11_SUBRESOURCE_DATA vertexData, indexData;
-
69 HRESULT result;
-
70 int i;
-
71
-
72
-
73 // Set the number of vertices in the vertex array.
-
74 m_vertexCount = 6;
-
75
-
76 // Set the number of indices in the index array.
-
77 m_indexCount = m_vertexCount;
-
78
-
79 // Create the vertex array.
-
80 vertices = new VertexType[m_vertexCount];
-
81
-
82 // Create the index array.
-
83 indices = new unsigned long[m_indexCount];
-
84
-
85 // Load the vertex array with data.
-
86 // First triangle.
-
87 vertices[0].position = XMFLOAT3(-width, height, 0.0f); // Top left.
-
88 vertices[0].texture = XMFLOAT2(0.0f, 0.0f);
-
89
-
90 vertices[1].position = XMFLOAT3(width, -height, 0.0f); // Bottom right.
-
91 vertices[1].texture = XMFLOAT2(1.0f, 1.0f);
-
92
-
93 vertices[2].position = XMFLOAT3(-width, -height, 0.0f); // Bottom left.
-
94 vertices[2].texture = XMFLOAT2(0.0f, 1.0f);
-
95
-
96 // Second triangle.
-
97 vertices[3].position = XMFLOAT3(-width, height, 0.0f); // Top left.
-
98 vertices[3].texture = XMFLOAT2(0.0f, 0.0f);
-
99
-
100 vertices[4].position = XMFLOAT3(width, height, 0.0f); // Top right.
-
101 vertices[4].texture = XMFLOAT2(1.0f, 0.0f);
-
102
-
103 vertices[5].position = XMFLOAT3(width, -height, 0.0f); // Bottom right.
-
104 vertices[5].texture = XMFLOAT2(1.0f, 1.0f);
-
105
-
106 // Load the index array with data.
-
107 for (i = 0; i < m_indexCount; i++)
-
108 {
-
109 indices[i] = i;
-
110 }
-
111
-
112 // Set up the description of the vertex buffer.
-
113 vertexBufferDesc.Usage = D3D11_USAGE_DEFAULT;
-
114 vertexBufferDesc.ByteWidth = sizeof(VertexType) * m_vertexCount;
-
115 vertexBufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
-
116 vertexBufferDesc.CPUAccessFlags = 0;
-
117 vertexBufferDesc.MiscFlags = 0;
-
118 vertexBufferDesc.StructureByteStride = 0;
-
119
-
120 // Give the subresource structure a pointer to the vertex data.
-
121 vertexData.pSysMem = vertices;
-
122 vertexData.SysMemPitch = 0;
-
123 vertexData.SysMemSlicePitch = 0;
-
124
-
125 // Now finally create the vertex buffer.
-
126 result = device->CreateBuffer(&vertexBufferDesc, &vertexData, &m_vertexBuffer);
-
127 if (FAILED(result))
-
128 {
-
129 Logger::Get().Log("Could not create vertex buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
-
130 return false;
-
131 }
-
132
-
133 // Set up the description of the index buffer.
-
134 indexBufferDesc.Usage = D3D11_USAGE_DEFAULT;
-
135 indexBufferDesc.ByteWidth = sizeof(unsigned long) * m_indexCount;
-
136 indexBufferDesc.BindFlags = D3D11_BIND_INDEX_BUFFER;
-
137 indexBufferDesc.CPUAccessFlags = 0;
-
138 indexBufferDesc.MiscFlags = 0;
-
139 indexBufferDesc.StructureByteStride = 0;
-
140
-
141 // Give the subresource structure a pointer to the index data.
-
142 indexData.pSysMem = indices;
-
143 indexData.SysMemPitch = 0;
-
144 indexData.SysMemSlicePitch = 0;
-
145
-
146 // Create the index buffer.
-
147 result = device->CreateBuffer(&indexBufferDesc, &indexData, &m_indexBuffer);
-
148 if (FAILED(result))
-
149 {
-
150 Logger::Get().Log("Could not create index buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
-
151 return false;
-
152 }
-
153
-
154 // Release the arrays now that the vertex and index buffers have been created and loaded.
-
155 delete[] vertices;
-
156 vertices = 0;
-
157
-
158 delete[] indices;
-
159 indices = 0;
-
160
-
161 Logger::Get().Log("Buffers initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
162
-
163 return true;
-
164}
-
165
-
166
-
167void display_plane_class::ShutdownBuffers()
-
168{
-
169 Logger::Get().Log("Shutting down Plane buffers", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
170
-
171 // Release the index buffer.
-
172 if (m_indexBuffer)
-
173 {
-
174 m_indexBuffer->Release();
-
175 m_indexBuffer = 0;
-
176 }
-
177
-
178 // Release the vertex buffer.
-
179 if (m_vertexBuffer)
-
180 {
-
181 m_vertexBuffer->Release();
-
182 m_vertexBuffer = 0;
-
183 }
-
184
-
185 Logger::Get().Log("Plane buffers shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
186
-
187 return;
-
188}
-
189
-
190
-
191void display_plane_class::RenderBuffers(ID3D11DeviceContext* deviceContext)
-
192{
-
193 unsigned int stride;
-
194 unsigned int offset;
-
195
-
196
-
197 // Set vertex buffer stride and offset.
-
198 stride = sizeof(VertexType);
-
199 offset = 0;
-
200
-
201 // Set the vertex buffer to active in the input assembler so it can be rendered.
-
202 deviceContext->IASetVertexBuffers(0, 1, &m_vertexBuffer, &stride, &offset);
-
203
-
204 // Set the index buffer to active in the input assembler so it can be rendered.
-
205 deviceContext->IASetIndexBuffer(m_indexBuffer, DXGI_FORMAT_R32_UINT, 0);
-
206
-
207 // Set the type of primitive that should be rendered from this vertex buffer, in this case triangles.
-
208 deviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
-
209
-
210 return;
-
211}
-
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
- -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:1be855c1b4247be6b2ac410ed484967364891c10a38ce624b3df5ec17531103a +size 35489 diff --git a/doxygen_docs/html/display__plane__class_8h_source.html b/doxygen_docs/html/display__plane__class_8h_source.html index b2ac105..a8371e2 100644 --- a/doxygen_docs/html/display__plane__class_8h_source.html +++ b/doxygen_docs/html/display__plane__class_8h_source.html @@ -1,157 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/inc/system/display_plane_class.h Source File - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
display_plane_class.h
-
-
-
1#ifndef _DISPLAYPLANECLASS_H_
-
2#define _DISPLAYPLANECLASS_H_
-
3
-
4
-
6// MY CLASS INCLUDES //
-
8#include "d_3d_class.h"
-
9
-
10
-
12// Class name: display_plane_class
-
- -
15{
-
16private:
-
17 struct VertexType
-
18 {
-
19 XMFLOAT3 position;
-
20 XMFLOAT2 texture;
-
21 };
-
22
-
23public:
- - - -
27
-
28
-
29 bool Initialize(ID3D11Device*, float, float);
-
30 void Shutdown();
-
31 void Render(ID3D11DeviceContext*);
-
32
-
33 int GetIndexCount();
-
34
-
35private:
-
36 bool InitializeBuffers(ID3D11Device*, float, float);
-
37 void ShutdownBuffers();
-
38 void RenderBuffers(ID3D11DeviceContext*);
-
39
-
40private:
-
41 ID3D11Buffer* m_vertexBuffer, * m_indexBuffer;
-
42 int m_vertexCount, m_indexCount;
-
43
-
44};
-
-
45
-
46#endif
- -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:56c3476ad2ea013829ad50efd21a265cbeeb8f059d2d023628b5e1091d368faa +size 10827 diff --git a/doxygen_docs/html/doc.svg b/doxygen_docs/html/doc.svg index 0b928a5..71a7929 100644 --- a/doxygen_docs/html/doc.svg +++ b/doxygen_docs/html/doc.svg @@ -1,12 +1,3 @@ - - - - - - - - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:83a7c9918c8b9ae1bb31a7bfee6f9c3e099f1ffe5dbf798232218d60ad2a6401 +size 1503 diff --git a/doxygen_docs/html/docd.svg b/doxygen_docs/html/docd.svg index ac18b27..cfe06ab 100644 --- a/doxygen_docs/html/docd.svg +++ b/doxygen_docs/html/docd.svg @@ -1,12 +1,3 @@ - - - - - - - - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:6b1d157a374648a3aa2c4b387ec7f9bad398ab00c41c2958fcbec2e3382cff1e +size 1503 diff --git a/doxygen_docs/html/doxygen.css b/doxygen_docs/html/doxygen.css index 574b333..f114116 100644 --- a/doxygen_docs/html/doxygen.css +++ b/doxygen_docs/html/doxygen.css @@ -1,2247 +1,3 @@ -/* The standard CSS for doxygen 1.12.0*/ - -html { -/* page base colors */ ---page-background-color: white; ---page-foreground-color: black; ---page-link-color: #3D578C; ---page-visited-link-color: #4665A2; - -/* index */ ---index-odd-item-bg-color: #F8F9FC; ---index-even-item-bg-color: white; ---index-header-color: black; ---index-separator-color: #A0A0A0; - -/* header */ ---header-background-color: #F9FAFC; ---header-separator-color: #C4CFE5; ---header-gradient-image: url('nav_h.png'); ---group-header-separator-color: #879ECB; ---group-header-color: #354C7B; ---inherit-header-color: gray; - ---footer-foreground-color: #2A3D61; ---footer-logo-width: 104px; ---citation-label-color: #334975; ---glow-color: cyan; - ---title-background-color: white; ---title-separator-color: #5373B4; ---directory-separator-color: #9CAFD4; ---separator-color: #4A6AAA; - ---blockquote-background-color: #F7F8FB; ---blockquote-border-color: #9CAFD4; - ---scrollbar-thumb-color: #9CAFD4; ---scrollbar-background-color: #F9FAFC; - ---icon-background-color: #728DC1; ---icon-foreground-color: white; ---icon-doc-image: url('doc.svg'); ---icon-folder-open-image: url('folderopen.svg'); ---icon-folder-closed-image: url('folderclosed.svg'); - -/* brief member declaration list */ ---memdecl-background-color: #F9FAFC; ---memdecl-separator-color: #DEE4F0; ---memdecl-foreground-color: #555; ---memdecl-template-color: #4665A2; - -/* detailed member list */ ---memdef-border-color: #A8B8D9; ---memdef-title-background-color: #E2E8F2; ---memdef-title-gradient-image: url('nav_f.png'); ---memdef-proto-background-color: #DFE5F1; ---memdef-proto-text-color: #253555; ---memdef-proto-text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); ---memdef-doc-background-color: white; ---memdef-param-name-color: #602020; ---memdef-template-color: #4665A2; - -/* tables */ ---table-cell-border-color: #2D4068; ---table-header-background-color: #374F7F; ---table-header-foreground-color: #FFFFFF; - -/* labels */ ---label-background-color: #728DC1; ---label-left-top-border-color: #5373B4; ---label-right-bottom-border-color: #C4CFE5; ---label-foreground-color: white; - -/** navigation bar/tree/menu */ ---nav-background-color: #F9FAFC; ---nav-foreground-color: #364D7C; ---nav-gradient-image: url('tab_b.png'); ---nav-gradient-hover-image: url('tab_h.png'); ---nav-gradient-active-image: url('tab_a.png'); ---nav-gradient-active-image-parent: url("../tab_a.png"); ---nav-separator-image: url('tab_s.png'); ---nav-breadcrumb-image: url('bc_s.png'); ---nav-breadcrumb-border-color: #C2CDE4; ---nav-splitbar-image: url('splitbar.png'); ---nav-font-size-level1: 13px; ---nav-font-size-level2: 10px; ---nav-font-size-level3: 9px; ---nav-text-normal-color: #283A5D; ---nav-text-hover-color: white; ---nav-text-active-color: white; ---nav-text-normal-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); ---nav-text-hover-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0); ---nav-text-active-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0); ---nav-menu-button-color: #364D7C; ---nav-menu-background-color: white; ---nav-menu-foreground-color: #555555; ---nav-menu-toggle-color: rgba(255, 255, 255, 0.5); ---nav-arrow-color: #9CAFD4; ---nav-arrow-selected-color: #9CAFD4; - -/* table of contents */ ---toc-background-color: #F4F6FA; ---toc-border-color: #D8DFEE; ---toc-header-color: #4665A2; ---toc-down-arrow-image: url("data:image/svg+xml;utf8,&%238595;"); - -/** search field */ ---search-background-color: white; ---search-foreground-color: #909090; ---search-magnification-image: url('mag.svg'); ---search-magnification-select-image: url('mag_sel.svg'); ---search-active-color: black; ---search-filter-background-color: #F9FAFC; ---search-filter-foreground-color: black; ---search-filter-border-color: #90A5CE; ---search-filter-highlight-text-color: white; ---search-filter-highlight-bg-color: #3D578C; ---search-results-foreground-color: #425E97; ---search-results-background-color: #EEF1F7; ---search-results-border-color: black; ---search-box-shadow: inset 0.5px 0.5px 3px 0px #555; - -/** code fragments */ ---code-keyword-color: #008000; ---code-type-keyword-color: #604020; ---code-flow-keyword-color: #E08000; ---code-comment-color: #800000; ---code-preprocessor-color: #806020; ---code-string-literal-color: #002080; ---code-char-literal-color: #008080; ---code-xml-cdata-color: black; ---code-vhdl-digit-color: #FF00FF; ---code-vhdl-char-color: #000000; ---code-vhdl-keyword-color: #700070; ---code-vhdl-logic-color: #FF0000; ---code-link-color: #4665A2; ---code-external-link-color: #4665A2; ---fragment-foreground-color: black; ---fragment-background-color: #FBFCFD; ---fragment-border-color: #C4CFE5; ---fragment-lineno-border-color: #00FF00; ---fragment-lineno-background-color: #E8E8E8; ---fragment-lineno-foreground-color: black; ---fragment-lineno-link-fg-color: #4665A2; ---fragment-lineno-link-bg-color: #D8D8D8; ---fragment-lineno-link-hover-fg-color: #4665A2; ---fragment-lineno-link-hover-bg-color: #C8C8C8; ---fragment-copy-ok-color: #2EC82E; ---tooltip-foreground-color: black; ---tooltip-background-color: white; ---tooltip-border-color: gray; ---tooltip-doc-color: grey; ---tooltip-declaration-color: #006318; ---tooltip-link-color: #4665A2; ---tooltip-shadow: 1px 1px 7px gray; ---fold-line-color: #808080; ---fold-minus-image: url('minus.svg'); ---fold-plus-image: url('plus.svg'); ---fold-minus-image-relpath: url('../../minus.svg'); ---fold-plus-image-relpath: url('../../plus.svg'); - -/** font-family */ ---font-family-normal: Roboto,sans-serif; ---font-family-monospace: 'JetBrains Mono',Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace,fixed; ---font-family-nav: 'Lucida Grande',Geneva,Helvetica,Arial,sans-serif; ---font-family-title: Tahoma,Arial,sans-serif; ---font-family-toc: Verdana,'DejaVu Sans',Geneva,sans-serif; ---font-family-search: Arial,Verdana,sans-serif; ---font-family-icon: Arial,Helvetica; ---font-family-tooltip: Roboto,sans-serif; - -/** special sections */ ---warning-color-bg: #f8d1cc; ---warning-color-hl: #b61825; ---warning-color-text: #75070f; ---note-color-bg: #faf3d8; ---note-color-hl: #f3a600; ---note-color-text: #5f4204; ---todo-color-bg: #e4f3ff; ---todo-color-hl: #1879C4; ---todo-color-text: #274a5c; ---test-color-bg: #e8e8ff; ---test-color-hl: #3939C4; ---test-color-text: #1a1a5c; ---deprecated-color-bg: #ecf0f3; ---deprecated-color-hl: #5b6269; ---deprecated-color-text: #43454a; ---bug-color-bg: #e4dafd; ---bug-color-hl: #5b2bdd; ---bug-color-text: #2a0d72; ---invariant-color-bg: #d8f1e3; ---invariant-color-hl: #44b86f; ---invariant-color-text: #265532; -} - -@media (prefers-color-scheme: dark) { - html:not(.dark-mode) { - color-scheme: dark; - -/* page base colors */ ---page-background-color: black; ---page-foreground-color: #C9D1D9; ---page-link-color: #90A5CE; ---page-visited-link-color: #A3B4D7; - -/* index */ ---index-odd-item-bg-color: #0B101A; ---index-even-item-bg-color: black; ---index-header-color: #C4CFE5; ---index-separator-color: #334975; - -/* header */ ---header-background-color: #070B11; ---header-separator-color: #141C2E; ---header-gradient-image: url('nav_hd.png'); ---group-header-separator-color: #283A5D; ---group-header-color: #90A5CE; ---inherit-header-color: #A0A0A0; - ---footer-foreground-color: #5B7AB7; ---footer-logo-width: 60px; ---citation-label-color: #90A5CE; ---glow-color: cyan; - ---title-background-color: #090D16; ---title-separator-color: #354C79; ---directory-separator-color: #283A5D; ---separator-color: #283A5D; - ---blockquote-background-color: #101826; ---blockquote-border-color: #283A5D; - ---scrollbar-thumb-color: #283A5D; ---scrollbar-background-color: #070B11; - ---icon-background-color: #334975; ---icon-foreground-color: #C4CFE5; ---icon-doc-image: url('docd.svg'); ---icon-folder-open-image: url('folderopend.svg'); ---icon-folder-closed-image: url('folderclosedd.svg'); - -/* brief member declaration list */ ---memdecl-background-color: #0B101A; ---memdecl-separator-color: #2C3F65; ---memdecl-foreground-color: #BBB; ---memdecl-template-color: #7C95C6; - -/* detailed member list */ ---memdef-border-color: #233250; ---memdef-title-background-color: #1B2840; ---memdef-title-gradient-image: url('nav_fd.png'); ---memdef-proto-background-color: #19243A; ---memdef-proto-text-color: #9DB0D4; ---memdef-proto-text-shadow: 0px 1px 1px rgba(0, 0, 0, 0.9); ---memdef-doc-background-color: black; ---memdef-param-name-color: #D28757; ---memdef-template-color: #7C95C6; - -/* tables */ ---table-cell-border-color: #283A5D; ---table-header-background-color: #283A5D; ---table-header-foreground-color: #C4CFE5; - -/* labels */ ---label-background-color: #354C7B; ---label-left-top-border-color: #4665A2; ---label-right-bottom-border-color: #283A5D; ---label-foreground-color: #CCCCCC; - -/** navigation bar/tree/menu */ ---nav-background-color: #101826; ---nav-foreground-color: #364D7C; ---nav-gradient-image: url('tab_bd.png'); ---nav-gradient-hover-image: url('tab_hd.png'); ---nav-gradient-active-image: url('tab_ad.png'); ---nav-gradient-active-image-parent: url("../tab_ad.png"); ---nav-separator-image: url('tab_sd.png'); ---nav-breadcrumb-image: url('bc_sd.png'); ---nav-breadcrumb-border-color: #2A3D61; ---nav-splitbar-image: url('splitbard.png'); ---nav-font-size-level1: 13px; ---nav-font-size-level2: 10px; ---nav-font-size-level3: 9px; ---nav-text-normal-color: #B6C4DF; ---nav-text-hover-color: #DCE2EF; ---nav-text-active-color: #DCE2EF; ---nav-text-normal-shadow: 0px 1px 1px black; ---nav-text-hover-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0); ---nav-text-active-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0); ---nav-menu-button-color: #B6C4DF; ---nav-menu-background-color: #05070C; ---nav-menu-foreground-color: #BBBBBB; ---nav-menu-toggle-color: rgba(255, 255, 255, 0.2); ---nav-arrow-color: #334975; ---nav-arrow-selected-color: #90A5CE; - -/* table of contents */ ---toc-background-color: #151E30; ---toc-border-color: #202E4A; ---toc-header-color: #A3B4D7; ---toc-down-arrow-image: url("data:image/svg+xml;utf8,&%238595;"); - -/** search field */ ---search-background-color: black; ---search-foreground-color: #C5C5C5; ---search-magnification-image: url('mag_d.svg'); ---search-magnification-select-image: url('mag_seld.svg'); ---search-active-color: #C5C5C5; ---search-filter-background-color: #101826; ---search-filter-foreground-color: #90A5CE; ---search-filter-border-color: #7C95C6; ---search-filter-highlight-text-color: #BCC9E2; ---search-filter-highlight-bg-color: #283A5D; ---search-results-background-color: #101826; ---search-results-foreground-color: #90A5CE; ---search-results-border-color: #7C95C6; ---search-box-shadow: inset 0.5px 0.5px 3px 0px #2F436C; - -/** code fragments */ ---code-keyword-color: #CC99CD; ---code-type-keyword-color: #AB99CD; ---code-flow-keyword-color: #E08000; ---code-comment-color: #717790; ---code-preprocessor-color: #65CABE; ---code-string-literal-color: #7EC699; ---code-char-literal-color: #00E0F0; ---code-xml-cdata-color: #C9D1D9; ---code-vhdl-digit-color: #FF00FF; ---code-vhdl-char-color: #C0C0C0; ---code-vhdl-keyword-color: #CF53C9; ---code-vhdl-logic-color: #FF0000; ---code-link-color: #79C0FF; ---code-external-link-color: #79C0FF; ---fragment-foreground-color: #C9D1D9; ---fragment-background-color: #090D16; ---fragment-border-color: #30363D; ---fragment-lineno-border-color: #30363D; ---fragment-lineno-background-color: black; ---fragment-lineno-foreground-color: #6E7681; ---fragment-lineno-link-fg-color: #6E7681; ---fragment-lineno-link-bg-color: #303030; ---fragment-lineno-link-hover-fg-color: #8E96A1; ---fragment-lineno-link-hover-bg-color: #505050; ---fragment-copy-ok-color: #0EA80E; ---tooltip-foreground-color: #C9D1D9; ---tooltip-background-color: #202020; ---tooltip-border-color: #C9D1D9; ---tooltip-doc-color: #D9E1E9; ---tooltip-declaration-color: #20C348; ---tooltip-link-color: #79C0FF; ---tooltip-shadow: none; ---fold-line-color: #808080; ---fold-minus-image: url('minusd.svg'); ---fold-plus-image: url('plusd.svg'); ---fold-minus-image-relpath: url('../../minusd.svg'); ---fold-plus-image-relpath: url('../../plusd.svg'); - -/** font-family */ ---font-family-normal: Roboto,sans-serif; ---font-family-monospace: 'JetBrains Mono',Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace,fixed; ---font-family-nav: 'Lucida Grande',Geneva,Helvetica,Arial,sans-serif; ---font-family-title: Tahoma,Arial,sans-serif; ---font-family-toc: Verdana,'DejaVu Sans',Geneva,sans-serif; ---font-family-search: Arial,Verdana,sans-serif; ---font-family-icon: Arial,Helvetica; ---font-family-tooltip: Roboto,sans-serif; - -/** special sections */ ---warning-color-bg: #2e1917; ---warning-color-hl: #ad2617; ---warning-color-text: #f5b1aa; ---note-color-bg: #3b2e04; ---note-color-hl: #f1b602; ---note-color-text: #ceb670; ---todo-color-bg: #163750; ---todo-color-hl: #1982D2; ---todo-color-text: #dcf0fa; ---test-color-bg: #121258; ---test-color-hl: #4242cf; ---test-color-text: #c0c0da; ---deprecated-color-bg: #2e323b; ---deprecated-color-hl: #738396; ---deprecated-color-text: #abb0bd; ---bug-color-bg: #2a2536; ---bug-color-hl: #7661b3; ---bug-color-text: #ae9ed6; ---invariant-color-bg: #303a35; ---invariant-color-hl: #76ce96; ---invariant-color-text: #cceed5; -}} -body { - background-color: var(--page-background-color); - color: var(--page-foreground-color); -} - -body, table, div, p, dl { - font-weight: 400; - font-size: 14px; - font-family: var(--font-family-normal); - line-height: 22px; -} - -/* @group Heading Levels */ - -.title { - font-family: var(--font-family-normal); - line-height: 28px; - font-size: 150%; - font-weight: bold; - margin: 10px 2px; -} - -h1.groupheader { - font-size: 150%; -} - -h2.groupheader { - border-bottom: 1px solid var(--group-header-separator-color); - color: var(--group-header-color); - font-size: 150%; - font-weight: normal; - margin-top: 1.75em; - padding-top: 8px; - padding-bottom: 4px; - width: 100%; -} - -h3.groupheader { - font-size: 100%; -} - -h1, h2, h3, h4, h5, h6 { - -webkit-transition: text-shadow 0.5s linear; - -moz-transition: text-shadow 0.5s linear; - -ms-transition: text-shadow 0.5s linear; - -o-transition: text-shadow 0.5s linear; - transition: text-shadow 0.5s linear; - margin-right: 15px; -} - -h1.glow, h2.glow, h3.glow, h4.glow, h5.glow, h6.glow { - text-shadow: 0 0 15px var(--glow-color); -} - -dt { - font-weight: bold; -} - -p.startli, p.startdd { - margin-top: 2px; -} - -th p.starttd, th p.intertd, th p.endtd { - font-size: 100%; - font-weight: 700; -} - -p.starttd { - margin-top: 0px; -} - -p.endli { - margin-bottom: 0px; -} - -p.enddd { - margin-bottom: 4px; -} - -p.endtd { - margin-bottom: 2px; -} - -p.interli { -} - -p.interdd { -} - -p.intertd { -} - -/* @end */ - -caption { - font-weight: bold; -} - -span.legend { - font-size: 70%; - text-align: center; -} - -h3.version { - font-size: 90%; - text-align: center; -} - -div.navtab { - padding-right: 15px; - text-align: right; - line-height: 110%; -} - -div.navtab table { - border-spacing: 0; -} - -td.navtab { - padding-right: 6px; - padding-left: 6px; -} - -td.navtabHL { - background-image: var(--nav-gradient-active-image); - background-repeat:repeat-x; - padding-right: 6px; - padding-left: 6px; -} - -td.navtabHL a, td.navtabHL a:visited { - color: var(--nav-text-hover-color); - text-shadow: var(--nav-text-hover-shadow); -} - -a.navtab { - font-weight: bold; -} - -div.qindex{ - text-align: center; - width: 100%; - line-height: 140%; - font-size: 130%; - color: var(--index-separator-color); -} - -#main-menu a:focus { - outline: auto; - z-index: 10; - position: relative; -} - -dt.alphachar{ - font-size: 180%; - font-weight: bold; -} - -.alphachar a{ - color: var(--index-header-color); -} - -.alphachar a:hover, .alphachar a:visited{ - text-decoration: none; -} - -.classindex dl { - padding: 25px; - column-count:1 -} - -.classindex dd { - display:inline-block; - margin-left: 50px; - width: 90%; - line-height: 1.15em; -} - -.classindex dl.even { - background-color: var(--index-even-item-bg-color); -} - -.classindex dl.odd { - background-color: var(--index-odd-item-bg-color); -} - -@media(min-width: 1120px) { - .classindex dl { - column-count:2 - } -} - -@media(min-width: 1320px) { - .classindex dl { - column-count:3 - } -} - - -/* @group Link Styling */ - -a { - color: var(--page-link-color); - font-weight: normal; - text-decoration: none; -} - -.contents a:visited { - color: var(--page-visited-link-color); -} - -a:hover { - text-decoration: none; - background: linear-gradient(to bottom, transparent 0,transparent calc(100% - 1px), currentColor 100%); -} - -a:hover > span.arrow { - text-decoration: none; - background : var(--nav-background-color); -} - -a.el { - font-weight: bold; -} - -a.elRef { -} - -a.code, a.code:visited, a.line, a.line:visited { - color: var(--code-link-color); -} - -a.codeRef, a.codeRef:visited, a.lineRef, a.lineRef:visited { - color: var(--code-external-link-color); -} - -a.code.hl_class { /* style for links to class names in code snippets */ } -a.code.hl_struct { /* style for links to struct names in code snippets */ } -a.code.hl_union { /* style for links to union names in code snippets */ } -a.code.hl_interface { /* style for links to interface names in code snippets */ } -a.code.hl_protocol { /* style for links to protocol names in code snippets */ } -a.code.hl_category { /* style for links to category names in code snippets */ } -a.code.hl_exception { /* style for links to exception names in code snippets */ } -a.code.hl_service { /* style for links to service names in code snippets */ } -a.code.hl_singleton { /* style for links to singleton names in code snippets */ } -a.code.hl_concept { /* style for links to concept names in code snippets */ } -a.code.hl_namespace { /* style for links to namespace names in code snippets */ } -a.code.hl_package { /* style for links to package names in code snippets */ } -a.code.hl_define { /* style for links to macro names in code snippets */ } -a.code.hl_function { /* style for links to function names in code snippets */ } -a.code.hl_variable { /* style for links to variable names in code snippets */ } -a.code.hl_typedef { /* style for links to typedef names in code snippets */ } -a.code.hl_enumvalue { /* style for links to enum value names in code snippets */ } -a.code.hl_enumeration { /* style for links to enumeration names in code snippets */ } -a.code.hl_signal { /* style for links to Qt signal names in code snippets */ } -a.code.hl_slot { /* style for links to Qt slot names in code snippets */ } -a.code.hl_friend { /* style for links to friend names in code snippets */ } -a.code.hl_dcop { /* style for links to KDE3 DCOP names in code snippets */ } -a.code.hl_property { /* style for links to property names in code snippets */ } -a.code.hl_event { /* style for links to event names in code snippets */ } -a.code.hl_sequence { /* style for links to sequence names in code snippets */ } -a.code.hl_dictionary { /* style for links to dictionary names in code snippets */ } - -/* @end */ - -dl.el { - margin-left: -1cm; -} - -ul.check { - list-style:none; - text-indent: -16px; - padding-left: 38px; -} -li.unchecked:before { - content: "\2610\A0"; -} -li.checked:before { - content: "\2611\A0"; -} - -ol { - text-indent: 0px; -} - -ul { - text-indent: 0px; - overflow: visible; -} - -ul.multicol { - -moz-column-gap: 1em; - -webkit-column-gap: 1em; - column-gap: 1em; - -moz-column-count: 3; - -webkit-column-count: 3; - column-count: 3; - list-style-type: none; -} - -#side-nav ul { - overflow: visible; /* reset ul rule for scroll bar in GENERATE_TREEVIEW window */ -} - -#main-nav ul { - overflow: visible; /* reset ul rule for the navigation bar drop down lists */ -} - -.fragment { - text-align: left; - direction: ltr; - overflow-x: auto; - overflow-y: hidden; - position: relative; - min-height: 12px; - margin: 10px 0px; - padding: 10px 10px; - border: 1px solid var(--fragment-border-color); - border-radius: 4px; - background-color: var(--fragment-background-color); - color: var(--fragment-foreground-color); -} - -pre.fragment { - word-wrap: break-word; - font-size: 10pt; - line-height: 125%; - font-family: var(--font-family-monospace); -} - -.clipboard { - width: 24px; - height: 24px; - right: 5px; - top: 5px; - opacity: 0; - position: absolute; - display: inline; - overflow: auto; - fill: var(--fragment-foreground-color); - justify-content: center; - align-items: center; - cursor: pointer; -} - -.clipboard.success { - border: 1px solid var(--fragment-foreground-color); - border-radius: 4px; -} - -.fragment:hover .clipboard, .clipboard.success { - opacity: .28; -} - -.clipboard:hover, .clipboard.success { - opacity: 1 !important; -} - -.clipboard:active:not([class~=success]) svg { - transform: scale(.91); -} - -.clipboard.success svg { - fill: var(--fragment-copy-ok-color); -} - -.clipboard.success { - border-color: var(--fragment-copy-ok-color); -} - -div.line { - font-family: var(--font-family-monospace); - font-size: 13px; - min-height: 13px; - line-height: 1.2; - text-wrap: unrestricted; - white-space: -moz-pre-wrap; /* Moz */ - white-space: -pre-wrap; /* Opera 4-6 */ - white-space: -o-pre-wrap; /* Opera 7 */ - white-space: pre-wrap; /* CSS3 */ - word-wrap: break-word; /* IE 5.5+ */ - text-indent: -53px; - padding-left: 53px; - padding-bottom: 0px; - margin: 0px; - -webkit-transition-property: background-color, box-shadow; - -webkit-transition-duration: 0.5s; - -moz-transition-property: background-color, box-shadow; - -moz-transition-duration: 0.5s; - -ms-transition-property: background-color, box-shadow; - -ms-transition-duration: 0.5s; - -o-transition-property: background-color, box-shadow; - -o-transition-duration: 0.5s; - transition-property: background-color, box-shadow; - transition-duration: 0.5s; -} - -div.line:after { - content:"\000A"; - white-space: pre; -} - -div.line.glow { - background-color: var(--glow-color); - box-shadow: 0 0 10px var(--glow-color); -} - -span.fold { - margin-left: 5px; - margin-right: 1px; - margin-top: 0px; - margin-bottom: 0px; - padding: 0px; - display: inline-block; - width: 12px; - height: 12px; - background-repeat:no-repeat; - background-position:center; -} - -span.lineno { - padding-right: 4px; - margin-right: 9px; - text-align: right; - border-right: 2px solid var(--fragment-lineno-border-color); - color: var(--fragment-lineno-foreground-color); - background-color: var(--fragment-lineno-background-color); - white-space: pre; -} -span.lineno a, span.lineno a:visited { - color: var(--fragment-lineno-link-fg-color); - background-color: var(--fragment-lineno-link-bg-color); -} - -span.lineno a:hover { - color: var(--fragment-lineno-link-hover-fg-color); - background-color: var(--fragment-lineno-link-hover-bg-color); -} - -.lineno { - -webkit-touch-callout: none; - -webkit-user-select: none; - -khtml-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; -} - -div.classindex ul { - list-style: none; - padding-left: 0; -} - -div.classindex span.ai { - display: inline-block; -} - -div.groupHeader { - margin-left: 16px; - margin-top: 12px; - font-weight: bold; -} - -div.groupText { - margin-left: 16px; - font-style: italic; -} - -body { - color: var(--page-foreground-color); - margin: 0; -} - -div.contents { - margin-top: 10px; - margin-left: 12px; - margin-right: 8px; -} - -p.formulaDsp { - text-align: center; -} - -img.dark-mode-visible { - display: none; -} -img.light-mode-visible { - display: none; -} - -img.formulaInl, img.inline { - vertical-align: middle; -} - -div.center { - text-align: center; - margin-top: 0px; - margin-bottom: 0px; - padding: 0px; -} - -div.center img { - border: 0px; -} - -address.footer { - text-align: right; - padding-right: 12px; -} - -img.footer { - border: 0px; - vertical-align: middle; - width: var(--footer-logo-width); -} - -.compoundTemplParams { - color: var(--memdecl-template-color); - font-size: 80%; - line-height: 120%; -} - -/* @group Code Colorization */ - -span.keyword { - color: var(--code-keyword-color); -} - -span.keywordtype { - color: var(--code-type-keyword-color); -} - -span.keywordflow { - color: var(--code-flow-keyword-color); -} - -span.comment { - color: var(--code-comment-color); -} - -span.preprocessor { - color: var(--code-preprocessor-color); -} - -span.stringliteral { - color: var(--code-string-literal-color); -} - -span.charliteral { - color: var(--code-char-literal-color); -} - -span.xmlcdata { - color: var(--code-xml-cdata-color); -} - -span.vhdldigit { - color: var(--code-vhdl-digit-color); -} - -span.vhdlchar { - color: var(--code-vhdl-char-color); -} - -span.vhdlkeyword { - color: var(--code-vhdl-keyword-color); -} - -span.vhdllogic { - color: var(--code-vhdl-logic-color); -} - -blockquote { - background-color: var(--blockquote-background-color); - border-left: 2px solid var(--blockquote-border-color); - margin: 0 24px 0 4px; - padding: 0 12px 0 16px; -} - -/* @end */ - -td.tiny { - font-size: 75%; -} - -.dirtab { - padding: 4px; - border-collapse: collapse; - border: 1px solid var(--table-cell-border-color); -} - -th.dirtab { - background-color: var(--table-header-background-color); - color: var(--table-header-foreground-color); - font-weight: bold; -} - -hr { - height: 0px; - border: none; - border-top: 1px solid var(--separator-color); -} - -hr.footer { - height: 1px; -} - -/* @group Member Descriptions */ - -table.memberdecls { - border-spacing: 0px; - padding: 0px; -} - -.memberdecls td, .fieldtable tr { - -webkit-transition-property: background-color, box-shadow; - -webkit-transition-duration: 0.5s; - -moz-transition-property: background-color, box-shadow; - -moz-transition-duration: 0.5s; - -ms-transition-property: background-color, box-shadow; - -ms-transition-duration: 0.5s; - -o-transition-property: background-color, box-shadow; - -o-transition-duration: 0.5s; - transition-property: background-color, box-shadow; - transition-duration: 0.5s; -} - -.memberdecls td.glow, .fieldtable tr.glow { - background-color: var(--glow-color); - box-shadow: 0 0 15px var(--glow-color); -} - -.mdescLeft, .mdescRight, -.memItemLeft, .memItemRight, -.memTemplItemLeft, .memTemplItemRight, .memTemplParams { - background-color: var(--memdecl-background-color); - border: none; - margin: 4px; - padding: 1px 0 0 8px; -} - -.mdescLeft, .mdescRight { - padding: 0px 8px 4px 8px; - color: var(--memdecl-foreground-color); -} - -.memSeparator { - border-bottom: 1px solid var(--memdecl-separator-color); - line-height: 1px; - margin: 0px; - padding: 0px; -} - -.memItemLeft, .memTemplItemLeft { - white-space: nowrap; -} - -.memItemRight, .memTemplItemRight { - width: 100%; -} - -.memTemplParams { - color: var(--memdecl-template-color); - white-space: nowrap; - font-size: 80%; -} - -/* @end */ - -/* @group Member Details */ - -/* Styles for detailed member documentation */ - -.memtitle { - padding: 8px; - border-top: 1px solid var(--memdef-border-color); - border-left: 1px solid var(--memdef-border-color); - border-right: 1px solid var(--memdef-border-color); - border-top-right-radius: 4px; - border-top-left-radius: 4px; - margin-bottom: -1px; - background-image: var(--memdef-title-gradient-image); - background-repeat: repeat-x; - background-color: var(--memdef-title-background-color); - line-height: 1.25; - font-weight: 300; - float:left; -} - -.permalink -{ - font-size: 65%; - display: inline-block; - vertical-align: middle; -} - -.memtemplate { - font-size: 80%; - color: var(--memdef-template-color); - font-weight: normal; - margin-left: 9px; -} - -.mempage { - width: 100%; -} - -.memitem { - padding: 0; - margin-bottom: 10px; - margin-right: 5px; - -webkit-transition: box-shadow 0.5s linear; - -moz-transition: box-shadow 0.5s linear; - -ms-transition: box-shadow 0.5s linear; - -o-transition: box-shadow 0.5s linear; - transition: box-shadow 0.5s linear; - display: table !important; - width: 100%; -} - -.memitem.glow { - box-shadow: 0 0 15px var(--glow-color); -} - -.memname { - font-weight: 400; - margin-left: 6px; -} - -.memname td { - vertical-align: bottom; -} - -.memproto, dl.reflist dt { - border-top: 1px solid var(--memdef-border-color); - border-left: 1px solid var(--memdef-border-color); - border-right: 1px solid var(--memdef-border-color); - padding: 6px 0px 6px 0px; - color: var(--memdef-proto-text-color); - font-weight: bold; - text-shadow: var(--memdef-proto-text-shadow); - background-color: var(--memdef-proto-background-color); - box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); - border-top-right-radius: 4px; -} - -.overload { - font-family: var(--font-family-monospace); - font-size: 65%; -} - -.memdoc, dl.reflist dd { - border-bottom: 1px solid var(--memdef-border-color); - border-left: 1px solid var(--memdef-border-color); - border-right: 1px solid var(--memdef-border-color); - padding: 6px 10px 2px 10px; - border-top-width: 0; - background-image:url('nav_g.png'); - background-repeat:repeat-x; - background-color: var(--memdef-doc-background-color); - /* opera specific markup */ - border-bottom-left-radius: 4px; - border-bottom-right-radius: 4px; - box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); - /* firefox specific markup */ - -moz-border-radius-bottomleft: 4px; - -moz-border-radius-bottomright: 4px; - -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px; - /* webkit specific markup */ - -webkit-border-bottom-left-radius: 4px; - -webkit-border-bottom-right-radius: 4px; - -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); -} - -dl.reflist dt { - padding: 5px; -} - -dl.reflist dd { - margin: 0px 0px 10px 0px; - padding: 5px; -} - -.paramkey { - text-align: right; -} - -.paramtype { - white-space: nowrap; - padding: 0px; - padding-bottom: 1px; -} - -.paramname { - white-space: nowrap; - padding: 0px; - padding-bottom: 1px; - margin-left: 2px; -} - -.paramname em { - color: var(--memdef-param-name-color); - font-style: normal; - margin-right: 1px; -} - -.paramname .paramdefval { - font-family: var(--font-family-monospace); -} - -.params, .retval, .exception, .tparams { - margin-left: 0px; - padding-left: 0px; -} - -.params .paramname, .retval .paramname, .tparams .paramname, .exception .paramname { - font-weight: bold; - vertical-align: top; -} - -.params .paramtype, .tparams .paramtype { - font-style: italic; - vertical-align: top; -} - -.params .paramdir, .tparams .paramdir { - font-family: var(--font-family-monospace); - vertical-align: top; -} - -table.mlabels { - border-spacing: 0px; -} - -td.mlabels-left { - width: 100%; - padding: 0px; -} - -td.mlabels-right { - vertical-align: bottom; - padding: 0px; - white-space: nowrap; -} - -span.mlabels { - margin-left: 8px; -} - -span.mlabel { - background-color: var(--label-background-color); - border-top:1px solid var(--label-left-top-border-color); - border-left:1px solid var(--label-left-top-border-color); - border-right:1px solid var(--label-right-bottom-border-color); - border-bottom:1px solid var(--label-right-bottom-border-color); - text-shadow: none; - color: var(--label-foreground-color); - margin-right: 4px; - padding: 2px 3px; - border-radius: 3px; - font-size: 7pt; - white-space: nowrap; - vertical-align: middle; -} - - - -/* @end */ - -/* these are for tree view inside a (index) page */ - -div.directory { - margin: 10px 0px; - border-top: 1px solid var(--directory-separator-color); - border-bottom: 1px solid var(--directory-separator-color); - width: 100%; -} - -.directory table { - border-collapse:collapse; -} - -.directory td { - margin: 0px; - padding: 0px; - vertical-align: top; -} - -.directory td.entry { - white-space: nowrap; - padding-right: 6px; - padding-top: 3px; -} - -.directory td.entry a { - outline:none; -} - -.directory td.entry a img { - border: none; -} - -.directory td.desc { - width: 100%; - padding-left: 6px; - padding-right: 6px; - padding-top: 3px; - border-left: 1px solid rgba(0,0,0,0.05); -} - -.directory tr.odd { - padding-left: 6px; - background-color: var(--index-odd-item-bg-color); -} - -.directory tr.even { - padding-left: 6px; - background-color: var(--index-even-item-bg-color); -} - -.directory img { - vertical-align: -30%; -} - -.directory .levels { - white-space: nowrap; - width: 100%; - text-align: right; - font-size: 9pt; -} - -.directory .levels span { - cursor: pointer; - padding-left: 2px; - padding-right: 2px; - color: var(--page-link-color); -} - -.arrow { - color: var(--nav-arrow-color); - -webkit-user-select: none; - -khtml-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - cursor: pointer; - font-size: 80%; - display: inline-block; - width: 16px; - height: 22px; -} - -.icon { - font-family: var(--font-family-icon); - line-height: normal; - font-weight: bold; - font-size: 12px; - height: 14px; - width: 16px; - display: inline-block; - background-color: var(--icon-background-color); - color: var(--icon-foreground-color); - text-align: center; - border-radius: 4px; - margin-left: 2px; - margin-right: 2px; -} - -.icona { - width: 24px; - height: 22px; - display: inline-block; -} - -.iconfopen { - width: 24px; - height: 18px; - margin-bottom: 4px; - background-image:var(--icon-folder-open-image); - background-repeat: repeat-y; - vertical-align:top; - display: inline-block; -} - -.iconfclosed { - width: 24px; - height: 18px; - margin-bottom: 4px; - background-image:var(--icon-folder-closed-image); - background-repeat: repeat-y; - vertical-align:top; - display: inline-block; -} - -.icondoc { - width: 24px; - height: 18px; - margin-bottom: 4px; - background-image:var(--icon-doc-image); - background-position: 0px -4px; - background-repeat: repeat-y; - vertical-align:top; - display: inline-block; -} - -/* @end */ - -div.dynheader { - margin-top: 8px; - -webkit-touch-callout: none; - -webkit-user-select: none; - -khtml-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; -} - -address { - font-style: normal; - color: var(--footer-foreground-color); -} - -table.doxtable caption { - caption-side: top; -} - -table.doxtable { - border-collapse:collapse; - margin-top: 4px; - margin-bottom: 4px; -} - -table.doxtable td, table.doxtable th { - border: 1px solid var(--table-cell-border-color); - padding: 3px 7px 2px; -} - -table.doxtable th { - background-color: var(--table-header-background-color); - color: var(--table-header-foreground-color); - font-size: 110%; - padding-bottom: 4px; - padding-top: 5px; -} - -table.fieldtable { - margin-bottom: 10px; - border: 1px solid var(--memdef-border-color); - border-spacing: 0px; - border-radius: 4px; - box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.15); -} - -.fieldtable td, .fieldtable th { - padding: 3px 7px 2px; -} - -.fieldtable td.fieldtype, .fieldtable td.fieldname, .fieldtable td.fieldinit { - white-space: nowrap; - border-right: 1px solid var(--memdef-border-color); - border-bottom: 1px solid var(--memdef-border-color); - vertical-align: top; -} - -.fieldtable td.fieldname { - padding-top: 3px; -} - -.fieldtable td.fieldinit { - padding-top: 3px; - text-align: right; -} - - -.fieldtable td.fielddoc { - border-bottom: 1px solid var(--memdef-border-color); -} - -.fieldtable td.fielddoc p:first-child { - margin-top: 0px; -} - -.fieldtable td.fielddoc p:last-child { - margin-bottom: 2px; -} - -.fieldtable tr:last-child td { - border-bottom: none; -} - -.fieldtable th { - background-image: var(--memdef-title-gradient-image); - background-repeat:repeat-x; - background-color: var(--memdef-title-background-color); - font-size: 90%; - color: var(--memdef-proto-text-color); - padding-bottom: 4px; - padding-top: 5px; - text-align:left; - font-weight: 400; - border-top-left-radius: 4px; - border-top-right-radius: 4px; - border-bottom: 1px solid var(--memdef-border-color); -} - - -.tabsearch { - top: 0px; - left: 10px; - height: 36px; - background-image: var(--nav-gradient-image); - z-index: 101; - overflow: hidden; - font-size: 13px; -} - -.navpath ul -{ - font-size: 11px; - background-image: var(--nav-gradient-image); - background-repeat:repeat-x; - background-position: 0 -5px; - height:30px; - line-height:30px; - color:var(--nav-text-normal-color); - border:solid 1px var(--nav-breadcrumb-border-color); - overflow:hidden; - margin:0px; - padding:0px; -} - -.navpath li -{ - list-style-type:none; - float:left; - padding-left:10px; - padding-right:15px; - background-image:var(--nav-breadcrumb-image); - background-repeat:no-repeat; - background-position:right; - color: var(--nav-foreground-color); -} - -.navpath li.navelem a -{ - height:32px; - display:block; - outline: none; - color: var(--nav-text-normal-color); - font-family: var(--font-family-nav); - text-shadow: var(--nav-text-normal-shadow); - text-decoration: none; -} - -.navpath li.navelem a:hover -{ - color: var(--nav-text-hover-color); - text-shadow: var(--nav-text-hover-shadow); -} - -.navpath li.footer -{ - list-style-type:none; - float:right; - padding-left:10px; - padding-right:15px; - background-image:none; - background-repeat:no-repeat; - background-position:right; - color: var(--footer-foreground-color); - font-size: 8pt; -} - - -div.summary -{ - float: right; - font-size: 8pt; - padding-right: 5px; - width: 50%; - text-align: right; -} - -div.summary a -{ - white-space: nowrap; -} - -table.classindex -{ - margin: 10px; - white-space: nowrap; - margin-left: 3%; - margin-right: 3%; - width: 94%; - border: 0; - border-spacing: 0; - padding: 0; -} - -div.ingroups -{ - font-size: 8pt; - width: 50%; - text-align: left; -} - -div.ingroups a -{ - white-space: nowrap; -} - -div.header -{ - background-image: var(--header-gradient-image); - background-repeat:repeat-x; - background-color: var(--header-background-color); - margin: 0px; - border-bottom: 1px solid var(--header-separator-color); -} - -div.headertitle -{ - padding: 5px 5px 5px 10px; -} - -.PageDocRTL-title div.headertitle { - text-align: right; - direction: rtl; -} - -dl { - padding: 0 0 0 0; -} - -/* - -dl.section { - margin-left: 0px; - padding-left: 0px; -} - -dl.note { - margin-left: -7px; - padding-left: 3px; - border-left: 4px solid; - border-color: #D0C000; -} - -dl.warning, dl.attention, dl.important { - margin-left: -7px; - padding-left: 3px; - border-left: 4px solid; - border-color: #FF0000; -} - -dl.pre, dl.post, dl.invariant { - margin-left: -7px; - padding-left: 3px; - border-left: 4px solid; - border-color: #00D000; -} - -dl.deprecated { - margin-left: -7px; - padding-left: 3px; - border-left: 4px solid; - border-color: #505050; -} - -dl.todo { - margin-left: -7px; - padding-left: 3px; - border-left: 4px solid; - border-color: #00C0E0; -} - -dl.test { - margin-left: -7px; - padding-left: 3px; - border-left: 4px solid; - border-color: #3030E0; -} - -dl.bug { - margin-left: -7px; - padding-left: 3px; - border-left: 4px solid; - border-color: #C08050; -} - -*/ - -dl.bug dt a, dl.deprecated dt a, dl.todo dt a, dl.test a { - font-weight: bold !important; -} - -dl.warning, dl.attention, dl.important, dl.note, dl.deprecated, dl.bug, -dl.invariant, dl.pre, dl.post, dl.todo, dl.test, dl.remark { - padding: 10px; - margin: 10px 0px; - overflow: hidden; - margin-left: 0; - border-radius: 4px; -} - -dl.section dd { - margin-bottom: 2px; -} - -dl.warning, dl.attention, dl.important { - background: var(--warning-color-bg); - border-left: 8px solid var(--warning-color-hl); - color: var(--warning-color-text); -} - -dl.warning dt, dl.attention dt, dl.important dt { - color: var(--warning-color-hl); -} - -dl.note, dl.remark { - background: var(--note-color-bg); - border-left: 8px solid var(--note-color-hl); - color: var(--note-color-text); -} - -dl.note dt, dl.remark dt { - color: var(--note-color-hl); -} - -dl.todo { - background: var(--todo-color-bg); - border-left: 8px solid var(--todo-color-hl); - color: var(--todo-color-text); -} - -dl.todo dt { - color: var(--todo-color-hl); -} - -dl.test { - background: var(--test-color-bg); - border-left: 8px solid var(--test-color-hl); - color: var(--test-color-text); -} - -dl.test dt { - color: var(--test-color-hl); -} - -dl.bug dt a { - color: var(--bug-color-hl) !important; -} - -dl.bug { - background: var(--bug-color-bg); - border-left: 8px solid var(--bug-color-hl); - color: var(--bug-color-text); -} - -dl.bug dt a { - color: var(--bug-color-hl) !important; -} - -dl.deprecated { - background: var(--deprecated-color-bg); - border-left: 8px solid var(--deprecated-color-hl); - color: var(--deprecated-color-text); -} - -dl.deprecated dt a { - color: var(--deprecated-color-hl) !important; -} - -dl.note dd, dl.warning dd, dl.pre dd, dl.post dd, -dl.remark dd, dl.attention dd, dl.important dd, dl.invariant dd, -dl.bug dd, dl.deprecated dd, dl.todo dd, dl.test dd { - margin-inline-start: 0px; -} - -dl.invariant, dl.pre, dl.post { - background: var(--invariant-color-bg); - border-left: 8px solid var(--invariant-color-hl); - color: var(--invariant-color-text); -} - -dl.invariant dt, dl.pre dt, dl.post dt { - color: var(--invariant-color-hl); -} - - -#projectrow -{ - height: 56px; -} - -#projectlogo -{ - text-align: center; - vertical-align: bottom; - border-collapse: separate; -} - -#projectlogo img -{ - border: 0px none; -} - -#projectalign -{ - vertical-align: middle; - padding-left: 0.5em; -} - -#projectname -{ - font-size: 200%; - font-family: var(--font-family-title); - margin: 0px; - padding: 2px 0px; -} - -#projectbrief -{ - font-size: 90%; - font-family: var(--font-family-title); - margin: 0px; - padding: 0px; -} - -#projectnumber -{ - font-size: 50%; - font-family: 50% var(--font-family-title); - margin: 0px; - padding: 0px; -} - -#titlearea -{ - padding: 0px; - margin: 0px; - width: 100%; - border-bottom: 1px solid var(--title-separator-color); - background-color: var(--title-background-color); -} - -.image -{ - text-align: center; -} - -.dotgraph -{ - text-align: center; -} - -.mscgraph -{ - text-align: center; -} - -.plantumlgraph -{ - text-align: center; -} - -.diagraph -{ - text-align: center; -} - -.caption -{ - font-weight: bold; -} - -dl.citelist { - margin-bottom:50px; -} - -dl.citelist dt { - color:var(--citation-label-color); - float:left; - font-weight:bold; - margin-right:10px; - padding:5px; - text-align:right; - width:52px; -} - -dl.citelist dd { - margin:2px 0 2px 72px; - padding:5px 0; -} - -div.toc { - padding: 14px 25px; - background-color: var(--toc-background-color); - border: 1px solid var(--toc-border-color); - border-radius: 7px 7px 7px 7px; - float: right; - height: auto; - margin: 0 8px 10px 10px; - width: 200px; -} - -div.toc li { - background: var(--toc-down-arrow-image) no-repeat scroll 0 5px transparent; - font: 10px/1.2 var(--font-family-toc); - margin-top: 5px; - padding-left: 10px; - padding-top: 2px; -} - -div.toc h3 { - font: bold 12px/1.2 var(--font-family-toc); - color: var(--toc-header-color); - border-bottom: 0 none; - margin: 0; -} - -div.toc ul { - list-style: none outside none; - border: medium none; - padding: 0px; -} - -div.toc li[class^='level'] { - margin-left: 15px; -} - -div.toc li.level1 { - margin-left: 0px; -} - -div.toc li.empty { - background-image: none; - margin-top: 0px; -} - -span.emoji { - /* font family used at the site: https://unicode.org/emoji/charts/full-emoji-list.html - * font-family: "Noto Color Emoji", "Apple Color Emoji", "Segoe UI Emoji", Times, Symbola, Aegyptus, Code2000, Code2001, Code2002, Musica, serif, LastResort; - */ -} - -span.obfuscator { - display: none; -} - -.inherit_header { - font-weight: bold; - color: var(--inherit-header-color); - cursor: pointer; - -webkit-touch-callout: none; - -webkit-user-select: none; - -khtml-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; -} - -.inherit_header td { - padding: 6px 0px 2px 5px; -} - -.inherit { - display: none; -} - -tr.heading h2 { - margin-top: 12px; - margin-bottom: 4px; -} - -/* tooltip related style info */ - -.ttc { - position: absolute; - display: none; -} - -#powerTip { - cursor: default; - /*white-space: nowrap;*/ - color: var(--tooltip-foreground-color); - background-color: var(--tooltip-background-color); - border: 1px solid var(--tooltip-border-color); - border-radius: 4px 4px 4px 4px; - box-shadow: var(--tooltip-shadow); - display: none; - font-size: smaller; - max-width: 80%; - opacity: 0.9; - padding: 1ex 1em 1em; - position: absolute; - z-index: 2147483647; -} - -#powerTip div.ttdoc { - color: var(--tooltip-doc-color); - font-style: italic; -} - -#powerTip div.ttname a { - font-weight: bold; -} - -#powerTip a { - color: var(--tooltip-link-color); -} - -#powerTip div.ttname { - font-weight: bold; -} - -#powerTip div.ttdeci { - color: var(--tooltip-declaration-color); -} - -#powerTip div { - margin: 0px; - padding: 0px; - font-size: 12px; - font-family: var(--font-family-tooltip); - line-height: 16px; -} - -#powerTip:before, #powerTip:after { - content: ""; - position: absolute; - margin: 0px; -} - -#powerTip.n:after, #powerTip.n:before, -#powerTip.s:after, #powerTip.s:before, -#powerTip.w:after, #powerTip.w:before, -#powerTip.e:after, #powerTip.e:before, -#powerTip.ne:after, #powerTip.ne:before, -#powerTip.se:after, #powerTip.se:before, -#powerTip.nw:after, #powerTip.nw:before, -#powerTip.sw:after, #powerTip.sw:before { - border: solid transparent; - content: " "; - height: 0; - width: 0; - position: absolute; -} - -#powerTip.n:after, #powerTip.s:after, -#powerTip.w:after, #powerTip.e:after, -#powerTip.nw:after, #powerTip.ne:after, -#powerTip.sw:after, #powerTip.se:after { - border-color: rgba(255, 255, 255, 0); -} - -#powerTip.n:before, #powerTip.s:before, -#powerTip.w:before, #powerTip.e:before, -#powerTip.nw:before, #powerTip.ne:before, -#powerTip.sw:before, #powerTip.se:before { - border-color: rgba(128, 128, 128, 0); -} - -#powerTip.n:after, #powerTip.n:before, -#powerTip.ne:after, #powerTip.ne:before, -#powerTip.nw:after, #powerTip.nw:before { - top: 100%; -} - -#powerTip.n:after, #powerTip.ne:after, #powerTip.nw:after { - border-top-color: var(--tooltip-background-color); - border-width: 10px; - margin: 0px -10px; -} -#powerTip.n:before, #powerTip.ne:before, #powerTip.nw:before { - border-top-color: var(--tooltip-border-color); - border-width: 11px; - margin: 0px -11px; -} -#powerTip.n:after, #powerTip.n:before { - left: 50%; -} - -#powerTip.nw:after, #powerTip.nw:before { - right: 14px; -} - -#powerTip.ne:after, #powerTip.ne:before { - left: 14px; -} - -#powerTip.s:after, #powerTip.s:before, -#powerTip.se:after, #powerTip.se:before, -#powerTip.sw:after, #powerTip.sw:before { - bottom: 100%; -} - -#powerTip.s:after, #powerTip.se:after, #powerTip.sw:after { - border-bottom-color: var(--tooltip-background-color); - border-width: 10px; - margin: 0px -10px; -} - -#powerTip.s:before, #powerTip.se:before, #powerTip.sw:before { - border-bottom-color: var(--tooltip-border-color); - border-width: 11px; - margin: 0px -11px; -} - -#powerTip.s:after, #powerTip.s:before { - left: 50%; -} - -#powerTip.sw:after, #powerTip.sw:before { - right: 14px; -} - -#powerTip.se:after, #powerTip.se:before { - left: 14px; -} - -#powerTip.e:after, #powerTip.e:before { - left: 100%; -} -#powerTip.e:after { - border-left-color: var(--tooltip-border-color); - border-width: 10px; - top: 50%; - margin-top: -10px; -} -#powerTip.e:before { - border-left-color: var(--tooltip-border-color); - border-width: 11px; - top: 50%; - margin-top: -11px; -} - -#powerTip.w:after, #powerTip.w:before { - right: 100%; -} -#powerTip.w:after { - border-right-color: var(--tooltip-border-color); - border-width: 10px; - top: 50%; - margin-top: -10px; -} -#powerTip.w:before { - border-right-color: var(--tooltip-border-color); - border-width: 11px; - top: 50%; - margin-top: -11px; -} - -@media print -{ - #top { display: none; } - #side-nav { display: none; } - #nav-path { display: none; } - body { overflow:visible; } - h1, h2, h3, h4, h5, h6 { page-break-after: avoid; } - .summary { display: none; } - .memitem { page-break-inside: avoid; } - #doc-content - { - margin-left:0 !important; - height:auto !important; - width:auto !important; - overflow:inherit; - display:inline; - } -} - -/* @group Markdown */ - -table.markdownTable { - border-collapse:collapse; - margin-top: 4px; - margin-bottom: 4px; -} - -table.markdownTable td, table.markdownTable th { - border: 1px solid var(--table-cell-border-color); - padding: 3px 7px 2px; -} - -table.markdownTable tr { -} - -th.markdownTableHeadLeft, th.markdownTableHeadRight, th.markdownTableHeadCenter, th.markdownTableHeadNone { - background-color: var(--table-header-background-color); - color: var(--table-header-foreground-color); - font-size: 110%; - padding-bottom: 4px; - padding-top: 5px; -} - -th.markdownTableHeadLeft, td.markdownTableBodyLeft { - text-align: left -} - -th.markdownTableHeadRight, td.markdownTableBodyRight { - text-align: right -} - -th.markdownTableHeadCenter, td.markdownTableBodyCenter { - text-align: center -} - -tt, code, kbd, samp -{ - display: inline-block; -} -/* @end */ - -u { - text-decoration: underline; -} - -details>summary { - list-style-type: none; -} - -details > summary::-webkit-details-marker { - display: none; -} - -details>summary::before { - content: "\25ba"; - padding-right:4px; - font-size: 80%; -} - -details[open]>summary::before { - content: "\25bc"; - padding-right:4px; - font-size: 80%; -} - -body { - scrollbar-color: var(--scrollbar-thumb-color) var(--scrollbar-background-color); -} - -::-webkit-scrollbar { - background-color: var(--scrollbar-background-color); - height: 12px; - width: 12px; -} -::-webkit-scrollbar-thumb { - border-radius: 6px; - box-shadow: inset 0 0 12px 12px var(--scrollbar-thumb-color); - border: solid 2px transparent; -} -::-webkit-scrollbar-corner { - background-color: var(--scrollbar-background-color); -} - +version https://git-lfs.github.com/spec/v1 +oid sha256:4e4247c387f5909e633fd5e2bb5a8e1226b7cd01df0336d29b09dd0155ba7462 +size 50043 diff --git a/doxygen_docs/html/doxygen.svg b/doxygen_docs/html/doxygen.svg index 79a7635..fc0ab0b 100644 --- a/doxygen_docs/html/doxygen.svg +++ b/doxygen_docs/html/doxygen.svg @@ -1,28 +1,3 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:2c92e9d85d456640d5f2bbdf717112a216230e4b5be7450983c6182afbaf1fc9 +size 15461 diff --git a/doxygen_docs/html/doxygen_crawl.html b/doxygen_docs/html/doxygen_crawl.html index 80aa7b3..88f9e34 100644 --- a/doxygen_docs/html/doxygen_crawl.html +++ b/doxygen_docs/html/doxygen_crawl.html @@ -1,857 +1,3 @@ - - - -Validator / crawler helper - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:48d7384f6b6e3c0d3f030abb8d994070d1cc01afe4fc77317acbdead9079677e +size 46105 diff --git a/doxygen_docs/html/dynsections.js b/doxygen_docs/html/dynsections.js index 8985f42..d43a8f2 100644 --- a/doxygen_docs/html/dynsections.js +++ b/doxygen_docs/html/dynsections.js @@ -1,205 +1,3 @@ -/* - @licstart The following is the entire license notice for the JavaScript code in this file. - - The MIT License (MIT) - - Copyright (C) 1997-2020 by Dimitri van Heesch - - Permission is hereby granted, free of charge, to any person obtaining a copy of this software - and associated documentation files (the "Software"), to deal in the Software without restriction, - including without limitation the rights to use, copy, modify, merge, publish, distribute, - sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all copies or - substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING - BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - @licend The above is the entire license notice for the JavaScript code in this file - */ - -function toggleVisibility(linkObj) { - return dynsection.toggleVisibility(linkObj); -} - -let dynsection = { - - // helper function - updateStripes : function() { - $('table.directory tr'). - removeClass('even').filter(':visible:even').addClass('even'); - $('table.directory tr'). - removeClass('odd').filter(':visible:odd').addClass('odd'); - }, - - toggleVisibility : function(linkObj) { - const base = $(linkObj).attr('id'); - const summary = $('#'+base+'-summary'); - const content = $('#'+base+'-content'); - const trigger = $('#'+base+'-trigger'); - const src=$(trigger).attr('src'); - if (content.is(':visible')===true) { - content.hide(); - summary.show(); - $(linkObj).addClass('closed').removeClass('opened'); - $(trigger).attr('src',src.substring(0,src.length-8)+'closed.png'); - } else { - content.show(); - summary.hide(); - $(linkObj).removeClass('closed').addClass('opened'); - $(trigger).attr('src',src.substring(0,src.length-10)+'open.png'); - } - return false; - }, - - toggleLevel : function(level) { - $('table.directory tr').each(function() { - const l = this.id.split('_').length-1; - const i = $('#img'+this.id.substring(3)); - const a = $('#arr'+this.id.substring(3)); - if (l'); - // add vertical lines to other rows - $('span[class=lineno]').not(':eq(0)').append(''); - // add toggle controls to lines with fold divs - $('div[class=foldopen]').each(function() { - // extract specific id to use - const id = $(this).attr('id').replace('foldopen',''); - // extract start and end foldable fragment attributes - const start = $(this).attr('data-start'); - const end = $(this).attr('data-end'); - // replace normal fold span with controls for the first line of a foldable fragment - $(this).find('span[class=fold]:first').replaceWith(''); - // append div for folded (closed) representation - $(this).after(''); - // extract the first line from the "open" section to represent closed content - const line = $(this).children().first().clone(); - // remove any glow that might still be active on the original line - $(line).removeClass('glow'); - if (start) { - // if line already ends with a start marker (e.g. trailing {), remove it - $(line).html($(line).html().replace(new RegExp('\\s*'+start+'\\s*$','g'),'')); - } - // replace minus with plus symbol - $(line).find('span[class=fold]').css('background-image',codefold.plusImg[relPath]); - // append ellipsis - $(line).append(' '+start+''+end); - // insert constructed line into closed div - $('#foldclosed'+id).html(line); - }); - }, -}; -/* @license-end */ -$(function() { - $('.code,.codeRef').each(function() { - $(this).data('powertip',$('#a'+$(this).attr('href').replace(/.*\//,'').replace(/[^a-z_A-Z0-9]/g,'_')).html()); - $.fn.powerTip.smartPlacementLists.s = [ 's', 'n', 'ne', 'se' ]; - $(this).powerTip({ placement: 's', smartPlacement: true, mouseOnToPopup: true }); - }); -}); +version https://git-lfs.github.com/spec/v1 +oid sha256:0f62fcf5d2cf11e3249be7ed9c96d2f3a78bc15268a080e67406e760f0fb66a1 +size 8432 diff --git a/doxygen_docs/html/entity_8h_source.html b/doxygen_docs/html/entity_8h_source.html index 49ed10f..0053cb4 100644 --- a/doxygen_docs/html/entity_8h_source.html +++ b/doxygen_docs/html/entity_8h_source.html @@ -1,230 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/inc/system/ecs/entity.h Source File - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
entity.h
-
-
-
1#pragma once
-
2#include "component.h"
-
3#include <unordered_map>
-
4#include <vector>
-
5#include <memory>
-
6#include <algorithm>
-
7#include <cassert>
-
8
-
9namespace ecs {
-
13 using EntityID = uint32_t;
-
14
-
-
15class Entity {
-
16public:
-
20 explicit Entity(EntityID id) : m_ID(id) {}
-
21 ~Entity() = default;
-
22
-
26 Entity(const Entity&) = delete;
-
27 Entity& operator=(const Entity&) = delete;
-
28
-
32 Entity(Entity&&) = default;
-
33 Entity& operator=(Entity&&) = default;
-
34
-
39 EntityID GetID() const { return m_ID; }
-
40
-
48 template<typename T, typename... Args>
-
-
49 std::shared_ptr<T> AddComponent(Args&&... args) {
-
50 static_assert(std::is_base_of<Component, T>::value, "T must derive from Component");
-
51
- -
53
-
54 // Vérifier si le composant existe déjà
-
55 if (m_Components.find(typeID) != m_Components.end()) {
-
56 return std::static_pointer_cast<T>(m_Components[typeID]);
-
57 }
-
58
-
59 // Créer et ajouter le composant
-
60 auto component = std::make_shared<T>(std::forward<Args>(args)...);
-
61 m_Components[typeID] = component;
-
62
-
63 // Initialiser le composant
-
64 component->Initialize();
-
65
-
66 return component;
-
67 }
-
-
68
-
74 template<typename T>
-
-
75 std::shared_ptr<T> GetComponent() {
-
76 static_assert(std::is_base_of<Component, T>::value, "T must derive from Component");
-
77
- -
79
-
80 auto it = m_Components.find(typeID);
-
81 if (it != m_Components.end()) {
-
82 return std::static_pointer_cast<T>(it->second);
-
83 }
-
84
-
85 return nullptr;
-
86 }
-
-
87
-
93 template<typename T>
-
-
94 bool HasComponent() const {
-
95 static_assert(std::is_base_of<Component, T>::value, "T must derive from Component");
-
96
- -
98 return m_Components.find(typeID) != m_Components.end();
-
99 }
-
-
100
-
105 template<typename T>
-
- -
107 static_assert(std::is_base_of<Component, T>::value, "T must derive from Component");
-
108
- -
110 auto it = m_Components.find(typeID);
-
111
-
112 if (it != m_Components.end()) {
-
113 m_Components.erase(it);
-
114 }
-
115 }
-
-
116
-
-
121 void UpdateComponents(float deltaTime) {
-
122 for (auto& [typeID, component] : m_Components) {
-
123 component->Update(deltaTime);
-
124 }
-
125 }
-
-
126
-
127private:
-
128
-
132 EntityID m_ID;
-
137 std::unordered_map<ComponentTypeID, ComponentPtr> m_Components;
-
138};
-
-
139
-
140} // namespace ecs
- -
Entity(const Entity &)=delete
-
std::shared_ptr< T > GetComponent()
Definition entity.h:75
-
void UpdateComponents(float deltaTime)
Definition entity.h:121
-
std::shared_ptr< T > AddComponent(Args &&... args)
Definition entity.h:49
-
bool HasComponent() const
Definition entity.h:94
-
Entity(Entity &&)=default
-
void RemoveComponent()
Definition entity.h:106
-
EntityID GetID() const
Definition entity.h:39
-
Entity(EntityID id)
Definition entity.h:20
-
Definition component.h:9
-
std::type_index ComponentTypeID
Definition component.h:48
-
ComponentTypeID GetComponentTypeID()
Definition component.h:54
-
uint32_t EntityID
Definition entity.h:13
-
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:303faffaec1f196ad7452c0f6111aa468c3edaca46b89cfde9c53bc1c6697d96 +size 26146 diff --git a/doxygen_docs/html/entity__manager_8h_source.html b/doxygen_docs/html/entity__manager_8h_source.html index ef54b57..5029037 100644 --- a/doxygen_docs/html/entity__manager_8h_source.html +++ b/doxygen_docs/html/entity__manager_8h_source.html @@ -1,242 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/inc/system/ecs/entity_manager.h Source File - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
entity_manager.h
-
-
-
1#pragma once
-
2#include "entity.h"
-
3#include <vector>
-
4#include <unordered_map>
-
5#include <queue>
-
6
-
7namespace ecs {
-
8
-
- -
10public:
-
11
-
15 EntityManager() : m_NextEntityID(0) {}
-
16 ~EntityManager() = default;
-
17
-
-
22 std::shared_ptr<Entity> CreateEntity() {
-
23 EntityID id;
-
24
-
25 // Réutiliser les IDs des entités supprimées si possible
-
26 if (!m_FreeIDs.empty()) {
-
27 id = m_FreeIDs.front();
-
28 m_FreeIDs.pop();
-
29 } else {
-
30 id = m_NextEntityID++;
-
31 }
-
32
-
33 auto entity = std::make_shared<Entity>(id);
-
34 m_Entities[id] = entity;
-
35
-
36 return entity;
-
37 }
-
-
38
-
- -
44 auto it = m_Entities.find(id);
-
45 if (it != m_Entities.end()) {
-
46 m_Entities.erase(it);
-
47 m_FreeIDs.push(id); // Recycler l'ID
-
48 }
-
49 }
-
-
50
-
-
56 std::shared_ptr<Entity> GetEntity(EntityID id) {
-
57 auto it = m_Entities.find(id);
-
58 if (it != m_Entities.end()) {
-
59 return it->second;
-
60 }
-
61 return nullptr;
-
62 }
-
-
63
-
-
68 void UpdateEntities(float deltaTime) {
-
69 for (auto& [id, entity] : m_Entities) {
-
70 entity->UpdateComponents(deltaTime);
-
71 }
-
72 }
-
-
73
-
-
78 std::vector<std::shared_ptr<Entity>> GetAllEntities() {
-
79 std::vector<std::shared_ptr<Entity>> result;
-
80 result.reserve(m_Entities.size());
-
81
-
82 for (const auto& [id, entity] : m_Entities) {
-
83 result.push_back(entity);
-
84 }
-
85
-
86 return result;
-
87 }
-
-
88
-
94 template<typename T>
-
-
95 std::vector<std::shared_ptr<Entity>> GetEntitiesWithComponent() {
-
96 static_assert(std::is_base_of<Component, T>::value, "T must derive from Component");
-
97
-
98 std::vector<std::shared_ptr<Entity>> result;
-
99
-
100 for (auto& [id, entity] : m_Entities) {
-
101 if (entity->HasComponent<T>()) {
-
102 result.push_back(entity);
-
103 }
-
104 }
-
105
-
106 return result;
-
107 }
-
-
108
-
-
113 size_t GetEntityCount() const {
-
114 return m_Entities.size();
-
115 }
-
-
116
-
-
121 void Clear() {
-
122 m_Entities.clear();
-
123
-
124 // Vider la file des IDs libres
-
125 std::queue<EntityID> empty;
-
126 std::swap(m_FreeIDs, empty);
-
127
-
128 m_NextEntityID = 0;
-
129 }
-
-
130
-
131private:
-
132 EntityID m_NextEntityID;
-
133 std::unordered_map<EntityID, std::shared_ptr<Entity>> m_Entities;
-
134 std::queue<EntityID> m_FreeIDs; // IDs à réutiliser
-
135};
-
-
136
-
137} // namespace ecs
- -
std::vector< std::shared_ptr< Entity > > GetEntitiesWithComponent()
-
void DestroyEntity(EntityID id)
-
std::shared_ptr< Entity > CreateEntity()
- -
std::shared_ptr< Entity > GetEntity(EntityID id)
-
void UpdateEntities(float deltaTime)
-
EntityManager()
Type pour l'ID d'une entité.
-
std::vector< std::shared_ptr< Entity > > GetAllEntities()
-
size_t GetEntityCount() const
-
Definition component.h:9
-
uint32_t EntityID
Definition entity.h:13
-
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:f73ddb4e767de76671b06416ea1a8ae2b9abd889362435fc5d78cc9d6e4e9785 +size 25729 diff --git a/doxygen_docs/html/files.html b/doxygen_docs/html/files.html index 017bb4a..3eba280 100644 --- a/doxygen_docs/html/files.html +++ b/doxygen_docs/html/files.html @@ -1,236 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: File List - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
File List
-
-
-
Here is a list of all documented files with brief descriptions:
-
[detail level 1234567]
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  enginecustom
  src
  inc
  shader
  system
  src
  shader
  system
-
-
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:0d47e1ba6c0a4c3784b2e95e1a216057d740cd792229dd68254cf87334612c44 +size 39392 diff --git a/doxygen_docs/html/files_dup.js b/doxygen_docs/html/files_dup.js index cb42e2c..5dbc0f8 100644 --- a/doxygen_docs/html/files_dup.js +++ b/doxygen_docs/html/files_dup.js @@ -1,4 +1,3 @@ -var files_dup = -[ - [ "enginecustom", "dir_f4a881938f04d9c04de7741e8b9c813b.html", "dir_f4a881938f04d9c04de7741e8b9c813b" ] -]; \ No newline at end of file +version https://git-lfs.github.com/spec/v1 +oid sha256:8dfeee73ee9f9db43d2f4f3860f6c510e55b0f6cdcca2a01a4f22680daeef298 +size 128 diff --git a/doxygen_docs/html/folderclosed.svg b/doxygen_docs/html/folderclosed.svg index b04bed2..a49a0a5 100644 --- a/doxygen_docs/html/folderclosed.svg +++ b/doxygen_docs/html/folderclosed.svg @@ -1,11 +1,3 @@ - - - - - - - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:5e69d68baad1ee117dac14f49cad9afbfb73cce14d48d28560c89b0b7345f205 +size 1996 diff --git a/doxygen_docs/html/folderclosedd.svg b/doxygen_docs/html/folderclosedd.svg index 52f0166..80447d7 100644 --- a/doxygen_docs/html/folderclosedd.svg +++ b/doxygen_docs/html/folderclosedd.svg @@ -1,11 +1,3 @@ - - - - - - - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:3d53dd5faa7a4fcac2695013494b8ba5b2466d85c5b2e0959a2f8ce0f4d23ee3 +size 1996 diff --git a/doxygen_docs/html/folderopen.svg b/doxygen_docs/html/folderopen.svg index f6896dd..36a267d 100644 --- a/doxygen_docs/html/folderopen.svg +++ b/doxygen_docs/html/folderopen.svg @@ -1,17 +1,3 @@ - - - - - - - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:54a824d5208f5b504b2d283899fe31e45918df7df9b8af104f95a2f47bd5230d +size 3269 diff --git a/doxygen_docs/html/folderopend.svg b/doxygen_docs/html/folderopend.svg index 2d1f06e..ac2e9b4 100644 --- a/doxygen_docs/html/folderopend.svg +++ b/doxygen_docs/html/folderopend.svg @@ -1,12 +1,3 @@ - - - - - - - - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:21337c5db15aaf20a567216c02e21225b36b8f86d15217018c84a13218e1f9a5 +size 3214 diff --git a/doxygen_docs/html/font__class_8cpp_source.html b/doxygen_docs/html/font__class_8cpp_source.html index c41dcac..1094d80 100644 --- a/doxygen_docs/html/font__class_8cpp_source.html +++ b/doxygen_docs/html/font__class_8cpp_source.html @@ -1,384 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/src/system/font_class.cpp Source File - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
font_class.cpp
-
-
-
1#include "font_class.h"
-
2
-
3font_class::font_class()
-
4{
-
5 m_Font = 0;
-
6 m_Texture = 0;
-
7}
-
8
-
9
-
10font_class::font_class(const font_class& other)
-
11{
-
12}
-
13
-
14
-
15font_class::~font_class()
-
16{
-
17}
-
18
-
19bool font_class::Initialize(ID3D11Device* device, ID3D11DeviceContext* deviceContext, int fontChoice)
-
20{
-
21 Logger::Get().Log("Initializing font class", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
22
-
23 char fontFilename[128];
-
24 char fontTextureFilename[128];
-
25 bool result;
-
26
-
27 // Choose one of the available fonts, and default to the first font otherwise.
-
28 switch (fontChoice)
-
29 {
-
30 case 0:
-
31 {
-
32 strcpy_s(fontFilename, "font01.txt");
-
33 strcpy_s(fontTextureFilename, "font01.tga");
-
34 m_fontHeight = 32.0f;
-
35 m_spaceSize = 3;
-
36 break;
-
37 }
-
38 default:
-
39 {
-
40 strcpy_s(fontFilename, "font01.txt");
-
41 strcpy_s(fontTextureFilename, "font01.tga");
-
42 m_fontHeight = 32.0f;
-
43 m_spaceSize = 3;
-
44 break;
-
45 }
-
46 }
-
47
-
48 // Load in the text file containing the font data.
-
49 result = LoadFontData(fontFilename);
-
50 if (!result)
-
51 {
-
52 Logger::Get().Log("Failed to load font data", __FILE__, __LINE__, Logger::LogLevel::Error);
-
53 return false;
-
54 }
-
55
-
56 // Load the texture that has the font characters on it.
-
57 result = LoadTexture(device, deviceContext, fontTextureFilename);
-
58 if (!result)
-
59 {
-
60 Logger::Get().Log("Failed to load font texture", __FILE__, __LINE__, Logger::LogLevel::Error);
-
61 return false;
-
62 }
-
63
-
64 Logger::Get().Log("Font class initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
65
-
66 return true;
-
67}
-
68
-
69void font_class::Shutdown()
-
70{
-
71 // Release the font texture.
-
72 ReleaseTexture();
-
73
-
74 // Release the font data.
-
75 ReleaseFontData();
-
76
-
77 return;
-
78}
-
79
-
80bool font_class::LoadFontData(char* filename)
-
81{
-
82 Logger::Get().Log(("Loading font data from %s", filename), __FILE__, __LINE__);
-
83
-
84 std::ifstream fin;
-
85 int i;
-
86 char temp;
-
87
-
88 // Create the font spacing buffer.
-
89 m_Font = new FontType[95];
-
90
-
91 // Read in the font size and spacing between chars.
-
92 fin.open(filename);
-
93 if (fin.fail())
-
94 {
-
95 Logger::Get().Log("Failed to open font file", __FILE__, __LINE__, Logger::LogLevel::Error);
-
96 return false;
-
97 }
-
98
-
99 // Read in the 95 used ascii characters for text.
-
100 for (i = 0; i < 95; i++)
-
101 {
-
102 fin.get(temp);
-
103 while (temp != ' ')
-
104 {
-
105 fin.get(temp);
-
106 }
-
107 fin.get(temp);
-
108 while (temp != ' ')
-
109 {
-
110 fin.get(temp);
-
111 }
-
112
-
113 fin >> m_Font[i].left;
-
114 fin >> m_Font[i].right;
-
115 fin >> m_Font[i].size;
-
116 }
-
117
-
118 // Close the file.
-
119 fin.close();
-
120
-
121 Logger::Get().Log("Font data loaded", __FILE__, __LINE__);
-
122
-
123 return true;
-
124}
-
125
-
126void font_class::ReleaseFontData()
-
127{
-
128 // Release the font data array.
-
129 if (m_Font)
-
130 {
-
131 delete[] m_Font;
-
132 m_Font = 0;
-
133 }
-
134
-
135 return;
-
136}
-
137
-
138bool font_class::LoadTexture(ID3D11Device* device, ID3D11DeviceContext* deviceContext, char* filename)
-
139{
-
140 Logger::Get().Log(("Loading font texture from %s", filename), __FILE__, __LINE__);
-
141
-
142 bool result;
-
143
-
144
-
145 // Create and initialize the font texture object.
-
146 m_Texture = new texture_class;
-
147
-
148 result = m_Texture->Initialize(device, deviceContext, filename);
-
149 if (!result)
-
150 {
-
151 Logger::Get().Log("Failed to initialize font texture", __FILE__, __LINE__, Logger::LogLevel::Error);
-
152 return false;
-
153 }
-
154
-
155 Logger::Get().Log("Font texture loaded", __FILE__, __LINE__);
-
156
-
157 return true;
-
158}
-
159
-
160void font_class::ReleaseTexture()
-
161{
-
162 // Release the texture object.
-
163 if (m_Texture)
-
164 {
-
165 m_Texture->Shutdown();
-
166 delete m_Texture;
-
167 m_Texture = 0;
-
168 }
-
169
-
170 return;
-
171}
-
172
-
173ID3D11ShaderResourceView* font_class::GetTexture()
-
174{
-
175 return m_Texture->GetTexture();
-
176}
-
177
-
178void font_class::BuildVertexArray(void* vertices, char* sentence, float drawX, float drawY)
-
179{
-
180 VertexType* vertexPtr;
-
181 int numLetters, index, i, letter;
-
182
-
183
-
184 // Coerce the input vertices into a VertexType structure.
-
185 vertexPtr = (VertexType*)vertices;
-
186
-
187 // Get the number of letters in the sentence.
-
188 numLetters = (int)strlen(sentence);
-
189
-
190 // Initialize the index to the vertex array.
-
191 index = 0;
-
192
-
193 // Draw each letter onto a quad.
-
194 for (i = 0; i < numLetters; i++)
-
195 {
-
196 letter = ((int)sentence[i]) - 32;
-
197
-
198 // If the letter is a space then just move over three pixels.
-
199 if (letter == 0)
-
200 {
-
201 drawX = drawX + m_spaceSize;
-
202 }
-
203 else
-
204 {
-
205 // First triangle in quad.
-
206 vertexPtr[index].position = XMFLOAT3(drawX, drawY, 0.0f); // Top left.
-
207 vertexPtr[index].texture = XMFLOAT2(m_Font[letter].left, 0.0f);
-
208 index++;
-
209
-
210 vertexPtr[index].position = XMFLOAT3((drawX + m_Font[letter].size), (drawY - m_fontHeight), 0.0f); // Bottom right.
-
211 vertexPtr[index].texture = XMFLOAT2(m_Font[letter].right, 1.0f);
-
212 index++;
-
213
-
214 vertexPtr[index].position = XMFLOAT3(drawX, (drawY - m_fontHeight), 0.0f); // Bottom left.
-
215 vertexPtr[index].texture = XMFLOAT2(m_Font[letter].left, 1.0f);
-
216 index++;
-
217
-
218 // Second triangle in quad.
-
219 vertexPtr[index].position = XMFLOAT3(drawX, drawY, 0.0f); // Top left.
-
220 vertexPtr[index].texture = XMFLOAT2(m_Font[letter].left, 0.0f);
-
221 index++;
-
222
-
223 vertexPtr[index].position = XMFLOAT3(drawX + m_Font[letter].size, drawY, 0.0f); // Top right.
-
224 vertexPtr[index].texture = XMFLOAT2(m_Font[letter].right, 0.0f);
-
225 index++;
-
226
-
227 vertexPtr[index].position = XMFLOAT3((drawX + m_Font[letter].size), (drawY - m_fontHeight), 0.0f); // Bottom right.
-
228 vertexPtr[index].texture = XMFLOAT2(m_Font[letter].right, 1.0f);
-
229 index++;
-
230
-
231 // Update the x location for drawing by the size of the letter and one pixel.
-
232 drawX = drawX + m_Font[letter].size + 1.0f;
-
233 }
-
234 }
-
235
-
236 return;
-
237}
-
238
-
239int font_class::GetSentencePixelLength(char* sentence)
-
240{
-
241 int pixelLength, numLetters, i, letter;
-
242
-
243
-
244 pixelLength = 0;
-
245 numLetters = (int)strlen(sentence);
-
246
-
247 for (i = 0; i < numLetters; i++)
-
248 {
-
249 letter = ((int)sentence[i]) - 32;
-
250
-
251 // If the letter is a space then count it as three pixels.
-
252 if (letter == 0)
-
253 {
-
254 pixelLength += m_spaceSize;
-
255 }
-
256 else
-
257 {
-
258 pixelLength += (m_Font[letter].size + 1);
-
259 }
-
260 }
-
261
-
262 return pixelLength;
-
263}
-
264
-
265int font_class::GetFontHeight()
-
266{
-
267 return (int)m_fontHeight;
-
268}
-
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
- - -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:1f6a35a3da9b07f8c3ab6e2d37c3482ed11f24d8b97917ab3c39f0227eb6bd45 +size 42606 diff --git a/doxygen_docs/html/font__class_8h_source.html b/doxygen_docs/html/font__class_8h_source.html index 4019de3..2ad0f4c 100644 --- a/doxygen_docs/html/font__class_8h_source.html +++ b/doxygen_docs/html/font__class_8h_source.html @@ -1,174 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/inc/system/font_class.h Source File - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
font_class.h
-
-
-
1#ifndef _FONTCLASS_H_
-
2#define _FONTCLASS_H_
-
3
-
4
-
6// INCLUDES //
-
8#include <directxmath.h>
-
9#include <fstream>
-
10using namespace DirectX;
-
11
-
12
-
14// MY CLASS INCLUDES //
-
16#include "texture_class.h"
-
17
-
18
-
20// Class name: font_class
-
- -
23{
-
24private:
-
25 struct FontType
-
26 {
-
27 float left, right;
-
28 int size;
-
29 };
-
30
-
31 struct VertexType
-
32 {
-
33 XMFLOAT3 position;
-
34 XMFLOAT2 texture;
-
35 };
-
36
-
37public:
-
38 font_class();
-
39 font_class(const font_class&);
- -
41
-
42 bool Initialize(ID3D11Device*, ID3D11DeviceContext*, int);
-
43 void Shutdown();
-
44
-
45 ID3D11ShaderResourceView* GetTexture();
-
46
-
47 void BuildVertexArray(void*, char*, float, float);
-
48 int GetSentencePixelLength(char*);
-
49 int GetFontHeight();
-
50
-
51private:
-
52 bool LoadFontData(char*);
-
53 void ReleaseFontData();
-
54 bool LoadTexture(ID3D11Device*, ID3D11DeviceContext*, char*);
-
55 void ReleaseTexture();
-
56
-
57private:
-
58 FontType* m_Font;
-
59 texture_class* m_Texture;
-
60 float m_fontHeight;
-
61 int m_spaceSize;
-
62};
-
-
63
-
64#endif
- - -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:dd61a6497dc0d05957ed36acefd38f42800099c5ceb7997f664bea407b227586 +size 13139 diff --git a/doxygen_docs/html/font__shader__class_8cpp_source.html b/doxygen_docs/html/font__shader__class_8cpp_source.html index 856fe18..c67a389 100644 --- a/doxygen_docs/html/font__shader__class_8cpp_source.html +++ b/doxygen_docs/html/font__shader__class_8cpp_source.html @@ -1,549 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/src/shader/font_shader_class.cpp Source File - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
font_shader_class.cpp
-
-
-
1#include "font_shader_class.h"
-
2
-
3
-
4font_shader_class::font_shader_class()
-
5{
-
6 vertex_shader_ = 0;
-
7 pixel_shader_ = 0;
-
8 layout_ = 0;
-
9 matrix_buffer_ = 0;
-
10 sample_state_ = 0;
-
11 pixel_buffer_ = 0;
-
12}
-
13
-
14
-
15font_shader_class::font_shader_class(const font_shader_class& other)
-
16{
-
17}
-
18
-
19
-
20font_shader_class::~font_shader_class()
-
21{
-
22}
-
23
-
24
-
25bool font_shader_class::initialize(ID3D11Device* device, HWND hwnd)
-
26{
-
27 Logger::Get().Log("Initializing font_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/font.vs");
-
36 if (error != 0)
-
37 {
-
38 Logger::Get().Log("Error copying string", __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/font.ps");
-
44 if (error != 0)
-
45 {
-
46 Logger::Get().Log("Error copying string", __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("Error initializing shader", __FILE__, __LINE__, Logger::LogLevel::Error);
-
55 return false;
-
56 }
-
57
-
58 Logger::Get().Log("font_shader_class initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
59
-
60 return true;
-
61}
-
62
-
63void font_shader_class::shutdown()
-
64{
-
65 // shutdown the vertex and pixel shaders as well as the related objects.
-
66 shutdown_shader();
-
67
-
68 return;
-
69}
-
70
-
71bool font_shader_class::render(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix,
-
72 XMMATRIX projectionMatrix, ID3D11ShaderResourceView* texture, XMFLOAT4 pixelColor)
-
73{
-
74 bool result;
-
75
-
76
-
77 // Set the shader parameters that it will use for rendering.
-
78 result = set_shader_parameters(deviceContext, worldMatrix, viewMatrix, projectionMatrix, texture, pixelColor);
-
79 if (!result)
-
80 {
-
81 Logger::Get().Log("Error setting shader parameters", __FILE__, __LINE__, Logger::LogLevel::Error);
-
82 return false;
-
83 }
-
84
-
85 // Now render the prepared buffers with the shader.
-
86 render_shader(deviceContext, indexCount);
-
87
-
88 return true;
-
89}
-
90
-
91bool font_shader_class::initialize_shader(ID3D11Device* device, HWND hwnd, WCHAR* vsFilename, WCHAR* psFilename)
-
92{
-
93 Logger::Get().Log("Initializing shader", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
94
-
95 HRESULT result;
-
96 ID3D10Blob* errorMessage;
-
97 ID3D10Blob* vertexShaderBuffer;
-
98 ID3D10Blob* pixelShaderBuffer;
-
99 D3D11_INPUT_ELEMENT_DESC polygonLayout[2];
-
100 unsigned int numElements;
-
101 D3D11_BUFFER_DESC matrixBufferDesc;
-
102 D3D11_SAMPLER_DESC samplerDesc;
-
103 D3D11_BUFFER_DESC pixelBufferDesc;
-
104
-
105
-
106 // initialize the pointers this function will use to null.
-
107 errorMessage = 0;
-
108 vertexShaderBuffer = 0;
-
109 pixelShaderBuffer = 0;
-
110
-
111 // Compile the vertex shader code.
-
112 result = D3DCompileFromFile(vsFilename, NULL, NULL, "FontVertexShader", "vs_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0,
-
113 &vertexShaderBuffer, &errorMessage);
-
114 if (FAILED(result))
-
115 {
-
116 // If the shader failed to compile it should have writen something to the error message.
-
117 if (errorMessage)
-
118 {
-
119 output_shader_error_message(errorMessage, hwnd, vsFilename);
-
120 }
-
121 // If there was nothing in the error message then it simply could not find the shader file itself.
-
122 else
-
123 {
-
124 Logger::Get().Log("Error compiling shader", __FILE__, __LINE__, Logger::LogLevel::Error);
-
125 }
-
126
-
127 return false;
-
128 }
-
129
-
130 // Compile the pixel shader code.
-
131 result = D3DCompileFromFile(psFilename, NULL, NULL, "FontPixelShader", "ps_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0,
-
132 &pixelShaderBuffer, &errorMessage);
-
133 if (FAILED(result))
-
134 {
-
135 // If the shader failed to compile it should have writen something to the error message.
-
136 if (errorMessage)
-
137 {
-
138 output_shader_error_message(errorMessage, hwnd, psFilename);
-
139 }
-
140 // If there was nothing in the error message then it simply could not find the file itself.
-
141 else
-
142 {
-
143 Logger::Get().Log("Error compiling shader", __FILE__, __LINE__, Logger::LogLevel::Error);
-
144 }
-
145
-
146 return false;
-
147 }
-
148
-
149 // Create the vertex shader from the buffer.
-
150 result = device->CreateVertexShader(vertexShaderBuffer->GetBufferPointer(), vertexShaderBuffer->GetBufferSize(), NULL, &vertex_shader_);
-
151 if (FAILED(result))
-
152 {
-
153 Logger::Get().Log("Error creating vertex shader", __FILE__, __LINE__, Logger::LogLevel::Error);
-
154 return false;
-
155 }
-
156
-
157 // Create the pixel shader from the buffer.
-
158 result = device->CreatePixelShader(pixelShaderBuffer->GetBufferPointer(), pixelShaderBuffer->GetBufferSize(), NULL, &pixel_shader_);
-
159 if (FAILED(result))
-
160 {
-
161 Logger::Get().Log("Error creating pixel shader", __FILE__, __LINE__, Logger::LogLevel::Error);
-
162 return false;
-
163 }
-
164
-
165 // Create the vertex input layout description.
-
166 polygonLayout[0].SemanticName = "POSITION";
-
167 polygonLayout[0].SemanticIndex = 0;
-
168 polygonLayout[0].Format = DXGI_FORMAT_R32G32B32_FLOAT;
-
169 polygonLayout[0].InputSlot = 0;
-
170 polygonLayout[0].AlignedByteOffset = 0;
-
171 polygonLayout[0].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
-
172 polygonLayout[0].InstanceDataStepRate = 0;
-
173
-
174 polygonLayout[1].SemanticName = "TEXCOORD";
-
175 polygonLayout[1].SemanticIndex = 0;
-
176 polygonLayout[1].Format = DXGI_FORMAT_R32G32_FLOAT;
-
177 polygonLayout[1].InputSlot = 0;
-
178 polygonLayout[1].AlignedByteOffset = D3D11_APPEND_ALIGNED_ELEMENT;
-
179 polygonLayout[1].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
-
180 polygonLayout[1].InstanceDataStepRate = 0;
-
181
-
182
-
183 // Get a count of the elements in the layout.
-
184 numElements = sizeof(polygonLayout) / sizeof(polygonLayout[0]);
-
185
-
186 // Create the vertex input layout.
-
187 result = device->CreateInputLayout(polygonLayout, numElements, vertexShaderBuffer->GetBufferPointer(),
-
188 vertexShaderBuffer->GetBufferSize(), &layout_);
-
189 if (FAILED(result))
-
190 {
-
191 Logger::Get().Log("Error creating input layout", __FILE__, __LINE__, Logger::LogLevel::Error);
-
192 return false;
-
193 }
-
194
-
195 // Release the vertex shader buffer and pixel shader buffer since they are no longer needed.
-
196 vertexShaderBuffer->Release();
-
197 vertexShaderBuffer = 0;
-
198
-
199 pixelShaderBuffer->Release();
-
200 pixelShaderBuffer = 0;
-
201
-
202 // Setup the description of the dynamic matrix constant buffer that is in the vertex shader.
-
203 matrixBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
-
204 matrixBufferDesc.ByteWidth = sizeof(matrix_buffer_type);
-
205 matrixBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
-
206 matrixBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
-
207 matrixBufferDesc.MiscFlags = 0;
-
208 matrixBufferDesc.StructureByteStride = 0;
-
209
-
210 // Create the constant buffer pointer so we can access the vertex shader constant buffer from within this class.
-
211 result = device->CreateBuffer(&matrixBufferDesc, NULL, &matrix_buffer_);
-
212 if (FAILED(result))
-
213 {
-
214 Logger::Get().Log("Error creating constant buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
-
215 return false;
-
216 }
-
217
-
218 // Create a texture sampler state description.
-
219 samplerDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR;
-
220 samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP;
-
221 samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP;
-
222 samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_WRAP;
-
223 samplerDesc.MipLODBias = 0.0f;
-
224 samplerDesc.MaxAnisotropy = 1;
-
225 samplerDesc.ComparisonFunc = D3D11_COMPARISON_ALWAYS;
-
226 samplerDesc.BorderColor[0] = 0;
-
227 samplerDesc.BorderColor[1] = 0;
-
228 samplerDesc.BorderColor[2] = 0;
-
229 samplerDesc.BorderColor[3] = 0;
-
230 samplerDesc.MinLOD = 0;
-
231 samplerDesc.MaxLOD = D3D11_FLOAT32_MAX;
-
232
-
233 // Create the texture sampler state.
-
234 result = device->CreateSamplerState(&samplerDesc, &sample_state_);
-
235 if (FAILED(result))
-
236 {
-
237 Logger::Get().Log("Error creating sampler state", __FILE__, __LINE__, Logger::LogLevel::Error);
-
238 return false;
-
239 }
-
240
-
241 // Setup the description of the dynamic pixel constant buffer that is in the pixel shader.
-
242 pixelBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
-
243 pixelBufferDesc.ByteWidth = sizeof(pixel_buffer_type);
-
244 pixelBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
-
245 pixelBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
-
246 pixelBufferDesc.MiscFlags = 0;
-
247 pixelBufferDesc.StructureByteStride = 0;
-
248
-
249 // Create the pixel constant buffer pointer so we can access the pixel shader constant buffer from within this class.
-
250 result = device->CreateBuffer(&pixelBufferDesc, NULL, &pixel_buffer_);
-
251 if (FAILED(result))
-
252 {
-
253 Logger::Get().Log("Error creating constant buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
-
254 return false;
-
255 }
-
256
-
257 Logger::Get().Log("Shader initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
258
-
259 return true;
-
260}
-
261
-
262void font_shader_class::shutdown_shader()
-
263{
-
264 Logger::Get().Log("Shutting down shader", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
265
-
266 // Release the pixel constant buffer.
-
267 if (pixel_buffer_)
-
268 {
-
269 pixel_buffer_->Release();
-
270 pixel_buffer_ = 0;
-
271 }
-
272
-
273 // Release the sampler state.
-
274 if (sample_state_)
-
275 {
-
276 sample_state_->Release();
-
277 sample_state_ = 0;
-
278 }
-
279
-
280 // Release the matrix constant buffer.
-
281 if (matrix_buffer_)
-
282 {
-
283 matrix_buffer_->Release();
-
284 matrix_buffer_ = 0;
-
285 }
-
286
-
287 // Release the layout.
-
288 if (layout_)
-
289 {
-
290 layout_->Release();
-
291 layout_ = 0;
-
292 }
-
293
-
294 // Release the pixel shader.
-
295 if (pixel_shader_)
-
296 {
-
297 pixel_shader_->Release();
-
298 pixel_shader_ = 0;
-
299 }
-
300
-
301 // Release the vertex shader.
-
302 if (vertex_shader_)
-
303 {
-
304 vertex_shader_->Release();
-
305 vertex_shader_ = 0;
-
306 }
-
307
-
308 Logger::Get().Log("Shader shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
309
-
310 return;
-
311}
-
312
-
313void font_shader_class::output_shader_error_message(ID3D10Blob* errorMessage, HWND hwnd, WCHAR* shaderFilename)
-
314{
-
315 char* compileErrors;
-
316 unsigned long long bufferSize, i;
-
317 ofstream fout;
-
318
-
319
-
320 // Get a pointer to the error message text buffer.
-
321 compileErrors = (char*)(errorMessage->GetBufferPointer());
-
322
-
323 // Get the length of the message.
-
324 bufferSize = errorMessage->GetBufferSize();
-
325
-
326 // Open a file to write the error message to.
-
327 fout.open("shader-error.txt");
-
328
-
329 // Write out the error message.
-
330 for (i = 0; i < bufferSize; i++)
-
331 {
-
332 fout << compileErrors[i];
-
333 }
-
334
-
335 // Close the file.
-
336 fout.close();
-
337
-
338 // Release the error message.
-
339 errorMessage->Release();
-
340 errorMessage = 0;
-
341
-
342 // Pop a message up on the screen to notify the user to check the text file for compile errors.
-
343 MessageBox(hwnd, L"Error compiling shader. Check shader-error.txt for message.", shaderFilename, MB_OK);
-
344
-
345 return;
-
346}
-
347
-
348bool font_shader_class::set_shader_parameters(ID3D11DeviceContext* deviceContext, XMMATRIX worldMatrix, XMMATRIX viewMatrix,
-
349 XMMATRIX projectionMatrix, ID3D11ShaderResourceView* texture, XMFLOAT4 pixelColor)
-
350{
-
351
-
352 HRESULT result;
-
353 D3D11_MAPPED_SUBRESOURCE mappedResource;
-
354 matrix_buffer_type* dataPtr;
-
355 unsigned int bufferNumber;
-
356 pixel_buffer_type* dataPtr2;
-
357
-
358
-
359 // Transpose the matrices to prepare them for the shader.
-
360 worldMatrix = XMMatrixTranspose(worldMatrix);
-
361 viewMatrix = XMMatrixTranspose(viewMatrix);
-
362 projectionMatrix = XMMatrixTranspose(projectionMatrix);
-
363
-
364 // Lock the constant buffer so it can be written to.
-
365 result = deviceContext->Map(matrix_buffer_, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
-
366 if (FAILED(result))
-
367 {
-
368 Logger::Get().Log("Error mapping constant buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
-
369 return false;
-
370 }
-
371
-
372 // Get a pointer to the data in the constant buffer.
-
373 dataPtr = (matrix_buffer_type*)mappedResource.pData;
-
374
-
375 // Copy the matrices into the constant buffer.
-
376 dataPtr->world = worldMatrix;
-
377 dataPtr->view = viewMatrix;
-
378 dataPtr->projection = projectionMatrix;
-
379
-
380 // Unlock the constant buffer.
-
381 deviceContext->Unmap(matrix_buffer_, 0);
-
382
-
383 // Set the position of the constant buffer in the vertex shader.
-
384 bufferNumber = 0;
-
385
-
386 // Finally set the constant buffer in the vertex shader with the updated values.
-
387 deviceContext->VSSetConstantBuffers(bufferNumber, 1, &matrix_buffer_);
-
388
-
389 // Set shader texture resource in the pixel shader.
-
390 deviceContext->PSSetShaderResources(0, 1, &texture);
-
391
-
392 // Lock the pixel constant buffer so it can be written to.
-
393 result = deviceContext->Map(pixel_buffer_, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
-
394 if (FAILED(result))
-
395 {
-
396 Logger::Get().Log("Error mapping constant buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
-
397 return false;
-
398 }
-
399
-
400 // Get a pointer to the data in the pixel constant buffer.
-
401 dataPtr2 = (pixel_buffer_type*)mappedResource.pData;
-
402
-
403 // Copy the pixel color into the pixel constant buffer.
-
404 dataPtr2->pixelColor = pixelColor;
-
405
-
406 // Unlock the pixel constant buffer.
-
407 deviceContext->Unmap(pixel_buffer_, 0);
-
408
-
409 // Set the position of the pixel constant buffer in the pixel shader.
-
410 bufferNumber = 0;
-
411
-
412 // Now set the pixel constant buffer in the pixel shader with the updated value.
-
413 deviceContext->PSSetConstantBuffers(bufferNumber, 1, &pixel_buffer_);
-
414
-
415 return true;
-
416}
-
417
-
418void font_shader_class::render_shader(ID3D11DeviceContext* deviceContext, int indexCount)
-
419{
-
420 // Set the vertex input layout.
-
421 deviceContext->IASetInputLayout(layout_);
-
422
-
423 // Set the vertex and pixel shaders that will be used to render this triangle.
-
424 deviceContext->VSSetShader(vertex_shader_, NULL, 0);
-
425 deviceContext->PSSetShader(pixel_shader_, NULL, 0);
-
426
-
427 // Set the sampler state in the pixel shader.
-
428 deviceContext->PSSetSamplers(0, 1, &sample_state_);
-
429
-
430 // render the triangle.
-
431 deviceContext->DrawIndexed(indexCount, 0, 0);
-
432
-
433 return;
-
434}
-
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
- -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:dd679eb654f62342d0a60f6e39934450e079a68e4ca6d486239490fa1fb23aab +size 69152 diff --git a/doxygen_docs/html/font__shader__class_8h_source.html b/doxygen_docs/html/font__shader__class_8h_source.html index 36fbfc3..5770196 100644 --- a/doxygen_docs/html/font__shader__class_8h_source.html +++ b/doxygen_docs/html/font__shader__class_8h_source.html @@ -1,173 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/inc/shader/font_shader_class.h Source File - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
font_shader_class.h
-
-
-
1#ifndef _FONTSHADERCLASS_H_
-
2#define _FONTSHADERCLASS_H_
-
3
-
4
-
6// INCLUDES //
-
8#include "Logger.h"
-
9#include <d3d11.h>
-
10#include <d3dcompiler.h>
-
11#include <directxmath.h>
-
12#include <fstream>
-
13using namespace DirectX;
-
14using namespace std;
-
15
-
16
-
18// Class name: font_shader_class
-
- -
21{
-
22private:
-
23 struct matrix_buffer_type
-
24 {
-
25 XMMATRIX world;
-
26 XMMATRIX view;
-
27 XMMATRIX projection;
-
28 };
-
29
-
30 struct pixel_buffer_type
-
31 {
-
32 XMFLOAT4 pixelColor;
-
33 };
-
34
-
35public:
- - - -
39
-
40 bool initialize(ID3D11Device*, HWND);
-
41 void shutdown();
-
42 bool render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT4);
-
43
-
44private:
-
45 bool initialize_shader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
-
46 void shutdown_shader();
-
47 void output_shader_error_message(ID3D10Blob*, HWND, WCHAR*);
-
48
-
49 bool set_shader_parameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT4);
-
50 void render_shader(ID3D11DeviceContext*, int);
-
51
-
52private:
-
53 ID3D11VertexShader* vertex_shader_;
-
54 ID3D11PixelShader* pixel_shader_;
-
55 ID3D11InputLayout* layout_;
-
56 ID3D11Buffer* matrix_buffer_;
-
57 ID3D11SamplerState* sample_state_;
-
58 ID3D11Buffer* pixel_buffer_;
-
59
-
60};
-
-
61
-
62#endif
- -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:b81a5024d04b49890acb0ac385e812d3a3a71f2889540075338b5d3557648378 +size 12990 diff --git a/doxygen_docs/html/fps__class_8cpp_source.html b/doxygen_docs/html/fps__class_8cpp_source.html index 573ec27..04ee06d 100644 --- a/doxygen_docs/html/fps__class_8cpp_source.html +++ b/doxygen_docs/html/fps__class_8cpp_source.html @@ -1,195 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/src/system/fps_class.cpp Source File - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
fps_class.cpp
-
-
-
1#include "fps_class.h"
-
2
-
3
-
4fps_class::fps_class()
-
5{
-
6}
-
7
-
8
-
9fps_class::fps_class(const fps_class& other)
-
10{
-
11}
-
12
-
13
-
14fps_class::~fps_class()
-
15{
-
16}
-
17
-
18void fps_class::Initialize()
-
19{
-
20 m_fps = 0;
-
21 m_count = 0;
-
22 m_minFps = INT_MAX;
-
23 m_maxFps = 0;
-
24 m_frameTime = 0.0f;
-
25 m_previousTime = timeGetTime();
-
26 m_startTime = m_previousTime;
-
27
-
28 return;
-
29}
-
30
-
31void fps_class::Frame()
-
32{
-
33
-
34 unsigned int currentTime = timeGetTime();
-
35
-
36 m_frameTime = (currentTime - m_previousTime) * 0.001f;
-
37 m_previousTime = currentTime;
-
38
-
39 m_count++;
-
40
-
41 if (timeGetTime() >= (m_startTime + 1000))
-
42 {
-
43 m_fps = m_count;
-
44
-
45 if (m_fps < m_minFps)
-
46 m_minFps = m_fps;
-
47
-
48 if (m_fps > m_maxFps)
-
49 m_maxFps = m_fps;
-
50
-
51 m_count = 0;
-
52 m_startTime = timeGetTime();
-
53 }
-
54
-
55 return;
-
56}
-
57
-
58int fps_class::GetMinFps() const
-
59{
-
60 return m_minFps;
-
61}
-
62
-
63int fps_class::GetMaxFps() const
-
64{
-
65 return m_maxFps;
-
66}
-
67
-
68float fps_class::GetFrameTime() const
-
69{
-
70 return m_frameTime;
-
71}
-
72
-
73void fps_class::ResetStats()
-
74{
-
75 m_minFps = INT_MAX;
-
76 m_maxFps = 0;
-
77}
-
78
-
79int fps_class::GetFps()
-
80{
-
81 return m_fps;
-
82}
- -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:8b3af61476c8cc0b8d947f2ddc9d8034ca5a214f927b9db7f9953a3aa3cba314 +size 14364 diff --git a/doxygen_docs/html/fps__class_8h_source.html b/doxygen_docs/html/fps__class_8h_source.html index 6901275..ea59b1f 100644 --- a/doxygen_docs/html/fps__class_8h_source.html +++ b/doxygen_docs/html/fps__class_8h_source.html @@ -1,155 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/inc/system/fps_class.h Source File - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
fps_class.h
-
-
-
1#ifndef _FPSCLASS_H_
-
2#define _FPSCLASS_H_
-
3
-
4
-
6// LINKING //
-
8#pragma comment(lib, "winmm.lib")
-
9
-
10
-
12// INCLUDES //
-
14#include <windows.h>
-
15#include <mmsystem.h>
-
16
-
18// Class name: fps_class
-
- -
21{
-
22public:
-
23 fps_class();
-
24 fps_class(const fps_class&);
-
25 ~fps_class();
-
26
-
27 void Initialize();
-
28 void Frame();
-
29 int GetFps();
-
30
-
31 int GetMinFps() const;
-
32 int GetMaxFps() const;
-
33 float GetFrameTime() const;
-
34 void ResetStats();
-
35
-
36private:
-
37 int m_fps, m_count;
-
38 unsigned long m_startTime;
-
39
-
40 int m_minFps;
-
41 int m_maxFps;
-
42 float m_frameTime;
-
43 unsigned long m_previousTime;
-
44};
-
-
45
-
46#endif
- -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:9d57f52d333c4f0a1358985218b345ec26499bb419f6f37fe0b1d5650201de64 +size 10535 diff --git a/doxygen_docs/html/fps__limiter_8h_source.html b/doxygen_docs/html/fps__limiter_8h_source.html index 556dd09..f3f4d5c 100644 --- a/doxygen_docs/html/fps__limiter_8h_source.html +++ b/doxygen_docs/html/fps__limiter_8h_source.html @@ -1,143 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/inc/system/fps_limiter.h Source File - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
fps_limiter.h
-
-
-
1#pragma once
-
2#include <chrono>
-
3
-
- -
5public:
-
6
-
-
12 explicit fps_limiter(const float target_fps = 60.0f)
-
13 : min_delta_(1.0f / target_fps), last_time_(std::chrono::high_resolution_clock::now()) {}
-
-
14
-
-
19 bool should_run() {
-
20 const auto now = std::chrono::high_resolution_clock::now();
-
21 if (const float elapsed = std::chrono::duration<float>(now - last_time_).count(); elapsed >= min_delta_) {
-
22 last_time_ = now;
-
23 return true;
-
24 }
-
25 return false;
-
26 }
-
-
27
-
28private:
-
29 float min_delta_;
-
30 std::chrono::high_resolution_clock::time_point last_time_;
-
31};
-
- -
bool should_run()
Definition fps_limiter.h:19
-
fps_limiter(const float target_fps=60.0f)
Definition fps_limiter.h:12
-
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:ea653e4f1644b42551c770326a732f4abe34cb5f72d72a82f28ca58201761773 +size 9493 diff --git a/doxygen_docs/html/frustum_8cpp_source.html b/doxygen_docs/html/frustum_8cpp_source.html index 8c395e2..63a6ee2 100644 --- a/doxygen_docs/html/frustum_8cpp_source.html +++ b/doxygen_docs/html/frustum_8cpp_source.html @@ -1,206 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/src/system/frustum.cpp Source File - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
frustum.cpp
-
-
-
1#include "frustum.h"
-
2
-
-
3void frustum::ConstructFrustum(float screenDepth, XMMATRIX projectionMatrix, XMMATRIX viewMatrix)
-
4{
-
5 XMMATRIX matrix;
-
6 XMVECTOR planes[6];
-
7
-
8 // Calculate the minimum Z distance in the frustum.
-
9 float zMinimum = -projectionMatrix.r[3].m128_f32[2] / projectionMatrix.r[2].m128_f32[2];
-
10 float r = screenDepth / (screenDepth - zMinimum);
-
11 projectionMatrix.r[2].m128_f32[2] = r;
-
12 projectionMatrix.r[3].m128_f32[2] = -r * zMinimum;
-
13
-
14 // Create the frustum matrix from the view matrix and updated projection matrix.
-
15 matrix = XMMatrixMultiply(viewMatrix, projectionMatrix);
-
16
-
17 // Calculate near plane of frustum.
-
18 planes[0] = XMPlaneNormalize(XMVectorSet(matrix.r[0].m128_f32[3] + matrix.r[0].m128_f32[2],
-
19 matrix.r[1].m128_f32[3] + matrix.r[1].m128_f32[2],
-
20 matrix.r[2].m128_f32[3] + matrix.r[2].m128_f32[2],
-
21 matrix.r[3].m128_f32[3] + matrix.r[3].m128_f32[2]));
-
22
-
23 // Calculate far plane of frustum.
-
24 planes[1] = XMPlaneNormalize(XMVectorSet(matrix.r[0].m128_f32[3] - matrix.r[0].m128_f32[2],
-
25 matrix.r[1].m128_f32[3] - matrix.r[1].m128_f32[2],
-
26 matrix.r[2].m128_f32[3] - matrix.r[2].m128_f32[2],
-
27 matrix.r[3].m128_f32[3] - matrix.r[3].m128_f32[2]));
-
28
-
29 // Calculate left plane of frustum.
-
30 planes[2] = XMPlaneNormalize(XMVectorSet(matrix.r[0].m128_f32[3] + matrix.r[0].m128_f32[0],
-
31 matrix.r[1].m128_f32[3] + matrix.r[1].m128_f32[0],
-
32 matrix.r[2].m128_f32[3] + matrix.r[2].m128_f32[0],
-
33 matrix.r[3].m128_f32[3] + matrix.r[3].m128_f32[0]));
-
34
-
35 // Calculate right plane of frustum.
-
36 planes[3] = XMPlaneNormalize(XMVectorSet(matrix.r[0].m128_f32[3] - matrix.r[0].m128_f32[0],
-
37 matrix.r[1].m128_f32[3] - matrix.r[1].m128_f32[0],
-
38 matrix.r[2].m128_f32[3] - matrix.r[2].m128_f32[0],
-
39 matrix.r[3].m128_f32[3] - matrix.r[3].m128_f32[0]));
-
40
-
41 // Calculate top plane of frustum.
-
42 planes[4] = XMPlaneNormalize(XMVectorSet(matrix.r[0].m128_f32[3] - matrix.r[0].m128_f32[1],
-
43 matrix.r[1].m128_f32[3] - matrix.r[1].m128_f32[1],
-
44 matrix.r[2].m128_f32[3] - matrix.r[2].m128_f32[1],
-
45 matrix.r[3].m128_f32[3] - matrix.r[3].m128_f32[1]));
-
46
-
47 // Calculate bottom plane of frustum.
-
48 planes[5] = XMPlaneNormalize(XMVectorSet(matrix.r[0].m128_f32[3] + matrix.r[0].m128_f32[1],
-
49 matrix.r[1].m128_f32[3] + matrix.r[1].m128_f32[1],
-
50 matrix.r[2].m128_f32[3] + matrix.r[2].m128_f32[1],
-
51 matrix.r[3].m128_f32[3] + matrix.r[3].m128_f32[1]));
-
52
-
53 for (int i = 0; i < 6; i++)
-
54 {
-
55 m_planes[i] = planes[i];
-
56 }
-
57}
-
-
58
-
-
59bool frustum::CheckCube(float xCenter, float yCenter, float zCenter, float radius, float tolerance)
-
60{
-
61 // Vérifiez chaque plan du frustum pour voir si le cube est à l'intérieur
-
62 for (int i = 0; i < 6; i++)
-
63 {
-
64 XMVECTOR plane = m_planes[i];
-
65 if (XMVectorGetX(plane) * (xCenter - radius) + XMVectorGetY(plane) * (yCenter - radius) + XMVectorGetZ(plane) * (zCenter - radius) + XMVectorGetW(plane) > -tolerance)
-
66 continue;
-
67 if (XMVectorGetX(plane) * (xCenter + radius) + XMVectorGetY(plane) * (yCenter - radius) + XMVectorGetZ(plane) * (zCenter - radius) + XMVectorGetW(plane) > -tolerance)
-
68 continue;
-
69 if (XMVectorGetX(plane) * (xCenter - radius) + XMVectorGetY(plane) * (yCenter + radius) + XMVectorGetZ(plane) * (zCenter - radius) + XMVectorGetW(plane) > -tolerance)
-
70 continue;
-
71 if (XMVectorGetX(plane) * (xCenter + radius) + XMVectorGetY(plane) * (yCenter + radius) + XMVectorGetZ(plane) * (zCenter - radius) + XMVectorGetW(plane) > -tolerance)
-
72 continue;
-
73 if (XMVectorGetX(plane) * (xCenter - radius) + XMVectorGetY(plane) * (yCenter - radius) + XMVectorGetZ(plane) * (zCenter + radius) + XMVectorGetW(plane) > -tolerance)
-
74 continue;
-
75 if (XMVectorGetX(plane) * (xCenter + radius) + XMVectorGetY(plane) * (yCenter - radius) + XMVectorGetZ(plane) * (zCenter + radius) + XMVectorGetW(plane) > -tolerance)
-
76 continue;
-
77 if (XMVectorGetX(plane) * (xCenter - radius) + XMVectorGetY(plane) * (yCenter + radius) + XMVectorGetZ(plane) * (zCenter + radius) + XMVectorGetW(plane) > -tolerance)
-
78 continue;
-
79 if (XMVectorGetX(plane) * (xCenter + radius) + XMVectorGetY(plane) * (yCenter + radius) + XMVectorGetZ(plane) * (zCenter + radius) + XMVectorGetW(plane) > -tolerance)
-
80 continue;
-
81
-
82 // Si le cube est en dehors de l'un des plans, il n'est pas dans le frustum
-
83 return false;
-
84 }
-
85
-
86 // Si le cube est à l'intérieur de tous les plans, il est dans le frustum
-
87 return true;
-
88}
-
-
void ConstructFrustum(float screenDepth, XMMATRIX projectionMatrix, XMMATRIX viewMatrix)
Definition frustum.cpp:3
-
bool CheckCube(float xCenter, float yCenter, float zCenter, float radius, float tolerance)
Definition frustum.cpp:59
-
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:2b39bea6e6c51f2a06d0818fd89dc98e71d7d602b2a75b0c48b60cf14b973302 +size 20051 diff --git a/doxygen_docs/html/frustum_8h_source.html b/doxygen_docs/html/frustum_8h_source.html index f2a6a36..420c973 100644 --- a/doxygen_docs/html/frustum_8h_source.html +++ b/doxygen_docs/html/frustum_8h_source.html @@ -1,129 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/inc/system/frustum.h Source File - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
frustum.h
-
-
-
1#include <DirectXMath.h>
-
2using namespace DirectX;
-
3
-
-
4class frustum
-
5{
-
6public:
-
13 void ConstructFrustum(float screenDepth, XMMATRIX projectionMatrix, XMMATRIX viewMatrix);
-
21 bool CheckCube(float xCenter, float yCenter, float zCenter, float radius, float tolerance);
-
22
-
23private:
-
24 XMVECTOR m_planes[6];
-
25};
-
- -
void ConstructFrustum(float screenDepth, XMMATRIX projectionMatrix, XMMATRIX viewMatrix)
Definition frustum.cpp:3
-
bool CheckCube(float xCenter, float yCenter, float zCenter, float radius, float tolerance)
Definition frustum.cpp:59
-
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:30379811197677ea5ab15df9ebcf8aa3991271388fdc1e5ded3816740e16e763 +size 7858 diff --git a/doxygen_docs/html/frustumclass_8cpp_source.html b/doxygen_docs/html/frustumclass_8cpp_source.html index 36b5a00..169ae01 100644 --- a/doxygen_docs/html/frustumclass_8cpp_source.html +++ b/doxygen_docs/html/frustumclass_8cpp_source.html @@ -1,409 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/src/system/frustumclass.cpp Source File - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
frustumclass.cpp
-
-
-
1#include "frustumclass.h"
-
2
-
3
-
4FrustumClass::FrustumClass()
-
5{
-
6}
-
7
-
8
-
9FrustumClass::FrustumClass(const FrustumClass& other)
-
10{
-
11}
-
12
-
13
-
14FrustumClass::~FrustumClass()
-
15{
-
16}
-
17
-
18void FrustumClass::ConstructFrustum(XMMATRIX viewMatrix, XMMATRIX projectionMatrix, float screenDepth)
-
19{
-
20 XMMATRIX finalMatrix;
-
21 XMFLOAT4X4 projMatrix, matrix;
-
22 float zMinimum, r, t;
-
23
-
24 // Load the projection matrix into a XMFLOAT4X4 structure.
-
25 XMStoreFloat4x4(&projMatrix, projectionMatrix);
-
26
-
27 // Calculate the minimum Z distance in the frustum.
-
28 zMinimum = -projMatrix._43 / projMatrix._33;
-
29 r = screenDepth / (screenDepth - zMinimum);
-
30 projMatrix._33 = r;
-
31 projMatrix._43 = -r * zMinimum;
-
32
-
33 // Load the updated XMFLOAT4X4 back into the original projection matrix.
-
34 projectionMatrix = XMLoadFloat4x4(&projMatrix);
-
35
-
36 // Create the frustum matrix from the view matrix and updated projection matrix.
-
37 finalMatrix = XMMatrixMultiply(viewMatrix, projectionMatrix);
-
38
-
39 // Load the final matrix into a XMFLOAT4X4 structure.
-
40 XMStoreFloat4x4(&matrix, finalMatrix);
-
41
-
42 // Get the near plane of the frustum.
-
43 m_planes[0].x = matrix._13;
-
44 m_planes[0].y = matrix._23;
-
45 m_planes[0].z = matrix._33;
-
46 m_planes[0].w = matrix._43;
-
47
-
48 // Normalize it.
-
49 t = (float)sqrt((m_planes[0].x * m_planes[0].x) + (m_planes[0].y * m_planes[0].y) + (m_planes[0].z * m_planes[0].z));
-
50 m_planes[0].x /= t;
-
51 m_planes[0].y /= t;
-
52 m_planes[0].z /= t;
-
53 m_planes[0].w /= t;
-
54
-
55 // Calculate the far plane of frustum.
-
56 m_planes[1].x = matrix._14 - matrix._13;
-
57 m_planes[1].y = matrix._24 - matrix._23;
-
58 m_planes[1].z = matrix._34 - matrix._33;
-
59 m_planes[1].w = matrix._44 - matrix._43;
-
60
-
61 // Normalize it.
-
62 t = (float)sqrt((m_planes[1].x * m_planes[1].x) + (m_planes[1].y * m_planes[1].y) + (m_planes[1].z * m_planes[1].z));
-
63 m_planes[1].x /= t;
-
64 m_planes[1].y /= t;
-
65 m_planes[1].z /= t;
-
66 m_planes[1].w /= t;
-
67
-
68 // Calculate the left plane of frustum.
-
69 m_planes[2].x = matrix._14 + matrix._11;
-
70 m_planes[2].y = matrix._24 + matrix._21;
-
71 m_planes[2].z = matrix._34 + matrix._31;
-
72 m_planes[2].w = matrix._44 + matrix._41;
-
73
-
74 // Normalize it.
-
75 t = (float)sqrt((m_planes[2].x * m_planes[2].x) + (m_planes[2].y * m_planes[2].y) + (m_planes[2].z * m_planes[2].z));
-
76 m_planes[2].x /= t;
-
77 m_planes[2].y /= t;
-
78 m_planes[2].z /= t;
-
79 m_planes[2].w /= t;
-
80
-
81 // Calculate the right plane of frustum.
-
82 m_planes[3].x = matrix._14 - matrix._11;
-
83 m_planes[3].y = matrix._24 - matrix._21;
-
84 m_planes[3].z = matrix._34 - matrix._31;
-
85 m_planes[3].w = matrix._44 - matrix._41;
-
86
-
87 // Normalize it.
-
88 t = (float)sqrt((m_planes[3].x * m_planes[3].x) + (m_planes[3].y * m_planes[3].y) + (m_planes[3].z * m_planes[3].z));
-
89 m_planes[3].x /= t;
-
90 m_planes[3].y /= t;
-
91 m_planes[3].z /= t;
-
92 m_planes[3].w /= t;
-
93
-
94 // Calculate the top plane of frustum.
-
95 m_planes[4].x = matrix._14 - matrix._12;
-
96 m_planes[4].y = matrix._24 - matrix._22;
-
97 m_planes[4].z = matrix._34 - matrix._32;
-
98 m_planes[4].w = matrix._44 - matrix._42;
-
99
-
100 // Normalize it.
-
101 t = (float)sqrt((m_planes[4].x * m_planes[4].x) + (m_planes[4].y * m_planes[4].y) + (m_planes[4].z * m_planes[4].z));
-
102 m_planes[4].x /= t;
-
103 m_planes[4].y /= t;
-
104 m_planes[4].z /= t;
-
105 m_planes[4].w /= t;
-
106
-
107 // Calculate the bottom plane of frustum.
-
108 m_planes[5].x = matrix._14 + matrix._12;
-
109 m_planes[5].y = matrix._24 + matrix._22;
-
110 m_planes[5].z = matrix._34 + matrix._32;
-
111 m_planes[5].w = matrix._44 + matrix._42;
-
112
-
113 // Normalize it.
-
114 t = (float)sqrt((m_planes[5].x * m_planes[5].x) + (m_planes[5].y * m_planes[5].y) + (m_planes[5].z * m_planes[5].z));
-
115 m_planes[5].x /= t;
-
116 m_planes[5].y /= t;
-
117 m_planes[5].z /= t;
-
118 m_planes[5].w /= t;
-
119
-
120 return;
-
121}
-
122
-
123bool FrustumClass::CheckPoint(float x, float y, float z)
-
124{
-
125 int i;
-
126
-
127
-
128 // Check if the point is inside all six planes of the view frustum.
-
129 for (i = 0; i < 6; i++)
-
130 {
-
131 if (((m_planes[i].x * x) + (m_planes[i].y * y) + (m_planes[i].z * z) + m_planes[i].w) < 0.0f)
-
132 {
-
133 return false;
-
134 }
-
135 }
-
136
-
137 return true;
-
138}
-
139
-
140bool FrustumClass::CheckCube(float xCenter, float yCenter, float zCenter, float radius)
-
141{
-
142 int i;
-
143
-
144
-
145 // Check if any one point of the cube is in the view frustum.
-
146 for (i = 0; i < 6; i++)
-
147 {
-
148 if (m_planes[i].x * (xCenter - radius) +
-
149 m_planes[i].y * (yCenter - radius) +
-
150 m_planes[i].z * (zCenter - radius) + m_planes[i].w >= 0.0f)
-
151 {
-
152 continue;
-
153 }
-
154
-
155 if (m_planes[i].x * (xCenter + radius) +
-
156 m_planes[i].y * (yCenter - radius) +
-
157 m_planes[i].z * (zCenter - radius) + m_planes[i].w >= 0.0f)
-
158 {
-
159 continue;
-
160 }
-
161
-
162 if (m_planes[i].x * (xCenter - radius) +
-
163 m_planes[i].y * (yCenter + radius) +
-
164 m_planes[i].z * (zCenter - radius) + m_planes[i].w >= 0.0f)
-
165 {
-
166 continue;
-
167 }
-
168
-
169 if (m_planes[i].x * (xCenter + radius) +
-
170 m_planes[i].y * (yCenter + radius) +
-
171 m_planes[i].z * (zCenter - radius) + m_planes[i].w >= 0.0f)
-
172 {
-
173 continue;
-
174 }
-
175
-
176 if (m_planes[i].x * (xCenter - radius) +
-
177 m_planes[i].y * (yCenter - radius) +
-
178 m_planes[i].z * (zCenter + radius) + m_planes[i].w >= 0.0f)
-
179 {
-
180 continue;
-
181 }
-
182
-
183 if (m_planes[i].x * (xCenter + radius) +
-
184 m_planes[i].y * (yCenter - radius) +
-
185 m_planes[i].z * (zCenter + radius) + m_planes[i].w >= 0.0f)
-
186 {
-
187 continue;
-
188 }
-
189
-
190 if (m_planes[i].x * (xCenter - radius) +
-
191 m_planes[i].y * (yCenter + radius) +
-
192 m_planes[i].z * (zCenter + radius) + m_planes[i].w >= 0.0f)
-
193 {
-
194 continue;
-
195 }
-
196
-
197 if (m_planes[i].x * (xCenter + radius) +
-
198 m_planes[i].y * (yCenter + radius) +
-
199 m_planes[i].z * (zCenter + radius) + m_planes[i].w >= 0.0f)
-
200 {
-
201 continue;
-
202 }
-
203
-
204 return false;
-
205 }
-
206
-
207 return true;
-
208}
-
209
-
210bool FrustumClass::CheckSphere(float xCenter, float yCenter, float zCenter, float radius)
-
211{
-
212 int i;
-
213
-
214
-
215 // Check if the radius of the sphere is inside the view frustum.
-
216 for (i = 0; i < 6; i++)
-
217 {
-
218 if (((m_planes[i].x * xCenter) + (m_planes[i].y * yCenter) + (m_planes[i].z * zCenter) + m_planes[i].w) < -radius)
-
219 {
-
220 return false;
-
221 }
-
222 }
-
223
-
224 return true;
-
225}
-
226
-
227bool FrustumClass::CheckRectangle(float xCenter, float yCenter, float zCenter, float xSize, float ySize, float zSize)
-
228{
-
229 int i;
-
230
-
231
-
232 // Check if any of the 6 planes of the rectangle are inside the view frustum.
-
233 for (i = 0; i < 6; i++)
-
234 {
-
235 if (m_planes[i].x * (xCenter - xSize) +
-
236 m_planes[i].y * (yCenter - ySize) +
-
237 m_planes[i].z * (zCenter - zSize) + m_planes[i].w >= 0.0f)
-
238 {
-
239 continue;
-
240 }
-
241
-
242 if (m_planes[i].x * (xCenter + xSize) +
-
243 m_planes[i].y * (yCenter - ySize) +
-
244 m_planes[i].z * (zCenter - zSize) + m_planes[i].w >= 0.0f)
-
245 {
-
246 continue;
-
247 }
-
248
-
249 if (m_planes[i].x * (xCenter - xSize) +
-
250 m_planes[i].y * (yCenter + ySize) +
-
251 m_planes[i].z * (zCenter - zSize) + m_planes[i].w >= 0.0f)
-
252 {
-
253 continue;
-
254 }
-
255
-
256 if (m_planes[i].x * (xCenter - xSize) +
-
257 m_planes[i].y * (yCenter - ySize) +
-
258 m_planes[i].z * (zCenter + zSize) + m_planes[i].w >= 0.0f)
-
259 {
-
260 continue;
-
261 }
-
262
-
263 if (m_planes[i].x * (xCenter + xSize) +
-
264 m_planes[i].y * (yCenter + ySize) +
-
265 m_planes[i].z * (zCenter - zSize) + m_planes[i].w >= 0.0f)
-
266 {
-
267 continue;
-
268 }
-
269
-
270 if (m_planes[i].x * (xCenter + xSize) +
-
271 m_planes[i].y * (yCenter - ySize) +
-
272 m_planes[i].z * (zCenter + zSize) + m_planes[i].w >= 0.0f)
-
273 {
-
274 continue;
-
275 }
-
276
-
277 if (m_planes[i].x * (xCenter - xSize) +
-
278 m_planes[i].y * (yCenter + ySize) +
-
279 m_planes[i].z * (zCenter + zSize) + m_planes[i].w >= 0.0f)
-
280 {
-
281 continue;
-
282 }
-
283
-
284 if (m_planes[i].x * (xCenter + xSize) +
-
285 m_planes[i].y * (yCenter + ySize) +
-
286 m_planes[i].z * (zCenter + zSize) + m_planes[i].w >= 0.0f)
-
287 {
-
288 continue;
-
289 }
-
290
-
291 return false;
-
292 }
-
293
-
294 return true;
-
295}
-
296
- -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:ec6169d13f6fbf4d06ac89467406c7c60c6909b811bdcc5ab82f364018d3de6c +size 43685 diff --git a/doxygen_docs/html/frustumclass_8h_source.html b/doxygen_docs/html/frustumclass_8h_source.html index 07479be..0c563ea 100644 --- a/doxygen_docs/html/frustumclass_8h_source.html +++ b/doxygen_docs/html/frustumclass_8h_source.html @@ -1,144 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/inc/system/frustumclass.h Source File - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
frustumclass.h
-
-
-
1#ifndef _FRUSTUMCLASS_H_
-
2#define _FRUSTUMCLASS_H_
-
3
-
4
-
6// INCLUDES //
-
8#include <directxmath.h>
-
9using namespace DirectX;
-
10
-
11
-
13// Class name: FrustumClass
-
- -
16{
-
17public:
- - - -
21
-
22 void ConstructFrustum(XMMATRIX, XMMATRIX, float);
-
23
-
24 bool CheckPoint(float, float, float);
-
25 bool CheckCube(float, float, float, float);
-
26 bool CheckSphere(float, float, float, float);
-
27 bool CheckRectangle(float, float, float, float, float, float);
-
28
-
29private:
-
30 XMFLOAT4 m_planes[6];
-
31};
-
-
32
-
33#endif
- -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:f76291e7f397c4f6015f7a3a2d43a00ebd7aaf33fbec1de077ed971fb68093d2 +size 9642 diff --git a/doxygen_docs/html/functions.html b/doxygen_docs/html/functions.html index 222c896..aaa577c 100644 --- a/doxygen_docs/html/functions.html +++ b/doxygen_docs/html/functions.html @@ -1,116 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Class Members - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
Here is a list of all documented class members with links to the class documentation for each member:
- -

- a -

-
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:7c7378cdbfdd10891b392b35de1af84829024b43fd025c506ecd7dbd767f2831 +size 4792 diff --git a/doxygen_docs/html/functions_b.html b/doxygen_docs/html/functions_b.html index 2cc23ab..1eab74c 100644 --- a/doxygen_docs/html/functions_b.html +++ b/doxygen_docs/html/functions_b.html @@ -1,113 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Class Members - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
Here is a list of all documented class members with links to the class documentation for each member:
- -

- b -

-
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:ecc5de1d72f68e04c7b362169b9fa67b86c03bf661a74a76cfa90aa4318a40c8 +size 4364 diff --git a/doxygen_docs/html/functions_c.html b/doxygen_docs/html/functions_c.html index 2bcad6a..1c08bfa 100644 --- a/doxygen_docs/html/functions_c.html +++ b/doxygen_docs/html/functions_c.html @@ -1,121 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Class Members - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
Here is a list of all documented class members with links to the class documentation for each member:
- -

- c -

-
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:b8a594e3d5a28515a3888f5b6f71f95d57ff5ff4ce0fbc98c52e6cd984b8a790 +size 5461 diff --git a/doxygen_docs/html/functions_d.html b/doxygen_docs/html/functions_d.html index 43985ed..fd2ca99 100644 --- a/doxygen_docs/html/functions_d.html +++ b/doxygen_docs/html/functions_d.html @@ -1,117 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Class Members - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
Here is a list of all documented class members with links to the class documentation for each member:
- -

- d -

-
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:2b2832e7bb9ee07bcd2e955b44a0a6dbce72e99bb266ebce95ecc6e16a5895d5 +size 4943 diff --git a/doxygen_docs/html/functions_dup.js b/doxygen_docs/html/functions_dup.js index fdbc5c0..71b5caa 100644 --- a/doxygen_docs/html/functions_dup.js +++ b/doxygen_docs/html/functions_dup.js @@ -1,22 +1,3 @@ -var functions_dup = -[ - [ "a", "functions.html", null ], - [ "b", "functions_b.html", null ], - [ "c", "functions_c.html", null ], - [ "d", "functions_d.html", null ], - [ "e", "functions_e.html", null ], - [ "f", "functions_f.html", null ], - [ "g", "functions_g.html", null ], - [ "h", "functions_h.html", null ], - [ "i", "functions_i.html", null ], - [ "l", "functions_l.html", null ], - [ "m", "functions_m.html", null ], - [ "n", "functions_n.html", null ], - [ "o", "functions_o.html", null ], - [ "p", "functions_p.html", null ], - [ "r", "functions_r.html", null ], - [ "s", "functions_s.html", null ], - [ "t", "functions_t.html", null ], - [ "u", "functions_u.html", null ], - [ "w", "functions_w.html", null ] -]; \ No newline at end of file +version https://git-lfs.github.com/spec/v1 +oid sha256:8f71634af7e1149e2a5f5460bc9ee0ba83889a46c429aaa8f8391ec1a8a85492 +size 762 diff --git a/doxygen_docs/html/functions_e.html b/doxygen_docs/html/functions_e.html index a63b9b7..7c072d8 100644 --- a/doxygen_docs/html/functions_e.html +++ b/doxygen_docs/html/functions_e.html @@ -1,116 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Class Members - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
Here is a list of all documented class members with links to the class documentation for each member:
- -

- e -

-
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:9e598849b05cc3cdefc644034c21acd5ccce5b52e70c134e41dfaf65f596c02f +size 4774 diff --git a/doxygen_docs/html/functions_enum.html b/doxygen_docs/html/functions_enum.html index 218ca49..6ad38f8 100644 --- a/doxygen_docs/html/functions_enum.html +++ b/doxygen_docs/html/functions_enum.html @@ -1,111 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Class Members - Enumerations - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
Here is a list of all documented enums with links to the class documentation for each member:
-
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:4685c4572b096224a14d4b405cc54462e26df1f5f1f4d7a826ed2d4f38adac26 +size 4309 diff --git a/doxygen_docs/html/functions_f.html b/doxygen_docs/html/functions_f.html index c5f8f47..001c897 100644 --- a/doxygen_docs/html/functions_f.html +++ b/doxygen_docs/html/functions_f.html @@ -1,114 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Class Members - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
Here is a list of all documented class members with links to the class documentation for each member:
- -

- f -

-
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:e6527730b48570ae29a3a3cfb3014ee3db0c4e6de6ca70630fa1f795e573a012 +size 4500 diff --git a/doxygen_docs/html/functions_func.html b/doxygen_docs/html/functions_func.html index be7972b..acc9cae 100644 --- a/doxygen_docs/html/functions_func.html +++ b/doxygen_docs/html/functions_func.html @@ -1,116 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Class Members - Functions - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
Here is a list of all documented functions with links to the class documentation for each member:
- -

- a -

-
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:c82afcd2bb5e4296c2a4cbedbf9f7cf6176536e973006c7ca3c6fa4b9c7337e2 +size 4805 diff --git a/doxygen_docs/html/functions_func.js b/doxygen_docs/html/functions_func.js index a700687..2e79a20 100644 --- a/doxygen_docs/html/functions_func.js +++ b/doxygen_docs/html/functions_func.js @@ -1,22 +1,3 @@ -var functions_func = -[ - [ "a", "functions_func.html", null ], - [ "b", "functions_func_b.html", null ], - [ "c", "functions_func_c.html", null ], - [ "d", "functions_func_d.html", null ], - [ "e", "functions_func_e.html", null ], - [ "f", "functions_func_f.html", null ], - [ "g", "functions_func_g.html", null ], - [ "h", "functions_func_h.html", null ], - [ "i", "functions_func_i.html", null ], - [ "l", "functions_func_l.html", null ], - [ "m", "functions_func_m.html", null ], - [ "n", "functions_func_n.html", null ], - [ "o", "functions_func_o.html", null ], - [ "p", "functions_func_p.html", null ], - [ "r", "functions_func_r.html", null ], - [ "s", "functions_func_s.html", null ], - [ "t", "functions_func_t.html", null ], - [ "u", "functions_func_u.html", null ], - [ "w", "functions_func_w.html", null ] -]; \ No newline at end of file +version https://git-lfs.github.com/spec/v1 +oid sha256:874c4c7847b74a603b93f56024653b8f1eec4627dab96f8e3a88d2f826ca240e +size 858 diff --git a/doxygen_docs/html/functions_func_b.html b/doxygen_docs/html/functions_func_b.html index 8213353..420a3de 100644 --- a/doxygen_docs/html/functions_func_b.html +++ b/doxygen_docs/html/functions_func_b.html @@ -1,113 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Class Members - Functions - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
Here is a list of all documented functions with links to the class documentation for each member:
- -

- b -

-
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:49c848ffa1eda89473e211b24d062c29c6a26ad2e182848a8793d6685d19526d +size 4377 diff --git a/doxygen_docs/html/functions_func_c.html b/doxygen_docs/html/functions_func_c.html index 51f749b..8e5c971 100644 --- a/doxygen_docs/html/functions_func_c.html +++ b/doxygen_docs/html/functions_func_c.html @@ -1,121 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Class Members - Functions - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
Here is a list of all documented functions with links to the class documentation for each member:
- -

- c -

-
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:40113b635c46a022018301e7dfbfad7e34219c7c079ea497083298eb64040884 +size 5474 diff --git a/doxygen_docs/html/functions_func_d.html b/doxygen_docs/html/functions_func_d.html index f965a97..6efc7dc 100644 --- a/doxygen_docs/html/functions_func_d.html +++ b/doxygen_docs/html/functions_func_d.html @@ -1,117 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Class Members - Functions - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
Here is a list of all documented functions with links to the class documentation for each member:
- -

- d -

-
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:6308fe01951aa764f54cd3e0e9f961e7ba7e1436dfade4e2473dddc36dd95e2a +size 4956 diff --git a/doxygen_docs/html/functions_func_e.html b/doxygen_docs/html/functions_func_e.html index 15b40c8..a99b574 100644 --- a/doxygen_docs/html/functions_func_e.html +++ b/doxygen_docs/html/functions_func_e.html @@ -1,116 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Class Members - Functions - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
Here is a list of all documented functions with links to the class documentation for each member:
- -

- e -

-
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:b27e12e0589050dec06c24a95cf4930d8cad0907a78f1c5fb227065c1e68d624 +size 4787 diff --git a/doxygen_docs/html/functions_func_f.html b/doxygen_docs/html/functions_func_f.html index 00f9f6c..664a917 100644 --- a/doxygen_docs/html/functions_func_f.html +++ b/doxygen_docs/html/functions_func_f.html @@ -1,114 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Class Members - Functions - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
Here is a list of all documented functions with links to the class documentation for each member:
- -

- f -

-
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:a3c75989556605fb8a5275ef178075b13a2ead0001f225af1564e2ca7b2e5b18 +size 4513 diff --git a/doxygen_docs/html/functions_func_g.html b/doxygen_docs/html/functions_func_g.html index 5b074c6..bf3469a 100644 --- a/doxygen_docs/html/functions_func_g.html +++ b/doxygen_docs/html/functions_func_g.html @@ -1,186 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Class Members - Functions - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
Here is a list of all documented functions with links to the class documentation for each member:
- -

- g -

-
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:013c097d121df284dce032c84490fb62e7ec26ca80cd126725e766e29f9093ef +size 14949 diff --git a/doxygen_docs/html/functions_func_h.html b/doxygen_docs/html/functions_func_h.html index 241f286..62b3a37 100644 --- a/doxygen_docs/html/functions_func_h.html +++ b/doxygen_docs/html/functions_func_h.html @@ -1,113 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Class Members - Functions - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
Here is a list of all documented functions with links to the class documentation for each member:
- -

- h -

-
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:08ced522018d1b981fd6e6633b49f9a957679721b66165dd847a62c0e0c4dffd +size 4381 diff --git a/doxygen_docs/html/functions_func_i.html b/doxygen_docs/html/functions_func_i.html index 840911c..3c6c3c2 100644 --- a/doxygen_docs/html/functions_func_i.html +++ b/doxygen_docs/html/functions_func_i.html @@ -1,124 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Class Members - Functions - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
Here is a list of all documented functions with links to the class documentation for each member:
- -

- i -

-
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:06ca4293e0eb00310864058046686e8b2ddd9d1ece2c8b2c9a2a0389c3395056 +size 6993 diff --git a/doxygen_docs/html/functions_func_l.html b/doxygen_docs/html/functions_func_l.html index fe2c2e1..b90883f 100644 --- a/doxygen_docs/html/functions_func_l.html +++ b/doxygen_docs/html/functions_func_l.html @@ -1,117 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Class Members - Functions - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
Here is a list of all documented functions with links to the class documentation for each member:
- -

- l -

-
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:80b1755bbeab69e563ad2075e4873ae74174ebb6cdb2ee33c8940453e86f92ba +size 4918 diff --git a/doxygen_docs/html/functions_func_m.html b/doxygen_docs/html/functions_func_m.html index d644e00..a993613 100644 --- a/doxygen_docs/html/functions_func_m.html +++ b/doxygen_docs/html/functions_func_m.html @@ -1,113 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Class Members - Functions - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
Here is a list of all documented functions with links to the class documentation for each member:
- -

- m -

-
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:769caf5d2c3b6e688e9b6ee5b71643a4ac903db128661478ac97395cebaa8a03 +size 4371 diff --git a/doxygen_docs/html/functions_func_n.html b/doxygen_docs/html/functions_func_n.html index be0a298..a15097c 100644 --- a/doxygen_docs/html/functions_func_n.html +++ b/doxygen_docs/html/functions_func_n.html @@ -1,113 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Class Members - Functions - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
Here is a list of all documented functions with links to the class documentation for each member:
- -

- n -

-
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:58bfb797d1a924d41715d0308a79c12d8cdd8e3cbcb6d440745df131fe07cd14 +size 4377 diff --git a/doxygen_docs/html/functions_func_o.html b/doxygen_docs/html/functions_func_o.html index 39f38a2..af8a85a 100644 --- a/doxygen_docs/html/functions_func_o.html +++ b/doxygen_docs/html/functions_func_o.html @@ -1,113 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Class Members - Functions - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
Here is a list of all documented functions with links to the class documentation for each member:
- -

- o -

-
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:5c83bbf16aef2f36a922596c3a264a1dcae7ad38037f3602ed8c54e5189a6ff2 +size 4410 diff --git a/doxygen_docs/html/functions_func_p.html b/doxygen_docs/html/functions_func_p.html index 078ef58..89164cc 100644 --- a/doxygen_docs/html/functions_func_p.html +++ b/doxygen_docs/html/functions_func_p.html @@ -1,114 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Class Members - Functions - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
Here is a list of all documented functions with links to the class documentation for each member:
- -

- p -

-
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:c61cbed1f3a8e7d6891f7ff8dd121e3f3483d7f74ccb0e20198a807e9bed1ebc +size 4559 diff --git a/doxygen_docs/html/functions_func_r.html b/doxygen_docs/html/functions_func_r.html index 8ddc503..13ee409 100644 --- a/doxygen_docs/html/functions_func_r.html +++ b/doxygen_docs/html/functions_func_r.html @@ -1,124 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Class Members - Functions - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
Here is a list of all documented functions with links to the class documentation for each member:
- -

- r -

-
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:89f5ad8d6a67f211ae89be09ab3174236f7230f8a33ae6e7f53507473730ff7c +size 6014 diff --git a/doxygen_docs/html/functions_func_s.html b/doxygen_docs/html/functions_func_s.html index a2a4e60..7aec7e0 100644 --- a/doxygen_docs/html/functions_func_s.html +++ b/doxygen_docs/html/functions_func_s.html @@ -1,170 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Class Members - Functions - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
Here is a list of all documented functions with links to the class documentation for each member:
- -

- s -

-
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:8c201dc99a63cf0d366a129c85dd0083b88b6a5d5cd441873b329a186319913d +size 13045 diff --git a/doxygen_docs/html/functions_func_t.html b/doxygen_docs/html/functions_func_t.html index d40a6d9..fdfbc7f 100644 --- a/doxygen_docs/html/functions_func_t.html +++ b/doxygen_docs/html/functions_func_t.html @@ -1,115 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Class Members - Functions - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
Here is a list of all documented functions with links to the class documentation for each member:
- -

- t -

-
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:bc705eb490eeffa5b139ab13cd9fb3afb649ea2c27872bdb9a8c8118943a8054 +size 4679 diff --git a/doxygen_docs/html/functions_func_u.html b/doxygen_docs/html/functions_func_u.html index 85cc56b..f6baa92 100644 --- a/doxygen_docs/html/functions_func_u.html +++ b/doxygen_docs/html/functions_func_u.html @@ -1,117 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Class Members - Functions - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
Here is a list of all documented functions with links to the class documentation for each member:
- -

- u -

-
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:9372377ee1fd5db481312da375e5d5d94152e09bf7fccbee5052081fb27d62f9 +size 5462 diff --git a/doxygen_docs/html/functions_func_w.html b/doxygen_docs/html/functions_func_w.html index 1745dfa..7e35cde 100644 --- a/doxygen_docs/html/functions_func_w.html +++ b/doxygen_docs/html/functions_func_w.html @@ -1,123 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Class Members - Functions - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
Here is a list of all documented functions with links to the class documentation for each member:
- -

- w -

-
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:79ae39a9c75476564f3b6770c065b7b6c3374d277ba2a0640b45a132c5049e35 +size 5752 diff --git a/doxygen_docs/html/functions_g.html b/doxygen_docs/html/functions_g.html index 9de2bfc..91164cb 100644 --- a/doxygen_docs/html/functions_g.html +++ b/doxygen_docs/html/functions_g.html @@ -1,186 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Class Members - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
Here is a list of all documented class members with links to the class documentation for each member:
- -

- g -

-
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:6b1b0fd238b35bed753d3b46e162dd03117cfc2a43191ce37d6dde8cf8513815 +size 14936 diff --git a/doxygen_docs/html/functions_h.html b/doxygen_docs/html/functions_h.html index d52999d..3b7b9df 100644 --- a/doxygen_docs/html/functions_h.html +++ b/doxygen_docs/html/functions_h.html @@ -1,113 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Class Members - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
Here is a list of all documented class members with links to the class documentation for each member:
- -

- h -

-
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:b4da0838144ec65afff8a53579b14fe0f09e167dd20200b919a6539193e6474b +size 4368 diff --git a/doxygen_docs/html/functions_i.html b/doxygen_docs/html/functions_i.html index 551edaa..c892b83 100644 --- a/doxygen_docs/html/functions_i.html +++ b/doxygen_docs/html/functions_i.html @@ -1,124 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Class Members - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
Here is a list of all documented class members with links to the class documentation for each member:
- -

- i -

-
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:dcab34c99a61ab6685fdec3f84cefc93a8b6c9ce567aa53f0296b1d80534cae2 +size 6980 diff --git a/doxygen_docs/html/functions_l.html b/doxygen_docs/html/functions_l.html index bfdec41..c713f63 100644 --- a/doxygen_docs/html/functions_l.html +++ b/doxygen_docs/html/functions_l.html @@ -1,118 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Class Members - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
Here is a list of all documented class members with links to the class documentation for each member:
- -

- l -

-
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:cb8f094bc63e0869338aa6c4b7a2446752e80b178e625b5e30399e7a1085cac6 +size 5019 diff --git a/doxygen_docs/html/functions_m.html b/doxygen_docs/html/functions_m.html index 3e00bfe..9727775 100644 --- a/doxygen_docs/html/functions_m.html +++ b/doxygen_docs/html/functions_m.html @@ -1,113 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Class Members - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
Here is a list of all documented class members with links to the class documentation for each member:
- -

- m -

-
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:9d4bf5adfae4a4a3ec943b80d078a66e58507a2a6ccb9b18b6a4c9b9615166b6 +size 4358 diff --git a/doxygen_docs/html/functions_n.html b/doxygen_docs/html/functions_n.html index 03425c4..1532e59 100644 --- a/doxygen_docs/html/functions_n.html +++ b/doxygen_docs/html/functions_n.html @@ -1,113 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Class Members - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
Here is a list of all documented class members with links to the class documentation for each member:
- -

- n -

-
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:5b4c485b1b94b5fda63c6f42a18e292af5e4982e54f58eddcb33ec3ea8196365 +size 4364 diff --git a/doxygen_docs/html/functions_o.html b/doxygen_docs/html/functions_o.html index 5e822f4..321fe2b 100644 --- a/doxygen_docs/html/functions_o.html +++ b/doxygen_docs/html/functions_o.html @@ -1,113 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Class Members - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
Here is a list of all documented class members with links to the class documentation for each member:
- -

- o -

-
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:c8332a21a5f31665135ae5ed249351164afbefd92c09cc8580cfa769bf9a66f9 +size 4397 diff --git a/doxygen_docs/html/functions_p.html b/doxygen_docs/html/functions_p.html index 07094c5..aaa1a0b 100644 --- a/doxygen_docs/html/functions_p.html +++ b/doxygen_docs/html/functions_p.html @@ -1,114 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Class Members - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
Here is a list of all documented class members with links to the class documentation for each member:
- -

- p -

-
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:e92cc665a5bb954ffe9cc3b12d0a6a93a32de14b5b97e8bd5aaebdeaa1c91796 +size 4546 diff --git a/doxygen_docs/html/functions_r.html b/doxygen_docs/html/functions_r.html index e85dbef..93833a4 100644 --- a/doxygen_docs/html/functions_r.html +++ b/doxygen_docs/html/functions_r.html @@ -1,124 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Class Members - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
Here is a list of all documented class members with links to the class documentation for each member:
- -

- r -

-
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:954ee7ae6b7b6fcf2a2035bbdcd5fcd80ba95f5ef55ca1afe3435686e554bebb +size 6001 diff --git a/doxygen_docs/html/functions_s.html b/doxygen_docs/html/functions_s.html index 0217c8a..850244b 100644 --- a/doxygen_docs/html/functions_s.html +++ b/doxygen_docs/html/functions_s.html @@ -1,170 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Class Members - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
Here is a list of all documented class members with links to the class documentation for each member:
- -

- s -

-
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:dc60ebe2b48f39bbf033c245c0122995fae77b99b6752bd54893222a231e32c8 +size 13032 diff --git a/doxygen_docs/html/functions_t.html b/doxygen_docs/html/functions_t.html index 0f3ed1c..be4f246 100644 --- a/doxygen_docs/html/functions_t.html +++ b/doxygen_docs/html/functions_t.html @@ -1,115 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Class Members - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
Here is a list of all documented class members with links to the class documentation for each member:
- -

- t -

-
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:20e78a3276b12e389030b1973331b1890748da2e88fa02bbcfe255bc306d39f0 +size 4666 diff --git a/doxygen_docs/html/functions_u.html b/doxygen_docs/html/functions_u.html index d5ce993..8099251 100644 --- a/doxygen_docs/html/functions_u.html +++ b/doxygen_docs/html/functions_u.html @@ -1,117 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Class Members - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
Here is a list of all documented class members with links to the class documentation for each member:
- -

- u -

-
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:4550ef99ecd2dc7bf7ff253d427053d53db7fe35a7c65023297a7072408a97ed +size 5449 diff --git a/doxygen_docs/html/functions_w.html b/doxygen_docs/html/functions_w.html index 43564e2..0e80df9 100644 --- a/doxygen_docs/html/functions_w.html +++ b/doxygen_docs/html/functions_w.html @@ -1,123 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Class Members - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
Here is a list of all documented class members with links to the class documentation for each member:
- -

- w -

-
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:2a9396b0be64609de58ada371500b33c22bb322ae6621588b1de4536c6206035 +size 5739 diff --git a/doxygen_docs/html/hierarchy.html b/doxygen_docs/html/hierarchy.html index 76db4a8..f9fc0ab 100644 --- a/doxygen_docs/html/hierarchy.html +++ b/doxygen_docs/html/hierarchy.html @@ -1,188 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Class Hierarchy - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
Class Hierarchy
-
-
-
This inheritance list is sorted roughly, but not completely, alphabetically:
-
[detail level 12]
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 Calpha_map_shader_class
 Capplication_class
 Cbitmap_class
 Ccamera_class
 Ccelshade_class
 Ccolor_shader_class
 Cecs::Component
 Cecs::IdentityComponent
 Cecs::ModelPathComponent
 Cecs::PhysicsComponent
 Cecs::RenderComponent
 Cecs::ShaderComponent
 Cecs::TransformComponent
 Cd_3d_class
 Cdepth_shader_class
 Cdisplay_plane_class
 Cecs::Entity
 Cecs::EntityManager
 Cmodel_class::Face
 Cfont_class
 Cfont_shader_class
 Cfps_class
 Cfps_limiter
 Cfrustum
 CFrustumClass
 CimguiManager
 Cinput
 Cinput_class
 Clight_class
 Clight_map_shader_class
 Clight_shader_class
 CLogger::LogEntry
 CLogger
 CLogger::LogLevelInfo
 Cmaster_shader
 Cmodel_class
 CModelListClass
 Cmodel_class::ModelType
 Cmulti_texture_shader_class
 Cmodel_class::Normal
 Cnormal_map_shader_class
 Cobject
 Cphysics
 Cposition_class
 Creflection_shader_class
 Crefraction_shader_class
 Crender_texture_class
 Cecs::RenderSystem
 Cscene_manager
 CsceneManager
 Cshader_manager_class
 Cshadow_map
 CSkybox
 Cskybox_shader_class
 Cspec_map_shader_class
 Csprite_class
 Cstats
 Csunlight_shader_class
 Csystem_class
 Cmodel_class::TempVertexType
 Ctext_class
 Cmodel_class::Texture
 Ctexture_class
 Ctexture_shader_class
 CTextureContainer
 Ctimer_class
 Ctranslate_shader_class
 Ctransparent_shader_class
 Cmodel_class::VectorType
 Cmodel_class::Vertex
 Cmodel_class::VertexType
 Cwater_shader_class
 Cwidget_entry
-
-
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:73c7d5a99ab46cfc41f9cb9239ddf35498b2a7cfe108789ecc87f7e19fe5471a +size 25113 diff --git a/doxygen_docs/html/hierarchy.js b/doxygen_docs/html/hierarchy.js index cb7ce13..dc7c720 100644 --- a/doxygen_docs/html/hierarchy.js +++ b/doxygen_docs/html/hierarchy.js @@ -1,78 +1,3 @@ -var hierarchy = -[ - [ "alpha_map_shader_class", "classalpha__map__shader__class.html", null ], - [ "application_class", "classapplication__class.html", null ], - [ "bitmap_class", "classbitmap__class.html", null ], - [ "camera_class", "classcamera__class.html", null ], - [ "celshade_class", "classcelshade__class.html", null ], - [ "color_shader_class", "classcolor__shader__class.html", null ], - [ "ecs::Component", "classecs_1_1_component.html", [ - [ "ecs::IdentityComponent", "classecs_1_1_identity_component.html", null ], - [ "ecs::ModelPathComponent", "classecs_1_1_model_path_component.html", null ], - [ "ecs::PhysicsComponent", "classecs_1_1_physics_component.html", null ], - [ "ecs::RenderComponent", "classecs_1_1_render_component.html", null ], - [ "ecs::ShaderComponent", "classecs_1_1_shader_component.html", null ], - [ "ecs::TransformComponent", "classecs_1_1_transform_component.html", null ] - ] ], - [ "d_3d_class", "classd__3d__class.html", null ], - [ "depth_shader_class", "classdepth__shader__class.html", null ], - [ "display_plane_class", "classdisplay__plane__class.html", null ], - [ "ecs::Entity", "classecs_1_1_entity.html", null ], - [ "ecs::EntityManager", "classecs_1_1_entity_manager.html", null ], - [ "model_class::Face", "structmodel__class_1_1_face.html", null ], - [ "font_class", "classfont__class.html", null ], - [ "font_shader_class", "classfont__shader__class.html", null ], - [ "fps_class", "classfps__class.html", null ], - [ "fps_limiter", "classfps__limiter.html", null ], - [ "frustum", "classfrustum.html", null ], - [ "FrustumClass", "class_frustum_class.html", null ], - [ "imguiManager", "classimgui_manager.html", null ], - [ "input", "structinput.html", null ], - [ "input_class", "classinput__class.html", null ], - [ "light_class", "classlight__class.html", null ], - [ "light_map_shader_class", "classlight__map__shader__class.html", null ], - [ "light_shader_class", "classlight__shader__class.html", null ], - [ "Logger::LogEntry", "struct_logger_1_1_log_entry.html", null ], - [ "Logger", "class_logger.html", null ], - [ "Logger::LogLevelInfo", "struct_logger_1_1_log_level_info.html", null ], - [ "master_shader", "classmaster__shader.html", null ], - [ "model_class", "classmodel__class.html", null ], - [ "ModelListClass", "class_model_list_class.html", null ], - [ "model_class::ModelType", "structmodel__class_1_1_model_type.html", null ], - [ "multi_texture_shader_class", "classmulti__texture__shader__class.html", null ], - [ "model_class::Normal", "structmodel__class_1_1_normal.html", null ], - [ "normal_map_shader_class", "classnormal__map__shader__class.html", null ], - [ "object", "classobject.html", [ - [ "physics", "classphysics.html", null ] - ] ], - [ "position_class", "classposition__class.html", null ], - [ "reflection_shader_class", "classreflection__shader__class.html", null ], - [ "refraction_shader_class", "classrefraction__shader__class.html", null ], - [ "render_texture_class", "classrender__texture__class.html", null ], - [ "ecs::RenderSystem", "classecs_1_1_render_system.html", null ], - [ "scene_manager", "classscene__manager.html", null ], - [ "sceneManager", "classscene_manager.html", null ], - [ "shader_manager_class", "classshader__manager__class.html", null ], - [ "shadow_map", "classshadow__map.html", null ], - [ "Skybox", "class_skybox.html", null ], - [ "skybox_shader_class", "classskybox__shader__class.html", null ], - [ "spec_map_shader_class", "classspec__map__shader__class.html", null ], - [ "sprite_class", "classsprite__class.html", null ], - [ "stats", "classstats.html", null ], - [ "sunlight_shader_class", "classsunlight__shader__class.html", null ], - [ "system_class", "classsystem__class.html", null ], - [ "model_class::TempVertexType", "structmodel__class_1_1_temp_vertex_type.html", null ], - [ "text_class", "classtext__class.html", null ], - [ "model_class::Texture", "structmodel__class_1_1_texture.html", null ], - [ "texture_class", "classtexture__class.html", null ], - [ "texture_shader_class", "classtexture__shader__class.html", null ], - [ "TextureContainer", "struct_texture_container.html", null ], - [ "timer_class", "classtimer__class.html", null ], - [ "translate_shader_class", "classtranslate__shader__class.html", null ], - [ "transparent_shader_class", "classtransparent__shader__class.html", null ], - [ "model_class::VectorType", "structmodel__class_1_1_vector_type.html", null ], - [ "model_class::Vertex", "structmodel__class_1_1_vertex.html", null ], - [ "model_class::VertexType", "structmodel__class_1_1_vertex_type.html", null ], - [ "water_shader_class", "classwater__shader__class.html", null ], - [ "widget_entry", "structwidget__entry.html", null ] -]; \ No newline at end of file +version https://git-lfs.github.com/spec/v1 +oid sha256:d353936af056a4bb9a925484540973bc7e91a3b9249fc760459731b674453644 +size 4881 diff --git a/doxygen_docs/html/identity__component_8h_source.html b/doxygen_docs/html/identity__component_8h_source.html index 55a0edf..8770764 100644 --- a/doxygen_docs/html/identity__component_8h_source.html +++ b/doxygen_docs/html/identity__component_8h_source.html @@ -1,189 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/inc/system/ecs/components/identity_component.h Source File - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
identity_component.h
-
-
-
1#pragma once
-
2#include "../component.h"
-
3#include <string>
-
4
-
5namespace ecs {
-
-
10 enum class ObjectType
-
11 {
-
12 Sphere,
-
13 Cube,
-
14 Terrain,
-
15 Unknown
-
16 };
-
-
17
-
- -
19public:
-
23 IdentityComponent() : m_id(0), m_type(ObjectType::Unknown) {}
-
24 explicit IdentityComponent(int id) : m_id(id), m_type(ObjectType::Unknown) {}
-
25 IdentityComponent(int id, const std::string& name) : m_id(id), m_name(name), m_type(ObjectType::Unknown) {}
-
26 ~IdentityComponent() = default;
-
27
-
33 void Initialize() override {}
-
34 //void Update(float deltaTime) override {}
-
35
-
40 int GetId() const { return m_id; }
-
45 void SetId(int id) { m_id = id; }
-
46
-
51 const std::string& GetName() const { return m_name; }
-
56 void SetName(const std::string& name) { m_name = name; }
-
57
-
62 ObjectType GetType() const { return m_type; }
-
67 void SetType(ObjectType type) { m_type = type; }
-
68
-
-
74 static std::string ObjectTypeToString(ObjectType type) {
-
75 switch (type) {
-
76 case ObjectType::Cube: return "Cube";
-
77 case ObjectType::Sphere: return "Sphere";
-
78 case ObjectType::Terrain: return "Terrain";
-
79 default: return "Unknown";
-
80 }
-
81 }
-
-
82
-
-
88 static ObjectType StringToObjectType(const std::string& str) {
-
89 if (str == "Cube") return ObjectType::Cube;
-
90 if (str == "Sphere") return ObjectType::Sphere;
-
91 if (str == "Terrain") return ObjectType::Terrain;
-
92 return ObjectType::Unknown;
-
93 }
-
-
94
-
95private:
-
96 int m_id; // ID unique de l'objet
-
97 std::string m_name; // Nom de l'objet
-
98 ObjectType m_type; // Type de l'objet (Cube, Sphere, Terrain, etc.)
-
99};
-
-
100
-
101} // namespace ecs
- - - - -
static std::string ObjectTypeToString(ObjectType type)
- -
const std::string & GetName() const
-
void SetType(ObjectType type)
-
static ObjectType StringToObjectType(const std::string &str)
-
void SetName(const std::string &name)
-
ObjectType GetType() const
- -
Definition component.h:9
- -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:57e2b86f691c5a605787916dbc63bc5f66aac71ad44bda6027e9c772905941c6 +size 22381 diff --git a/doxygen_docs/html/imgui_manager_8cpp_source.html b/doxygen_docs/html/imgui_manager_8cpp_source.html index f047788..5b7b33f 100644 --- a/doxygen_docs/html/imgui_manager_8cpp_source.html +++ b/doxygen_docs/html/imgui_manager_8cpp_source.html @@ -1,1315 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/src/system/imguiManager.cpp Source File - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
imguiManager.cpp
-
-
-
1#include "imguiManager.h"
-
2#include "application_class.h"
-
3#include "stats.h"
-
4
-
5static fps_limiter fpsLimiter(60.0f);
-
6
-
- -
8{
-
9 io = nullptr;
-
10 m_frameTimeHistoryIndex = 0;
-
11
-
12 current_fps_ = 0;
-
13 min_fps_ = 0;
-
14 max_fps_ = 0;
-
15 draw_calls_ = 0;
-
16 total_vertex_count_ = 0;
-
17 total_triangle_count_ = 0;
-
18 visible_triangle_count_ = 0;
-
19 current_frame_time_ = 0;
-
20
-
21 showObjectWindow = false;
-
22 showTerrainWindow = false;
-
23 showLightWindow = false;
-
24 showOldSceneWindow = false;
-
25 showEngineSettingsWindow = false;
-
26 showLogWindow = false;
-
27 showStatsWindow = false;
-
28
-
29 // Initialiser l'historique des frametimes à zéro
-
30 for (int i = 0; i < FRAME_HISTORY_COUNT; i++)
-
31 {
-
32 m_frameTimeHistory[i] = 0.0f;
-
33 }
-
34
-
35 widgets_ = {
-
36 {&showObjectWindow, [&](){WidgetObjectWindow();}},
-
37 {&showEngineSettingsWindow, [&](){WidgetEngineSettingsWindow();}},
-
38 {&showTerrainWindow, [&](){WidgetTerrainWindow();}},
-
39 {&showLightWindow, [&](){WidgetLightWindow();}},
-
40 {&showLogWindow, [&](){WidgetLogWindow();}},
-
41 {&showOldSceneWindow, [&](){WidgetRenderWindow(ImVec2(800, 600));}},
-
42 {&showStatsWindow, [&](){WidgetRenderStats();}}
-
43 };
-
44}
-
-
45
-
46imguiManager::~imguiManager()
-
47{
-
48}
-
49
-
-
50bool imguiManager::Initialize(HWND hwnd, ID3D11Device* device, ID3D11DeviceContext* deviceContext)
-
51{
-
52 Logger::Get().Log("Initializing imgui", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
53
-
54 m_device = device;
-
55 m_deviceContext = deviceContext;
-
56
-
57 IMGUI_CHECKVERSION();
-
58 ImGui::CreateContext();
-
59 io = &ImGui::GetIO();
-
60 io->ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard;
-
61 io->ConfigFlags |= ImGuiConfigFlags_DockingEnable;
-
62 io->FontGlobalScale = 1.0f;
-
63
-
64 ImGui_ImplWin32_Init(hwnd);
-
65 ImGui_ImplDX11_Init(m_device, m_deviceContext);
-
66
-
67 // Appliquer un thème sombre de base
-
68 ImGui::StyleColorsDark();
-
69
-
70 // Définir les couleurs pour une interface de type éditeur sobre
-
71 ImGuiStyle& style = ImGui::GetStyle();
-
72
-
73 // Palette de couleurs sobres inspirée des éditeurs modernes
-
74 ImVec4 background_dark = ImVec4(0.10f, 0.10f, 0.10f, 1.00f); // Fond foncé
-
75 ImVec4 background = ImVec4(0.15f, 0.15f, 0.15f, 1.00f); // Fond principal
-
76 ImVec4 background_light = ImVec4(0.20f, 0.20f, 0.20f, 1.00f); // Fond clair
-
77 ImVec4 accent = ImVec4(0.14f, 0.44f, 0.80f, 0.50f); // Accent bleu
-
78 ImVec4 accent_light = ImVec4(0.14f, 0.44f, 0.80f, 1.00f); // Accent bleu vif
-
79 ImVec4 text = ImVec4(1.0f, 1.0f, 1.0f, 1.00f); // Texte plus blanc
-
80 ImVec4 text_dim = ImVec4(0.70f, 0.70f, 0.70f, 1.00f);
-
81
-
82 // Ajustements de style généraux
-
83 style.WindowPadding = ImVec2(4.0f, 4.0f); // Moins de padding dans les fenêtres
-
84 style.FramePadding = ImVec2(4.0f, 3.0f); // Moins de padding dans les cadres
-
85 style.ItemSpacing = ImVec2(4.0f, 3.0f); // Moins d'espace entre les widgets
-
86 style.ItemInnerSpacing = ImVec2(3.0f, 3.0f); // Moins d'espace interne
-
87 style.DisplayWindowPadding = ImVec2(0.0f, 0.0f); // Pas de padding pour l'affichage
-
88 style.DisplaySafeAreaPadding = ImVec2(0.0f, 0.0f);
-
89 style.TouchExtraPadding = ImVec2(0.0f, 0.0f);
-
90 style.IndentSpacing = 20.0f;
-
91 style.ScrollbarSize = 14.0f;
-
92 style.GrabMinSize = 10.0f;
-
93
-
94 // Arrondis
-
95 style.WindowRounding = 4.0f;
-
96 style.ChildRounding = 4.0f;
-
97 style.FrameRounding = 3.0f;
-
98 style.PopupRounding = 4.0f;
-
99 style.ScrollbarRounding = 9.0f;
-
100 style.GrabRounding = 3.0f;
-
101 style.TabRounding = 4.0f;
-
102
-
103 // Couleurs principales
-
104 style.Colors[ImGuiCol_Text] = text;
-
105 style.Colors[ImGuiCol_TextDisabled] = text_dim;
-
106 style.Colors[ImGuiCol_WindowBg] = background;
-
107 style.Colors[ImGuiCol_ChildBg] = background_dark;
-
108 style.Colors[ImGuiCol_PopupBg] = background_dark;
-
109 style.Colors[ImGuiCol_Border] = ImVec4(0.25f, 0.25f, 0.27f, 1.00f);
-
110 style.Colors[ImGuiCol_BorderShadow] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
-
111
-
112 // Encadrements
-
113 style.Colors[ImGuiCol_FrameBg] = background_light;
-
114 style.Colors[ImGuiCol_FrameBgHovered] = ImVec4(0.25f, 0.25f, 0.25f, 1.00f);
-
115 style.Colors[ImGuiCol_FrameBgActive] = ImVec4(0.30f, 0.30f, 0.30f, 1.00f);
-
116
-
117 // Titres
-
118 style.Colors[ImGuiCol_TitleBg] = background_dark;
-
119 style.Colors[ImGuiCol_TitleBgActive] = accent;
-
120 style.Colors[ImGuiCol_TitleBgCollapsed] = ImVec4(0.12f, 0.12f, 0.12f, 0.90f);
-
121
-
122 // Éléments de menu
-
123 style.Colors[ImGuiCol_MenuBarBg] = background_dark;
-
124 style.Colors[ImGuiCol_ScrollbarBg] = background_dark;
-
125 style.Colors[ImGuiCol_ScrollbarGrab] = ImVec4(0.40f, 0.40f, 0.40f, 1.00f);
-
126 style.Colors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.50f, 0.50f, 0.50f, 1.00f);
-
127 style.Colors[ImGuiCol_ScrollbarGrabActive] = ImVec4(0.60f, 0.60f, 0.60f, 1.00f);
-
128
-
129 // Boutons et interactions
-
130 style.Colors[ImGuiCol_CheckMark] = accent_light;
-
131 style.Colors[ImGuiCol_SliderGrab] = accent;
-
132 style.Colors[ImGuiCol_SliderGrabActive] = accent_light;
-
133 style.Colors[ImGuiCol_Button] = background_light;
-
134 style.Colors[ImGuiCol_ButtonHovered] = ImVec4(0.30f, 0.30f, 0.30f, 1.00f);
-
135 style.Colors[ImGuiCol_ButtonActive] = accent;
-
136
-
137 // En-têtes et onglets
-
138 style.Colors[ImGuiCol_Header] = ImVec4(0.20f, 0.20f, 0.20f, 1.00f);
-
139 style.Colors[ImGuiCol_HeaderHovered] = ImVec4(0.25f, 0.25f, 0.25f, 1.00f);
-
140 style.Colors[ImGuiCol_HeaderActive] = accent;
-
141
-
142 style.Colors[ImGuiCol_Separator] = ImVec4(0.28f, 0.28f, 0.28f, 1.00f);
-
143 style.Colors[ImGuiCol_SeparatorHovered] = ImVec4(0.45f, 0.45f, 0.45f, 1.00f);
-
144 style.Colors[ImGuiCol_SeparatorActive] = accent;
-
145
-
146 style.Colors[ImGuiCol_Tab] = background_dark;
-
147 style.Colors[ImGuiCol_TabHovered] = accent;
-
148 style.Colors[ImGuiCol_TabActive] = accent;
-
149 style.Colors[ImGuiCol_TabUnfocused] = background_dark;
-
150 style.Colors[ImGuiCol_TabUnfocusedActive] = background;
-
151
-
152 // Autres éléments
-
153 style.Colors[ImGuiCol_DockingPreview] = accent;
-
154 style.Colors[ImGuiCol_DockingEmptyBg] = background_light;
-
155
-
156 // Charger une police avec une meilleure netteté
-
157 ImFontConfig fontConfig;
-
158 fontConfig.OversampleH = 2; // Suréchantillonnage horizontal
-
159 fontConfig.OversampleV = 2; // Suréchantillonnage vertical
-
160 fontConfig.PixelSnapH = true; // Alignement sur la grille de pixels
-
161 fontConfig.RasterizerMultiply = 1.2f; // Légère augmentation de l'épaisseur
-
162 io->Fonts->AddFontDefault(&fontConfig);
-
163
-
164 io->Fonts->Build();
-
165
-
166 // OU charger une police personnalisée (décommenter si vous avez la police)
-
167 // io->Fonts->AddFontFromFileTTF("assets/fonts/roboto.ttf", 16.0f, &fontConfig);
-
168
-
169
-
170 unsigned char* pixels;
-
171 int width, height;
-
172 io->Fonts->GetTexDataAsRGBA32(&pixels, &width, &height);
-
173
-
174 // initialize the scene manager
-
175 scene_manager_ = new scene_manager;
-
176 if (!scene_manager_->initialize(app_.get())) {
-
177 Logger::Get().Log("Failed to initialize scene manager", __FILE__, __LINE__, Logger::LogLevel::Error);
-
178 return false;
-
179 }
-
180
-
181 stats_ = app_->get_stats();
-
182
-
183 total_triangle_count_ = stats_->get_triangle_count_ptr();
-
184 total_vertex_count_ = stats_->get_vertex_count_ptr();
-
185
-
186 Logger::Get().Log("imgui initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
187
-
188 return true;
-
189}
-
-
190
-
- -
192{
-
193 Logger::Get().Log("Shutting down imgui", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
194 ImGui_ImplDX11_Shutdown();
-
195 ImGui_ImplWin32_Shutdown();
-
196 ImGui::DestroyContext();
-
197 Logger::Get().Log("imgui shutdown", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
198}
-
-
199
-
- -
201{
-
202 ImGui::Render();
-
203
-
204 //app->get_direct_3d()->turn_z_buffer_off();
-
205 //app->get_direct_3d()->enable_alpha_blending();
-
206
-
207 ImGui_ImplDX11_RenderDrawData(ImGui::GetDrawData());
-
208
-
209 //app->get_direct_3d()->disable_alpha_blending();
-
210 //app->get_direct_3d()->turn_z_buffer_on();
-
211}
-
-
212
-
- -
214{
-
215 ImGui_ImplDX11_NewFrame();
-
216 ImGui_ImplWin32_NewFrame();
-
217 ImGui::NewFrame();
-
218}
-
-
219
-
- -
221 // Configuration du style pour supprimer l'espace autour des fenêtres dockées
-
222 ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f));
-
223 ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f);
-
224 ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f);
-
225
-
226 // Configuration du style pour les nœuds de dock
-
227 ImGui::PushStyleVar(ImGuiStyleVar_DockingSeparatorSize, 1.0f); // Réduit l'épaisseur des séparateurs
-
228
-
229 // Configuration de la fenêtre principale
-
230 ImGuiWindowFlags window_flags = ImGuiWindowFlags_MenuBar | ImGuiWindowFlags_NoDocking;
-
231 ImGuiViewport* viewport = ImGui::GetMainViewport();
-
232 ImGui::SetNextWindowPos(viewport->Pos);
-
233 ImGui::SetNextWindowSize(viewport->Size);
-
234 ImGui::SetNextWindowViewport(viewport->ID);
-
235 window_flags |= ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove;
-
236 window_flags |= ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_NoNavFocus;
-
237
-
238 ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(0, 0, 0, 0));
-
239
-
240 ImGui::Begin("DockSpace", nullptr, window_flags);
-
241
-
242 // Pop des styles après avoir créé la fenêtre principale
-
243 ImGui::PopStyleVar(4); // 4 car nous avons poussé 4 variables de style
-
244 ImGui::PopStyleColor();
-
245
-
246 // Configuration du DockSpace
-
247 ImGuiID dockspace_id = ImGui::GetID("MainDockSpace");
-
248 ImGuiDockNodeFlags dockspace_flags = ImGuiDockNodeFlags_PassthruCentralNode;
-
249 ImGui::DockSpace(dockspace_id, ImVec2(0.0f, 0.0f), dockspace_flags);
-
250
-
251 if (ImGui::BeginMenuBar()) {
-
252 if (ImGui::BeginMenu("Windows")) {
-
253 ImGui::MenuItem("Object Window", NULL, &showObjectWindow);
-
254 ImGui::MenuItem("Terrain Window", NULL, &showTerrainWindow);
-
255 ImGui::MenuItem("Light Window", NULL, &showLightWindow);
-
256 ImGui::MenuItem("Engine Settings Window", NULL, &showEngineSettingsWindow);
-
257 ImGui::MenuItem("Log Window", NULL, &showLogWindow);
-
258 ImGui::MenuItem("render Stats", NULL, &showStatsWindow);
-
259 ImGui::EndMenu();
-
260 }
-
261
-
262 if (ImGui::BeginMenu("Scene")) {
-
263 if (ImGui::MenuItem("Save Scene")) {
-
264 scene_manager_->save_scene();
-
265 }
-
266 if (ImGui::MenuItem("Save Scene As...")) {
-
267 scene_manager_->save_scene_as();
-
268 }
-
269 if (ImGui::MenuItem("Load Scene")) {
-
270 scene_manager_->load_scene();
-
271 }
-
272 ImGui::EndMenu();
-
273 }
-
274
-
275 ImGui::EndMenuBar();
-
276 }
-
277
-
278 ImGui::End();
-
279}
-
-
280
-
- -
282{
-
283 ImGui::SliderFloat("Speed", speed, 0.0f, 100.0f);
-
284}
-
-
285
-
- -
287{
-
288 static int counter = 0;
-
289
-
290 if (ImGui::Button("Button")) // Buttons return true when clicked (most widgets return true when edited/activated)
-
291 counter++;
-
292 ImGui::SameLine();
-
293 ImGui::Text("counter = %d", counter);
-
294}
-
-
295
-
- -
297{
-
298 if (ImGui::CollapsingHeader("Objects"))
-
299 {
-
300 if (ImGui::Button("Add Cube"))
-
301 {
-
302 app_->add_cube();
-
303 }
-
304 ImGui::SameLine();
-
305 if (ImGui::Button("Import Object"))
-
306 {
-
307 // Open file dialog
-
308 OPENFILENAME ofn;
-
309 WCHAR szFile[260];
-
310 ZeroMemory(&ofn, sizeof(ofn));
-
311 ofn.lStructSize = sizeof(ofn);
-
312 ofn.hwndOwner = NULL;
-
313 ofn.lpstrFile = szFile;
-
314 ofn.lpstrFile[0] = '\0';
-
315 ofn.nMaxFile = sizeof(szFile);
-
316 ofn.lpstrFilter = L"OBJ\0*.obj\0KOBJ\0*.kobj\0TXT\0*.txt";
-
317 ofn.nFilterIndex = 1;
-
318 ofn.lpstrFileTitle = NULL;
-
319 ofn.nMaxFileTitle = 0;
-
320 ofn.lpstrInitialDir = NULL;
-
321 ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
-
322
-
323 if (GetOpenFileName(&ofn))
-
324 {
-
325 std::wstring filepath = ofn.lpstrFile;
-
326
-
327 WCHAR exePath[MAX_PATH];
-
328 GetModuleFileName(NULL,exePath,MAX_PATH);
-
329 std::wstring exeDir = exePath;
-
330 size_t pos = exeDir.find_last_of(L"\\/");
-
331 if(pos != std::wstring::npos)
-
332 {
-
333 exeDir = exeDir.substr(0, pos);
-
334 }
-
335
-
336 std::wstring targetDir = exeDir + L"\\Content\\Assets\\Kobject";
-
337
-
338
-
339 DWORD ftyp = GetFileAttributesW(targetDir.c_str());
-
340 if( ftyp == INVALID_FILE_ATTRIBUTES)
-
341 {
-
342 std::wstring contentDir = exeDir + L"\\Content";
-
343 if (GetFileAttributes(contentDir.c_str()) == INVALID_FILE_ATTRIBUTES)
-
344 {
-
345 CreateDirectory(contentDir.c_str(), NULL);
-
346 }
-
347 std::wstring assetsDir = contentDir + L"\\Assets";
-
348 if (GetFileAttributes(assetsDir.c_str()) == INVALID_FILE_ATTRIBUTES)
-
349 {
-
350 CreateDirectory(assetsDir.c_str(), NULL);
-
351 }
-
352 std::wstring kobjectDir = assetsDir + L"\\Kobject";
-
353 if (GetFileAttributes(kobjectDir.c_str()) == INVALID_FILE_ATTRIBUTES)
-
354 {
-
355 CreateDirectory(kobjectDir.c_str(), NULL);
-
356 }
-
357 }
-
358
-
359 size_t posFile = filepath.find_last_of(L"\\/");
-
360 std::wstring filename = (posFile != std::wstring::npos) ? filepath.substr(posFile + 1) : filepath;
-
361
-
362 std::wstring targetPath = targetDir + L"\\" + filename;
-
363
-
364 if (!CopyFile(filepath.c_str(), targetPath.c_str(), FALSE))
-
365 {
-
366 // En cas d'erreur, vous pouvez gérer ici l'erreur (par exemple afficher un message)
-
367 MessageBox(NULL, L"Erreur lors de la copie du fichier.", L"Erreur", MB_OK);
-
368 }
-
369 else
-
370 {
-
371 // On récupère le chemin relatif par rapport à exeDir
-
372 std::wstring relativePath = targetPath.substr(exeDir.size());
-
373
-
374 // Suppression du premier caractère s'il s'agit d'un antislash
-
375 if (!relativePath.empty() && (relativePath[0] == L'\\' || relativePath[0] == L'/'))
-
376 {
-
377 relativePath.erase(0, 1);
-
378 }
-
379
-
380 // Remplacer les antislashs par des slashs
-
381 std::replace(relativePath.begin(), relativePath.end(), L'\\', L'/');
-
382 app_->add_kobject(relativePath);
-
383 }
-
384
-
385 }
-
386
-
387 }
-
388 ImGui::SameLine();
-
389 ImGui::Text("Number of cubes: %d", app_->get_entity_manager()->GetEntityCount());
-
390 }
-
391}
-
-
392
-
- -
394{
-
395 ImGui::Begin("Objects", &showObjectWindow);
-
396
-
397 // Obtenir toutes les entités avec un composant d'identité et de transformation
-
398 auto entities = app_->get_entity_manager()->GetEntitiesWithComponent<ecs::IdentityComponent>();
-
399
-
400 int index = 0;
-
401 for (auto& entity : entities)
-
402 {
-
403 auto identity = entity->GetComponent<ecs::IdentityComponent>();
-
404 auto transform = entity->GetComponent<ecs::TransformComponent>();
-
405 auto render = entity->GetComponent<ecs::RenderComponent>();
-
406 auto shader = entity->GetComponent<ecs::ShaderComponent>();
-
407 auto physics = entity->GetComponent<ecs::PhysicsComponent>();
-
408
-
409 if (identity && transform)
-
410 {
-
411 std::string headerName = identity->GetName() + " " + std::to_string(identity->GetId());
-
412 if (ImGui::CollapsingHeader(headerName.c_str()))
-
413 {
-
414 // Position, Rotation, Scale
-
415 XMVECTOR position = transform->GetPosition();
-
416 XMVECTOR rotation = transform->GetRotation();
-
417 XMVECTOR scale = transform->GetScale();
-
418
-
419 float pos[3] = { XMVectorGetX(position), XMVectorGetY(position), XMVectorGetZ(position) };
-
420 std::string posLabel = "Position##" + std::to_string(identity->GetId());
-
421 if (ImGui::DragFloat3(posLabel.c_str(), pos))
-
422 {
-
423 transform->SetPosition(XMVectorSet(pos[0], pos[1], pos[2], 0.0f));
-
424 transform->UpdateWorldMatrix();
-
425 }
-
426
-
427 float rot[3] = { XMVectorGetX(rotation), XMVectorGetY(rotation), XMVectorGetZ(rotation) };
-
428 std::string rotLabel = "Rotation##" + std::to_string(identity->GetId());
-
429 if (ImGui::DragFloat3(rotLabel.c_str(), rot))
-
430 {
-
431 transform->SetRotation(XMVectorSet(rot[0], rot[1], rot[2], 0.0f));
-
432 transform->UpdateWorldMatrix();
-
433 }
-
434
-
435 float scl[3] = { XMVectorGetX(scale), XMVectorGetY(scale), XMVectorGetZ(scale) };
-
436 std::string sclLabel = "Scale##" + std::to_string(identity->GetId());
-
437 if (ImGui::DragFloat3(sclLabel.c_str(), scl))
-
438 {
-
439 transform->SetScale(XMVectorSet(scl[0], scl[1], scl[2], 0.0f));
-
440 transform->UpdateWorldMatrix();
-
441 }
-
442
-
443 ImGui::Separator();
-
444
-
445 // Textures - Seulement si le composant de rendu existe
-
446 if (render && render->GetModel())
-
447 {
-
448 // Définir les types de textures_
-
449 std::vector<std::string> textureCategories = {
-
450 "Diffuse", "Normal", "Specular", "Alpha"
-
451 };
-
452
-
453 std::vector<TextureType> textureTypes = {
-
454 TextureType::Diffuse, TextureType::Normal,
-
455 TextureType::Specular, TextureType::Alpha
-
456 };
-
457
-
458 // Créer un espace pour afficher les textures_ avec défilement
-
459 std::string textureChildId = "TextureChild##" + std::to_string(identity->GetId());
-
460 ImGui::BeginChild(textureChildId.c_str(), ImVec2(0, 200), true, ImGuiWindowFlags_HorizontalScrollbar);
-
461
-
462 // Pour chaque type de texture
-
463 for (int typeIndex = 0; typeIndex < textureCategories.size(); typeIndex++)
-
464 {
-
465 TextureType type = textureTypes[typeIndex];
-
466 std::string typeName = textureCategories[typeIndex];
-
467
-
468 // Afficher le titre de la catégorie
-
469 std::string categoryLabel = typeName + "##" + std::to_string(identity->GetId());
-
470 ImGui::Text("%s:", typeName.c_str());
-
471 ImGui::SameLine();
-
472
-
473 // Compter combien de textures_ de ce type existent
-
474 int textureCount = 0;
-
475 while (render->GetModel()->GetTexture(type, textureCount) != nullptr)
-
476 {
-
477 textureCount++;
-
478 }
-
479
-
480 // Afficher toutes les textures_ existantes
-
481 std::string groupId = "TextureGroup_" + std::to_string(identity->GetId()) + "_" + std::to_string(typeIndex);
-
482 ImGui::BeginGroup();
-
483 for (int texIndex = 0; texIndex < textureCount; texIndex++)
-
484 {
-
485 ID3D11ShaderResourceView* texture = render->GetModel()->GetTexture(type, texIndex);
-
486 if (texture)
-
487 {
-
488 // ID unique pour chaque bouton de texture
-
489 std::string buttonId = "tex##" + std::to_string(identity->GetId()) + "_" +
-
490 std::to_string(typeIndex) + "_" +
-
491 std::to_string(texIndex);
-
492
-
493 if (ImGui::ImageButton(buttonId.c_str(), (ImTextureID)texture, ImVec2(48, 48)))
-
494 {
-
495 // Ouvrir une boîte de dialogue pour changer la texture
-
496 OPENFILENAME ofn;
-
497 WCHAR szFile[260] = {0};
-
498 ZeroMemory(&ofn, sizeof(ofn));
-
499 ofn.lStructSize = sizeof(ofn);
-
500 ofn.hwndOwner = NULL;
-
501 ofn.lpstrFile = szFile;
-
502 ofn.nMaxFile = sizeof(szFile);
-
503 ofn.lpstrFilter = L"Texture\0*.png;*.jpg;*.dds\0";
-
504 ofn.nFilterIndex = 1;
-
505 ofn.lpstrInitialDir = NULL;
-
506 ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
-
507
-
508 if (GetOpenFileName(&ofn))
-
509 {
-
510 // Changer la texture existante
-
511 render->GetModel()->ChangeTexture(m_device, m_deviceContext, ofn.lpstrFile, type, texIndex);
-
512 }
-
513 }
-
514
-
515 // Afficher l'indice de texture et prévisualisation au survol
-
516 if (ImGui::IsItemHovered())
-
517 {
-
518 ImGui::BeginTooltip();
-
519 ImGui::Text("%s %d", typeName.c_str(), texIndex);
-
520 ImGui::Image((ImTextureID)texture, ImVec2(192, 192));
-
521 ImGui::EndTooltip();
-
522 }
-
523
-
524 ImGui::SameLine();
-
525 }
-
526 }
-
527
-
528 // Bouton pour ajouter une nouvelle texture
-
529 std::string addButtonLabel = "+##" + std::to_string(identity->GetId()) + "_" + std::to_string(typeIndex);
-
530 if (ImGui::Button(addButtonLabel.c_str(), ImVec2(48, 48)))
-
531 {
-
532 // Ouvrir une boîte de dialogue pour ajouter une texture
-
533 OPENFILENAME ofn;
-
534 WCHAR szFile[260] = {0};
-
535 ZeroMemory(&ofn, sizeof(ofn));
-
536 ofn.lStructSize = sizeof(ofn);
-
537 ofn.hwndOwner = NULL;
-
538 ofn.lpstrFile = szFile;
-
539 ofn.nMaxFile = sizeof(szFile);
-
540 ofn.lpstrFilter = L"Texture\0*.png;*.jpg;*.dds\0";
-
541 ofn.nFilterIndex = 1;
-
542 ofn.lpstrInitialDir = NULL;
-
543 ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
-
544
-
545 if (GetOpenFileName(&ofn))
-
546 {
-
547 // Ajouter une nouvelle texture
-
548 render->GetModel()->AddTexture(m_device, m_deviceContext, ofn.lpstrFile, type);
-
549 }
-
550 }
-
551
-
552 ImGui::EndGroup();
-
553 ImGui::Separator();
-
554 }
-
555
-
556 ImGui::EndChild();
-
557 }
-
558
-
559 ImGui::Separator();
-
560
-
561 // Delete button
-
562 std::string deleteLabel = "Delete##" + std::to_string(identity->GetId());
-
563 if (ImGui::Button(deleteLabel.c_str()))
-
564 {
-
565 app_->delete_entity_by_id(identity->GetId());
-
566 // Sortir du boucle après suppression pour éviter des accès invalides
-
567 break;
-
568 }
-
569
-
570 ImGui::Separator();
-
571
-
572 // Shader options
-
573 if (shader)
-
574 {
-
575 // Liste des options de shader
-
576 const char* shaderOptions[] = {
-
577 "Enable Global Lighting",
-
578 "Enable Lighting",
-
579 "Enable Cel Shading",
-
580 "Enable Normal Mapping",
-
581 "Enable Specular Mapping",
-
582 "Enable Alpha Mapping"
-
583 };
-
584
-
585 std::vector<ecs::ShaderType> shaderTypes = {
-
586 ecs::ShaderType::SUNLIGHT,
-
587 ecs::ShaderType::LIGHTING,
-
588 ecs::ShaderType::CEL_SHADING,
-
589 ecs::ShaderType::NORMAL_MAPPING,
-
590 ecs::ShaderType::SPECULAR_MAPPING,
-
591 ecs::ShaderType::ALPHA_MAPPING
-
592 };
-
593
-
594 // Trouver l'index actuel du shader pour cette entité spécifique
-
595 int currentShader = 0;
-
596 ecs::ShaderType activeShader = shader->GetActiveShader();
-
597 for (size_t i = 0; i < shaderTypes.size(); i++)
-
598 {
-
599 if (shaderTypes[i] == activeShader)
-
600 {
-
601 currentShader = static_cast<int>(i);
-
602 break;
-
603 }
-
604 }
-
605
-
606 // Création du menu déroulant avec un ID unique pour chaque entité
-
607 std::string shaderComboId = "Shader Options##" + std::to_string(identity->GetId());
-
608 if (ImGui::BeginCombo(shaderComboId.c_str(), shaderOptions[currentShader]))
-
609 {
-
610 for (int i = 0; i < IM_ARRAYSIZE(shaderOptions); i++)
-
611 {
-
612 // Crée une option sélectionnable pour chaque shader avec ID unique
-
613 std::string shaderSelectableId = std::to_string(i) + "##shader_" + std::to_string(identity->GetId());
-
614 bool isSelected = (currentShader == i);
-
615 if (ImGui::Selectable(shaderOptions[i], isSelected))
-
616 {
-
617 // Met à jour l'option sélectionnée uniquement pour cette entité
-
618 currentShader = i;
-
619 shader->SetActiveShader(shaderTypes[i]);
-
620 }
-
621
-
622 // Si l'option sélectionnée est active, nous mettons en surbrillance
-
623 if (isSelected)
-
624 ImGui::SetItemDefaultFocus();
-
625 }
-
626 ImGui::EndCombo();
-
627 }
-
628 }
-
629
-
630 ImGui::Separator();
-
631
-
632 // Physics
-
633 bool isPhysicsEnabled = (physics != nullptr);
-
634 std::string physicsLabel = "Physics##" + std::to_string(identity->GetId());
-
635
-
636 if (ImGui::Checkbox(physicsLabel.c_str(), &isPhysicsEnabled))
-
637 {
-
638 if (isPhysicsEnabled && !physics)
-
639 {
-
640 // Ajouter un composant de physique
-
641 physics = entity->AddComponent<ecs::PhysicsComponent>();
-
642 physics->Initialize();
-
643 }
-
644 else if (!isPhysicsEnabled && physics)
-
645 {
-
646 // Retirer le composant de physique
-
647 entity->RemoveComponent<ecs::PhysicsComponent>();
-
648 physics = nullptr;
-
649 }
-
650 }
-
651
-
652 if (physics)
-
653 {
-
654 // Gravity Enabled checkbox
-
655 bool gravityEnabled = physics->IsGravityEnabled();
-
656 std::string gravityLabel = "Gravity##" + std::to_string(identity->GetId());
-
657 if (ImGui::Checkbox(gravityLabel.c_str(), &gravityEnabled))
-
658 {
-
659 physics->SetGravityEnabled(gravityEnabled);
-
660 }
-
661
-
662 // 3 radio buttons pour le type d'objet physique avec IDs uniques
-
663 std::string typeLabel = "Type##" + std::to_string(identity->GetId());
-
664 ecs::ObjectType type = identity->GetType();
-
665
-
666 if (ImGui::RadioButton(("None##" + std::to_string(identity->GetId())).c_str(),
-
667 type == ecs::ObjectType::Unknown))
-
668 {
-
669 identity->SetType(ecs::ObjectType::Unknown);
-
670 }
-
671 ImGui::SameLine();
-
672 if (ImGui::RadioButton(("Cube##" + std::to_string(identity->GetId())).c_str(),
-
673 type == ecs::ObjectType::Cube))
-
674 {
-
675 identity->SetType(ecs::ObjectType::Cube);
-
676 }
-
677 ImGui::SameLine();
-
678 if (ImGui::RadioButton(("Sphere##" + std::to_string(identity->GetId())).c_str(),
-
679 type == ecs::ObjectType::Sphere))
-
680 {
-
681 identity->SetType(ecs::ObjectType::Sphere);
-
682 }
-
683 ImGui::SameLine();
-
684 if (ImGui::RadioButton(("Terrain##" + std::to_string(identity->GetId())).c_str(),
-
685 type == ecs::ObjectType::Terrain))
-
686 {
-
687 identity->SetType(ecs::ObjectType::Terrain);
-
688 }
-
689
-
690 }
-
691
-
692 ImGui::Separator();
-
693 }
-
694 index++;
-
695 }
-
696 }
-
697
-
698 ImGui::End();
-
699}
-
-
700
-
- -
702{
-
703 ImGui::Begin("Terrain", &showTerrainWindow);
-
704
-
705 ImGui::Text("Number of terrain cubes: %d", app_->get_terrain_entity_count());
-
706
-
707 ImGui::Separator();
-
708
-
709 if (ImGui::Button("Generate Flat Terrain"))
-
710 {
-
711 app_->generate_terrain();
-
712 }
-
713
-
714 ImGui::Separator();
-
715
-
716 // Input for the number of cubes on each side
-
717 ImGui::Text("Number of cubes on each side: ");
-
718 ImGui::SameLine();
-
719 ImGui::InputInt("##SideCount", &m_SideCount);
-
720 if (m_SideCount < 1)
-
721 {
-
722 m_SideCount = 1;
-
723 }
-
724
-
725 ImGui::Separator();
-
726
-
727 if (ImGui::Button("Generate BigCube Terrain"))
-
728 {
-
729 app_->create_big_cube(m_SideCount);
-
730 }
-
731
-
732 ImGui::Separator();
-
733
-
734 if (ImGui::Button("Delete All Terrain Cubes"))
-
735 {
-
736 app_->delete_terrain();
-
737 }
-
738
-
739
-
740
-
741 ImGui::End();
-
742}
-
-
743
-
- -
745{
-
746 // Start the Dear ImGui frame
-
747 NewFrame();
-
748
-
749 // Setup the dockspace
- -
751
-
752 //ImGui Widget
-
753 ImGui::Begin("Khaotic Engine", NULL);
-
754
-
755 float speed = app_->get_speed();
-
756
-
757 WidgetSpeedSlider(&speed);
-
758 app_->set_speed(speed);
-
759 WidgetButton();
- -
761
-
762 ImGui::End();
-
763
-
764 // Read the widget list and call the function if the show variable is true
-
765 for (const auto& entry : widgets_)
-
766 {
-
767 if (*entry.show == true) {entry.func();}
-
768 }
-
769
-
770 //render imgui
-
771 Render();
-
772
-
773 return true;
-
774}
-
-
775
-
- -
777{
-
778 ImGui::Begin("Light", &showLightWindow);
-
779
-
780
-
781 // Sun light settings
-
782 light_class* sunLight = app_->get_sun_light();
-
783 // Direction input
-
784 XMFLOAT3 direction = sunLight->GetDirection();
-
785 float dir[3] = { direction.x, direction.y, direction.z };
-
786 if (ImGui::DragFloat3("Sun Direction", dir))
-
787 {
-
788 sunLight->SetDirection(dir[0], dir[1], dir[2]);
-
789 }
-
790 // Color input
-
791 XMFLOAT4 color = sunLight->GetDiffuseColor();
-
792 float col[3] = { color.x, color.y, color.z };
-
793 if (ImGui::ColorEdit3("Sun Color", col))
-
794 {
-
795 sunLight->SetDiffuseColor(col[0], col[1], col[2], 1.0f);
-
796 }
-
797 // Intensity input
-
798 float intensity = sunLight->GetIntensity();
-
799 if (ImGui::DragFloat("Sun Intensity", &intensity, 0.1f, 0.0f, 100.0f))
-
800 {
-
801 sunLight->SetIntensity(intensity);
-
802 }
-
803
-
804
-
805 ImGui::Separator();
-
806
-
807 int index = 0;
-
808
-
809 // Area light settings
-
810
-
811 for(auto& light : app_->get_lights())
-
812 {
-
813 std::string headerName = "Light " + std::to_string(index);
-
814 if (ImGui::CollapsingHeader(headerName.c_str()))
-
815 {
-
816 XMVECTOR position = app_->get_light_position(index);
-
817 XMVECTOR color = app_->get_light_color(index);
-
818 float pos[3] = { XMVectorGetX(position), XMVectorGetY(position), XMVectorGetZ(position) };
-
819 float col[3] = { XMVectorGetX(color), XMVectorGetY(color), XMVectorGetZ(color) };
-
820
-
821 std::string posLabel = "Position##" + std::to_string(index);
-
822 std::string colLabel = "Color##" + std::to_string(index);
-
823
-
824 if (ImGui::DragFloat3(posLabel.c_str(), pos))
-
825 {
-
826 app_->set_light_position(index, XMVectorSet(pos[0], pos[1], pos[2], 0.0f));
-
827 }
-
828
-
829 if (ImGui::ColorEdit3(colLabel.c_str(), col))
-
830 {
-
831 app_->set_light_color(index, XMVectorSet(col[0], col[1], col[2], 0.0f));
-
832 }
-
833
-
834 }
-
835 index++;
-
836 };
-
837
-
838 ImGui::End();
-
839}
-
-
840
-
- -
842{
-
843 ImGui::Begin("Engine Settings", &showEngineSettingsWindow);
-
844
-
845 // Begining Of General Setting
-
846 ImGui::Text("General");
-
847
-
848 // Checkbox for toggling vsync globally in the application class by calling the set_vsync function in the application class when the checkbox state changes
-
849 bool vsync = app_->get_vsync();
-
850 if (ImGui::Checkbox("Vsync", &vsync))
-
851 {
-
852 app_->set_vsync(vsync);
-
853 }
-
854
-
855 // End Of General Setting
-
856 ImGui::Separator();
-
857 // culling section
-
858 ImGui::Text("Culling");
-
859
-
860 // float input for frustum tolerance
-
861 float frustumTolerance = app_->get_frustum_tolerance();
-
862 if (ImGui::DragFloat("Frustum Tolerance", &frustumTolerance, 0.1f, 0.0f, 100.0f))
-
863 {
-
864 app_->set_frustum_tolerance(frustumTolerance);
-
865 }
-
866
-
867 // End Of Culling Setting
-
868 ImGui::Separator();
-
869
-
870 // physics section
-
871 ImGui::Text("physics");
-
872
-
873 // Input To set the Fixed Update Interval
-
874 int physicsInterval = app_->get_physics_tick_rate();
-
875 if (ImGui::InputInt("physics Tick Rate", &physicsInterval))
-
876 {
-
877 app_->set_physics_tick_rate(physicsInterval);
-
878 }
-
879
-
880 // Input to change the gravity on same line
-
881 XMVECTOR gravity = app_->get_physics()->GetGravity();
-
882 float gravityValues[3] = { XMVectorGetX(gravity), XMVectorGetY(gravity), XMVectorGetZ(gravity) };
-
883 if (ImGui::DragFloat3("Gravity", gravityValues))
-
884 {
-
885 app_->get_physics()->SetGravity(XMVectorSet(gravityValues[0], gravityValues[1], gravityValues[2], 0.0f));
-
886 }
-
887
-
888 ImGui::End();
-
889}
-
-
890
-
- -
892{
-
893 ImGui::Begin("Log Window" , &showLogWindow);
-
894
-
895 // Filtre de recherche
-
896 static ImGuiTextFilter filter;
-
897 filter.Draw("Filter ", 180);
-
898
-
899 ImGui::SameLine();
-
900
-
901 // Bouton pour ouvrir le fichier de log
-
902 if (ImGui::Button("Open Log File"))
-
903 {
-
904 ShellExecuteA(NULL, "open", Logger::Get().m_logFilePath.c_str(), NULL, NULL, SW_SHOWNORMAL);
-
905 }
-
906
-
907 // Place the menu on the same line as the filter
-
908 ImGui::SameLine();
-
909
-
910 // Menu déroulant pour les niveaux de log
-
911 if (ImGui::BeginMenu("Log Levels"))
-
912 {
-
913 for (size_t i = 0; i < Logger::LogLevelCount; ++i)
-
914 {
-
915 bool isVisible = !Logger::Get().m_disabledLogLevels[i];
-
916 if (ImGui::Checkbox(Logger::Get().GetLogLevelInfo(static_cast<Logger::LogLevel>(i)).name, &isVisible))
-
917 {
-
918 Logger::Get().m_disabledLogLevels[i] = !isVisible;
-
919 }
-
920 }
-
921 ImGui::EndMenu();
-
922 }
-
923
-
924 const auto& logBuffer = Logger::Get().GetLogBuffer();
-
925 std::vector<Logger::LogEntry> logfiltered;
-
926 int logCount = logBuffer.size();
-
927
-
928 // Affichage des logs filtrés
-
929 ImGui::BeginChild("Log");
-
930
-
931 for (const auto& log : logBuffer)
-
932 {
-
933 if (filter.PassFilter(log.message.c_str()) && !Logger::Get().m_disabledLogLevels[static_cast<size_t>(log.level)])
-
934 {
-
935 logfiltered.push_back(log);
-
936 }
-
937 }
-
938
-
939 if (logfiltered.size() == 0)
-
940 {
-
941 ImGui::Text("No logs to display.");
-
942 }
-
943 else
-
944 {
-
945 ImGuiListClipper clipper;
-
946 clipper.Begin(logCount);
-
947 while (clipper.Step())
-
948 {
-
949 for (int i = clipper.DisplayStart; i < clipper.DisplayEnd; i++)
-
950 {
-
951 if (i < logfiltered.size()) {
-
952 const auto& log = logfiltered[i];
-
953 ImGui::TextColored(Logger::Get().GetLogLevelInfo(log.level).color, log.message.c_str());
-
954 }
-
955
-
956 }
-
957 }
-
958 clipper.End();
-
959 }
-
960
-
961 // Scroll to the bottom
-
962 if (ImGui::GetScrollY() >= ImGui::GetScrollMaxY())
-
963 {
-
964 ImGui::SetScrollHereY(1.0f);
-
965 }
-
966
-
967 ImGui::EndChild();
-
968
-
969 ImGui::End();
-
970}
-
-
971
-
-
972void imguiManager::WidgetRenderWindow(ImVec2 availableSize)
-
973{
-
974 ImGui::Begin("render Window");
-
975
-
976 ImVec2 oldWindowSize = windowSize;
-
977 windowSize = ImGui::GetContentRegionAvail();
-
978
-
979 // Si la taille de la fenêtre a changé, ajustez la taille de la fenêtre de l'application
-
980 if (oldWindowSize.x != windowSize.x || oldWindowSize.y != windowSize.y)
-
981 {
-
982 app_->set_window_size(windowSize);
-
983 }
-
984
-
985
-
986 // Get the aspect ratio of the scene in app
-
987 float aspectRatio = app_->get_aspect_ratio();
-
988 // calculate the size of the window
-
989 if (windowSize.x / windowSize.y > aspectRatio)
-
990 {
-
991 windowSize.x = windowSize.y * aspectRatio;
-
992 }
-
993 else
-
994 {
-
995 windowSize.y = windowSize.x / aspectRatio;
-
996 }
-
997
-
998 ID3D11ShaderResourceView* texture = app_->get_scene_texture()->GetShaderResourceView();
-
999 if (texture)
-
1000 {
-
1001
-
1002 // Affichez la scenne projeté sur texture dans une fenêtre ImGui
-
1003 // alpha blend is not enable to render the texture
-
1004
-
1005 app_->get_direct_3d()->turn_z_buffer_off();
-
1006 app_->get_direct_3d()->enable_alpha_blending();
-
1007
-
1008 ImGui::Image((ImTextureID)texture, windowSize, ImVec2(0, 0), ImVec2(1, 1), ImVec4(1, 1, 1, 1));
-
1009 }
-
1010 else
-
1011 {
-
1012 ImGui::Text("render texture is not available.");
-
1013 }
-
1014
-
1015 ImGui::End();
-
1016}
-
-
1017
-
- -
1019{
-
1020 ImGui::Begin("render Stats");
-
1021
-
1022 current_fps_ = stats_->get_current_fps();
-
1023 min_fps_ = stats_->get_min_fps();
-
1024 max_fps_ = stats_->get_max_fps();
-
1025 draw_calls_ = stats_->get_draw_calls();
-
1026
-
1027
-
1028 // total_vertex_count_ = stats_->get_total_vertex_count();
-
1029 // total_triangle_count_ = stats_->get_total_triangle_count();
-
1030
-
1031 visible_triangle_count_ = stats_->get_visible_triangle_count();
-
1032 current_frame_time_ = stats_->get_frame_time();
-
1033
-
1034 m_frameTimeHistory[m_frameTimeHistoryIndex] = current_frame_time_;
-
1035 m_frameTimeHistoryIndex = (m_frameTimeHistoryIndex + 1) % FRAME_HISTORY_COUNT;
-
1036
-
1037 ImGui::Text("FPS: %d", current_fps_);
-
1038 ImGui::SameLine();
-
1039 ImGui::Text("Min Fps: %d", min_fps_);
-
1040 ImGui::SameLine();
-
1041 ImGui::Text("Max Fps: %d", max_fps_);
-
1042
-
1043 ImGui::Separator();
-
1044
-
1045 // Trouver les valeurs min/max pour l'échelle du graphique
-
1046 float frameTimeMin = FLT_MAX;
-
1047 float frameTimeMax = 0.0f;
-
1048 for (int i = 0; i < FRAME_HISTORY_COUNT; i++) {
-
1049 if (m_frameTimeHistory[i] > 0.0f) {
-
1050 frameTimeMin = min(frameTimeMin, m_frameTimeHistory[i]);
-
1051 frameTimeMax = max(frameTimeMax, m_frameTimeHistory[i]);
-
1052 }
-
1053 }
-
1054 // S'assurer d'avoir au moins une petite plage
-
1055 if (frameTimeMax == 0.0f) frameTimeMax = 0.033f; // ~30 FPS
-
1056 if (frameTimeMin == FLT_MAX) frameTimeMin = 0.0f;
-
1057
-
1058 // Ajouter 10% de marge pour la lisibilité
-
1059 float margin = (frameTimeMax - frameTimeMin) * 0.1f;
-
1060 frameTimeMin = max(0.0f, frameTimeMin - margin);
-
1061 frameTimeMax += margin;
-
1062
-
1063 // Afficher le graphique
-
1064 ImGui::Text("Frame Time: %.3f ms", current_frame_time_ * 1000.0f);
-
1065 ImGui::PlotLines("FrameTimeGraph", // Au lieu de chaîne vide ""
-
1066 m_frameTimeHistory,
-
1067 FRAME_HISTORY_COUNT,
-
1068 m_frameTimeHistoryIndex,
-
1069 "",
-
1070 frameTimeMin,
-
1071 frameTimeMax,
-
1072 ImVec2(0, 80));
-
1073
-
1074 ImGui::Text("Draw Calls: %d", draw_calls_);
-
1075
-
1076 ImGui::Separator();
-
1077
-
1078 ImGui::Text("Statistiques de rendu:");
-
1079 ImGui::Text("Vertices total: %d", *total_vertex_count_);
-
1080
-
1081 ImGui::Text("Triangles total: %d", *total_triangle_count_);
-
1082 ImGui::SameLine();
-
1083 ImGui::Text("Triangles visibles: %d", visible_triangle_count_);
-
1084
-
1085 app_->get_direct_3d()->get_video_card_info(card_name_, video_memory_);
-
1086 cpu_name_ = stats_->get_cpu_name();
-
1087 version_driver_ = stats_->get_gpu_driver_version(app_->get_direct_3d()->get_device());
-
1088
-
1089 ImGui::Columns(3, "GPUCPURAMColumns", false);
-
1090 ImGui::SetColumnWidth(0, ImGui::GetWindowWidth() * 0.33f);
-
1091 ImGui::SetColumnWidth(1, ImGui::GetWindowWidth() * 0.33f);
-
1092
-
1093 // Premier collapsing header pour les informations GPU
-
1094 if (ImGui::CollapsingHeader("Informations GPU"))
-
1095 {
-
1096 ImGui::Text("Carte graphique: %s", card_name_);
-
1097 ImGui::Text("Memoire video: %d Mo", video_memory_);
-
1098 ImGui::Text("Pilote: %s", version_driver_.c_str());
-
1099 }
-
1100
-
1101 ImGui::NextColumn();
-
1102
-
1103 // Second collapsing header pour les informations CPU
-
1104 if (ImGui::CollapsingHeader("Informations CPU"))
-
1105 {
-
1106 SYSTEM_INFO sysInfo;
-
1107 GetSystemInfo(&sysInfo);
-
1108 ImGui::Text("Processeur: %s", cpu_name_.c_str());
-
1109 ImGui::Text("Nombre de coeurs: %u", sysInfo.dwNumberOfProcessors);
-
1110 ImGui::Text("Architecture: %s", (sysInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) ? "x64" : "x86");
-
1111 ImGui::Text("Taille de la page: %u octets", sysInfo.dwPageSize);
-
1112 ImGui::Text("Taille du cache: %u octets", sysInfo.dwAllocationGranularity);
-
1113 ImGui::Text("Type de processeur: %u", sysInfo.wProcessorLevel);
-
1114 ImGui::Text("Version du processeur: %u", sysInfo.wProcessorRevision);
-
1115 }
-
1116
-
1117 ImGui::NextColumn();
-
1118
-
1119 if (ImGui::CollapsingHeader("Informations RAM"))
-
1120 {
-
1121 MEMORYSTATUSEX mem_info;
-
1122 mem_info.dwLength = sizeof(MEMORYSTATUSEX);
-
1123 GlobalMemoryStatusEx(&mem_info);
-
1124 ImGui::Text("Memoire totale: %llu Mo", mem_info.ullTotalPhys / (1024 * 1024));
-
1125 ImGui::Text("Memoire disponible: %llu Mo", mem_info.ullAvailPhys / (1024 * 1024));
-
1126 ImGui::Text("Memoire utilisee: %llu Mo", (mem_info.ullTotalPhys - mem_info.ullAvailPhys) / (1024 * 1024));
-
1127 }
-
1128
-
1129 ImGui::Columns(1);
-
1130
-
1131 ImGui::End();
-
1132}
-
-
1133
-
static Logger & Get()
Definition Logger.h:20
-
const std::deque< LogEntry > & GetLogBuffer() const
Definition Logger.h:220
-
void Log(const std::string &message, const std::string &fileName, int lineNumber, LogLevel level=LogLevel::Info)
Definition Logger.h:158
-
LogLevel
Definition Logger.h:38
- - - - - - -
void WidgetObjectWindow()
-
void SetupDockspace()
-
void WidgetLightWindow()
-
bool Initialize(HWND hwnd, ID3D11Device *device, ID3D11DeviceContext *deviceContext)
-
void WidgetEngineSettingsWindow()
- -
void WidgetAddObject()
- -
void WidgetTerrainWindow()
-
void WidgetRenderWindow(ImVec2 availableSize)
-
void WidgetLogWindow()
-
bool ImGuiWidgetRenderer()
- - -
void WidgetRenderStats()
-
void WidgetSpeedSlider(float *speed)
- - - - -
bool initialize(application_class *app)
- - - - - -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:e816aa763140b870ff026f176ce6b1a8b7d8129288a7596a3c3f555700828d0b +size 188912 diff --git a/doxygen_docs/html/imgui_manager_8h_source.html b/doxygen_docs/html/imgui_manager_8h_source.html index c6958e0..5a1c710 100644 --- a/doxygen_docs/html/imgui_manager_8h_source.html +++ b/doxygen_docs/html/imgui_manager_8h_source.html @@ -1,268 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/inc/system/imguiManager.h Source File - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
imguiManager.h
-
-
-
1#pragma once
-
2#ifndef _IMGUI_MANAGER_H_
-
3#define _IMGUI_MANAGER_H_
-
4
-
5#include "Logger.h"
-
6#include "sceneManager.h"
-
7#include "fps_limiter.h"
-
8
-
9#include <imgui.h>
-
10#include <imgui_impl_dx11.h>
-
11#include <imgui_impl_win32.h>
-
12#include <windows.h>
-
13#include <deque>
-
14#include <functional>
-
15
-
16#include "render_texture_class.h"
-
17#include "scene_manager.h"
-
18
- -
20class stats;
-
21
-
- -
28{
-
29 bool* show;
-
30 std::function<void()> func;
-
31};
-
-
32
-
- -
34{
-
35public:
-
36
- - -
43
-
51 bool Initialize(HWND hwnd, ID3D11Device* device, ID3D11DeviceContext* deviceContext);
-
55 void Shutdown();
-
59 void Render();
-
63 void NewFrame();
-
68 void SetupDockspace();
-
69
-
70 // Widgets
-
75 void WidgetSpeedSlider(float* speed);
-
79 void WidgetButton();
-
83 void WidgetFPS();
-
87 void WidgetAddObject();
-
88
-
92 void WidgetObjectWindow();
- -
100 void WidgetLightWindow();
- -
109 void WidgetRenderWindow(ImVec2 availableSize);
-
113 void WidgetLogWindow();
-
119 void WidgetRenderStats();
-
125 bool ImGuiWidgetRenderer();
-
126
-
131 void SetWindowSize(ImVec2 size) { windowSize = size; }
-
136 ImVec2 GetWindowSize() const { return windowSize; }
-
137
-
142 void SetApp(std::shared_ptr<application_class> app) { app_ = app; }
-
143
-
144 // Shader toggles
-
145
-
146 bool m_EnableCelShading;
-
147
-
148private:
-
149
-
150 // --------------------------------------------- //
-
151 // ----------------- Functions ----------------- //
-
152 // --------------------------------------------- //
-
153
-
154 // --------------------------------------------- //
-
155 // ----------------- Variables ----------------- //
-
156 // --------------------------------------------- //
-
157
-
158 std::vector<widget_entry> widgets_;
-
159
-
160 std::shared_ptr<application_class> app_;
-
161 scene_manager* scene_manager_;
-
162 stats* stats_;
-
163
-
164 bool showObjectWindow;
-
165 bool showTerrainWindow;
-
166 bool showLightWindow;
-
167 bool showOldSceneWindow;
-
168 bool showEngineSettingsWindow;
-
169 bool showLogWindow;
-
170 bool showStatsWindow;
-
171
-
172 int m_SideCount = 0;
-
173
-
174 static const int FRAME_HISTORY_COUNT = 3600; // 1min secondes à 60 FPS
-
175 float m_frameTimeHistory[FRAME_HISTORY_COUNT] = {};
-
176 int m_frameTimeHistoryIndex = 0;
-
177
-
178 bool m_isPhyiscsEnabled = false;
-
179 bool m_isGravityEnabled = false;
-
180
-
181 ImGuiIO* io;
-
182
-
183 ID3D11Device* m_device;
-
184 ID3D11DeviceContext* m_deviceContext;
-
185 ImVec2 windowSize;
-
186
-
187 render_texture_class* m_renderTexture;
-
188
-
189 const std::deque<Logger::LogEntry>& logBuffer = Logger::Get().GetLogBuffer();
-
190
-
191 int current_fps_, min_fps_, max_fps_, draw_calls_, visible_triangle_count_;
-
192 float current_frame_time_, min_frame_time_, max_frame_time_ ;
-
193
-
194 std::shared_ptr<int> total_vertex_count_;
-
195 std::shared_ptr<int> total_triangle_count_;
-
196
-
197 // gpu information
-
198 char card_name_[128];
-
199 int video_memory_ = 0;
-
200
-
201 // cpu information
-
202 std::string cpu_name_;
-
203 std::string version_driver_;
-
204};
-
-
205
-
206#endif
-
static Logger & Get()
Definition Logger.h:20
-
const std::deque< LogEntry > & GetLogBuffer() const
Definition Logger.h:220
- - -
void WidgetObjectWindow()
-
void SetupDockspace()
-
void WidgetLightWindow()
-
bool Initialize(HWND hwnd, ID3D11Device *device, ID3D11DeviceContext *deviceContext)
-
void WidgetEngineSettingsWindow()
- -
void WidgetAddObject()
-
void SetWindowSize(ImVec2 size)
-
ImVec2 GetWindowSize() const
-
void SetApp(std::shared_ptr< application_class > app)
-
void WidgetFPS()
- -
void WidgetTerrainWindow()
-
void WidgetRenderWindow(ImVec2 availableSize)
-
void WidgetLogWindow()
-
bool ImGuiWidgetRenderer()
- - -
void WidgetRenderStats()
-
void WidgetSpeedSlider(float *speed)
- - - -
Definition stats.h:13
-
-
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:88d9168cd232ba9b3540f464f59728b805e59812f9597f7791e09ca9c7611139 +size 34664 diff --git a/doxygen_docs/html/index.html b/doxygen_docs/html/index.html index a0fc1db..ff2a36c 100644 --- a/doxygen_docs/html/index.html +++ b/doxygen_docs/html/index.html @@ -1,112 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Main Page - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
Khaotic Engine Reborn Documentation
-
-
- -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:b1d3a16658fbd6e34a123d18f337bff5c9fe01aecdd2850dd67f064fd2816222 +size 4203 diff --git a/doxygen_docs/html/input__class_8cpp_source.html b/doxygen_docs/html/input__class_8cpp_source.html index 36c1810..efa0e79 100644 --- a/doxygen_docs/html/input__class_8cpp_source.html +++ b/doxygen_docs/html/input__class_8cpp_source.html @@ -1,557 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/src/system/input_class.cpp Source File - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
input_class.cpp
-
-
-
1#include "input_class.h"
-
2
-
3
-
4input_class::input_class()
-
5{
-
6 m_directInput = 0;
-
7 m_keyboard = 0;
-
8 m_mouse = 0;
-
9 m_previousTildeState = false;
-
10}
-
11
-
12
-
13input_class::input_class(const input_class& other)
-
14{
-
15}
-
16
-
17
-
18input_class::~input_class()
-
19{
-
20}
-
21
-
22bool input_class::Initialize(HINSTANCE hinstance, HWND hwnd, int screenWidth, int screenHeight)
-
23{
-
24 Logger::Get().Log("Initializing input class", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
25
-
26 HRESULT result;
-
27 int i;
-
28
-
29 // Initialize all the keys to being released and not pressed.
-
30 for (i = 0; i < 256; i++)
-
31 {
-
32 m_keys[i] = false;
-
33 }
-
34
-
35 // Store the screen size which will be used for positioning the mouse cursor.
-
36 m_screenWidth = screenWidth;
-
37 m_screenHeight = screenHeight;
-
38
-
39 // Initialize the location of the mouse on the screen.
-
40 m_mouseX = 0;
-
41 m_mouseY = 0;
-
42
-
43 // Initialize the main direct input interface.
-
44 result = DirectInput8Create(hinstance, DIRECTINPUT_VERSION, IID_IDirectInput8, (void**)&m_directInput, NULL);
-
45 if (FAILED(result))
-
46 {
-
47 Logger::Get().Log("Failed to create direct input interface", __FILE__, __LINE__, Logger::LogLevel::Error);
-
48 return false;
-
49 }
-
50
-
51 // Initialize the direct input interface for the keyboard.
-
52 result = m_directInput->CreateDevice(GUID_SysKeyboard, &m_keyboard, NULL);
-
53 if (FAILED(result))
-
54 {
-
55 Logger::Get().Log("Failed to create direct input interface for the keyboard", __FILE__, __LINE__, Logger::LogLevel::Error);
-
56 return false;
-
57 }
-
58
-
59 // Set the data format. In this case since it is a keyboard we can use the predefined data format.
-
60 result = m_keyboard->SetDataFormat(&c_dfDIKeyboard);
-
61 if (FAILED(result))
-
62 {
-
63 Logger::Get().Log("Failed to set data format for the keyboard", __FILE__, __LINE__, Logger::LogLevel::Error);
-
64 return false;
-
65 }
-
66
-
67 // Set the cooperative level of the keyboard to share with other programs.
-
68 result = m_keyboard->SetCooperativeLevel(hwnd, DISCL_FOREGROUND | DISCL_NONEXCLUSIVE);
-
69 if (FAILED(result))
-
70 {
-
71 Logger::Get().Log("Failed to set cooperative level of the keyboard", __FILE__, __LINE__, Logger::LogLevel::Error);
-
72 return false;
-
73 }
-
74
-
75 // Now acquire the keyboard.
-
76 result = m_keyboard->Acquire();
-
77 if (FAILED(result))
-
78 {
-
79 Logger::Get().Log("Failed to acquire the keyboard", __FILE__, __LINE__, Logger::LogLevel::Error);
-
80 return false;
-
81 }
-
82
-
83 // Initialize the direct input interface for the mouse.
-
84 result = m_directInput->CreateDevice(GUID_SysMouse, &m_mouse, NULL);
-
85 if (FAILED(result))
-
86 {
-
87 Logger::Get().Log("Failed to create direct input interface for the mouse", __FILE__, __LINE__, Logger::LogLevel::Error);
-
88 return false;
-
89 }
-
90
-
91 // Set the data format for the mouse using the pre-defined mouse data format.
-
92 result = m_mouse->SetDataFormat(&c_dfDIMouse);
-
93 if (FAILED(result))
-
94 {
-
95 Logger::Get().Log("Failed to set data format for the mouse", __FILE__, __LINE__, Logger::LogLevel::Error);
-
96 return false;
-
97 }
-
98
-
99 // Set the cooperative level of the mouse to share with other programs.
-
100 result = m_mouse->SetCooperativeLevel(hwnd, DISCL_FOREGROUND | DISCL_NONEXCLUSIVE);
-
101 if (FAILED(result))
-
102 {
-
103 Logger::Get().Log("Failed to set cooperative level of the mouse", __FILE__, __LINE__, Logger::LogLevel::Error);
-
104 return false;
-
105 }
-
106
-
107 // Acquire the mouse.
-
108 result = m_mouse->Acquire();
-
109 if (FAILED(result))
-
110 {
-
111 Logger::Get().Log("Failed to acquire the mouse", __FILE__, __LINE__, Logger::LogLevel::Error);
-
112 return false;
-
113 }
-
114
-
115 Logger::Get().Log("Input class initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
116
-
117 return true;
-
118}
-
119
-
120
-
121void input_class::KeyDown(unsigned int input)
-
122{
-
123 // If a key is pressed then save that state in the key array.
-
124 Logger::Get().Log("Key down: " + std::to_string(input), __FILE__, __LINE__, Logger::LogLevel::Input);
-
125 m_keys[input] = true;
-
126 return;
-
127}
-
128
-
129
-
130void input_class::KeyUp(unsigned int input)
-
131{
-
132 // If a key is released then clear that state in the key array.
-
133 m_keys[input] = false;
-
134 return;
-
135}
-
136
-
137
-
138bool input_class::IsKeyDown(unsigned int key) const
-
139{
-
140 // Return what state the key is in (pressed/not pressed).
-
141 return m_keys[key];
-
142}
-
143
-
144void input_class::Shutdown()
-
145{
-
146 Logger::Get().Log("Shutting down input class", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
147
-
148 // Release the mouse.
-
149 if (m_mouse)
-
150 {
-
151 m_mouse->Unacquire();
-
152 m_mouse->Release();
-
153 m_mouse = 0;
-
154 }
-
155
-
156 // Release the keyboard.
-
157 if (m_keyboard)
-
158 {
-
159 m_keyboard->Unacquire();
-
160 m_keyboard->Release();
-
161 m_keyboard = 0;
-
162 }
-
163
-
164 // Release the main interface to direct input.
-
165 if (m_directInput)
-
166 {
-
167 m_directInput->Release();
-
168 m_directInput = 0;
-
169 }
-
170
-
171 Logger::Get().Log("Input class shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
172
-
173 return;
-
174}
-
175
-
176bool input_class::Frame()
-
177{
-
178 bool result;
-
179
-
180
-
181 // Read the current state of the keyboard.
-
182 result = ReadKeyboard();
-
183 if (!result)
-
184 {
-
185 Logger::Get().Log("Failed to read keyboard state", __FILE__, __LINE__, Logger::LogLevel::Error);
-
186 return false;
-
187 }
-
188
-
189 // Read the current state of the mouse.
-
190 result = ReadMouse();
-
191 if (!result)
-
192 {
-
193 Logger::Get().Log("Failed to read mouse state", __FILE__, __LINE__, Logger::LogLevel::Error);
-
194 return false;
-
195 }
-
196
-
197 // Process the changes in the mouse and keyboard.
-
198 ProcessInput();
-
199
-
200 return true;
-
201}
-
202
-
203bool input_class::ReadKeyboard()
-
204{
-
205 HRESULT result;
-
206
-
207
-
208 // Read the keyboard device.
-
209 result = m_keyboard->GetDeviceState(sizeof(m_keyboardState), (LPVOID)&m_keyboardState);
-
210 if (FAILED(result))
-
211 {
-
212 // If the keyboard lost focus or was not acquired then try to get control back.
-
213 if ((result == DIERR_INPUTLOST) || (result == DIERR_NOTACQUIRED))
-
214 {
-
215 m_keyboard->Acquire();
-
216 }
-
217 else
-
218 {
-
219 Logger::Get().Log("Failed to get keyboard device state", __FILE__, __LINE__, Logger::LogLevel::Error);
-
220 return false;
-
221 }
-
222 }
-
223
-
224 return true;
-
225}
-
226
-
227bool input_class::ReadMouse()
-
228{
-
229 HRESULT result;
-
230
-
231
-
232 // Read the mouse device.
-
233 result = m_mouse->GetDeviceState(sizeof(DIMOUSESTATE), (LPVOID)&m_mouseState);
-
234 if (FAILED(result))
-
235 {
-
236 // If the mouse lost focus or was not acquired then try to get control back.
-
237 if ((result == DIERR_INPUTLOST) || (result == DIERR_NOTACQUIRED))
-
238 {
-
239 m_mouse->Acquire();
-
240 }
-
241 else
-
242 {
-
243 Logger::Get().Log("Failed to get mouse device state", __FILE__, __LINE__, Logger::LogLevel::Error);
-
244 return false;
-
245 }
-
246 }
-
247
-
248 return true;
-
249}
-
250
-
251void input_class::ProcessInput()
-
252{
-
253 // Update the location of the mouse cursor based on the change of the mouse location during the frame.
-
254 m_mouseX += m_mouseState.lX;
-
255 m_mouseY += m_mouseState.lY;
-
256
-
258 //if (m_mouseX < 0) { m_mouseX = 0; }
-
259 if (m_mouseY < -m_screenHeight) { m_mouseY = -m_screenHeight; }
-
260
-
261 //if (m_mouseX > m_screenWidth) { m_mouseX = m_screenWidth; }
-
262 if (m_mouseY > m_screenHeight) { m_mouseY = m_screenHeight; }
-
263
-
264 return;
-
265}
-
266
-
267bool input_class::IsEscapePressed() const
-
268{
-
269 // Do a bitwise and on the keyboard state to check if the escape key is currently being pressed.
-
270 if (m_keyboardState[DIK_ESCAPE] & 0x80)
-
271 {
-
272 return true;
-
273 }
-
274
-
275 return false;
-
276}
-
277
-
278bool input_class::IsLeftArrowPressed() const
-
279{
-
280 if (m_keyboardState[DIK_LEFT] & 0x80)
-
281 {
-
282 return true;
-
283 }
-
284
-
285 return false;
-
286}
-
287
-
288
-
289bool input_class::IsRightArrowPressed() const
-
290{
-
291 if (m_keyboardState[DIK_RIGHT] & 0x80)
-
292 {
-
293 return true;
-
294 }
-
295
-
296 return false;
-
297}
-
298
-
299bool input_class::IsUpArrowPressed() const
-
300{
-
301 if (m_keyboardState[DIK_UP] & 0x80)
-
302 {
-
303 return true;
-
304 }
-
305
-
306 return false;
-
307}
-
308
-
309
-
310bool input_class::IsDownArrowPressed() const
-
311{
-
312 if (m_keyboardState[DIK_DOWN] & 0x80)
-
313 {
-
314 return true;
-
315 }
-
316
-
317 return false;
-
318}
-
319
-
321// Les touches correspondent aux claviers QWERTY //
-
323
-
324bool input_class::IsAPressed() const
-
325{
-
326 // Touche A sur QWERTY, Q sur AZERTY
-
327 if (m_keyboardState[DIK_A] & 0x80)
-
328 {
-
329 return true;
-
330 }
-
331
-
332 return false;
-
333}
-
334
-
335bool input_class::IsDPressed() const
-
336{
-
337 if (m_keyboardState[DIK_D] & 0x80)
-
338 {
-
339 return true;
-
340 }
-
341
-
342 return false;
-
343}
-
344
-
345bool input_class::IsWPressed() const
-
346{
-
347 // Touche W sur QWERTY, Z sur AZERTY
-
348 if (m_keyboardState[DIK_W] & 0x80)
-
349 {
-
350 return true;
-
351 }
-
352
-
353 return false;
-
354}
-
355
-
356bool input_class::IsSPressed() const
-
357{
-
358 if (m_keyboardState[DIK_S] & 0x80)
-
359 {
-
360 return true;
-
361 }
-
362
-
363 return false;
-
364}
-
365
-
366bool input_class::IsQPressed() const
-
367{
-
368 // Touche Q sur QWERTY, A sur AZERTY
-
369 if (m_keyboardState[DIK_Q] & 0x80)
-
370 {
-
371 return true;
-
372 }
-
373
-
374 return false;
-
375}
-
376
-
377bool input_class::IsEPressed() const
-
378{
-
379 if (m_keyboardState[DIK_E] & 0x80)
-
380 {
-
381 return true;
-
382 }
-
383
-
384 return false;
-
385}
-
386
-
387void input_class::GetMouseLocation(int& mouseX, int& mouseY) const
-
388{
-
389 mouseX = m_mouseX;
-
390 mouseY = m_mouseY;
-
391 return;
-
392}
-
393
-
394bool input_class::IsLeftMousePressed() const
-
395{
-
396 // Check the left mouse button state.
-
397 if (m_mouseState.rgbButtons[0] & 0x80)
-
398 {
-
399 return true;
-
400 }
-
401
-
402 return false;
-
403}
-
404
-
405bool input_class::IsRightMousePressed() const
-
406{
-
407 // Check the left mouse button state.
-
408 if (m_mouseState.rgbButtons[1] & 0x80)
-
409 {
-
410 return true;
-
411 }
-
412
-
413 return false;
-
414}
-
415
-
416bool input_class::IsScrollUp() const
-
417{
-
418 if (m_mouseState.lZ > 0)
-
419 {
-
420 return true;
-
421 }
-
422
-
423 return false;
-
424}
-
425
-
426bool input_class::IsScrollDown() const
-
427{
-
428 if (m_mouseState.lZ < 0)
-
429 {
-
430 return true;
-
431 }
-
432
-
433 return false;
-
434}
-
435
-
436bool input_class::is_key_pressed(const unsigned int key_code)
-
437{
-
438 if (m_keyboardState[key_code] & 0x80)
-
439 {
-
440 return true;
-
441 }
-
442
-
443 return false;
-
444}
-
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
- - -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:be48234ccd01753efd869d11f8fbd4ce3ab0510508ad1e647190fcba070e4401 +size 68462 diff --git a/doxygen_docs/html/input__class_8h_source.html b/doxygen_docs/html/input__class_8h_source.html index 37270fb..a4cceef 100644 --- a/doxygen_docs/html/input__class_8h_source.html +++ b/doxygen_docs/html/input__class_8h_source.html @@ -1,183 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/inc/system/input_class.h Source File - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
input_class.h
-
-
-
1#ifndef _INPUTCLASS_H_
-
2#define _INPUTCLASS_H_
-
3
-
5// PRE-PROCESSING DIRECTIVES //
-
7#define DIRECTINPUT_VERSION 0x0800
-
8
-
10// LINKING //
-
12#pragma comment(lib, "dinput8.lib")
-
13#pragma comment(lib, "dxguid.lib")
-
14
-
16// INCLUDES //
-
18#include "Logger.h"
-
19#include <dinput.h>
-
20
-
22// Class name: input_class
-
- -
25{
-
26public:
- - - -
30
-
31 virtual bool Initialize(HINSTANCE, HWND, int, int);
-
32 virtual void Shutdown();
-
33 virtual bool Frame();
-
34
-
35 bool IsEscapePressed() const;
-
36 void GetMouseLocation(int&, int&) const;
-
37 bool IsLeftMousePressed() const;
-
38 bool IsRightMousePressed() const;
-
39 void KeyDown(unsigned int);
-
40 void KeyUp(unsigned int);
-
41 bool IsLeftArrowPressed() const;
-
42 bool IsRightArrowPressed() const;
-
43 bool IsScrollUp() const;
-
44 bool IsScrollDown() const;
-
45 bool IsUpArrowPressed() const;
-
46 bool IsDownArrowPressed() const;
-
47 bool IsAPressed() const;
-
48 bool IsDPressed() const;
-
49 bool IsWPressed() const;
-
50 bool IsSPressed() const;
-
51 bool IsQPressed() const;
-
52 bool IsEPressed()const;
-
53 bool IsKeyDown(unsigned int) const;
-
54 bool is_key_pressed(const unsigned int);
-
55
-
56private:
-
57 bool m_keys[256];
-
58
-
59 bool ReadKeyboard();
-
60 bool ReadMouse();
-
61 void ProcessInput();
-
62
-
63private:
-
64 IDirectInput8* m_directInput;
-
65 IDirectInputDevice8* m_keyboard;
-
66 IDirectInputDevice8* m_mouse;
-
67
-
68 unsigned char m_keyboardState[256];
-
69 DIMOUSESTATE m_mouseState;
-
70
-
71 int m_screenWidth, m_screenHeight, m_mouseX, m_mouseY;
-
72 bool m_previousTildeState;
-
73
-
74};
-
-
75
-
76#endif
- -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:c50ec43e606f37e8ca4f92feae9edfd070de44fcb4835c057b5a2213db0b33c3 +size 15645 diff --git a/doxygen_docs/html/jquery.js b/doxygen_docs/html/jquery.js index 875ada7..05107ff 100644 --- a/doxygen_docs/html/jquery.js +++ b/doxygen_docs/html/jquery.js @@ -1,204 +1,3 @@ -/*! jQuery v3.6.0 | (c) OpenJS Foundation and other contributors | jquery.org/license */ -!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(C,e){"use strict";var t=[],r=Object.getPrototypeOf,s=t.slice,g=t.flat?function(e){return t.flat.call(e)}:function(e){return t.concat.apply([],e)},u=t.push,i=t.indexOf,n={},o=n.toString,v=n.hasOwnProperty,a=v.toString,l=a.call(Object),y={},m=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType&&"function"!=typeof e.item},x=function(e){return null!=e&&e===e.window},E=C.document,c={type:!0,src:!0,nonce:!0,noModule:!0};function b(e,t,n){var r,i,o=(n=n||E).createElement("script");if(o.text=e,t)for(r in c)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function w(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[o.call(e)]||"object":typeof e} -var f="3.6.0",S=function(e,t){return new S.fn.init(e,t)};function p(e){var t=!!e&&"length"in e&&e.length,n=w(e);return!m(e)&&!x(e)&&("array"===n||0===t||"number"==typeof t&&0+~]|"+M+")"+M+"*"),U=new RegExp(M+"|>"),X=new RegExp(F),V=new RegExp("^"+I+"$"),G={ID:new RegExp("^#("+I+")"),CLASS:new RegExp("^\\.("+I+")"),TAG:new RegExp("^("+I+"|[*])"),ATTR:new RegExp("^"+W),PSEUDO:new RegExp("^"+F),CHILD:new RegExp( -"^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+R+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/HTML$/i,Q=/^(?:input|select|textarea|button)$/i,J=/^h\d$/i,K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/[+~]/,te=new RegExp("\\\\[\\da-fA-F]{1,6}"+M+"?|\\\\([^\\r\\n\\f])","g"),ne=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},re=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ie=function(e,t){return t?"\0"===e?"�":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},oe=function(){T()},ae=be(function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()},{dir:"parentNode",next:"legend"});try{H.apply(t=O.call(p.childNodes),p.childNodes),t[p.childNodes.length].nodeType -}catch(e){H={apply:t.length?function(e,t){L.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function se(t,e,n,r){var i,o,a,s,u,l,c,f=e&&e.ownerDocument,p=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==p&&9!==p&&11!==p)return n;if(!r&&(T(e),e=e||C,E)){if(11!==p&&(u=Z.exec(t)))if(i=u[1]){if(9===p){if(!(a=e.getElementById(i)))return n;if(a.id===i)return n.push(a),n}else if(f&&(a=f.getElementById(i))&&y(e,a)&&a.id===i)return n.push(a),n}else{if(u[2])return H.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&d.getElementsByClassName&&e.getElementsByClassName)return H.apply(n,e.getElementsByClassName(i)),n}if(d.qsa&&!N[t+" "]&&(!v||!v.test(t))&&(1!==p||"object"!==e.nodeName.toLowerCase())){if(c=t,f=e,1===p&&(U.test(t)||z.test(t))){(f=ee.test(t)&&ye(e.parentNode)||e)===e&&d.scope||((s=e.getAttribute("id"))?s=s.replace(re,ie):e.setAttribute("id",s=S)),o=(l=h(t)).length;while(o--)l[o]=(s?"#"+s:":scope")+" "+xe(l[o]);c=l.join(",")}try{return H.apply(n,f.querySelectorAll(c -)),n}catch(e){N(t,!0)}finally{s===S&&e.removeAttribute("id")}}}return g(t.replace($,"$1"),e,n,r)}function ue(){var r=[];return function e(t,n){return r.push(t+" ")>b.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function le(e){return e[S]=!0,e}function ce(e){var t=C.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function fe(e,t){var n=e.split("|"),r=n.length;while(r--)b.attrHandle[n[r]]=t}function pe(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function de(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function he(n){return function(e){var t=e.nodeName.toLowerCase();return("input"===t||"button"===t)&&e.type===n}}function ge(t){return function(e){ -return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&ae(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function ve(a){return le(function(o){return o=+o,le(function(e,t){var n,r=a([],e.length,o),i=r.length;while(i--)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function ye(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}for(e in d=se.support={},i=se.isXML=function(e){var t=e&&e.namespaceURI,n=e&&(e.ownerDocument||e).documentElement;return!Y.test(t||n&&n.nodeName||"HTML")},T=se.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:p;return r!=C&&9===r.nodeType&&r.documentElement&&(a=(C=r).documentElement,E=!i(C),p!=C&&(n=C.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",oe,!1):n.attachEvent&&n.attachEvent("onunload",oe)),d.scope=ce(function(e){return a.appendChild(e).appendChild(C.createElement("div")),"undefined"!=typeof e.querySelectorAll&&!e.querySelectorAll( -":scope fieldset div").length}),d.attributes=ce(function(e){return e.className="i",!e.getAttribute("className")}),d.getElementsByTagName=ce(function(e){return e.appendChild(C.createComment("")),!e.getElementsByTagName("*").length}),d.getElementsByClassName=K.test(C.getElementsByClassName),d.getById=ce(function(e){return a.appendChild(e).id=S,!C.getElementsByName||!C.getElementsByName(S).length}),d.getById?(b.filter.ID=function(e){var t=e.replace(te,ne);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n=t.getElementById(e);return n?[n]:[]}}):(b.filter.ID=function(e){var n=e.replace(te,ne);return function(e){var t="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id") -)&&n.value===e)return[o]}return[]}}),b.find.TAG=d.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):d.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},b.find.CLASS=d.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&E)return t.getElementsByClassName(e)},s=[],v=[],(d.qsa=K.test(C.querySelectorAll))&&(ce(function(e){var t;a.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&v.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||v.push("\\["+M+"*(?:value|"+R+")"),e.querySelectorAll("[id~="+S+"-]").length||v.push("~="),(t=C.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||v.push( -"\\["+M+"*name"+M+"*="+M+"*(?:''|\"\")"),e.querySelectorAll(":checked").length||v.push(":checked"),e.querySelectorAll("a#"+S+"+*").length||v.push(".#.+[+~]"),e.querySelectorAll("\\\f"),v.push("[\\r\\n\\f]")}),ce(function(e){e.innerHTML="";var t=C.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&v.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&v.push(":enabled",":disabled"),a.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&v.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),v.push(",.*:")})),(d.matchesSelector=K.test(c=a.matches||a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.msMatchesSelector))&&ce(function(e){d.disconnectedMatch=c.call(e,"*"),c.call(e,"[s!='']:x"),s.push("!=",F)}),v=v.length&&new RegExp(v.join("|")),s=s.length&&new RegExp(s.join("|")),t=K.test( -a.compareDocumentPosition),y=t||K.test(a.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},j=t?function(e,t){if(e===t)return l=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!d.sortDetached&&t.compareDocumentPosition(e)===n?e==C||e.ownerDocument==p&&y(p,e)?-1:t==C||t.ownerDocument==p&&y(p,t)?1:u?P(u,e)-P(u,t):0:4&n?-1:1)}:function(e,t){if(e===t)return l=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e==C?-1:t==C?1:i?-1:o?1:u?P(u,e)-P(u,t):0;if(i===o)return pe(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?pe(a[r],s[r]):a[r]==p?-1:s[r]==p?1:0}),C},se.matches=function(e,t){return se(e,null, -null,t)},se.matchesSelector=function(e,t){if(T(e),d.matchesSelector&&E&&!N[t+" "]&&(!s||!s.test(t))&&(!v||!v.test(t)))try{var n=c.call(e,t);if(n||d.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){N(t,!0)}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(te,ne),e[3]=(e[3]||e[4]||e[5]||"").replace(te,ne),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||se.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&se.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return G.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=h(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,ne -).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=m[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&m(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,r,i){return function(e){var t=se.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===i:"!="===r?t!==i:"^="===r?i&&0===t.indexOf(i):"*="===r?i&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function j(e,n,r){return m(n)?S.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?S.grep(e,function(e){return e===n!==r}):"string"!=typeof n?S.grep(e,function(e){return-1)[^>]*|#([\w-]+))$/;(S.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||D,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:q.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof S?t[0]:t,S.merge(this,S.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:E,!0)),N.test(r[1])&&S.isPlainObject(t))for(r in t)m(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=E.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):m(e)?void 0!==n.ready?n.ready(e):e(S):S.makeArray(e,this)}).prototype=S.fn,D=S(E);var L=/^(?:parents|prev(?:Until|All))/,H={children:!0,contents:!0,next:!0,prev:!0};function O(e,t){while((e=e[t])&&1!==e.nodeType);return e}S.fn.extend({has:function(e){var t=S(e,this),n=t.length;return this.filter(function(){for( -var e=0;e\x20\t\r\n\f]*)/i,he=/^$|^module$|\/(?:java|ecma)script/i;ce=E.createDocumentFragment().appendChild(E.createElement("div")),(fe=E.createElement("input")).setAttribute("type","radio"),fe.setAttribute("checked","checked"),fe.setAttribute("name","t"),ce.appendChild(fe),y.checkClone=ce.cloneNode(!0).cloneNode(!0).lastChild.checked,ce.innerHTML="",y.noCloneChecked=!!ce.cloneNode(!0).lastChild.defaultValue,ce.innerHTML="",y.option=!!ce.lastChild;var ge={thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function ve(e,t){var n; -return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&A(e,t)?S.merge([e],n):n}function ye(e,t){for(var n=0,r=e.length;n",""]);var me=/<|&#?\w+;/;function xe(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;d\s*$/g;function je(e,t){return A(e,"table")&&A(11!==t.nodeType?t:t.firstChild,"tr")&&S(e).children("tbody")[0]||e}function De(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function qe(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Le(e,t){var n,r,i,o,a,s;if(1===t.nodeType){if(Y.hasData(e)&&(s=Y.get(e).events))for(i in Y.remove(t,"handle events"),s)for(n=0, -r=s[i].length;n").attr(n.scriptAttrs||{}).prop({charset:n.scriptCharset,src:n.url}).on("load error",i=function(e){r.remove(),i=null,e&&t("error"===e.type?404:200,e.type)}),E.head.appendChild(r[0])},abort:function(){i&&i()}}});var _t,zt=[],Ut=/(=)\?(?=&|$)|\?\?/;S.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=zt.pop()||S.expando+"_"+wt.guid++;return this[e]=!0,e}}),S.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Ut.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Ut.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=m(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Ut,"$1"+r):!1!==e.jsonp&&(e.url+=(Tt.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||S.error(r+" was not called"),o[0]},e.dataTypes[0]="json",i=C[r] -,C[r]=function(){o=arguments},n.always(function(){void 0===i?S(C).removeProp(r):C[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,zt.push(r)),o&&m(i)&&i(o[0]),o=i=void 0}),"script"}),y.createHTMLDocument=((_t=E.implementation.createHTMLDocument("").body).innerHTML="
",2===_t.childNodes.length),S.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(y.createHTMLDocument?((r=(t=E.implementation.createHTMLDocument("")).createElement("base")).href=E.location.href,t.head.appendChild(r)):t=E),o=!n&&[],(i=N.exec(e))?[t.createElement(i[1])]:(i=xe([e],t,o),o&&o.length&&S(o).remove(),S.merge([],i.childNodes)));var r,i,o},S.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return-1").append(S.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each( -function(){n.apply(this,o||[e.responseText,t,e])})}),this},S.expr.pseudos.animated=function(t){return S.grep(S.timers,function(e){return t===e.elem}).length},S.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=S.css(e,"position"),c=S(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=S.css(e,"top"),u=S.css(e,"left"),("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),m(t)&&(t=t.call(e,n,S.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):c.css(f)}},S.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){S.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===S.css(r, -"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===S.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=S(e).offset()).top+=S.css(e,"borderTopWidth",!0),i.left+=S.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-S.css(r,"marginTop",!0),left:t.left-i.left-S.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===S.css(e,"position"))e=e.offsetParent;return e||re})}}),S.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;S.fn[t]=function(e){return $(this,function(e,t,n){var r;if(x(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),S.each(["top","left"],function(e,n){S.cssHooks[n]=Fe(y.pixelPosition,function(e,t){if(t)return t=We(e,n),Pe.test(t)?S(e).position()[n]+"px":t})} -),S.each({Height:"height",Width:"width"},function(a,s){S.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,o){S.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return $(this,function(e,t,n){var r;return x(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+a],r["scroll"+a],e.body["offset"+a],r["offset"+a],r["client"+a])):void 0===n?S.css(e,t,i):S.style(e,t,n,i)},s,n?e:void 0,n)}})}),S.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){S.fn[t]=function(e){return this.on(t,e)}}),S.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),S.each( -"blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,n){S.fn[n]=function(e,t){return 0",options:{classes:{},disabled:!1,create:null},_createWidget:function(t,e){e=y(e||this.defaultElement||this)[0],this.element=y(e),this.uuid=i++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=y(),this.hoverable=y(),this.focusable=y(),this.classesElementLookup={},e!==this&&(y.data(e,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t -){t.target===e&&this.destroy()}}),this.document=y(e.style?e.ownerDocument:e.document||e),this.window=y(this.document[0].defaultView||this.document[0].parentWindow)),this.options=y.widget.extend({},this.options,this._getCreateOptions(),t),this._create(),this.options.disabled&&this._setOptionDisabled(this.options.disabled),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:function(){return{}},_getCreateEventData:y.noop,_create:y.noop,_init:y.noop,destroy:function(){var i=this;this._destroy(),y.each(this.classesElementLookup,function(t,e){i._removeClass(e,t)}),this.element.off(this.eventNamespace).removeData(this.widgetFullName),this.widget().off(this.eventNamespace).removeAttr("aria-disabled"),this.bindings.off(this.eventNamespace)},_destroy:y.noop,widget:function(){return this.element},option:function(t,e){var i,s,n,o=t;if(0===arguments.length)return y.widget.extend({},this.options);if("string"==typeof t)if(o={},t=(i=t.split(".")).shift(),i.length){for(s=o[t -]=y.widget.extend({},this.options[t]),n=0;n
"),i=e.children()[0];return y("body").append(e),t=i.offsetWidth,e.css("overflow","scroll"),t===(i=i.offsetWidth)&&(i=e[0].clientWidth),e.remove(),s=t-i}, -getScrollInfo:function(t){var e=t.isWindow||t.isDocument?"":t.element.css("overflow-x"),i=t.isWindow||t.isDocument?"":t.element.css("overflow-y"),e="scroll"===e||"auto"===e&&t.widthx(D(s),D(n))?o.important="horizontal":o.important="vertical",p.using.call(this,t,o)}),h.offset(y.extend(l,{using:t}))})},y.ui.position={fit:{left:function(t,e){var i=e.within, -s=i.isWindow?i.scrollLeft:i.offset.left,n=i.width,o=t.left-e.collisionPosition.marginLeft,h=s-o,a=o+e.collisionWidth-n-s;e.collisionWidth>n?0n?0=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}}),y.ui.plugin={add:function(t,e,i){var s,n=y.ui[t].prototype;for(s in i)n.plugins[s]=n.plugins[s]||[],n.plugins[s].push([e,i[s]])},call:function(t,e,i,s){var n,o=t.plugins[e];if(o&&(s||t.element[0].parentNode&&11!==t.element[0].parentNode.nodeType))for(n=0;n").css({overflow:"hidden",position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})), -this.element=this.element.parent().data("ui-resizable",this.element.resizable("instance")),this.elementIsWrapper=!0,t={marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom"),marginLeft:this.originalElement.css("marginLeft")},this.element.css(t),this.originalElement.css("margin",0),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css(t),this._proportionallyResize()),this._setupHandles(),e.autoHide&&y(this.element).on("mouseenter",function(){e.disabled||(i._removeClass("ui-resizable-autohide"),i._handles.show())}).on("mouseleave",function(){e.disabled||i.resizing||(i._addClass("ui-resizable-autohide"),i._handles.hide())}),this._mouseInit()},_destroy:function(){this._mouseDestroy(),this._addedHandles.remove();function t(t){y(t -).removeData("resizable").removeData("ui-resizable").off(".resizable")}var e;return this.elementIsWrapper&&(t(this.element),e=this.element,this.originalElement.css({position:e.css("position"),width:e.outerWidth(),height:e.outerHeight(),top:e.css("top"),left:e.css("left")}).insertAfter(e),e.remove()),this.originalElement.css("resize",this.originalResizeStyle),t(this.originalElement),this},_setOption:function(t,e){switch(this._super(t,e),t){case"handles":this._removeHandles(),this._setupHandles();break;case"aspectRatio":this._aspectRatio=!!e}},_setupHandles:function(){var t,e,i,s,n,o=this.options,h=this;if(this.handles=o.handles||(y(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se"),this._handles=y(),this._addedHandles=y(),this.handles.constructor===String)for("all"===this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw"),i=this.handles.split( -","),this.handles={},e=0;e"),this._addClass(n,"ui-resizable-handle "+s),n.css({zIndex:o.zIndex}),this.handles[t]=".ui-resizable-"+t,this.element.children(this.handles[t]).length||(this.element.append(n),this._addedHandles=this._addedHandles.add(n));this._renderAxis=function(t){var e,i,s;for(e in t=t||this.element,this.handles)this.handles[e].constructor===String?this.handles[e]=this.element.children(this.handles[e]).first().show():(this.handles[e].jquery||this.handles[e].nodeType)&&(this.handles[e]=y(this.handles[e]),this._on(this.handles[e],{mousedown:h._mouseDown})),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/^(textarea|input|select|button)$/i)&&(i=y(this.handles[e],this.element),s=/sw|ne|nw|se|n|s/.test(e)?i.outerHeight():i.outerWidth(),i=["padding",/ne|nw|n/.test(e)?"Top":/se|sw|s/.test(e)?"Bottom":/^e$/.test(e)?"Right":"Left"].join(""),t.css(i,s),this._proportionallyResize()),this._handles=this._handles.add( -this.handles[e])},this._renderAxis(this.element),this._handles=this._handles.add(this.element.find(".ui-resizable-handle")),this._handles.disableSelection(),this._handles.on("mouseover",function(){h.resizing||(this.className&&(n=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),h.axis=n&&n[1]?n[1]:"se")}),o.autoHide&&(this._handles.hide(),this._addClass("ui-resizable-autohide"))},_removeHandles:function(){this._addedHandles.remove()},_mouseCapture:function(t){var e,i,s=!1;for(e in this.handles)(i=y(this.handles[e])[0])!==t.target&&!y.contains(i,t.target)||(s=!0);return!this.options.disabled&&s},_mouseStart:function(t){var e,i,s=this.options,n=this.element;return this.resizing=!0,this._renderProxy(),e=this._num(this.helper.css("left")),i=this._num(this.helper.css("top")),s.containment&&(e+=y(s.containment).scrollLeft()||0,i+=y(s.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:e,top:i},this.size=this._helper?{width:this.helper.width(),height:this.helper.height()}:{ -width:n.width(),height:n.height()},this.originalSize=this._helper?{width:n.outerWidth(),height:n.outerHeight()}:{width:n.width(),height:n.height()},this.sizeDiff={width:n.outerWidth()-n.width(),height:n.outerHeight()-n.height()},this.originalPosition={left:e,top:i},this.originalMousePosition={left:t.pageX,top:t.pageY},this.aspectRatio="number"==typeof s.aspectRatio?s.aspectRatio:this.originalSize.width/this.originalSize.height||1,s=y(".ui-resizable-"+this.axis).css("cursor"),y("body").css("cursor","auto"===s?this.axis+"-resize":s),this._addClass("ui-resizable-resizing"),this._propagate("start",t),!0},_mouseDrag:function(t){var e=this.originalMousePosition,i=this.axis,s=t.pageX-e.left||0,e=t.pageY-e.top||0,i=this._change[i];return this._updatePrevProperties(),i&&(e=i.apply(this,[t,s,e]),this._updateVirtualBoundaries(t.shiftKey),(this._aspectRatio||t.shiftKey)&&(e=this._updateRatio(e,t)),e=this._respectSize(e,t),this._updateCache(e),this._propagate("resize",t),e=this._applyChanges(), -!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),y.isEmptyObject(e)||(this._updatePrevProperties(),this._trigger("resize",t,this.ui()),this._applyChanges())),!1},_mouseStop:function(t){this.resizing=!1;var e,i,s,n=this.options,o=this;return this._helper&&(s=(e=(i=this._proportionallyResizeElements).length&&/textarea/i.test(i[0].nodeName))&&this._hasScroll(i[0],"left")?0:o.sizeDiff.height,i=e?0:o.sizeDiff.width,e={width:o.helper.width()-i,height:o.helper.height()-s},i=parseFloat(o.element.css("left"))+(o.position.left-o.originalPosition.left)||null,s=parseFloat(o.element.css("top"))+(o.position.top-o.originalPosition.top)||null,n.animate||this.element.css(y.extend(e,{top:s,left:i})),o.helper.height(o.size.height),o.helper.width(o.size.width),this._helper&&!n.animate&&this._proportionallyResize()),y("body").css("cursor","auto"),this._removeClass("ui-resizable-resizing"),this._propagate("stop",t),this._helper&&this.helper.remove(),!1},_updatePrevProperties:function(){ -this.prevPosition={top:this.position.top,left:this.position.left},this.prevSize={width:this.size.width,height:this.size.height}},_applyChanges:function(){var t={};return this.position.top!==this.prevPosition.top&&(t.top=this.position.top+"px"),this.position.left!==this.prevPosition.left&&(t.left=this.position.left+"px"),this.size.width!==this.prevSize.width&&(t.width=this.size.width+"px"),this.size.height!==this.prevSize.height&&(t.height=this.size.height+"px"),this.helper.css(t),t},_updateVirtualBoundaries:function(t){var e,i,s=this.options,n={minWidth:this._isNumber(s.minWidth)?s.minWidth:0,maxWidth:this._isNumber(s.maxWidth)?s.maxWidth:1/0,minHeight:this._isNumber(s.minHeight)?s.minHeight:0,maxHeight:this._isNumber(s.maxHeight)?s.maxHeight:1/0};(this._aspectRatio||t)&&(e=n.minHeight*this.aspectRatio,i=n.minWidth/this.aspectRatio,s=n.maxHeight*this.aspectRatio,t=n.maxWidth/this.aspectRatio,e>n.minWidth&&(n.minWidth=e),i>n.minHeight&&(n.minHeight=i),st.width,h=this._isNumber(t.height)&&e.minHeight&&e.minHeight>t.height,a=this.originalPosition.left+this.originalSize.width,r=this.originalPosition.top+this.originalSize.height -,l=/sw|nw|w/.test(i),i=/nw|ne|n/.test(i);return o&&(t.width=e.minWidth),h&&(t.height=e.minHeight),s&&(t.width=e.maxWidth),n&&(t.height=e.maxHeight),o&&l&&(t.left=a-e.minWidth),s&&l&&(t.left=a-e.maxWidth),h&&i&&(t.top=r-e.minHeight),n&&i&&(t.top=r-e.maxHeight),t.width||t.height||t.left||!t.top?t.width||t.height||t.top||!t.left||(t.left=null):t.top=null,t},_getPaddingPlusBorderDimensions:function(t){for(var e=0,i=[],s=[t.css("borderTopWidth"),t.css("borderRightWidth"),t.css("borderBottomWidth"),t.css("borderLeftWidth")],n=[t.css("paddingTop"),t.css("paddingRight"),t.css("paddingBottom"),t.css("paddingLeft")];e<4;e++)i[e]=parseFloat(s[e])||0,i[e]+=parseFloat(n[e])||0;return{height:i[0]+i[2],width:i[1]+i[3]}},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var t,e=0,i=this.helper||this.element;e").css({overflow:"hidden"}),this._addClass(this.helper,this._helper),this.helper.css({width:this.element.outerWidth(),height:this.element.outerHeight(),position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++e.zIndex}),this.helper.appendTo("body").disableSelection()):this.helper=this.element},_change:{e:function(t,e){return{width:this.originalSize.width+e}},w:function(t,e){var i=this.originalSize;return{left:this.originalPosition.left+e,width:i.width-e}},n:function(t,e,i){var s=this.originalSize;return{top:this.originalPosition.top+i,height:s.height-i}},s:function(t,e,i){return{height:this.originalSize.height+i}},se:function(t,e,i){return y.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[t,e,i]))},sw:function(t,e, -i){return y.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[t,e,i]))},ne:function(t,e,i){return y.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[t,e,i]))},nw:function(t,e,i){return y.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[t,e,i]))}},_propagate:function(t,e){y.ui.plugin.call(this,t,[e,this.ui()]),"resize"!==t&&this._trigger(t,e,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),y.ui.plugin.add("resizable","animate",{stop:function(e){var i=y(this).resizable("instance"),t=i.options,s=i._proportionallyResizeElements,n=s.length&&/textarea/i.test(s[0].nodeName),o=n&&i._hasScroll(s[0],"left")?0:i.sizeDiff.height,h=n?0:i.sizeDiff.width,n={width:i.size.width-h,height:i.size.height-o},h=parseFloat(i.element.css("left"))+(i.position.left-i.originalPosition.left -)||null,o=parseFloat(i.element.css("top"))+(i.position.top-i.originalPosition.top)||null;i.element.animate(y.extend(n,o&&h?{top:o,left:h}:{}),{duration:t.animateDuration,easing:t.animateEasing,step:function(){var t={width:parseFloat(i.element.css("width")),height:parseFloat(i.element.css("height")),top:parseFloat(i.element.css("top")),left:parseFloat(i.element.css("left"))};s&&s.length&&y(s[0]).css({width:t.width,height:t.height}),i._updateCache(t),i._propagate("resize",e)}})}}),y.ui.plugin.add("resizable","containment",{start:function(){var i,s,n=y(this).resizable("instance"),t=n.options,e=n.element,o=t.containment,h=o instanceof y?o.get(0):/parent/.test(o)?e.parent().get(0):o;h&&(n.containerElement=y(h),/document/.test(o)||o===document?(n.containerOffset={left:0,top:0},n.containerPosition={left:0,top:0},n.parentData={element:y(document),left:0,top:0,width:y(document).width(),height:y(document).height()||document.body.parentNode.scrollHeight}):(i=y(h),s=[],y(["Top","Right","Left","Bottom"]).each(function(t,e -){s[t]=n._num(i.css("padding"+e))}),n.containerOffset=i.offset(),n.containerPosition=i.position(),n.containerSize={height:i.innerHeight()-s[3],width:i.innerWidth()-s[1]},t=n.containerOffset,e=n.containerSize.height,o=n.containerSize.width,o=n._hasScroll(h,"left")?h.scrollWidth:o,e=n._hasScroll(h)?h.scrollHeight:e,n.parentData={element:h,left:t.left,top:t.top,width:o,height:e}))},resize:function(t){var e=y(this).resizable("instance"),i=e.options,s=e.containerOffset,n=e.position,o=e._aspectRatio||t.shiftKey,h={top:0,left:0},a=e.containerElement,t=!0;a[0]!==document&&/static/.test(a.css("position"))&&(h=s),n.left<(e._helper?s.left:0)&&(e.size.width=e.size.width+(e._helper?e.position.left-s.left:e.position.left-h.left),o&&(e.size.height=e.size.width/e.aspectRatio,t=!1),e.position.left=i.helper?s.left:0),n.top<(e._helper?s.top:0)&&(e.size.height=e.size.height+(e._helper?e.position.top-s.top:e.position.top),o&&(e.size.width=e.size.height*e.aspectRatio,t=!1),e.position.top=e._helper?s.top:0), -i=e.containerElement.get(0)===e.element.parent().get(0),n=/relative|absolute/.test(e.containerElement.css("position")),i&&n?(e.offset.left=e.parentData.left+e.position.left,e.offset.top=e.parentData.top+e.position.top):(e.offset.left=e.element.offset().left,e.offset.top=e.element.offset().top),n=Math.abs(e.sizeDiff.width+(e._helper?e.offset.left-h.left:e.offset.left-s.left)),s=Math.abs(e.sizeDiff.height+(e._helper?e.offset.top-h.top:e.offset.top-s.top)),n+e.size.width>=e.parentData.width&&(e.size.width=e.parentData.width-n,o&&(e.size.height=e.size.width/e.aspectRatio,t=!1)),s+e.size.height>=e.parentData.height&&(e.size.height=e.parentData.height-s,o&&(e.size.width=e.size.height*e.aspectRatio,t=!1)),t||(e.position.left=e.prevPosition.left,e.position.top=e.prevPosition.top,e.size.width=e.prevSize.width,e.size.height=e.prevSize.height)},stop:function(){var t=y(this).resizable("instance"),e=t.options,i=t.containerOffset,s=t.containerPosition,n=t.containerElement,o=y(t.helper),h=o.offset(),a=o.outerWidth( -)-t.sizeDiff.width,o=o.outerHeight()-t.sizeDiff.height;t._helper&&!e.animate&&/relative/.test(n.css("position"))&&y(this).css({left:h.left-s.left-i.left,width:a,height:o}),t._helper&&!e.animate&&/static/.test(n.css("position"))&&y(this).css({left:h.left-s.left-i.left,width:a,height:o})}}),y.ui.plugin.add("resizable","alsoResize",{start:function(){var t=y(this).resizable("instance").options;y(t.alsoResize).each(function(){var t=y(this);t.data("ui-resizable-alsoresize",{width:parseFloat(t.width()),height:parseFloat(t.height()),left:parseFloat(t.css("left")),top:parseFloat(t.css("top"))})})},resize:function(t,i){var e=y(this).resizable("instance"),s=e.options,n=e.originalSize,o=e.originalPosition,h={height:e.size.height-n.height||0,width:e.size.width-n.width||0,top:e.position.top-o.top||0,left:e.position.left-o.left||0};y(s.alsoResize).each(function(){var t=y(this),s=y(this).data("ui-resizable-alsoresize"),n={},e=t.parents(i.originalElement[0]).length?["width","height"]:["width","height","top","left"];y.each(e, -function(t,e){var i=(s[e]||0)+(h[e]||0);i&&0<=i&&(n[e]=i||null)}),t.css(n)})},stop:function(){y(this).removeData("ui-resizable-alsoresize")}}),y.ui.plugin.add("resizable","ghost",{start:function(){var t=y(this).resizable("instance"),e=t.size;t.ghost=t.originalElement.clone(),t.ghost.css({opacity:.25,display:"block",position:"relative",height:e.height,width:e.width,margin:0,left:0,top:0}),t._addClass(t.ghost,"ui-resizable-ghost"),!1!==y.uiBackCompat&&"string"==typeof t.options.ghost&&t.ghost.addClass(this.options.ghost),t.ghost.appendTo(t.helper)},resize:function(){var t=y(this).resizable("instance");t.ghost&&t.ghost.css({position:"relative",height:t.size.height,width:t.size.width})},stop:function(){var t=y(this).resizable("instance");t.ghost&&t.helper&&t.helper.get(0).removeChild(t.ghost.get(0))}}),y.ui.plugin.add("resizable","grid",{resize:function(){var t,e=y(this).resizable("instance"),i=e.options,s=e.size,n=e.originalSize,o=e.originalPosition,h=e.axis,a="number"==typeof i.grid?[i.grid,i.grid]:i.grid,r=a[0 -]||1,l=a[1]||1,u=Math.round((s.width-n.width)/r)*r,p=Math.round((s.height-n.height)/l)*l,d=n.width+u,c=n.height+p,f=i.maxWidth&&i.maxWidthd,s=i.minHeight&&i.minHeight>c;i.grid=a,m&&(d+=r),s&&(c+=l),f&&(d-=r),g&&(c-=l),/^(se|s|e)$/.test(h)?(e.size.width=d,e.size.height=c):/^(ne)$/.test(h)?(e.size.width=d,e.size.height=c,e.position.top=o.top-p):/^(sw)$/.test(h)?(e.size.width=d,e.size.height=c,e.position.left=o.left-u):((c-l<=0||d-r<=0)&&(t=e._getPaddingPlusBorderDimensions(this)),0=f[g]?0:Math.min(f[g],n));!a&&1-1){ -targetElements.on(evt+EVENT_NAMESPACE,function elementToggle(event){$.powerTip.toggle(this,event)})}else{targetElements.on(evt+EVENT_NAMESPACE,function elementOpen(event){$.powerTip.show(this,event)})}});$.each(options.closeEvents,function(idx,evt){if($.inArray(evt,options.openEvents)<0){targetElements.on(evt+EVENT_NAMESPACE,function elementClose(event){$.powerTip.hide(this,!isMouseEvent(event))})}});targetElements.on("keydown"+EVENT_NAMESPACE,function elementKeyDown(event){if(event.keyCode===27){$.powerTip.hide(this,true)}})}return targetElements};$.fn.powerTip.defaults={fadeInTime:200,fadeOutTime:100,followMouse:false,popupId:"powerTip",popupClass:null,intentSensitivity:7,intentPollInterval:100,closeDelay:100,placement:"n",smartPlacement:false,offset:10,mouseOnToPopup:false,manual:false,openEvents:["mouseenter","focus"],closeEvents:["mouseleave","blur"]};$.fn.powerTip.smartPlacementLists={n:["n","ne","nw","s"],e:["e","ne","se","w","nw","sw","n","s","e"],s:["s","se","sw","n"],w:["w","nw","sw","e","ne","se", -"n","s","w"],nw:["nw","w","sw","n","s","se","nw"],ne:["ne","e","se","n","s","sw","ne"],sw:["sw","w","nw","s","n","ne","sw"],se:["se","e","ne","s","n","nw","se"],"nw-alt":["nw-alt","n","ne-alt","sw-alt","s","se-alt","w","e"],"ne-alt":["ne-alt","n","nw-alt","se-alt","s","sw-alt","e","w"],"sw-alt":["sw-alt","s","se-alt","nw-alt","n","ne-alt","w","e"],"se-alt":["se-alt","s","sw-alt","ne-alt","n","nw-alt","e","w"]};$.powerTip={show:function apiShowTip(element,event){if(isMouseEvent(event)){trackMouse(event);session.previousX=event.pageX;session.previousY=event.pageY;$(element).data(DATA_DISPLAYCONTROLLER).show()}else{$(element).first().data(DATA_DISPLAYCONTROLLER).show(true,true)}return element},reposition:function apiResetPosition(element){$(element).first().data(DATA_DISPLAYCONTROLLER).resetPosition();return element},hide:function apiCloseTip(element,immediate){var displayController;immediate=element?immediate:true;if(element){displayController=$(element).first().data(DATA_DISPLAYCONTROLLER)}else if( -session.activeHover){displayController=session.activeHover.data(DATA_DISPLAYCONTROLLER)}if(displayController){displayController.hide(immediate)}return element},toggle:function apiToggle(element,event){if(session.activeHover&&session.activeHover.is(element)){$.powerTip.hide(element,!isMouseEvent(event))}else{$.powerTip.show(element,event)}return element}};$.powerTip.showTip=$.powerTip.show;$.powerTip.closeTip=$.powerTip.hide;function CSSCoordinates(){var me=this;me.top="auto";me.left="auto";me.right="auto";me.bottom="auto";me.set=function(property,value){if($.isNumeric(value)){me[property]=Math.round(value)}}}function DisplayController(element,options,tipController){var hoverTimer=null,myCloseDelay=null;function openTooltip(immediate,forceOpen){cancelTimer();if(!element.data(DATA_HASACTIVEHOVER)){if(!immediate){session.tipOpenImminent=true;hoverTimer=setTimeout(function intentDelay(){hoverTimer=null;checkForIntent()},options.intentPollInterval)}else{if(forceOpen){element.data(DATA_FORCEDOPEN,true)} -closeAnyDelayed();tipController.showTip(element)}}else{cancelClose()}}function closeTooltip(disableDelay){if(myCloseDelay){myCloseDelay=session.closeDelayTimeout=clearTimeout(myCloseDelay);session.delayInProgress=false}cancelTimer();session.tipOpenImminent=false;if(element.data(DATA_HASACTIVEHOVER)){element.data(DATA_FORCEDOPEN,false);if(!disableDelay){session.delayInProgress=true;session.closeDelayTimeout=setTimeout(function closeDelay(){session.closeDelayTimeout=null;tipController.hideTip(element);session.delayInProgress=false;myCloseDelay=null},options.closeDelay);myCloseDelay=session.closeDelayTimeout}else{tipController.hideTip(element)}}}function checkForIntent(){var xDifference=Math.abs(session.previousX-session.currentX),yDifference=Math.abs(session.previousY-session.currentY),totalDifference=xDifference+yDifference;if(totalDifference",{id:options.popupId});if($body.length===0){$body=$("body")}$body.append(tipElement);session.tooltips=session.tooltips?session.tooltips.add(tipElement):tipElement}if(options.followMouse){if(!tipElement.data(DATA_HASMOUSEMOVE)){$document.on("mousemove"+EVENT_NAMESPACE,positionTipOnCursor);$window.on("scroll"+EVENT_NAMESPACE,positionTipOnCursor);tipElement.data(DATA_HASMOUSEMOVE,true)}}function beginShowTip(element){element.data(DATA_HASACTIVEHOVER,true);tipElement.queue(function queueTipInit(next){showTip(element);next()})}function showTip(element){var tipContent;if(!element.data(DATA_HASACTIVEHOVER)){return}if( -session.isTipOpen){if(!session.isClosing){hideTip(session.activeHover)}tipElement.delay(100).queue(function queueTipAgain(next){showTip(element);next()});return}element.trigger("powerTipPreRender");tipContent=getTooltipContent(element);if(tipContent){tipElement.empty().append(tipContent)}else{return}element.trigger("powerTipRender");session.activeHover=element;session.isTipOpen=true;tipElement.data(DATA_MOUSEONTOTIP,options.mouseOnToPopup);tipElement.addClass(options.popupClass);if(!options.followMouse||element.data(DATA_FORCEDOPEN)){positionTipOnElement(element);session.isFixedTipOpen=true}else{positionTipOnCursor()}if(!element.data(DATA_FORCEDOPEN)&&!options.followMouse){$document.on("click"+EVENT_NAMESPACE,function documentClick(event){var target=event.target;if(target!==element[0]){if(options.mouseOnToPopup){if(target!==tipElement[0]&&!$.contains(tipElement[0],target)){$.powerTip.hide()}}else{$.powerTip.hide()}}})}if(options.mouseOnToPopup&&!options.manual){tipElement.on("mouseenter"+EVENT_NAMESPACE, -function tipMouseEnter(){if(session.activeHover){session.activeHover.data(DATA_DISPLAYCONTROLLER).cancel()}});tipElement.on("mouseleave"+EVENT_NAMESPACE,function tipMouseLeave(){if(session.activeHover){session.activeHover.data(DATA_DISPLAYCONTROLLER).hide()}})}tipElement.fadeIn(options.fadeInTime,function fadeInCallback(){if(!session.desyncTimeout){session.desyncTimeout=setInterval(closeDesyncedTip,500)}element.trigger("powerTipOpen")})}function hideTip(element){session.isClosing=true;session.isTipOpen=false;session.desyncTimeout=clearInterval(session.desyncTimeout);element.data(DATA_HASACTIVEHOVER,false);element.data(DATA_FORCEDOPEN,false);$document.off("click"+EVENT_NAMESPACE);tipElement.off(EVENT_NAMESPACE);tipElement.fadeOut(options.fadeOutTime,function fadeOutCallback(){var coords=new CSSCoordinates;session.activeHover=null;session.isClosing=false;session.isFixedTipOpen=false;tipElement.removeClass();coords.set("top",session.currentY+options.offset);coords.set("left",session.currentX+options.offset); -tipElement.css(coords);element.trigger("powerTipClose")})}function positionTipOnCursor(){var tipWidth,tipHeight,coords,collisions,collisionCount;if(!session.isFixedTipOpen&&(session.isTipOpen||session.tipOpenImminent&&tipElement.data(DATA_HASMOUSEMOVE))){tipWidth=tipElement.outerWidth();tipHeight=tipElement.outerHeight();coords=new CSSCoordinates;coords.set("top",session.currentY+options.offset);coords.set("left",session.currentX+options.offset);collisions=getViewportCollisions(coords,tipWidth,tipHeight);if(collisions!==Collision.none){collisionCount=countFlags(collisions);if(collisionCount===1){if(collisions===Collision.right){coords.set("left",session.scrollLeft+session.windowWidth-tipWidth)}else if(collisions===Collision.bottom){coords.set("top",session.scrollTop+session.windowHeight-tipHeight)}}else{coords.set("left",session.currentX-tipWidth-options.offset);coords.set("top",session.currentY-tipHeight-options.offset)}}tipElement.css(coords)}}function positionTipOnElement(element){var priorityList, -finalPlacement;if(options.smartPlacement||options.followMouse&&element.data(DATA_FORCEDOPEN)){priorityList=$.fn.powerTip.smartPlacementLists[options.placement];$.each(priorityList,function(idx,pos){var collisions=getViewportCollisions(placeTooltip(element,pos),tipElement.outerWidth(),tipElement.outerHeight());finalPlacement=pos;return collisions!==Collision.none})}else{placeTooltip(element,options.placement);finalPlacement=options.placement}tipElement.removeClass("w nw sw e ne se n s w se-alt sw-alt ne-alt nw-alt");tipElement.addClass(finalPlacement)}function placeTooltip(element,placement){var iterationCount=0,tipWidth,tipHeight,coords=new CSSCoordinates;coords.set("top",0);coords.set("left",0);tipElement.css(coords);do{tipWidth=tipElement.outerWidth();tipHeight=tipElement.outerHeight();coords=placementCalculator.compute(element,placement,tipWidth,tipHeight,options.offset);tipElement.css(coords)}while(++iterationCount<=5&&(tipWidth!==tipElement.outerWidth()||tipHeight!==tipElement.outerHeight())); -return coords}function closeDesyncedTip(){var isDesynced=false,hasDesyncableCloseEvent=$.grep(["mouseleave","mouseout","blur","focusout"],function(eventType){return $.inArray(eventType,options.closeEvents)!==-1}).length>0;if(session.isTipOpen&&!session.isClosing&&!session.delayInProgress&&hasDesyncableCloseEvent){if(session.activeHover.data(DATA_HASACTIVEHOVER)===false||session.activeHover.is(":disabled")){isDesynced=true}else if(!isMouseOver(session.activeHover)&&!session.activeHover.is(":focus")&&!session.activeHover.data(DATA_FORCEDOPEN)){if(tipElement.data(DATA_MOUSEONTOTIP)){if(!isMouseOver(tipElement)){isDesynced=true}}else{isDesynced=true}}if(isDesynced){hideTip(session.activeHover)}}}this.showTip=beginShowTip;this.hideTip=hideTip;this.resetPosition=positionTipOnElement}function isSvgElement(element){return Boolean(window.SVGElement&&element[0]instanceof SVGElement)}function isMouseEvent(event){return Boolean(event&&$.inArray(event.type,MOUSE_EVENTS)>-1&&typeof event.pageX==="number")} -function initTracking(){if(!session.mouseTrackingActive){session.mouseTrackingActive=true;getViewportDimensions();$(getViewportDimensions);$document.on("mousemove"+EVENT_NAMESPACE,trackMouse);$window.on("resize"+EVENT_NAMESPACE,trackResize);$window.on("scroll"+EVENT_NAMESPACE,trackScroll)}}function getViewportDimensions(){session.scrollLeft=$window.scrollLeft();session.scrollTop=$window.scrollTop();session.windowWidth=$window.width();session.windowHeight=$window.height()}function trackResize(){session.windowWidth=$window.width();session.windowHeight=$window.height()}function trackScroll(){var x=$window.scrollLeft(),y=$window.scrollTop();if(x!==session.scrollLeft){session.currentX+=x-session.scrollLeft;session.scrollLeft=x}if(y!==session.scrollTop){session.currentY+=y-session.scrollTop;session.scrollTop=y}}function trackMouse(event){session.currentX=event.pageX;session.currentY=event.pageY}function isMouseOver(element){var elementPosition=element.offset(),elementBox=element[0].getBoundingClientRect(), -elementWidth=elementBox.right-elementBox.left,elementHeight=elementBox.bottom-elementBox.top;return session.currentX>=elementPosition.left&&session.currentX<=elementPosition.left+elementWidth&&session.currentY>=elementPosition.top&&session.currentY<=elementPosition.top+elementHeight}function getTooltipContent(element){var tipText=element.data(DATA_POWERTIP),tipObject=element.data(DATA_POWERTIPJQ),tipTarget=element.data(DATA_POWERTIPTARGET),targetElement,content;if(tipText){if($.isFunction(tipText)){tipText=tipText.call(element[0])}content=tipText}else if(tipObject){if($.isFunction(tipObject)){tipObject=tipObject.call(element[0])}if(tipObject.length>0){content=tipObject.clone(true,true)}}else if(tipTarget){targetElement=$("#"+tipTarget);if(targetElement.length>0){content=targetElement.html()}}return content}function getViewportCollisions(coords,elementWidth,elementHeight){var viewportTop=session.scrollTop,viewportLeft=session.scrollLeft,viewportBottom=viewportTop+session.windowHeight, -viewportRight=viewportLeft+session.windowWidth,collisions=Collision.none;if(coords.topviewportBottom||Math.abs(coords.bottom-session.windowHeight)>viewportBottom){collisions|=Collision.bottom}if(coords.leftviewportRight){collisions|=Collision.left}if(coords.left+elementWidth>viewportRight||coords.right1)){a.preventDefault();var c=a.originalEvent.changedTouches[0],d=document.createEvent("MouseEvents");d.initMouseEvent(b,!0,!0,window,1,c.screenX,c.screenY,c.clientX,c.clientY,!1,!1,!1,!1,0,null),a.target.dispatchEvent(d)}}if(a.support.touch="ontouchend"in document,a.support.touch){var e,b=a.ui.mouse.prototype,c=b._mouseInit,d=b._mouseDestroy;b._touchStart=function(a){var b=this;!e&&b._mouseCapture(a.originalEvent.changedTouches[0])&&(e=!0,b._touchMoved=!1,f(a,"mouseover"),f(a,"mousemove"),f(a,"mousedown"))},b._touchMove=function(a){e&&(this._touchMoved=!0,f(a,"mousemove"))},b._touchEnd=function(a){e&&(f(a,"mouseup"),f(a,"mouseout"),this._touchMoved||f(a,"click"),e=!1)},b._mouseInit=function(){var b=this;b.element.bind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),c.call(b)},b._mouseDestroy=function(){var b=this;b.element.unbind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b, -"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),d.call(b)}}}(jQuery); -/*! SmartMenus jQuery Plugin - v1.1.0 - September 17, 2017 - * http://www.smartmenus.org/ - * Copyright Vasil Dinkov, Vadikom Web Ltd. http://vadikom.com; Licensed MIT */(function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof module&&"object"==typeof module.exports?module.exports=t(require("jquery")):t(jQuery)})(function($){function initMouseDetection(t){var e=".smartmenus_mouse";if(mouseDetectionEnabled||t)mouseDetectionEnabled&&t&&($(document).off(e),mouseDetectionEnabled=!1);else{var i=!0,s=null,o={mousemove:function(t){var e={x:t.pageX,y:t.pageY,timeStamp:(new Date).getTime()};if(s){var o=Math.abs(s.x-e.x),a=Math.abs(s.y-e.y);if((o>0||a>0)&&2>=o&&2>=a&&300>=e.timeStamp-s.timeStamp&&(mouse=!0,i)){var n=$(t.target).closest("a");n.is("a")&&$.each(menuTrees,function(){return $.contains(this.$root[0],n[0])?(this.itemEnter({currentTarget:n[0]}),!1):void 0}),i=!1}}s=e}};o[touchEvents?"touchstart":"pointerover pointermove pointerout MSPointerOver MSPointerMove MSPointerOut"]=function(t){isTouchEvent(t.originalEvent)&&(mouse=!1)},$(document).on(getEventsNS(o,e)), -mouseDetectionEnabled=!0}}function isTouchEvent(t){return!/^(4|mouse)$/.test(t.pointerType)}function getEventsNS(t,e){e||(e="");var i={};for(var s in t)i[s.split(" ").join(e+" ")+e]=t[s];return i}var menuTrees=[],mouse=!1,touchEvents="ontouchstart"in window,mouseDetectionEnabled=!1,requestAnimationFrame=window.requestAnimationFrame||function(t){return setTimeout(t,1e3/60)},cancelAnimationFrame=window.cancelAnimationFrame||function(t){clearTimeout(t)},canAnimate=!!$.fn.animate;return $.SmartMenus=function(t,e){this.$root=$(t),this.opts=e,this.rootId="",this.accessIdPrefix="",this.$subArrow=null,this.activatedItems=[],this.visibleSubMenus=[],this.showTimeout=0,this.hideTimeout=0,this.scrollTimeout=0,this.clickActivated=!1,this.focusActivated=!1,this.zIndexInc=0,this.idInc=0,this.$firstLink=null,this.$firstSub=null,this.disabled=!1,this.$disableOverlay=null,this.$touchScrollingSub=null,this.cssTransforms3d="perspective"in t.style||"webkitPerspective"in t.style,this.wasCollapsible=!1,this.init()},$.extend( -$.SmartMenus,{hideAll:function(){$.each(menuTrees,function(){this.menuHideAll()})},destroy:function(){for(;menuTrees.length;)menuTrees[0].destroy();initMouseDetection(!0)},prototype:{init:function(t){var e=this;if(!t){menuTrees.push(this),this.rootId=((new Date).getTime()+Math.random()+"").replace(/\D/g,""),this.accessIdPrefix="sm-"+this.rootId+"-",this.$root.hasClass("sm-rtl")&&(this.opts.rightToLeftSubMenus=!0);var i=".smartmenus";this.$root.data("smartmenus",this).attr("data-smartmenus-id",this.rootId).dataSM("level",1).on(getEventsNS({"mouseover focusin":$.proxy(this.rootOver,this),"mouseout focusout":$.proxy(this.rootOut,this),keydown:$.proxy(this.rootKeyDown,this)},i)).on(getEventsNS({mouseenter:$.proxy(this.itemEnter,this),mouseleave:$.proxy(this.itemLeave,this),mousedown:$.proxy(this.itemDown,this),focus:$.proxy(this.itemFocus,this),blur:$.proxy(this.itemBlur,this),click:$.proxy(this.itemClick,this)},i),"a"),i+=this.rootId,this.opts.hideOnClick&&$(document).on(getEventsNS({touchstart:$.proxy( -this.docTouchStart,this),touchmove:$.proxy(this.docTouchMove,this),touchend:$.proxy(this.docTouchEnd,this),click:$.proxy(this.docClick,this)},i)),$(window).on(getEventsNS({"resize orientationchange":$.proxy(this.winResize,this)},i)),this.opts.subIndicators&&(this.$subArrow=$("").addClass("sub-arrow"),this.opts.subIndicatorsText&&this.$subArrow.html(this.opts.subIndicatorsText)),initMouseDetection()}if(this.$firstSub=this.$root.find("ul").each(function(){e.menuInit($(this))}).eq(0),this.$firstLink=this.$root.find("a").eq(0),this.opts.markCurrentItem){var s=/(index|default)\.[^#\?\/]*/i,o=/#.*/,a=window.location.href.replace(s,""),n=a.replace(o,"");this.$root.find("a").each(function(){var t=this.href.replace(s,""),i=$(this);(t==a||t==n)&&(i.addClass("current"),e.opts.markCurrentTree&&i.parentsUntil("[data-smartmenus-id]","ul").each(function(){$(this).dataSM("parent-a").addClass("current")}))})}this.wasCollapsible=this.isCollapsible()},destroy:function(t){if(!t){var e=".smartmenus";this.$root.removeData( -"smartmenus").removeAttr("data-smartmenus-id").removeDataSM("level").off(e),e+=this.rootId,$(document).off(e),$(window).off(e),this.opts.subIndicators&&(this.$subArrow=null)}this.menuHideAll();var i=this;this.$root.find("ul").each(function(){var t=$(this);t.dataSM("scroll-arrows")&&t.dataSM("scroll-arrows").remove(),t.dataSM("shown-before")&&((i.opts.subMenusMinWidth||i.opts.subMenusMaxWidth)&&t.css({width:"",minWidth:"",maxWidth:""}).removeClass("sm-nowrap"),t.dataSM("scroll-arrows")&&t.dataSM("scroll-arrows").remove(),t.css({zIndex:"",top:"",left:"",marginLeft:"",marginTop:"",display:""})),0==(t.attr("id")||"").indexOf(i.accessIdPrefix)&&t.removeAttr("id")}).removeDataSM("in-mega").removeDataSM("shown-before").removeDataSM("scroll-arrows").removeDataSM("parent-a").removeDataSM("level").removeDataSM("beforefirstshowfired").removeAttr("role").removeAttr("aria-hidden").removeAttr("aria-labelledby").removeAttr("aria-expanded"),this.$root.find("a.has-submenu").each(function(){var t=$(this);0==t.attr("id" -).indexOf(i.accessIdPrefix)&&t.removeAttr("id")}).removeClass("has-submenu").removeDataSM("sub").removeAttr("aria-haspopup").removeAttr("aria-controls").removeAttr("aria-expanded").closest("li").removeDataSM("sub"),this.opts.subIndicators&&this.$root.find("span.sub-arrow").remove(),this.opts.markCurrentItem&&this.$root.find("a.current").removeClass("current"),t||(this.$root=null,this.$firstLink=null,this.$firstSub=null,this.$disableOverlay&&(this.$disableOverlay.remove(),this.$disableOverlay=null),menuTrees.splice($.inArray(this,menuTrees),1))},disable:function(t){if(!this.disabled){if(this.menuHideAll(),!t&&!this.opts.isPopup&&this.$root.is(":visible")){var e=this.$root.offset();this.$disableOverlay=$('
').css({position:"absolute",top:e.top,left:e.left,width:this.$root.outerWidth(),height:this.$root.outerHeight(),zIndex:this.getStartZIndex(!0),opacity:0}).appendTo(document.body)}this.disabled=!0}},docClick:function(t){return this.$touchScrollingSub?( -this.$touchScrollingSub=null,void 0):((this.visibleSubMenus.length&&!$.contains(this.$root[0],t.target)||$(t.target).closest("a").length)&&this.menuHideAll(),void 0)},docTouchEnd:function(){if(this.lastTouch){if(!(!this.visibleSubMenus.length||void 0!==this.lastTouch.x2&&this.lastTouch.x1!=this.lastTouch.x2||void 0!==this.lastTouch.y2&&this.lastTouch.y1!=this.lastTouch.y2||this.lastTouch.target&&$.contains(this.$root[0],this.lastTouch.target))){this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=0);var t=this;this.hideTimeout=setTimeout(function(){t.menuHideAll()},350)}this.lastTouch=null}},docTouchMove:function(t){if(this.lastTouch){var e=t.originalEvent.touches[0];this.lastTouch.x2=e.pageX,this.lastTouch.y2=e.pageY}},docTouchStart:function(t){var e=t.originalEvent.touches[0];this.lastTouch={x1:e.pageX,y1:e.pageY,target:e.target}},enable:function(){this.disabled&&(this.$disableOverlay&&(this.$disableOverlay.remove(),this.$disableOverlay=null),this.disabled=!1)},getClosestMenu:function(t){for( -var e=$(t).closest("ul");e.dataSM("in-mega");)e=e.parent().closest("ul");return e[0]||null},getHeight:function(t){return this.getOffset(t,!0)},getOffset:function(t,e){var i;"none"==t.css("display")&&(i={position:t[0].style.position,visibility:t[0].style.visibility},t.css({position:"absolute",visibility:"hidden"}).show());var s=t[0].getBoundingClientRect&&t[0].getBoundingClientRect(),o=s&&(e?s.height||s.bottom-s.top:s.width||s.right-s.left);return o||0===o||(o=e?t[0].offsetHeight:t[0].offsetWidth),i&&t.hide().css(i),o},getStartZIndex:function(t){var e=parseInt(this[t?"$root":"$firstSub"].css("z-index"));return!t&&isNaN(e)&&(e=parseInt(this.$root.css("z-index"))),isNaN(e)?1:e},getTouchPoint:function(t){return t.touches&&t.touches[0]||t.changedTouches&&t.changedTouches[0]||t},getViewport:function(t){var e=t?"Height":"Width",i=document.documentElement["client"+e],s=window["inner"+e];return s&&(i=Math.min(i,s)),i},getViewportHeight:function(){return this.getViewport(!0)},getViewportWidth:function(){ -return this.getViewport()},getWidth:function(t){return this.getOffset(t)},handleEvents:function(){return!this.disabled&&this.isCSSOn()},handleItemEvents:function(t){return this.handleEvents()&&!this.isLinkInMegaMenu(t)},isCollapsible:function(){return"static"==this.$firstSub.css("position")},isCSSOn:function(){return"inline"!=this.$firstLink.css("display")},isFixed:function(){var t="fixed"==this.$root.css("position");return t||this.$root.parentsUntil("body").each(function(){return"fixed"==$(this).css("position")?(t=!0,!1):void 0}),t},isLinkInMegaMenu:function(t){return $(this.getClosestMenu(t[0])).hasClass("mega-menu")},isTouchMode:function(){return!mouse||this.opts.noMouseOver||this.isCollapsible()},itemActivate:function(t,e){var i=t.closest("ul"),s=i.dataSM("level");if(s>1&&(!this.activatedItems[s-2]||this.activatedItems[s-2][0]!=i.dataSM("parent-a")[0])){var o=this;$(i.parentsUntil("[data-smartmenus-id]","ul").get().reverse()).add(i).each(function(){o.itemActivate($(this).dataSM("parent-a"))})}if(( -!this.isCollapsible()||e)&&this.menuHideSubMenus(this.activatedItems[s-1]&&this.activatedItems[s-1][0]==t[0]?s:s-1),this.activatedItems[s-1]=t,this.$root.triggerHandler("activate.smapi",t[0])!==!1){var a=t.dataSM("sub");a&&(this.isTouchMode()||!this.opts.showOnClick||this.clickActivated)&&this.menuShow(a)}},itemBlur:function(t){var e=$(t.currentTarget);this.handleItemEvents(e)&&this.$root.triggerHandler("blur.smapi",e[0])},itemClick:function(t){var e=$(t.currentTarget);if(this.handleItemEvents(e)){if(this.$touchScrollingSub&&this.$touchScrollingSub[0]==e.closest("ul")[0])return this.$touchScrollingSub=null,t.stopPropagation(),!1;if(this.$root.triggerHandler("click.smapi",e[0])===!1)return!1;var i=$(t.target).is(".sub-arrow"),s=e.dataSM("sub"),o=s?2==s.dataSM("level"):!1,a=this.isCollapsible(),n=/toggle$/.test(this.opts.collapsibleBehavior),r=/link$/.test(this.opts.collapsibleBehavior),h=/^accordion/.test(this.opts.collapsibleBehavior);if(s&&!s.is(":visible")){if((!r||!a||i)&&(this.opts.showOnClick&&o&&( -this.clickActivated=!0),this.itemActivate(e,h),s.is(":visible")))return this.focusActivated=!0,!1}else if(a&&(n||i))return this.itemActivate(e,h),this.menuHide(s),n&&(this.focusActivated=!1),!1;return this.opts.showOnClick&&o||e.hasClass("disabled")||this.$root.triggerHandler("select.smapi",e[0])===!1?!1:void 0}},itemDown:function(t){var e=$(t.currentTarget);this.handleItemEvents(e)&&e.dataSM("mousedown",!0)},itemEnter:function(t){var e=$(t.currentTarget);if(this.handleItemEvents(e)){if(!this.isTouchMode()){this.showTimeout&&(clearTimeout(this.showTimeout),this.showTimeout=0);var i=this;this.showTimeout=setTimeout(function(){i.itemActivate(e)},this.opts.showOnClick&&1==e.closest("ul").dataSM("level")?1:this.opts.showTimeout)}this.$root.triggerHandler("mouseenter.smapi",e[0])}},itemFocus:function(t){var e=$(t.currentTarget);this.handleItemEvents(e)&&(!this.focusActivated||this.isTouchMode()&&e.dataSM("mousedown")||this.activatedItems.length&&this.activatedItems[this.activatedItems.length-1][0]==e[0 -]||this.itemActivate(e,!0),this.$root.triggerHandler("focus.smapi",e[0]))},itemLeave:function(t){var e=$(t.currentTarget);this.handleItemEvents(e)&&(this.isTouchMode()||(e[0].blur(),this.showTimeout&&(clearTimeout(this.showTimeout),this.showTimeout=0)),e.removeDataSM("mousedown"),this.$root.triggerHandler("mouseleave.smapi",e[0]))},menuHide:function(t){if(this.$root.triggerHandler("beforehide.smapi",t[0])!==!1&&(canAnimate&&t.stop(!0,!0),"none"!=t.css("display"))){var e=function(){t.css("z-index","")};this.isCollapsible()?canAnimate&&this.opts.collapsibleHideFunction?this.opts.collapsibleHideFunction.call(this,t,e):t.hide(this.opts.collapsibleHideDuration,e):canAnimate&&this.opts.hideFunction?this.opts.hideFunction.call(this,t,e):t.hide(this.opts.hideDuration,e),t.dataSM("scroll")&&(this.menuScrollStop(t),t.css({"touch-action":"","-ms-touch-action":"","-webkit-transform":"",transform:""}).off(".smartmenus_scroll").removeDataSM("scroll").dataSM("scroll-arrows").hide()),t.dataSM("parent-a").removeClass( -"highlighted").attr("aria-expanded","false"),t.attr({"aria-expanded":"false","aria-hidden":"true"});var i=t.dataSM("level");this.activatedItems.splice(i-1,1),this.visibleSubMenus.splice($.inArray(t,this.visibleSubMenus),1),this.$root.triggerHandler("hide.smapi",t[0])}},menuHideAll:function(){this.showTimeout&&(clearTimeout(this.showTimeout),this.showTimeout=0);for(var t=this.opts.isPopup?1:0,e=this.visibleSubMenus.length-1;e>=t;e--)this.menuHide(this.visibleSubMenus[e]);this.opts.isPopup&&(canAnimate&&this.$root.stop(!0,!0),this.$root.is(":visible")&&(canAnimate&&this.opts.hideFunction?this.opts.hideFunction.call(this,this.$root):this.$root.hide(this.opts.hideDuration))),this.activatedItems=[],this.visibleSubMenus=[],this.clickActivated=!1,this.focusActivated=!1,this.zIndexInc=0,this.$root.triggerHandler("hideAll.smapi")},menuHideSubMenus:function(t){for(var e=this.activatedItems.length-1;e>=t;e--){var i=this.activatedItems[e].dataSM("sub");i&&this.menuHide(i)}},menuInit:function(t){if(!t.dataSM("in-mega")){ -t.hasClass("mega-menu")&&t.find("ul").dataSM("in-mega",!0);for(var e=2,i=t[0];(i=i.parentNode.parentNode)!=this.$root[0];)e++;var s=t.prevAll("a").eq(-1);s.length||(s=t.prevAll().find("a").eq(-1)),s.addClass("has-submenu").dataSM("sub",t),t.dataSM("parent-a",s).dataSM("level",e).parent().dataSM("sub",t);var o=s.attr("id")||this.accessIdPrefix+ ++this.idInc,a=t.attr("id")||this.accessIdPrefix+ ++this.idInc;s.attr({id:o,"aria-haspopup":"true","aria-controls":a,"aria-expanded":"false"}),t.attr({id:a,role:"group","aria-hidden":"true","aria-labelledby":o,"aria-expanded":"false"}),this.opts.subIndicators&&s[this.opts.subIndicatorsPos](this.$subArrow.clone())}},menuPosition:function(t){var e,i,s=t.dataSM("parent-a"),o=s.closest("li"),a=o.parent(),n=t.dataSM("level"),r=this.getWidth(t),h=this.getHeight(t),u=s.offset(),l=u.left,c=u.top,d=this.getWidth(s),m=this.getHeight(s),p=$(window),f=p.scrollLeft(),v=p.scrollTop(),b=this.getViewportWidth(),S=this.getViewportHeight(),g=a.parent().is("[data-sm-horizontal-sub]" -)||2==n&&!a.hasClass("sm-vertical"),M=this.opts.rightToLeftSubMenus&&!o.is("[data-sm-reverse]")||!this.opts.rightToLeftSubMenus&&o.is("[data-sm-reverse]"),w=2==n?this.opts.mainMenuSubOffsetX:this.opts.subMenusSubOffsetX,T=2==n?this.opts.mainMenuSubOffsetY:this.opts.subMenusSubOffsetY;if(g?(e=M?d-r-w:w,i=this.opts.bottomToTopSubMenus?-h-T:m+T):(e=M?w-r:d-w,i=this.opts.bottomToTopSubMenus?m-T-h:T),this.opts.keepInViewport){var y=l+e,I=c+i;if(M&&f>y?e=g?f-y+e:d-w:!M&&y+r>f+b&&(e=g?f+b-r-y+e:w-r),g||(S>h&&I+h>v+S?i+=v+S-h-I:(h>=S||v>I)&&(i+=v-I)),g&&(I+h>v+S+.49||v>I)||!g&&h>S+.49){var x=this;t.dataSM("scroll-arrows")||t.dataSM("scroll-arrows",$([$('')[0],$('')[0]]).on({mouseenter:function(){t.dataSM("scroll").up=$(this).hasClass("scroll-up"),x.menuScroll(t)},mouseleave:function(e){x.menuScrollStop(t),x.menuScrollOut(t,e)},"mousewheel DOMMouseScroll":function(t){ -t.preventDefault()}}).insertAfter(t));var A=".smartmenus_scroll";if(t.dataSM("scroll",{y:this.cssTransforms3d?0:i-m,step:1,itemH:m,subH:h,arrowDownH:this.getHeight(t.dataSM("scroll-arrows").eq(1))}).on(getEventsNS({mouseover:function(e){x.menuScrollOver(t,e)},mouseout:function(e){x.menuScrollOut(t,e)},"mousewheel DOMMouseScroll":function(e){x.menuScrollMousewheel(t,e)}},A)).dataSM("scroll-arrows").css({top:"auto",left:"0",marginLeft:e+(parseInt(t.css("border-left-width"))||0),width:r-(parseInt(t.css("border-left-width"))||0)-(parseInt(t.css("border-right-width"))||0),zIndex:t.css("z-index")}).eq(g&&this.opts.bottomToTopSubMenus?0:1).show(),this.isFixed()){var C={};C[touchEvents?"touchstart touchmove touchend":"pointerdown pointermove pointerup MSPointerDown MSPointerMove MSPointerUp"]=function(e){x.menuScrollTouch(t,e)},t.css({"touch-action":"none","-ms-touch-action":"none"}).on(getEventsNS(C,A))}}}t.css({top:"auto",left:"0",marginLeft:e,marginTop:i-m})},menuScroll:function(t,e,i){var s,o=t.dataSM("scroll"), -a=t.dataSM("scroll-arrows"),n=o.up?o.upEnd:o.downEnd;if(!e&&o.momentum){if(o.momentum*=.92,s=o.momentum,.5>s)return this.menuScrollStop(t),void 0}else s=i||(e||!this.opts.scrollAccelerate?this.opts.scrollStep:Math.floor(o.step));var r=t.dataSM("level");if(this.activatedItems[r-1]&&this.activatedItems[r-1].dataSM("sub")&&this.activatedItems[r-1].dataSM("sub").is(":visible")&&this.menuHideSubMenus(r-1),o.y=o.up&&o.y>=n||!o.up&&n>=o.y?o.y:Math.abs(n-o.y)>s?o.y+(o.up?s:-s):n,t.css(this.cssTransforms3d?{"-webkit-transform":"translate3d(0, "+o.y+"px, 0)",transform:"translate3d(0, "+o.y+"px, 0)"}:{marginTop:o.y}),mouse&&(o.up&&o.y>o.downEnd||!o.up&&o.y0;t.dataSM("scroll-arrows").eq(i?0:1).is(":visible")&&(t.dataSM("scroll").up=i,this.menuScroll(t,!0))}e.preventDefault()},menuScrollOut:function(t,e){mouse&&(/^scroll-(up|down)/.test((e.relatedTarget||"").className)||(t[0]==e.relatedTarget||$.contains(t[0],e.relatedTarget))&&this.getClosestMenu(e.relatedTarget)==t[0]||t.dataSM("scroll-arrows").css("visibility","hidden"))},menuScrollOver:function(t,e){if(mouse&&!/^scroll-(up|down)/.test(e.target.className)&&this.getClosestMenu(e.target)==t[0]){this.menuScrollRefreshData(t);var i=t.dataSM("scroll"),s=$(window).scrollTop()-t.dataSM("parent-a").offset().top-i.itemH;t.dataSM("scroll-arrows").eq(0).css("margin-top",s).end().eq(1).css("margin-top",s+this.getViewportHeight()-i.arrowDownH).end().css("visibility","visible")}},menuScrollRefreshData:function(t){var e=t.dataSM("scroll"),i=$(window).scrollTop()-t.dataSM("parent-a").offset().top-e.itemH;this.cssTransforms3d&&(i=-(parseFloat(t.css("margin-top"))-i)),$.extend(e,{upEnd:i, -downEnd:i+this.getViewportHeight()-e.subH})},menuScrollStop:function(t){return this.scrollTimeout?(cancelAnimationFrame(this.scrollTimeout),this.scrollTimeout=0,t.dataSM("scroll").step=1,!0):void 0},menuScrollTouch:function(t,e){if(e=e.originalEvent,isTouchEvent(e)){var i=this.getTouchPoint(e);if(this.getClosestMenu(i.target)==t[0]){var s=t.dataSM("scroll");if(/(start|down)$/i.test(e.type))this.menuScrollStop(t)?(e.preventDefault(),this.$touchScrollingSub=t):this.$touchScrollingSub=null,this.menuScrollRefreshData(t),$.extend(s,{touchStartY:i.pageY,touchStartTime:e.timeStamp});else if(/move$/i.test(e.type)){var o=void 0!==s.touchY?s.touchY:s.touchStartY;if(void 0!==o&&o!=i.pageY){this.$touchScrollingSub=t;var a=i.pageY>o;void 0!==s.up&&s.up!=a&&$.extend(s,{touchStartY:i.pageY,touchStartTime:e.timeStamp}),$.extend(s,{up:a,touchY:i.pageY}),this.menuScroll(t,!0,Math.abs(i.pageY-o))}e.preventDefault()}else void 0!==s.touchY&&((s.momentum=15*Math.pow(Math.abs(i.pageY-s.touchStartY)/(e.timeStamp-s.touchStartTime),2) -)&&(this.menuScrollStop(t),this.menuScroll(t),e.preventDefault()),delete s.touchY)}}},menuShow:function(t){if((t.dataSM("beforefirstshowfired")||(t.dataSM("beforefirstshowfired",!0),this.$root.triggerHandler("beforefirstshow.smapi",t[0])!==!1))&&this.$root.triggerHandler("beforeshow.smapi",t[0])!==!1&&(t.dataSM("shown-before",!0),canAnimate&&t.stop(!0,!0),!t.is(":visible"))){var e=t.dataSM("parent-a"),i=this.isCollapsible();if((this.opts.keepHighlighted||i)&&e.addClass("highlighted"),i)t.removeClass("sm-nowrap").css({zIndex:"",width:"auto",minWidth:"",maxWidth:"",top:"",left:"",marginLeft:"",marginTop:""});else{if(t.css("z-index",this.zIndexInc=(this.zIndexInc||this.getStartZIndex())+1),(this.opts.subMenusMinWidth||this.opts.subMenusMaxWidth)&&(t.css({width:"auto",minWidth:"",maxWidth:""}).addClass("sm-nowrap"),this.opts.subMenusMinWidth&&t.css("min-width",this.opts.subMenusMinWidth),this.opts.subMenusMaxWidth)){var s=this.getWidth(t);t.css("max-width",this.opts.subMenusMaxWidth),s>this.getWidth(t -)&&t.removeClass("sm-nowrap").css("width",this.opts.subMenusMaxWidth)}this.menuPosition(t)}var o=function(){t.css("overflow","")};i?canAnimate&&this.opts.collapsibleShowFunction?this.opts.collapsibleShowFunction.call(this,t,o):t.show(this.opts.collapsibleShowDuration,o):canAnimate&&this.opts.showFunction?this.opts.showFunction.call(this,t,o):t.show(this.opts.showDuration,o),e.attr("aria-expanded","true"),t.attr({"aria-expanded":"true","aria-hidden":"false"}),this.visibleSubMenus.push(t),this.$root.triggerHandler("show.smapi",t[0])}},popupHide:function(t){this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=0);var e=this;this.hideTimeout=setTimeout(function(){e.menuHideAll()},t?1:this.opts.hideTimeout)},popupShow:function(t,e){if(!this.opts.isPopup)return alert('SmartMenus jQuery Error:\n\nIf you want to show this menu via the "popupShow" method, set the isPopup:true option.'),void 0;if(this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=0),this.$root.dataSM("shown-before",!0), -canAnimate&&this.$root.stop(!0,!0),!this.$root.is(":visible")){this.$root.css({left:t,top:e});var i=this,s=function(){i.$root.css("overflow","")};canAnimate&&this.opts.showFunction?this.opts.showFunction.call(this,this.$root,s):this.$root.show(this.opts.showDuration,s),this.visibleSubMenus[0]=this.$root}},refresh:function(){this.destroy(!0),this.init(!0)},rootKeyDown:function(t){if(this.handleEvents())switch(t.keyCode){case 27:var e=this.activatedItems[0];if(e){this.menuHideAll(),e[0].focus();var i=e.dataSM("sub");i&&this.menuHide(i)}break;case 32:var s=$(t.target);if(s.is("a")&&this.handleItemEvents(s)){var i=s.dataSM("sub");i&&!i.is(":visible")&&(this.itemClick({currentTarget:t.target}),t.preventDefault())}}},rootOut:function(t){if(this.handleEvents()&&!this.isTouchMode()&&t.target!=this.$root[0]&&(this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=0),!this.opts.showOnClick||!this.opts.hideOnClick)){var e=this;this.hideTimeout=setTimeout(function(){e.menuHideAll()},this.opts.hideTimeout)}}, -rootOver:function(t){this.handleEvents()&&!this.isTouchMode()&&t.target!=this.$root[0]&&this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=0)},winResize:function(t){if(this.handleEvents()){if(!("onorientationchange"in window)||"orientationchange"==t.type){var e=this.isCollapsible();this.wasCollapsible&&e||(this.activatedItems.length&&this.activatedItems[this.activatedItems.length-1][0].blur(),this.menuHideAll()),this.wasCollapsible=e}}else if(this.$disableOverlay){var i=this.$root.offset();this.$disableOverlay.css({top:i.top,left:i.left,width:this.$root.outerWidth(),height:this.$root.outerHeight()})}}}}),$.fn.dataSM=function(t,e){return e?this.data(t+"_smartmenus",e):this.data(t+"_smartmenus")},$.fn.removeDataSM=function(t){return this.removeData(t+"_smartmenus")},$.fn.smartmenus=function(options){if("string"==typeof options){var args=arguments,method=options;return Array.prototype.shift.call(args),this.each(function(){var t=$(this).data("smartmenus");t&&t[method]&&t[method].apply(t,args)})} -return this.each(function(){var dataOpts=$(this).data("sm-options")||null;if(dataOpts)try{dataOpts=eval("("+dataOpts+")")}catch(e){dataOpts=null,alert('ERROR\n\nSmartMenus jQuery init:\nInvalid "data-sm-options" attribute value syntax.')}new $.SmartMenus(this,$.extend({},$.fn.smartmenus.defaults,options,dataOpts))})},$.fn.smartmenus.defaults={isPopup:!1,mainMenuSubOffsetX:0,mainMenuSubOffsetY:0,subMenusSubOffsetX:0,subMenusSubOffsetY:0,subMenusMinWidth:"10em",subMenusMaxWidth:"20em",subIndicators:!0,subIndicatorsPos:"append",subIndicatorsText:"",scrollStep:30,scrollAccelerate:!0,showTimeout:250,hideTimeout:500,showDuration:0,showFunction:null,hideDuration:0,hideFunction:function(t,e){t.fadeOut(200,e)},collapsibleShowDuration:0,collapsibleShowFunction:function(t,e){t.slideDown(200,e)},collapsibleHideDuration:0,collapsibleHideFunction:function(t,e){t.slideUp(200,e)},showOnClick:!1,hideOnClick:!0,noMouseOver:!1,keepInViewport:!0,keepHighlighted:!0,markCurrentItem:!1,markCurrentTree:!0,rightToLeftSubMenus:!1, -bottomToTopSubMenus:!1,collapsibleBehavior:"default"},$}); +version https://git-lfs.github.com/spec/v1 +oid sha256:3092fe64f7a14890a95e713d556a50d08f8fbf4d8872af7a0164770285776706 +size 176782 diff --git a/doxygen_docs/html/light__class_8cpp_source.html b/doxygen_docs/html/light__class_8cpp_source.html index 789df1b..31a2e37 100644 --- a/doxygen_docs/html/light__class_8cpp_source.html +++ b/doxygen_docs/html/light__class_8cpp_source.html @@ -1,203 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/src/system/light_class.cpp Source File - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
light_class.cpp
-
-
-
1
-
2// Filename: lightclass.cpp
-
4#include "light_class.h"
-
5
-
6
-
7light_class::light_class()
-
8{
-
9}
-
10
-
11
-
12light_class::light_class(const light_class& other)
-
13{
-
14}
-
15
-
16
-
17light_class::~light_class()
-
18{
-
19}
-
20
-
21void light_class::SetAmbientColor(float red, float green, float blue, float alpha)
-
22{
-
23 m_ambientColor = XMFLOAT4(red, green, blue, alpha);
-
24 return;
-
25}
-
26
-
27
-
28
-
29void light_class::SetDiffuseColor(float red, float green, float blue, float alpha)
-
30{
-
31 m_diffuseColor = XMFLOAT4(red, green, blue, alpha);
-
32 return;
-
33}
-
34
-
35
-
36void light_class::SetDirection(float x, float y, float z)
-
37{
-
38 m_direction = XMFLOAT3(x, y, z);
-
39 return;
-
40}
-
41
-
42void light_class::SetSpecularColor(float red, float green, float blue, float alpha)
-
43{
-
44 m_specularColor = XMFLOAT4(red, green, blue, alpha);
-
45 return;
-
46}
-
47
-
48
-
49void light_class::SetSpecularPower(float power)
-
50{
-
51 m_specularPower = power;
-
52 return;
-
53}
-
54
-
55void light_class::SetPosition(float x, float y, float z)
-
56{
-
57 m_position = XMFLOAT4(x, y, z, 1.0f);
-
58 return;
-
59}
-
60
-
61XMFLOAT4 light_class::GetAmbientColor()
-
62{
-
63 return m_ambientColor;
-
64}
-
65
-
66
-
67XMFLOAT4 light_class::GetDiffuseColor()
-
68{
-
69 return m_diffuseColor;
-
70}
-
71
-
72XMFLOAT3 light_class::GetDirection()
-
73{
-
74 return m_direction;
-
75}
-
76
-
77XMFLOAT4 light_class::GetSpecularColor()
-
78{
-
79 return m_specularColor;
-
80}
-
81
-
82
-
83float light_class::GetSpecularPower()
-
84{
-
85 return m_specularPower;
-
86}
-
87
-
88XMFLOAT4 light_class::GetPosition()
-
89{
-
90 return m_position;
-
91}
- -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:34d1cb5ca665425b5139012d1fdeb34fa7498907689582ecc2ae26b29011ec41 +size 15877 diff --git a/doxygen_docs/html/light__class_8h_source.html b/doxygen_docs/html/light__class_8h_source.html index 31fbf1b..c17a7d1 100644 --- a/doxygen_docs/html/light__class_8h_source.html +++ b/doxygen_docs/html/light__class_8h_source.html @@ -1,162 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/inc/system/light_class.h Source File - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
light_class.h
-
-
-
1#pragma once
-
3// Filename: lightclass.h
-
5#ifndef _LIGHTCLASS_H_
-
6#define _LIGHTCLASS_H_
-
7
-
8
-
10// INCLUDES //
-
12#include <directxmath.h>
-
13using namespace DirectX;
-
14
-
15
-
17// Class name: light_class
-
- -
20{
-
21public:
- - - -
25
-
26 void SetAmbientColor(float, float, float, float);
-
27 void SetDiffuseColor(float, float, float, float);
-
28 void SetDirection(float, float, float);
-
29 void SetSpecularColor(float, float, float, float);
-
30 void SetSpecularPower(float);
-
31 void SetPosition(float, float, float);
-
32
-
33 XMFLOAT4 GetAmbientColor();
-
34 XMFLOAT4 GetDiffuseColor();
-
35 XMFLOAT3 GetDirection();
-
36 XMFLOAT4 GetSpecularColor();
-
37 float GetSpecularPower();
-
38 XMFLOAT4 GetPosition();
-
39
-
40 void SetIntensity(float intensity) { m_intensity = intensity; }
-
41 float GetIntensity() const { return m_intensity; }
-
42
-
43private:
-
44 XMFLOAT4 m_ambientColor;
-
45 XMFLOAT4 m_diffuseColor;
-
46 XMFLOAT3 m_direction;
-
47 XMFLOAT4 m_specularColor;
-
48 float m_intensity;
-
49 float m_specularPower;
-
50 XMFLOAT4 m_position;
-
51};
-
-
52
-
53#endif
- -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:42a1eb9c721584dbb39cdf3da886d054594245e3494a4747fe2395acb8bd1074 +size 12157 diff --git a/doxygen_docs/html/light__map__shader__class_8cpp_source.html b/doxygen_docs/html/light__map__shader__class_8cpp_source.html index ad047e3..86a3270 100644 --- a/doxygen_docs/html/light__map__shader__class_8cpp_source.html +++ b/doxygen_docs/html/light__map__shader__class_8cpp_source.html @@ -1,513 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/src/shader/light_map_shader_class.cpp Source File - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
light_map_shader_class.cpp
-
-
-
1#include "light_map_shader_class.h"
-
2
-
3
-
4light_map_shader_class::light_map_shader_class()
-
5{
-
6 vertex_shader_ = 0;
-
7 pixel_shader_ = 0;
-
8 layout_ = 0;
-
9 matrix_buffer_ = 0;
-
10 sample_state_ = 0;
-
11}
-
12
-
13
-
14light_map_shader_class::light_map_shader_class(const light_map_shader_class& other)
-
15{
-
16}
-
17
-
18
-
19light_map_shader_class::~light_map_shader_class()
-
20{
-
21}
-
22
-
23
-
24bool light_map_shader_class::initialize(ID3D11Device* device, HWND hwnd)
-
25{
-
26 Logger::Get().Log("Initializing light_map_shader_class", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
27
-
28 bool result;
-
29 wchar_t vsFilename[128];
-
30 wchar_t psFilename[128];
-
31 int error;
-
32
-
33 // Set the filename of the vertex shader.
-
34 error = wcscpy_s(vsFilename, 128, L"src/hlsl/lightmap.vs");
-
35 if (error != 0)
-
36 {
-
37 Logger::Get().Log("Error copying string", __FILE__, __LINE__, Logger::LogLevel::Error);
-
38 return false;
-
39 }
-
40
-
41 // Set the filename of the pixel shader.
-
42 error = wcscpy_s(psFilename, 128, L"src/hlsl/lightmap.ps");
-
43 if (error != 0)
-
44 {
-
45 Logger::Get().Log("Error copying string", __FILE__, __LINE__, Logger::LogLevel::Error);
-
46 return false;
-
47 }
-
48
-
49 // initialize the vertex and pixel shaders.
-
50 result = initialize_shader(device, hwnd, vsFilename, psFilename);
-
51 if (!result)
-
52 {
-
53 Logger::Get().Log("Error initializing shader", __FILE__, __LINE__, Logger::LogLevel::Error);
-
54 return false;
-
55 }
-
56
-
57 Logger::Get().Log("light_map_shader_class initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
58
-
59 return true;
-
60}
-
61
-
62
-
63void light_map_shader_class::shutdown()
-
64{
-
65 // shutdown the vertex and pixel shaders as well as the related objects.
-
66 shutdown_shader();
-
67
-
68 return;
-
69}
-
70
-
71
-
72bool light_map_shader_class::render(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix,
-
73 XMMATRIX projectionMatrix, ID3D11ShaderResourceView* texture1, ID3D11ShaderResourceView* texture2)
-
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, texture1, texture2);
-
80 if (!result)
-
81 {
-
82 Logger::Get().Log("Error setting 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}
-
91
-
92
-
93bool light_map_shader_class::initialize_shader(ID3D11Device* device, HWND hwnd, WCHAR* vsFilename, WCHAR* psFilename)
-
94{
-
95 Logger::Get().Log("Initializing shader", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
96 HRESULT result;
-
97 ID3D10Blob* errorMessage;
-
98 ID3D10Blob* vertexShaderBuffer;
-
99 ID3D10Blob* pixelShaderBuffer;
-
100 D3D11_INPUT_ELEMENT_DESC polygonLayout[3];
-
101 unsigned int numElements;
-
102 D3D11_BUFFER_DESC matrixBufferDesc;
-
103 D3D11_SAMPLER_DESC samplerDesc;
-
104
-
105
-
106 // initialize the pointers this function will use to null.
-
107 errorMessage = 0;
-
108 vertexShaderBuffer = 0;
-
109 pixelShaderBuffer = 0;
-
110
-
111 // Compile the vertex shader code.
-
112 result = D3DCompileFromFile(vsFilename, NULL, NULL, "LightMapVertexShader", "vs_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0,
-
113 &vertexShaderBuffer, &errorMessage);
-
114 if (FAILED(result))
-
115 {
-
116 // If the shader failed to compile it should have writen something to the error message.
-
117 if (errorMessage)
-
118 {
-
119 output_shader_error_message(errorMessage, hwnd, vsFilename);
-
120 }
-
121 // If there was nothing in the error message then it simply could not find the shader file itself.
-
122 else
-
123 {
-
124 Logger::Get().Log("Error compiling shader", __FILE__, __LINE__, Logger::LogLevel::Error);
-
125 }
-
126
-
127 return false;
-
128 }
-
129
-
130 // Compile the pixel shader code.
-
131 result = D3DCompileFromFile(psFilename, NULL, NULL, "LightMapPixelShader", "ps_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0,
-
132 &pixelShaderBuffer, &errorMessage);
-
133 if (FAILED(result))
-
134 {
-
135 // If the shader failed to compile it should have writen something to the error message.
-
136 if (errorMessage)
-
137 {
-
138 output_shader_error_message(errorMessage, hwnd, psFilename);
-
139 }
-
140 // If there was nothing in the error message then it simply could not find the file itself.
-
141 else
-
142 {
-
143 Logger::Get().Log("Error compiling shader", __FILE__, __LINE__, Logger::LogLevel::Error);
-
144 }
-
145
-
146 return false;
-
147 }
-
148
-
149 // Create the vertex shader from the buffer.
-
150 result = device->CreateVertexShader(vertexShaderBuffer->GetBufferPointer(), vertexShaderBuffer->GetBufferSize(), NULL, &vertex_shader_);
-
151 if (FAILED(result))
-
152 {
-
153 Logger::Get().Log("Error creating vertex shader", __FILE__, __LINE__, Logger::LogLevel::Error);
-
154 return false;
-
155 }
-
156
-
157 // Create the pixel shader from the buffer.
-
158 result = device->CreatePixelShader(pixelShaderBuffer->GetBufferPointer(), pixelShaderBuffer->GetBufferSize(), NULL, &pixel_shader_);
-
159 if (FAILED(result))
-
160 {
-
161 Logger::Get().Log("Error creating pixel shader", __FILE__, __LINE__, Logger::LogLevel::Error);
-
162 return false;
-
163 }
-
164
-
165 // Create the vertex input layout description.
-
166 polygonLayout[0].SemanticName = "POSITION";
-
167 polygonLayout[0].SemanticIndex = 0;
-
168 polygonLayout[0].Format = DXGI_FORMAT_R32G32B32_FLOAT;
-
169 polygonLayout[0].InputSlot = 0;
-
170 polygonLayout[0].AlignedByteOffset = 0;
-
171 polygonLayout[0].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
-
172 polygonLayout[0].InstanceDataStepRate = 0;
-
173
-
174 polygonLayout[1].SemanticName = "TEXCOORD";
-
175 polygonLayout[1].SemanticIndex = 0;
-
176 polygonLayout[1].Format = DXGI_FORMAT_R32G32_FLOAT;
-
177 polygonLayout[1].InputSlot = 0;
-
178 polygonLayout[1].AlignedByteOffset = D3D11_APPEND_ALIGNED_ELEMENT;
-
179 polygonLayout[1].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
-
180 polygonLayout[1].InstanceDataStepRate = 0;
-
181
-
182 polygonLayout[2].SemanticName = "NORMAL";
-
183 polygonLayout[2].SemanticIndex = 0;
-
184 polygonLayout[2].Format = DXGI_FORMAT_R32G32B32_FLOAT;
-
185 polygonLayout[2].InputSlot = 0;
-
186 polygonLayout[2].AlignedByteOffset = D3D11_APPEND_ALIGNED_ELEMENT;
-
187 polygonLayout[2].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
-
188 polygonLayout[2].InstanceDataStepRate = 0;
-
189
-
190 // Get a count of the elements in the layout.
-
191 numElements = sizeof(polygonLayout) / sizeof(polygonLayout[0]);
-
192
-
193 // Create the vertex input layout.
-
194 result = device->CreateInputLayout(polygonLayout, numElements, vertexShaderBuffer->GetBufferPointer(),
-
195 vertexShaderBuffer->GetBufferSize(), &layout_);
-
196 if (FAILED(result))
-
197 {
-
198 Logger::Get().Log("Error creating input layout", __FILE__, __LINE__, Logger::LogLevel::Error);
-
199 return false;
-
200 }
-
201
-
202 // Release the vertex shader buffer and pixel shader buffer since they are no longer needed.
-
203 vertexShaderBuffer->Release();
-
204 vertexShaderBuffer = 0;
-
205
-
206 pixelShaderBuffer->Release();
-
207 pixelShaderBuffer = 0;
-
208
-
209 // Setup the description of the dynamic matrix constant buffer that is in the vertex shader.
-
210 matrixBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
-
211 matrixBufferDesc.ByteWidth = sizeof(matrix_buffer_type);
-
212 matrixBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
-
213 matrixBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
-
214 matrixBufferDesc.MiscFlags = 0;
-
215 matrixBufferDesc.StructureByteStride = 0;
-
216
-
217 // Create the constant buffer pointer so we can access the vertex shader constant buffer from within this class.
-
218 result = device->CreateBuffer(&matrixBufferDesc, NULL, &matrix_buffer_);
-
219 if (FAILED(result))
-
220 {
-
221 Logger::Get().Log("Error creating constant buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
-
222 return false;
-
223 }
-
224
-
225 // Create a texture sampler state description.
-
226 samplerDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR;
-
227 samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP;
-
228 samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP;
-
229 samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_WRAP;
-
230 samplerDesc.MipLODBias = 0.0f;
-
231 samplerDesc.MaxAnisotropy = 1;
-
232 samplerDesc.ComparisonFunc = D3D11_COMPARISON_ALWAYS;
-
233 samplerDesc.BorderColor[0] = 0;
-
234 samplerDesc.BorderColor[1] = 0;
-
235 samplerDesc.BorderColor[2] = 0;
-
236 samplerDesc.BorderColor[3] = 0;
-
237 samplerDesc.MinLOD = 0;
-
238 samplerDesc.MaxLOD = D3D11_FLOAT32_MAX;
-
239
-
240 // Create the texture sampler state.
-
241 result = device->CreateSamplerState(&samplerDesc, &sample_state_);
-
242 if (FAILED(result))
-
243 {
-
244 Logger::Get().Log("Error creating sampler state", __FILE__, __LINE__, Logger::LogLevel::Error);
-
245 return false;
-
246 }
-
247
-
248 Logger::Get().Log("Shader initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
249
-
250 return true;
-
251}
-
252
-
253
-
254void light_map_shader_class::shutdown_shader()
-
255{
-
256 Logger::Get().Log("Shutting down light_map_shader_class", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
257
-
258 // Release the sampler state.
-
259 if (sample_state_)
-
260 {
-
261 sample_state_->Release();
-
262 sample_state_ = 0;
-
263 }
-
264
-
265 // Release the matrix constant buffer.
-
266 if (matrix_buffer_)
-
267 {
-
268 matrix_buffer_->Release();
-
269 matrix_buffer_ = 0;
-
270 }
-
271
-
272 // Release the layout.
-
273 if (layout_)
-
274 {
-
275 layout_->Release();
-
276 layout_ = 0;
-
277 }
-
278
-
279 // Release the pixel shader.
-
280 if (pixel_shader_)
-
281 {
-
282 pixel_shader_->Release();
-
283 pixel_shader_ = 0;
-
284 }
-
285
-
286 // Release the vertex shader.
-
287 if (vertex_shader_)
-
288 {
-
289 vertex_shader_->Release();
-
290 vertex_shader_ = 0;
-
291 }
-
292
-
293 Logger::Get().Log("light_map_shader_class shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
294
-
295 return;
-
296}
-
297
-
298
-
299void light_map_shader_class::output_shader_error_message(ID3D10Blob* errorMessage, HWND hwnd, WCHAR* shaderFilename)
-
300{
-
301 char* compileErrors;
-
302 unsigned long long bufferSize, i;
-
303 ofstream fout;
-
304
-
305
-
306 // Get a pointer to the error message text buffer.
-
307 compileErrors = (char*)(errorMessage->GetBufferPointer());
-
308
-
309 // Get the length of the message.
-
310 bufferSize = errorMessage->GetBufferSize();
-
311
-
312 // Open a file to write the error message to.
-
313 fout.open("shader-error.txt");
-
314
-
315 // Write out the error message.
-
316 for (i = 0; i < bufferSize; i++)
-
317 {
-
318 fout << compileErrors[i];
-
319 }
-
320
-
321 // Close the file.
-
322 fout.close();
-
323
-
324 // Release the error message.
-
325 errorMessage->Release();
-
326 errorMessage = 0;
-
327
-
328 // Pop a message up on the screen to notify the user to check the text file for compile errors.
-
329 MessageBox(hwnd, L"Error compiling shader. Check shader-error.txt for message.", shaderFilename, MB_OK);
-
330
-
331 return;
-
332}
-
333
-
334
-
335bool light_map_shader_class::set_shader_parameters(ID3D11DeviceContext* deviceContext, XMMATRIX worldMatrix, XMMATRIX viewMatrix,
-
336 XMMATRIX projectionMatrix, ID3D11ShaderResourceView* texture1, ID3D11ShaderResourceView* texture2)
-
337{
-
338 HRESULT result;
-
339 D3D11_MAPPED_SUBRESOURCE mappedResource;
-
340 matrix_buffer_type* dataPtr;
-
341 unsigned int bufferNumber;
-
342
-
343
-
344 // Transpose the matrices to prepare them for the shader.
-
345 worldMatrix = XMMatrixTranspose(worldMatrix);
-
346 viewMatrix = XMMatrixTranspose(viewMatrix);
-
347 projectionMatrix = XMMatrixTranspose(projectionMatrix);
-
348
-
349 // Lock the constant buffer so it can be written to.
-
350 result = deviceContext->Map(matrix_buffer_, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
-
351 if (FAILED(result))
-
352 {
-
353 Logger::Get().Log("Error mapping constant buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
-
354 return false;
-
355 }
-
356
-
357 // Get a pointer to the data in the constant buffer.
-
358 dataPtr = (matrix_buffer_type*)mappedResource.pData;
-
359
-
360 // Copy the matrices into the constant buffer.
-
361 dataPtr->world = worldMatrix;
-
362 dataPtr->view = viewMatrix;
-
363 dataPtr->projection = projectionMatrix;
-
364
-
365 // Unlock the constant buffer.
-
366 deviceContext->Unmap(matrix_buffer_, 0);
-
367
-
368 // Set the position of the constant buffer in the vertex shader.
-
369 bufferNumber = 0;
-
370
-
371 // Finally set the constant buffer in the vertex shader with the updated values.
-
372 deviceContext->VSSetConstantBuffers(bufferNumber, 1, &matrix_buffer_);
-
373
-
374 // Set shader texture resources in the pixel shader.
-
375 deviceContext->PSSetShaderResources(0, 1, &texture1);
-
376 deviceContext->PSSetShaderResources(1, 1, &texture2);
-
377
-
378 return true;
-
379}
-
380
-
381
-
382void light_map_shader_class::render_shader(ID3D11DeviceContext* deviceContext, int indexCount)
-
383{
-
384 // Set the vertex input layout.
-
385 deviceContext->IASetInputLayout(layout_);
-
386
-
387 // Set the vertex and pixel shaders that will be used to render this triangle.
-
388 deviceContext->VSSetShader(vertex_shader_, NULL, 0);
-
389 deviceContext->PSSetShader(pixel_shader_, NULL, 0);
-
390
-
391 // Set the sampler state in the pixel shader.
-
392 deviceContext->PSSetSamplers(0, 1, &sample_state_);
-
393
-
394 // render the triangle.
-
395 deviceContext->DrawIndexed(indexCount, 0, 0);
-
396
-
397 return;
-
398}
-
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
- -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:5cd03ee8049ee5d36b2f48449935717fdf5ab5cd20d763a2887a6379e637a8df +size 63720 diff --git a/doxygen_docs/html/light__map__shader__class_8h_source.html b/doxygen_docs/html/light__map__shader__class_8h_source.html index d8595ea..4fc2a00 100644 --- a/doxygen_docs/html/light__map__shader__class_8h_source.html +++ b/doxygen_docs/html/light__map__shader__class_8h_source.html @@ -1,168 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/inc/shader/light_map_shader_class.h Source File - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
light_map_shader_class.h
-
-
-
1
-
2#ifndef _LIGHTMAPSHADERCLASS_H_
-
3#define _LIGHTMAPSHADERCLASS_H_
-
4
-
5
-
7// INCLUDES //
-
9#include "Logger.h"
-
10#include <d3d11.h>
-
11#include <d3dcompiler.h>
-
12#include <directxmath.h>
-
13#include <fstream>
-
14using namespace DirectX;
-
15using namespace std;
-
16
-
17
-
19// Class name: light_map_shader_class
-
- -
22{
-
23private:
-
24 struct matrix_buffer_type
-
25 {
-
26 XMMATRIX world;
-
27 XMMATRIX view;
-
28 XMMATRIX projection;
-
29 };
-
30
-
31public:
- - - -
35
-
36 bool initialize(ID3D11Device*, HWND);
-
37 void shutdown();
-
38 bool render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*);
-
39
-
40private:
-
41 bool initialize_shader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
-
42 void shutdown_shader();
-
43 void output_shader_error_message(ID3D10Blob*, HWND, WCHAR*);
-
44
-
45 bool set_shader_parameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*);
-
46 void render_shader(ID3D11DeviceContext*, int);
-
47
-
48private:
-
49 ID3D11VertexShader* vertex_shader_;
-
50 ID3D11PixelShader* pixel_shader_;
-
51 ID3D11InputLayout* layout_;
-
52 ID3D11Buffer* matrix_buffer_;
-
53 ID3D11SamplerState* sample_state_;
-
54
-
55};
-
-
56
-
57#endif
- -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:fcc166e01538c2440e9c090fae22f455debb4239c13026832627654fa44bfb31 +size 12558 diff --git a/doxygen_docs/html/light__shader__class_8cpp_source.html b/doxygen_docs/html/light__shader__class_8cpp_source.html index 12a67a3..078dc42 100644 --- a/doxygen_docs/html/light__shader__class_8cpp_source.html +++ b/doxygen_docs/html/light__shader__class_8cpp_source.html @@ -1,658 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/src/shader/light_shader_class.cpp Source File - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
light_shader_class.cpp
-
-
-
1
-
2// Filename: lightshaderclass.cpp
-
4#include "light_shader_class.h"
-
5
-
6
-
7light_shader_class::light_shader_class()
-
8{
-
9 vertex_shader_ = 0;
-
10 pixel_shader_ = 0;
-
11 layout_ = 0;
-
12 sample_state_ = 0;
-
13 matrix_buffer_ = 0;
-
14 camera_buffer_ = 0;
-
15 light_buffer_ = 0;
-
16 light_color_buffer_ = 0;
-
17 light_position_buffer_ = 0;
-
18}
-
19
-
20
-
21light_shader_class::light_shader_class(const light_shader_class& other)
-
22{
-
23}
-
24
-
25
-
26light_shader_class::~light_shader_class()
-
27{
-
28}
-
29
-
30
-
31bool light_shader_class::initialize(ID3D11Device* device, HWND hwnd)
-
32{
-
33 Logger::Get().Log("Initializing light_shader_class", __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/light.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/light.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 = initialize_shader(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("light_shader_class initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
64
-
65 return true;
-
66}
-
67
-
68
-
69void light_shader_class::shutdown()
-
70{
-
71 // shutdown the vertex and pixel shaders as well as the related objects.
-
72 shutdown_shader();
-
73
-
74 return;
-
75}
-
76
-
77bool light_shader_class::render(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix,
-
78 ID3D11ShaderResourceView* texture, XMFLOAT4 diffuseColor[], XMFLOAT4 lightPosition[], XMFLOAT4 ambientClor[])
-
79{
-
80 bool result;
-
81
-
82
-
83 // Set the shader parameters that it will use for rendering.
-
84 result = set_shader_parameters(deviceContext, worldMatrix, viewMatrix, projectionMatrix, texture, diffuseColor, lightPosition, ambientClor);
-
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 render_shader(deviceContext, indexCount);
-
93
-
94 return true;
-
95}
-
96
-
97
-
98bool light_shader_class::initialize_shader(ID3D11Device* device, HWND hwnd, WCHAR* vsFilename, WCHAR* psFilename)
-
99{
-
100 Logger::Get().Log("Initializing shader", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
101
-
102 HRESULT result;
-
103 ID3D10Blob* errorMessage;
-
104 ID3D10Blob* vertexShaderBuffer;
-
105 ID3D10Blob* pixelShaderBuffer;
-
106 D3D11_INPUT_ELEMENT_DESC polygonLayout[3];
-
107 unsigned int numElements;
-
108 D3D11_SAMPLER_DESC samplerDesc;
-
109 D3D11_BUFFER_DESC matrixBufferDesc;
-
110 D3D11_BUFFER_DESC cameraBufferDesc;
-
111 D3D11_BUFFER_DESC lightColorBufferDesc;
-
112 D3D11_BUFFER_DESC lightPositionBufferDesc;
-
113
-
114
-
115 // initialize the pointers this function will use to null.
-
116 errorMessage = 0;
-
117 vertexShaderBuffer = 0;
-
118 pixelShaderBuffer = 0;
-
119
-
120 // Compile the vertex shader code.
-
121 result = D3DCompileFromFile(vsFilename, NULL, NULL, "LightVertexShader", "vs_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0, &vertexShaderBuffer, &errorMessage);
-
122 if (FAILED(result))
-
123 {
-
124 // If the shader failed to compile it should have writen something to the error message.
-
125 if (errorMessage)
-
126 {
-
127 output_shader_error_message(errorMessage, hwnd, vsFilename);
-
128 }
-
129 // If there was nothing in the error message then it simply could not find the shader file itself.
-
130 else
-
131 {
-
132 Logger::Get().Log("Failed to compile shader", __FILE__, __LINE__, Logger::LogLevel::Error);
-
133 }
-
134
-
135 return false;
-
136 }
-
137
-
138 // Compile the pixel shader code.
-
139 result = D3DCompileFromFile(psFilename, NULL, NULL, "LightPixelShader", "ps_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0, &pixelShaderBuffer, &errorMessage);
-
140 if (FAILED(result))
-
141 {
-
142 // If the shader failed to compile it should have writen something to the error message.
-
143 if (errorMessage)
-
144 {
-
145 output_shader_error_message(errorMessage, hwnd, psFilename);
-
146 }
-
147 // If there was nothing in the error message then it simply could not find the file itself.
-
148 else
-
149 {
-
150 Logger::Get().Log("Failed to compile shader", __FILE__, __LINE__, Logger::LogLevel::Error);
-
151 }
-
152
-
153 return false;
-
154 }
-
155
-
156 // Create the vertex shader from the buffer.
-
157 result = device->CreateVertexShader(vertexShaderBuffer->GetBufferPointer(), vertexShaderBuffer->GetBufferSize(), NULL, &vertex_shader_);
-
158 if (FAILED(result))
-
159 {
-
160 Logger::Get().Log("Failed to create vertex shader", __FILE__, __LINE__, Logger::LogLevel::Error);
-
161 return false;
-
162 }
-
163
-
164 // Create the pixel shader from the buffer.
-
165 result = device->CreatePixelShader(pixelShaderBuffer->GetBufferPointer(), pixelShaderBuffer->GetBufferSize(), NULL, &pixel_shader_);
-
166 if (FAILED(result))
-
167 {
-
168 Logger::Get().Log("Failed to create pixel shader", __FILE__, __LINE__, Logger::LogLevel::Error);
-
169 return false;
-
170 }
-
171
-
172 // Create the vertex input layout description.
-
173 // This setup needs to match the VertexType stucture in the ModelClass and in the shader.
-
174 polygonLayout[0].SemanticName = "POSITION";
-
175 polygonLayout[0].SemanticIndex = 0;
-
176 polygonLayout[0].Format = DXGI_FORMAT_R32G32B32_FLOAT;
-
177 polygonLayout[0].InputSlot = 0;
-
178 polygonLayout[0].AlignedByteOffset = 0;
-
179 polygonLayout[0].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
-
180 polygonLayout[0].InstanceDataStepRate = 0;
-
181
-
182 polygonLayout[1].SemanticName = "TEXCOORD";
-
183 polygonLayout[1].SemanticIndex = 0;
-
184 polygonLayout[1].Format = DXGI_FORMAT_R32G32_FLOAT;
-
185 polygonLayout[1].InputSlot = 0;
-
186 polygonLayout[1].AlignedByteOffset = D3D11_APPEND_ALIGNED_ELEMENT;
-
187 polygonLayout[1].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
-
188 polygonLayout[1].InstanceDataStepRate = 0;
-
189
-
190 polygonLayout[2].SemanticName = "NORMAL";
-
191 polygonLayout[2].SemanticIndex = 0;
-
192 polygonLayout[2].Format = DXGI_FORMAT_R32G32B32_FLOAT;
-
193 polygonLayout[2].InputSlot = 0;
-
194 polygonLayout[2].AlignedByteOffset = D3D11_APPEND_ALIGNED_ELEMENT;
-
195 polygonLayout[2].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
-
196 polygonLayout[2].InstanceDataStepRate = 0;
-
197
-
198 // Get a count of the elements in the layout.
-
199 numElements = sizeof(polygonLayout) / sizeof(polygonLayout[0]);
-
200
-
201 // Create the vertex input layout.
-
202 result = device->CreateInputLayout(polygonLayout, numElements, vertexShaderBuffer->GetBufferPointer(), vertexShaderBuffer->GetBufferSize(),
-
203 &layout_);
-
204 if (FAILED(result))
-
205 {
-
206 Logger::Get().Log("Failed to create input layout", __FILE__, __LINE__, Logger::LogLevel::Error);
-
207 return false;
-
208 }
-
209
-
210 // Release the vertex shader buffer and pixel shader buffer since they are no longer needed.
-
211 vertexShaderBuffer->Release();
-
212 vertexShaderBuffer = 0;
-
213
-
214 pixelShaderBuffer->Release();
-
215 pixelShaderBuffer = 0;
-
216
-
217 // Create a texture sampler state description.
-
218 samplerDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR;
-
219 samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP;
-
220 samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP;
-
221 samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_WRAP;
-
222 samplerDesc.MipLODBias = 0.0f;
-
223 samplerDesc.MaxAnisotropy = 1;
-
224 samplerDesc.ComparisonFunc = D3D11_COMPARISON_ALWAYS;
-
225 samplerDesc.BorderColor[0] = 0;
-
226 samplerDesc.BorderColor[1] = 0;
-
227 samplerDesc.BorderColor[2] = 0;
-
228 samplerDesc.BorderColor[3] = 0;
-
229 samplerDesc.MinLOD = 0;
-
230 samplerDesc.MaxLOD = D3D11_FLOAT32_MAX;
-
231
-
232 // Create the texture sampler state.
-
233 result = device->CreateSamplerState(&samplerDesc, &sample_state_);
-
234 if (FAILED(result))
-
235 {
-
236 Logger::Get().Log("Failed to create sampler state", __FILE__, __LINE__, Logger::LogLevel::Error);
-
237 return false;
-
238 }
-
239
-
240 // Setup the description of the dynamic matrix constant buffer that is in the vertex shader.
-
241 matrixBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
-
242 matrixBufferDesc.ByteWidth = sizeof(matrix_buffer_type);
-
243 matrixBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
-
244 matrixBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
-
245 matrixBufferDesc.MiscFlags = 0;
-
246 matrixBufferDesc.StructureByteStride = 0;
-
247
-
248 // Create the constant buffer pointer so we can access the vertex shader constant buffer from within this class.
-
249 result = device->CreateBuffer(&matrixBufferDesc, NULL, &matrix_buffer_);
-
250 if (FAILED(result))
-
251 {
-
252 Logger::Get().Log("Failed to create matrix buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
-
253 return false;
-
254 }
-
255
-
256
-
257
-
258 // Setup the description of the camera dynamic constant buffer that is in the vertex shader.
-
259 cameraBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
-
260 cameraBufferDesc.ByteWidth = sizeof(camera_buffer_type);
-
261 cameraBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
-
262 cameraBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
-
263 cameraBufferDesc.MiscFlags = 0;
-
264 cameraBufferDesc.StructureByteStride = 0;
-
265
-
266 // Create the camera constant buffer pointer so we can access the vertex shader constant buffer from within this class.
-
267 result = device->CreateBuffer(&cameraBufferDesc, NULL, &camera_buffer_);
-
268 if (FAILED(result))
-
269 {
-
270 Logger::Get().Log("Failed to create camera buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
-
271 return false;
-
272 }
-
273
-
274 // Setup the description of the dynamic constant buffer that is in the pixel shader.
-
275 lightColorBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
-
276 lightColorBufferDesc.ByteWidth = sizeof(light_color_buffer_type);
-
277 lightColorBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
-
278 lightColorBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
-
279 lightColorBufferDesc.MiscFlags = 0;
-
280 lightColorBufferDesc.StructureByteStride = 0;
-
281
-
282 // Create the constant buffer pointer so we can access the pixel shader constant buffer from within this class.
-
283 result = device->CreateBuffer(&lightColorBufferDesc, NULL, &light_color_buffer_);
-
284 if (FAILED(result))
-
285 {
-
286 Logger::Get().Log("Failed to create light color buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
-
287 return false;
-
288 }
-
289
-
290 // Setup the description of the dynamic constant buffer that is in the vertex shader.
-
291 lightPositionBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
-
292 lightPositionBufferDesc.ByteWidth = sizeof(light_position_buffer_type);
-
293 lightPositionBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
-
294 lightPositionBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
-
295 lightPositionBufferDesc.MiscFlags = 0;
-
296 lightPositionBufferDesc.StructureByteStride = 0;
-
297
-
298 // Create the constant buffer pointer so we can access the vertex shader constant buffer from within this class.
-
299 result = device->CreateBuffer(&lightPositionBufferDesc, NULL, &light_position_buffer_);
-
300 if (FAILED(result))
-
301 {
-
302 Logger::Get().Log("Failed to create light position buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
-
303 return false;
-
304 }
-
305
-
306 Logger::Get().Log("Shader initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
307
-
308 return true;
-
309}
-
310
-
311
-
312void light_shader_class::shutdown_shader()
-
313{
-
314 Logger::Get().Log("Shutting down light_shader_class", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
315
-
316 // Release the light constant buffers.
-
317 if (light_color_buffer_)
-
318 {
-
319 light_color_buffer_->Release();
-
320 light_color_buffer_ = 0;
-
321 }
-
322
-
323 if (light_position_buffer_)
-
324 {
-
325 light_position_buffer_->Release();
-
326 light_position_buffer_ = 0;
-
327 }
-
328
-
329 // Release the light constant buffer.
-
330 if (light_buffer_)
-
331 {
-
332 light_buffer_->Release();
-
333 light_buffer_ = 0;
-
334 }
-
335
-
336 // Release the camera constant buffer.
-
337 if (camera_buffer_)
-
338 {
-
339 camera_buffer_->Release();
-
340 camera_buffer_ = 0;
-
341 }
-
342
-
343 // Release the matrix constant buffer.
-
344 if (matrix_buffer_)
-
345 {
-
346 matrix_buffer_->Release();
-
347 matrix_buffer_ = 0;
-
348 }
-
349
-
350 // Release the sampler state.
-
351 if (sample_state_)
-
352 {
-
353 sample_state_->Release();
-
354 sample_state_ = 0;
-
355 }
-
356
-
357 // Release the layout.
-
358 if (layout_)
-
359 {
-
360 layout_->Release();
-
361 layout_ = 0;
-
362 }
-
363
-
364 // Release the pixel shader.
-
365 if (pixel_shader_)
-
366 {
-
367 pixel_shader_->Release();
-
368 pixel_shader_ = 0;
-
369 }
-
370
-
371 // Release the vertex shader.
-
372 if (vertex_shader_)
-
373 {
-
374 vertex_shader_->Release();
-
375 vertex_shader_ = 0;
-
376 }
-
377
-
378 Logger::Get().Log("light_shader_class shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
-
379
-
380 return;
-
381}
-
382
-
383
-
384void light_shader_class::output_shader_error_message(ID3D10Blob* errorMessage, HWND hwnd, WCHAR* shaderFilename)
-
385{
-
386 char* compileErrors;
-
387 unsigned __int64 bufferSize, i;
-
388 ofstream fout;
-
389
-
390
-
391 // Get a pointer to the error message text buffer.
-
392 compileErrors = (char*)(errorMessage->GetBufferPointer());
-
393
-
394 // Get the length of the message.
-
395 bufferSize = errorMessage->GetBufferSize();
-
396
-
397 // Open a file to write the error message to.
-
398 fout.open("shader-error.txt");
-
399
-
400 // Write out the error message.
-
401 for (i = 0; i < bufferSize; i++)
-
402 {
-
403 fout << compileErrors[i];
-
404 }
-
405
-
406 // Close the file.
-
407 fout.close();
-
408
-
409 // Release the error message.
-
410 errorMessage->Release();
-
411 errorMessage = 0;
-
412
-
413 // Pop a message up on the screen to notify the user to check the text file for compile errors.
-
414 MessageBox(hwnd, L"Error compiling shader. Check shader-error.txt for message.", shaderFilename, MB_OK);
-
415
-
416 return;
-
417}
-
418
-
419
-
420bool light_shader_class::set_shader_parameters(ID3D11DeviceContext* deviceContext, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix,
-
421 ID3D11ShaderResourceView* texture, XMFLOAT4 diffuseColor[], XMFLOAT4 lightPosition[], XMFLOAT4 ambientColor[])
-
422{
-
423 HRESULT result;
-
424 D3D11_MAPPED_SUBRESOURCE mappedResource;
-
425 unsigned int bufferNumber;
-
426 matrix_buffer_type* dataPtr;
-
427 light_position_buffer_type* dataPtr2;
-
428 light_color_buffer_type* dataPtr3;
-
429
-
430 // Transpose the matrices to prepare them for the shader.
-
431 worldMatrix = XMMatrixTranspose(worldMatrix);
-
432 viewMatrix = XMMatrixTranspose(viewMatrix);
-
433 projectionMatrix = XMMatrixTranspose(projectionMatrix);
-
434
-
435 // Lock the constant buffer so it can be written to.
-
436 result = deviceContext->Map(matrix_buffer_, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
-
437 if (FAILED(result))
-
438 {
-
439 Logger::Get().Log("Failed to map matrix buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
-
440 return false;
-
441 }
-
442
-
443 // Get a pointer to the data in the constant buffer.
-
444 dataPtr = (matrix_buffer_type*)mappedResource.pData;
-
445
-
446 // Copy the matrices into the constant buffer.
-
447 dataPtr->world = worldMatrix;
-
448 dataPtr->view = viewMatrix;
-
449 dataPtr->projection = projectionMatrix;
-
450
-
451 // Unlock the constant buffer.
-
452 deviceContext->Unmap(matrix_buffer_, 0);
-
453
-
454 // Set the position of the constant buffer in the vertex shader.
-
455 bufferNumber = 0;
-
456
-
457 // Now set the constant buffer in the vertex shader with the updated values.
-
458 deviceContext->VSSetConstantBuffers(bufferNumber, 1, &matrix_buffer_);
-
459
-
460 // Lock the camera constant buffer so it can be written to.
-
461 result = deviceContext->Map(camera_buffer_, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
-
462 if (FAILED(result))
-
463 {
-
464 Logger::Get().Log("Failed to map camera buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
-
465 return false;
-
466 }
-
467
-
468 // Lock the light position constant buffer so it can be written to.
-
469 result = deviceContext->Map(light_position_buffer_, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
-
470 if (FAILED(result))
-
471 {
-
472 Logger::Get().Log("Failed to map light position buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
-
473 return false;
-
474 }
-
475
-
476 // Get a pointer to the data in the constant buffer.
-
477 dataPtr2 = (light_position_buffer_type*)mappedResource.pData;
-
478
-
479 // Copy the light position variables into the constant buffer.
-
480 for (int i = 0; i < num_lights; i++)
-
481 {
-
482 dataPtr2->lightPosition[i] = lightPosition[i];
-
483 }
-
484
-
485 // Unlock the constant buffer.
-
486 deviceContext->Unmap(light_position_buffer_, 0);
-
487
-
488 // Set the position of the constant buffer in the vertex shader.
-
489 bufferNumber = 1;
-
490
-
491 // Finally set the constant buffer in the vertex shader with the updated values.
-
492 deviceContext->VSSetConstantBuffers(bufferNumber, 1, &light_position_buffer_);
-
493
-
494 // Set shader texture resource in the pixel shader.
-
495 deviceContext->PSSetShaderResources(0, 1, &texture);
-
496
-
497 // Lock the light color constant buffer so it can be written to.
-
498 result = deviceContext->Map(light_color_buffer_, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
-
499 if (FAILED(result))
-
500 {
-
501 Logger::Get().Log("Failed to map light color buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
-
502 return false;
-
503 }
-
504
-
505 // Get a pointer to the data in the constant buffer.
-
506 dataPtr3 = (light_color_buffer_type*)mappedResource.pData;
-
507
-
508 // Copy the light color variables into the constant buffer.
-
509 for (int i = 0; i < num_lights; i++)
-
510 {
-
511 dataPtr3->diffuseColor[i] = diffuseColor[i];
-
512 }
-
513
-
514 // Unlock the constant buffer.
-
515 deviceContext->Unmap(light_color_buffer_, 0);
-
516
-
517 // Set the position of the constant buffer in the pixel shader.
-
518 bufferNumber = 0;
-
519
-
520 // Finally set the constant buffer in the pixel shader with the updated values.
-
521 deviceContext->PSSetConstantBuffers(bufferNumber, 1, &light_color_buffer_);
-
522
-
523
-
524 return true;
-
525}
-
526
-
527
-
528void light_shader_class::render_shader(ID3D11DeviceContext* deviceContext, int indexCount)
-
529{
-
530 // Set the vertex input layout.
-
531 deviceContext->IASetInputLayout(layout_);
-
532
-
533 // Set the vertex and pixel shaders that will be used to render this triangle.
-
534 deviceContext->VSSetShader(vertex_shader_, NULL, 0);
-
535 deviceContext->PSSetShader(pixel_shader_, NULL, 0);
-
536
-
537 // Set the sampler state in the pixel shader.
-
538 deviceContext->PSSetSamplers(0, 1, &sample_state_);
-
539
-
540 // render the triangle.
-
541 deviceContext->DrawIndexed(indexCount, 0, 0);
-
542
-
543 return;
-
544}
-
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
- -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:a1fe61c852429170e694cf3ebaa98c200612b73b888556a305b39023eb3d7d82 +size 85433 diff --git a/doxygen_docs/html/light__shader__class_8h_source.html b/doxygen_docs/html/light__shader__class_8h_source.html index d429a6c..8df3126 100644 --- a/doxygen_docs/html/light__shader__class_8h_source.html +++ b/doxygen_docs/html/light__shader__class_8h_source.html @@ -1,200 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/inc/shader/light_shader_class.h Source File - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
light_shader_class.h
-
-
-
1
-
2// Filename: lightshaderclass.h
-
4#ifndef _LIGHTSHADERCLASS_H_
-
5#define _LIGHTSHADERCLASS_H_
-
6#pragma once
-
7
-
9// GLOBALS //
-
11constexpr int num_lights = 4;
-
13// INCLUDES //
-
15#include "Logger.h"
-
16#include <d3d11.h>
-
17#include <d3dcompiler.h>
-
18#include <directxmath.h>
-
19#include <fstream>
-
20using namespace DirectX;
-
21using namespace std;
-
22
-
23
-
25// Class name: light_shader_class
-
- -
28{
-
29private:
-
30 struct matrix_buffer_type
-
31 {
-
32 XMMATRIX world;
-
33 XMMATRIX view;
-
34 XMMATRIX projection;
-
35 };
-
36
-
37 struct camera_buffer_type
-
38 {
-
39 XMFLOAT3 cameraPosition;
-
40 float padding;
-
41 };
-
42
-
43 struct light_buffer_type
-
44 {
-
45 XMFLOAT4 ambientColor;
-
46 XMFLOAT4 diffuseColor;
-
47 XMFLOAT3 lightDirection;
-
48 float padding; // Added extra padding so structure is a multiple of 16 for CreateBuffer function requirements.
-
49 float specularPower;
-
50 XMFLOAT4 specularColor;
-
51 };
-
52
-
53 struct light_color_buffer_type
-
54 {
-
55 XMFLOAT4 diffuseColor[num_lights];
-
56 };
-
57
-
58 struct light_position_buffer_type
-
59 {
-
60 XMFLOAT4 lightPosition[num_lights];
-
61 };
-
62
-
63public:
- - - -
67
-
68 bool initialize(ID3D11Device*, HWND);
-
69 void shutdown();
-
70 bool render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT4[], XMFLOAT4[], XMFLOAT4[]);
-
71
-
72private:
-
73 bool initialize_shader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
-
74 void shutdown_shader();
-
75 void output_shader_error_message(ID3D10Blob*, HWND, WCHAR*);
-
76
-
77 bool set_shader_parameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT4[], XMFLOAT4[], XMFLOAT4[]);
-
78 void render_shader(ID3D11DeviceContext*, int);
-
79
-
80private:
-
81 ID3D11VertexShader* vertex_shader_;
-
82 ID3D11PixelShader* pixel_shader_;
-
83 ID3D11InputLayout* layout_;
-
84 ID3D11SamplerState* sample_state_;
-
85 ID3D11Buffer* matrix_buffer_;
-
86 ID3D11Buffer* camera_buffer_;
-
87 ID3D11Buffer* light_buffer_;
-
88 ID3D11Buffer* light_color_buffer_;
-
89 ID3D11Buffer* light_position_buffer_;
-
90};
-
-
91
-
92#endif
- -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:cfa066a9d47043440483dda2df3c1a853a237d216caff5a43089744cec977c43 +size 16603 diff --git a/doxygen_docs/html/master__shader_8cpp_source.html b/doxygen_docs/html/master__shader_8cpp_source.html index 5e6ce7c..2e005a6 100644 --- a/doxygen_docs/html/master__shader_8cpp_source.html +++ b/doxygen_docs/html/master__shader_8cpp_source.html @@ -1,138 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/src/shader/master_shader.cpp Source File - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
master_shader.cpp
-
-
-
1#include "master_shader.h"
-
2#include "Logger.h"
-
3
-
4master_shader::master_shader()
-
5{
-
6 // Initialize shader filenames
-
7 wcscpy_s(vs_filename_, 128, vs_name_);
-
8 wcscpy_s(ps_filename_, 128, ps_name_);
-
9
-
10}
-
11
-
12master_shader::~master_shader()
-
13{
-
14 // Destructor implementation
-
15}
-
16
-
17bool master_shader::initialize(ID3D11Device* device, HWND hwnd)
-
18{
-
19 Logger::Get().Log("Initializing master_shader", __FILE__, __LINE__, Logger::LogLevel::Initialize);
-
20
-
21 bool success = false;
-
22
-
23 return true;
-
24}
-
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
-
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:c783871dbe246a84f283455187e4cf7bf6bac9d2134614770631c21970effc0b +size 8666 diff --git a/doxygen_docs/html/master__shader_8h_source.html b/doxygen_docs/html/master__shader_8h_source.html index bcf926e..f0824a9 100644 --- a/doxygen_docs/html/master__shader_8h_source.html +++ b/doxygen_docs/html/master__shader_8h_source.html @@ -1,140 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/inc/shader/master_shader.h Source File - - - - - - - - - - - - - - - -
-
- - - - - - -
-
Khaotic Engine Reborn -
-
-
- - - - - - - - -
-
- -
-
-
- -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
master_shader.h
-
-
-
1#pragma once
-
2#include <d3d11.h>
-
3#include <DirectXMath.h>
-
4#include <string>
-
5
-
6
-
- -
8{
-
9public :
-
10
- -
12 master_shader(const master_shader& other) = delete;
-
13 virtual ~master_shader();
-
14
-
15 virtual bool initialize(ID3D11Device* device, HWND hwnd) = 0;
-
16
-
17
-
18protected:
-
19 wchar_t vs_filename_[128], ps_filename_[128];
-
20
-
21 wchar_t const* vs_name_ = L"";
-
22 wchar_t const* ps_name_ = L"";
-
23
-
24
-
25};
-
- -
-
- - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:14aaff9d22078ea9b9a6456c37c20db44c90d863f318c6179200b6a5c2668c5b +size 8652 diff --git a/doxygen_docs/html/menu.js b/doxygen_docs/html/menu.js index 0fd1e99..a0419b8 100644 --- a/doxygen_docs/html/menu.js +++ b/doxygen_docs/html/menu.js @@ -1,134 +1,3 @@ -/* - @licstart The following is the entire license notice for the JavaScript code in this file. - - The MIT License (MIT) - - Copyright (C) 1997-2020 by Dimitri van Heesch - - Permission is hereby granted, free of charge, to any person obtaining a copy of this software - and associated documentation files (the "Software"), to deal in the Software without restriction, - including without limitation the rights to use, copy, modify, merge, publish, distribute, - sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all copies or - substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING - BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - @licend The above is the entire license notice for the JavaScript code in this file - */ -function initMenu(relPath,searchEnabled,serverSide,searchPage,search,treeview) { - function makeTree(data,relPath) { - let result=''; - if ('children' in data) { - result+='
    '; - for (let i in data.children) { - let url; - const link = data.children[i].url; - if (link.substring(0,1)=='^') { - url = link.substring(1); - } else { - url = relPath+link; - } - result+='
  • '+ - data.children[i].text+''+ - makeTree(data.children[i],relPath)+'
  • '; - } - result+='
'; - } - return result; - } - let searchBoxHtml; - if (searchEnabled) { - if (serverSide) { - searchBoxHtml='
'+ - '
'+ - '
 '+ - ''+ - '
'+ - '
'+ - '
'+ - '
'; - } else { - searchBoxHtml='
'+ - ''+ - ' '+ - ''+ - ''+ - ''+ - ''+ - ''+ - '
'; - } - } - - $('#main-nav').before('
'+ - ''+ - ''+ - '
'); - $('#main-nav').append(makeTree(menudata,relPath)); - $('#main-nav').children(':first').addClass('sm sm-dox').attr('id','main-menu'); - if (searchBoxHtml) { - $('#main-menu').append('
  • '); - } - const $mainMenuState = $('#main-menu-state'); - let prevWidth = 0; - if ($mainMenuState.length) { - const initResizableIfExists = function() { - if (typeof initResizable==='function') initResizable(treeview); - } - // animate mobile menu - $mainMenuState.change(function() { - const $menu = $('#main-menu'); - let options = { duration: 250, step: initResizableIfExists }; - if (this.checked) { - options['complete'] = () => $menu.css('display', 'block'); - $menu.hide().slideDown(options); - } else { - options['complete'] = () => $menu.css('display', 'none'); - $menu.show().slideUp(options); - } - }); - // set default menu visibility - const resetState = function() { - const $menu = $('#main-menu'); - const newWidth = $(window).outerWidth(); - if (newWidth!=prevWidth) { - if ($(window).outerWidth()<768) { - $mainMenuState.prop('checked',false); $menu.hide(); - $('#searchBoxPos1').html(searchBoxHtml); - $('#searchBoxPos2').hide(); - } else { - $menu.show(); - $('#searchBoxPos1').empty(); - $('#searchBoxPos2').html(searchBoxHtml); - $('#searchBoxPos2').show(); - } - if (typeof searchBox!=='undefined') { - searchBox.CloseResultsWindow(); - } - prevWidth = newWidth; - } - } - $(window).ready(function() { resetState(); initResizableIfExists(); }); - $(window).resize(resetState); - } - $('#main-menu').smartmenus(); -} -/* @license-end */ +version https://git-lfs.github.com/spec/v1 +oid sha256:e1241547cfa82cbb5c7e485a8d3735e77ff163999ba18e9cb7dcc0fb137ab6ef +size 5885 diff --git a/doxygen_docs/html/menudata.js b/doxygen_docs/html/menudata.js index b2e25c6..2486d87 100644 --- a/doxygen_docs/html/menudata.js +++ b/doxygen_docs/html/menudata.js @@ -1,81 +1,3 @@ -/* - @licstart The following is the entire license notice for the JavaScript code in this file. - - The MIT License (MIT) - - Copyright (C) 1997-2020 by Dimitri van Heesch - - Permission is hereby granted, free of charge, to any person obtaining a copy of this software - and associated documentation files (the "Software"), to deal in the Software without restriction, - including without limitation the rights to use, copy, modify, merge, publish, distribute, - sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all copies or - substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING - BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - @licend The above is the entire license notice for the JavaScript code in this file -*/ -var menudata={children:[ -{text:"Main Page",url:"index.html"}, -{text:"Namespaces",url:"namespaces.html",children:[ -{text:"Namespace List",url:"namespaces.html"}, -{text:"Namespace Members",url:"namespacemembers.html",children:[ -{text:"All",url:"namespacemembers.html"}, -{text:"Functions",url:"namespacemembers_func.html"}, -{text:"Typedefs",url:"namespacemembers_type.html"}, -{text:"Enumerations",url:"namespacemembers_enum.html"}]}]}, -{text:"Classes",url:"annotated.html",children:[ -{text:"Class List",url:"annotated.html"}, -{text:"Class Index",url:"classes.html"}, -{text:"Class Hierarchy",url:"hierarchy.html"}, -{text:"Class Members",url:"functions.html",children:[ -{text:"All",url:"functions.html",children:[ -{text:"a",url:"functions.html#index_a"}, -{text:"b",url:"functions_b.html#index_b"}, -{text:"c",url:"functions_c.html#index_c"}, -{text:"d",url:"functions_d.html#index_d"}, -{text:"e",url:"functions_e.html#index_e"}, -{text:"f",url:"functions_f.html#index_f"}, -{text:"g",url:"functions_g.html#index_g"}, -{text:"h",url:"functions_h.html#index_h"}, -{text:"i",url:"functions_i.html#index_i"}, -{text:"l",url:"functions_l.html#index_l"}, -{text:"m",url:"functions_m.html#index_m"}, -{text:"n",url:"functions_n.html#index_n"}, -{text:"o",url:"functions_o.html#index_o"}, -{text:"p",url:"functions_p.html#index_p"}, -{text:"r",url:"functions_r.html#index_r"}, -{text:"s",url:"functions_s.html#index_s"}, -{text:"t",url:"functions_t.html#index_t"}, -{text:"u",url:"functions_u.html#index_u"}, -{text:"w",url:"functions_w.html#index_w"}]}, -{text:"Functions",url:"functions_func.html",children:[ -{text:"a",url:"functions_func.html#index_a"}, -{text:"b",url:"functions_func_b.html#index_b"}, -{text:"c",url:"functions_func_c.html#index_c"}, -{text:"d",url:"functions_func_d.html#index_d"}, -{text:"e",url:"functions_func_e.html#index_e"}, -{text:"f",url:"functions_func_f.html#index_f"}, -{text:"g",url:"functions_func_g.html#index_g"}, -{text:"h",url:"functions_func_h.html#index_h"}, -{text:"i",url:"functions_func_i.html#index_i"}, -{text:"l",url:"functions_func_l.html#index_l"}, -{text:"m",url:"functions_func_m.html#index_m"}, -{text:"n",url:"functions_func_n.html#index_n"}, -{text:"o",url:"functions_func_o.html#index_o"}, -{text:"p",url:"functions_func_p.html#index_p"}, -{text:"r",url:"functions_func_r.html#index_r"}, -{text:"s",url:"functions_func_s.html#index_s"}, -{text:"t",url:"functions_func_t.html#index_t"}, -{text:"u",url:"functions_func_u.html#index_u"}, -{text:"w",url:"functions_func_w.html#index_w"}]}, -{text:"Enumerations",url:"functions_enum.html"}]}]}, -{text:"Files",url:"files.html",children:[ -{text:"File List",url:"files.html"}]}]} +version https://git-lfs.github.com/spec/v1 +oid sha256:075738d34f677f9178dfef29ae73aebc6295fcb81065ee423fcd53551ae99672 +size 3922 diff --git a/doxygen_docs/html/minus.svg b/doxygen_docs/html/minus.svg index f70d0c1..0b91a44 100644 --- a/doxygen_docs/html/minus.svg +++ b/doxygen_docs/html/minus.svg @@ -1,8 +1,3 @@ - - - - - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:422b18aa23b98c22464d121c12bc52f870e6312db42cbf87e06f2036e85c9fa1 +size 582 diff --git a/doxygen_docs/html/minusd.svg b/doxygen_docs/html/minusd.svg index 5f8e879..2fefba8 100644 --- a/doxygen_docs/html/minusd.svg +++ b/doxygen_docs/html/minusd.svg @@ -1,8 +1,3 @@ - - - - - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:25594bc92fcf5604e7f70f85607806057c12eb081f6738eacc815227a6da7f1b +size 582 diff --git a/doxygen_docs/html/model__class_8cpp_source.html b/doxygen_docs/html/model__class_8cpp_source.html index 288604d..a0b2eaa 100644 --- a/doxygen_docs/html/model__class_8cpp_source.html +++ b/doxygen_docs/html/model__class_8cpp_source.html @@ -1,826 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/src/system/model_class.cpp Source File - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    model_class.cpp
    -
    -
    -
    1#include "model_class.h"
    -
    2
    -
    3
    -
    4model_class::model_class()
    -
    5{
    -
    6 m_vertexBuffer = 0;
    -
    7 m_indexBuffer = 0;
    -
    8 m_model = 0;
    -
    9 m_vertexCount = 0;
    -
    10 m_indexCount = 0;
    -
    11 m_Textures.diffuse.clear();
    -
    12 m_Textures.normal.clear();
    -
    13 m_Textures.specular.clear();
    -
    14 m_Textures.alpha.clear();
    -
    15 m_Textures.diffusePaths.clear();
    -
    16 m_Textures.normalPaths.clear();
    -
    17 m_Textures.specularPaths.clear();
    -
    18 m_Textures.alphaPaths.clear();
    -
    19}
    -
    20
    -
    21model_class::~model_class()
    -
    22{
    -
    23
    -
    24 // Destructor
    -
    25 Shutdown();
    -
    26}
    -
    27
    -
    28bool model_class::Initialize(ID3D11Device* device, ID3D11DeviceContext* deviceContext, char* modelFilename, const TextureContainer& textures) {
    -
    29
    -
    30 bool result = Initialize(device, deviceContext, modelFilename);
    -
    31 if (!result) {
    -
    32 return false;
    -
    33 }
    -
    34
    -
    35 m_Textures = textures; // Copie de la structure de textures
    -
    36
    -
    37 return true;
    -
    38}
    -
    39
    -
    40bool model_class::Initialize(ID3D11Device* device, ID3D11DeviceContext* deviceContext, char* modelFilename) {
    -
    41
    -
    42 bool result;
    -
    43
    -
    44 // Load in the model data.
    -
    45 result = LoadModel(modelFilename);
    -
    46 if (!result) {
    -
    47 Logger::Get().Log("Failed to load model data", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    48 return false;
    -
    49 }
    -
    50
    -
    51 // Calculate the tangent and binormal vectors for the model.
    -
    52 CalculateModelVectors();
    -
    53
    -
    54 // Initialize the vertex and index buffers.
    -
    55 result = InitializeBuffers(device);
    -
    56 if (!result) {
    -
    57 Logger::Get().Log("Failed to initialize buffers", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    58 return false;
    -
    59 }
    -
    60
    -
    61 return true;
    -
    62}
    -
    63
    -
    64void model_class::Shutdown()
    -
    65{
    -
    66 // Release the model textures.
    -
    67 ReleaseTextures();
    -
    68
    -
    69 // Shutdown the vertex and index buffers.
    -
    70 ShutdownBuffers();
    -
    71
    -
    72 // Release the model data.
    -
    73 ReleaseModel();
    -
    74
    -
    75 return;
    -
    76}
    -
    77
    -
    78
    -
    79void model_class::Render(ID3D11DeviceContext* deviceContext)
    -
    80{
    -
    81 // Put the vertex and index buffers on the graphics pipeline to prepare them for drawing.
    -
    82 RenderBuffers(deviceContext);
    -
    83
    -
    84 return;
    -
    85}
    -
    86
    -
    87
    -
    88int model_class::GetIndexCount()
    -
    89{
    -
    90 return m_indexCount;
    -
    91}
    -
    92
    -
    93ID3D11ShaderResourceView* model_class::GetTexture(TextureType type, int index) const {
    -
    94 return m_Textures.GetTexture(type, index);
    -
    95}
    -
    96
    -
    97bool model_class::InitializeBuffers(ID3D11Device* device)
    -
    98{
    -
    99
    -
    100 VertexType* vertices;
    -
    101 unsigned long* indices;
    -
    102 D3D11_BUFFER_DESC vertexBufferDesc, indexBufferDesc;
    -
    103 D3D11_SUBRESOURCE_DATA vertexData, indexData;
    -
    104 HRESULT result;
    -
    105 int i;
    -
    106
    -
    107 // Create the vertex array.
    -
    108 vertices = new VertexType[m_vertexCount];
    -
    109
    -
    110 // Create the index array.
    -
    111 indices = new unsigned long[m_indexCount];
    -
    112
    -
    113 // Load the vertex array and index array with data.
    -
    114 for (i = 0; i < m_vertexCount; i++)
    -
    115 {
    -
    116 vertices[i].position = XMFLOAT3(m_model[i].x, m_model[i].y, m_model[i].z);
    -
    117 vertices[i].texture = XMFLOAT2(m_model[i].tu, m_model[i].tv);
    -
    118 vertices[i].normal = XMFLOAT3(m_model[i].nx, m_model[i].ny, m_model[i].nz);
    -
    119 vertices[i].tangent = XMFLOAT3(m_model[i].tx, m_model[i].ty, m_model[i].tz);
    -
    120 vertices[i].binormal = XMFLOAT3(m_model[i].bx, m_model[i].by, m_model[i].bz);
    -
    121
    -
    122 indices[i] = i;
    -
    123 }
    -
    124
    -
    125 // Set up the description of the static vertex buffer.
    -
    126 vertexBufferDesc.Usage = D3D11_USAGE_DEFAULT;
    -
    127 vertexBufferDesc.ByteWidth = sizeof(VertexType) * m_vertexCount;
    -
    128 vertexBufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
    -
    129 vertexBufferDesc.CPUAccessFlags = 0;
    -
    130 vertexBufferDesc.MiscFlags = 0;
    -
    131 vertexBufferDesc.StructureByteStride = 0;
    -
    132
    -
    133 // Give the subresource structure a pointer to the vertex data.
    -
    134 vertexData.pSysMem = vertices;
    -
    135 vertexData.SysMemPitch = 0;
    -
    136 vertexData.SysMemSlicePitch = 0;
    -
    137
    -
    138 // Now create the vertex buffer.
    -
    139 result = device->CreateBuffer(&vertexBufferDesc, &vertexData, &m_vertexBuffer);
    -
    140 if (FAILED(result))
    -
    141 {
    -
    142 Logger::Get().Log("Failed to create vertex buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    143 return false;
    -
    144 }
    -
    145
    -
    146 // Set up the description of the static index buffer.
    -
    147 indexBufferDesc.Usage = D3D11_USAGE_DEFAULT;
    -
    148 indexBufferDesc.ByteWidth = sizeof(unsigned long) * m_indexCount;
    -
    149 indexBufferDesc.BindFlags = D3D11_BIND_INDEX_BUFFER;
    -
    150 indexBufferDesc.CPUAccessFlags = 0;
    -
    151 indexBufferDesc.MiscFlags = 0;
    -
    152 indexBufferDesc.StructureByteStride = 0;
    -
    153
    -
    154 // Give the subresource structure a pointer to the index data.
    -
    155 indexData.pSysMem = indices;
    -
    156 indexData.SysMemPitch = 0;
    -
    157 indexData.SysMemSlicePitch = 0;
    -
    158
    -
    159 // Create the index buffer.
    -
    160 result = device->CreateBuffer(&indexBufferDesc, &indexData, &m_indexBuffer);
    -
    161 if (FAILED(result))
    -
    162 {
    -
    163 Logger::Get().Log("Failed to create index buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    164 return false;
    -
    165 }
    -
    166
    -
    167 // Release the arrays now that the vertex and index buffers have been created and loaded.
    -
    168 delete[] vertices;
    -
    169 vertices = 0;
    -
    170
    -
    171 delete[] indices;
    -
    172 indices = 0;
    -
    173 return true;
    -
    174}
    -
    175
    -
    176
    -
    177void model_class::ShutdownBuffers()
    -
    178{
    -
    179 if (m_indexBuffer) { m_indexBuffer->Release(); m_indexBuffer = nullptr; }
    -
    180 if (m_vertexBuffer) { m_vertexBuffer->Release(); m_vertexBuffer = nullptr; }
    -
    181}
    -
    182
    -
    183void model_class::RenderBuffers(ID3D11DeviceContext* deviceContext)
    -
    184{
    -
    185 unsigned int stride;
    -
    186 unsigned int offset;
    -
    187
    -
    188
    -
    189 // Set vertex buffer stride and offset.
    -
    190 stride = sizeof(VertexType);
    -
    191 offset = 0;
    -
    192
    -
    193 // Set the vertex buffer to active in the input assembler so it can be rendered.
    -
    194 deviceContext->IASetVertexBuffers(0, 1, &m_vertexBuffer, &stride, &offset);
    -
    195
    -
    196 // Set the index buffer to active in the input assembler so it can be rendered.
    -
    197 deviceContext->IASetIndexBuffer(m_indexBuffer, DXGI_FORMAT_R32_UINT, 0);
    -
    198
    -
    199 // Set the type of primitive that should be rendered from this vertex buffer, in this case triangles.
    -
    200 deviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
    -
    201
    -
    202 return;
    -
    203}
    -
    204
    -
    205void model_class::ReleaseTextures()
    -
    206{
    -
    207
    -
    208 // Utilise la méthode ReleaseAll de TextureContainer
    -
    209 m_Textures.ReleaseAll();
    -
    210}
    -
    211
    -
    212bool model_class::LoadModel(char* filename)
    -
    213{
    -
    214
    -
    215 std::string fileStr(filename);
    -
    216 std::string extension = fileStr.substr(fileStr.find_last_of(".") + 1);
    -
    217
    -
    218 if (extension == "obj")
    -
    219 {
    -
    220 // Load .obj file
    -
    221 return LoadObjModel(filename);
    -
    222 }
    -
    223 else if (extension == "txt")
    -
    224 {
    -
    225 // Load .txt file
    -
    226 return LoadTxtModel(filename);
    -
    227 }
    -
    228 else
    -
    229 {
    -
    230 Logger::Get().Log("Unsupported file format", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    231 return false;
    -
    232 }
    -
    233}
    -
    234
    -
    235bool model_class::LoadObjModel(char* filename)
    -
    236{
    -
    237 // Lecture optimisée du fichier en mode binaire
    -
    238 std::ifstream fin(filename, std::ios::in | std::ios::binary);
    -
    239 if (!fin)
    -
    240 {
    -
    241 Logger::Get().Log("Échec d'ouverture du fichier modèle", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    242 return false;
    -
    243 }
    -
    244
    -
    245 // Lecture du fichier entier d'un coup (évite la lecture ligne par ligne)
    -
    246 fin.seekg(0, std::ios::end);
    -
    247 const size_t fileSize = fin.tellg();
    -
    248 fin.seekg(0, std::ios::beg);
    -
    249
    -
    250 std::string fileContent;
    -
    251 fileContent.resize(fileSize);
    -
    252 fin.read(&fileContent[0], fileSize);
    -
    253 fin.close();
    -
    254
    -
    255 // Pré-allocation des vecteurs (évite les réallocations)
    -
    256 const size_t estimatedVertices = fileSize / 150;
    -
    257 std::vector<XMFLOAT3> temp_positions;
    -
    258 std::vector<XMFLOAT2> temp_texcoords;
    -
    259 std::vector<XMFLOAT3> temp_normals;
    -
    260 std::vector<ModelType> temp_model;
    -
    261
    -
    262 temp_positions.reserve(estimatedVertices);
    -
    263 temp_texcoords.reserve(estimatedVertices);
    -
    264 temp_normals.reserve(estimatedVertices);
    -
    265 temp_model.reserve(estimatedVertices * 3);
    -
    266
    -
    267 // Analyse du contenu
    -
    268 std::istringstream iss(fileContent);
    -
    269 std::string line;
    -
    270
    -
    271 while (std::getline(iss, line))
    -
    272 {
    -
    273 if (line.empty() || line[0] == '#') continue;
    -
    274
    -
    275 // Analyse plus rapide basée sur le premier caractère
    -
    276 if (line[0] == 'v')
    -
    277 {
    -
    278 if (line[1] == ' ') // Position de sommet
    -
    279 {
    -
    280 XMFLOAT3 pos;
    -
    281 sscanf_s(line.c_str() + 2, "%f %f %f", &pos.x, &pos.y, &pos.z);
    -
    282 temp_positions.push_back(pos);
    -
    283 }
    -
    284 else if (line[1] == 't') // Coordonnées de texture
    -
    285 {
    -
    286 XMFLOAT2 tex;
    -
    287 sscanf_s(line.c_str() + 3, "%f %f", &tex.x, &tex.y);
    -
    288 temp_texcoords.push_back(tex);
    -
    289 }
    -
    290 else if (line[1] == 'n') // Normales
    -
    291 {
    -
    292 XMFLOAT3 norm;
    -
    293 sscanf_s(line.c_str() + 3, "%f %f %f", &norm.x, &norm.y, &norm.z);
    -
    294 temp_normals.push_back(norm);
    -
    295 }
    -
    296 }
    -
    297 else if (line[0] == 'f')
    -
    298 {
    -
    299 int posIndex[3], texIndex[3], normIndex[3];
    -
    300 const char* linePtr = line.c_str() + 2; // Sauter "f "
    -
    301
    -
    302 for (int i = 0; i < 3; i++)
    -
    303 {
    -
    304 // Analyse rapide du format v/vt/vn
    -
    305 sscanf_s(linePtr, "%d/%d/%d", &posIndex[i], &texIndex[i], &normIndex[i]);
    -
    306
    -
    307 // Avancer au prochain ensemble d'indices
    -
    308 while (*linePtr && *linePtr != ' ') linePtr++;
    -
    309 while (*linePtr == ' ') linePtr++;
    -
    310
    -
    311 if (posIndex[i] < 0) posIndex[i] += temp_positions.size() + 1;
    -
    312 if (texIndex[i] < 0) texIndex[i] += temp_texcoords.size() + 1;
    -
    313 if (normIndex[i] < 0) normIndex[i] += temp_normals.size() + 1;
    -
    314 }
    -
    315
    -
    316 for (int i = 0; i < 3; i++)
    -
    317 {
    -
    318 ModelType vertex{};
    -
    319 vertex.x = temp_positions[posIndex[i] - 1].x;
    -
    320 vertex.y = temp_positions[posIndex[i] - 1].y;
    -
    321 vertex.z = temp_positions[posIndex[i] - 1].z;
    -
    322 vertex.tu = temp_texcoords[texIndex[i] - 1].x;
    -
    323 vertex.tv = temp_texcoords[texIndex[i] - 1].y;
    -
    324 vertex.nx = temp_normals[normIndex[i] - 1].x;
    -
    325 vertex.ny = temp_normals[normIndex[i] - 1].y;
    -
    326 vertex.nz = temp_normals[normIndex[i] - 1].z;
    -
    327 temp_model.push_back(vertex);
    -
    328 }
    -
    329 }
    -
    330 }
    -
    331
    -
    332 // Allocation et copie efficace du modèle final
    -
    333 m_vertexCount = temp_model.size();
    -
    334 m_indexCount = temp_model.size();
    -
    335 m_model = new ModelType[m_vertexCount];
    -
    336 std::memcpy(m_model, temp_model.data(), m_vertexCount * sizeof(ModelType));
    -
    337
    -
    338 return true;
    -
    339}
    -
    340
    -
    341bool model_class::LoadTxtModel(char* filename)
    -
    342{
    -
    343 ifstream fin;
    -
    344 char input;
    -
    345 int i;
    -
    346
    -
    347
    -
    348 // Open the model file.
    -
    349 fin.open(filename);
    -
    350
    -
    351 // If it could not open the file then exit.
    -
    352 if (fin.fail())
    -
    353 {
    -
    354 Logger::Get().Log("Failed to open model file", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    355 return false;
    -
    356 }
    -
    357
    -
    358 // Read up to the value of vertex count.
    -
    359 fin.get(input);
    -
    360 while (input != ':')
    -
    361 {
    -
    362 fin.get(input);
    -
    363 }
    -
    364
    -
    365 // Read in the vertex count.
    -
    366 fin >> m_vertexCount;
    -
    367
    -
    368 // Set the number of indices to be the same as the vertex count.
    -
    369 m_indexCount = m_vertexCount;
    -
    370
    -
    371 // Create the model using the vertex count that was read in.
    -
    372 m_model = new ModelType[m_vertexCount];
    -
    373
    -
    374 // Read up to the beginning of the data.
    -
    375 fin.get(input);
    -
    376 while (input != ':')
    -
    377 {
    -
    378 fin.get(input);
    -
    379 }
    -
    380 fin.get(input);
    -
    381 fin.get(input);
    -
    382
    -
    383 // Read in the vertex data.
    -
    384 for (i = 0; i < m_vertexCount; i++)
    -
    385 {
    -
    386 fin >> m_model[i].x >> m_model[i].y >> m_model[i].z;
    -
    387 fin >> m_model[i].tu >> m_model[i].tv;
    -
    388 fin >> m_model[i].nx >> m_model[i].ny >> m_model[i].nz;
    -
    389 }
    -
    390
    -
    391 // Close the model file.
    -
    392 fin.close();
    -
    393
    -
    394 return true;
    -
    395}
    -
    396
    -
    397void model_class::CalculateModelVectors()
    -
    398{
    -
    399 int faceCount, i, index;
    -
    400 TempVertexType vertex1, vertex2, vertex3;
    -
    401 VectorType tangent, binormal;
    -
    402
    -
    403
    -
    404 // Calculate the number of faces in the model.
    -
    405 faceCount = m_vertexCount / 3;
    -
    406
    -
    407 // Initialize the index to the model data.
    -
    408 index = 0;
    -
    409
    -
    410 // Go through all the faces and calculate the the tangent and binormal vectors.
    -
    411 for (i = 0; i < faceCount; i++)
    -
    412 {
    -
    413 // Get the three vertices for this face from the model.
    -
    414 vertex1.x = m_model[index].x;
    -
    415 vertex1.y = m_model[index].y;
    -
    416 vertex1.z = m_model[index].z;
    -
    417 vertex1.tu = m_model[index].tu;
    -
    418 vertex1.tv = m_model[index].tv;
    -
    419 index++;
    -
    420
    -
    421 vertex2.x = m_model[index].x;
    -
    422 vertex2.y = m_model[index].y;
    -
    423 vertex2.z = m_model[index].z;
    -
    424 vertex2.tu = m_model[index].tu;
    -
    425 vertex2.tv = m_model[index].tv;
    -
    426 index++;
    -
    427
    -
    428 vertex3.x = m_model[index].x;
    -
    429 vertex3.y = m_model[index].y;
    -
    430 vertex3.z = m_model[index].z;
    -
    431 vertex3.tu = m_model[index].tu;
    -
    432 vertex3.tv = m_model[index].tv;
    -
    433 index++;
    -
    434
    -
    435 // Calculate the tangent and binormal of that face.
    -
    436 CalculateTangentBinormal(vertex1, vertex2, vertex3, tangent, binormal);
    -
    437
    -
    438 // Store the tangent and binormal for this face back in the model structure.
    -
    439 m_model[index - 1].tx = tangent.x;
    -
    440 m_model[index - 1].ty = tangent.y;
    -
    441 m_model[index - 1].tz = tangent.z;
    -
    442 m_model[index - 1].bx = binormal.x;
    -
    443 m_model[index - 1].by = binormal.y;
    -
    444 m_model[index - 1].bz = binormal.z;
    -
    445
    -
    446 m_model[index - 2].tx = tangent.x;
    -
    447 m_model[index - 2].ty = tangent.y;
    -
    448 m_model[index - 2].tz = tangent.z;
    -
    449 m_model[index - 2].bx = binormal.x;
    -
    450 m_model[index - 2].by = binormal.y;
    -
    451 m_model[index - 2].bz = binormal.z;
    -
    452
    -
    453 m_model[index - 3].tx = tangent.x;
    -
    454 m_model[index - 3].ty = tangent.y;
    -
    455 m_model[index - 3].tz = tangent.z;
    -
    456 m_model[index - 3].bx = binormal.x;
    -
    457 m_model[index - 3].by = binormal.y;
    -
    458 m_model[index - 3].bz = binormal.z;
    -
    459 }
    -
    460}
    -
    461
    -
    462void model_class::CalculateTangentBinormal(TempVertexType vertex1, TempVertexType vertex2, TempVertexType vertex3, VectorType& tangent, VectorType& binormal)
    -
    463{
    -
    464
    -
    465 float vector1[3], vector2[3];
    -
    466 float tuVector[2], tvVector[2];
    -
    467 float den;
    -
    468 float length;
    -
    469
    -
    470
    -
    471 // Calculate the two vectors for this face.
    -
    472 vector1[0] = vertex2.x - vertex1.x;
    -
    473 vector1[1] = vertex2.y - vertex1.y;
    -
    474 vector1[2] = vertex2.z - vertex1.z;
    -
    475
    -
    476 vector2[0] = vertex3.x - vertex1.x;
    -
    477 vector2[1] = vertex3.y - vertex1.y;
    -
    478 vector2[2] = vertex3.z - vertex1.z;
    -
    479
    -
    480 // Calculate the tu and tv texture space vectors.
    -
    481 tuVector[0] = vertex2.tu - vertex1.tu;
    -
    482 tvVector[0] = vertex2.tv - vertex1.tv;
    -
    483
    -
    484 tuVector[1] = vertex3.tu - vertex1.tu;
    -
    485 tvVector[1] = vertex3.tv - vertex1.tv;
    -
    486
    -
    487 // Calculate the denominator of the tangent/binormal equation.
    -
    488 den = 1.0f / (tuVector[0] * tvVector[1] - tuVector[1] * tvVector[0]);
    -
    489
    -
    490 // Calculate the cross products and multiply by the coefficient to get the tangent and binormal.
    -
    491 tangent.x = (tvVector[1] * vector1[0] - tvVector[0] * vector2[0]) * den;
    -
    492 tangent.y = (tvVector[1] * vector1[1] - tvVector[0] * vector2[1]) * den;
    -
    493 tangent.z = (tvVector[1] * vector1[2] - tvVector[0] * vector2[2]) * den;
    -
    494
    -
    495 binormal.x = (tuVector[0] * vector2[0] - tuVector[1] * vector1[0]) * den;
    -
    496 binormal.y = (tuVector[0] * vector2[1] - tuVector[1] * vector1[1]) * den;
    -
    497 binormal.z = (tuVector[0] * vector2[2] - tuVector[1] * vector1[2]) * den;
    -
    498
    -
    499 // Calculate the length of this normal.
    -
    500 length = sqrt((tangent.x * tangent.x) + (tangent.y * tangent.y) + (tangent.z * tangent.z));
    -
    501
    -
    502 // Normalize the normal and then store it
    -
    503 tangent.x = tangent.x / length;
    -
    504 tangent.y = tangent.y / length;
    -
    505 tangent.z = tangent.z / length;
    -
    506
    -
    507 // Calculate the length of this normal.
    -
    508 length = sqrt((binormal.x * binormal.x) + (binormal.y * binormal.y) + (binormal.z * binormal.z));
    -
    509
    -
    510 // Normalize the normal and then store it
    -
    511 binormal.x = binormal.x / length;
    -
    512 binormal.y = binormal.y / length;
    -
    513 binormal.z = binormal.z / length;
    -
    514}
    -
    515
    -
    516void model_class::ReleaseModel()
    -
    517{
    -
    518
    -
    519 if (m_model)
    -
    520 {
    -
    521 delete[] m_model;
    -
    522 m_model = 0;
    -
    523 }
    -
    524}
    -
    525
    -
    526bool model_class::PreloadTextures(ID3D11Device* device, ID3D11DeviceContext* deviceContext, TextureContainer& textureContainer)
    -
    527{
    -
    528 HRESULT hResult;
    -
    529
    -
    530 // Charger les textures diffuses
    -
    531 for (const auto& texturePath : textureContainer.diffusePaths)
    -
    532 {
    -
    533 ID3D11ShaderResourceView* texture = nullptr;
    -
    534 hResult = DirectX::CreateWICTextureFromFile(device, deviceContext, texturePath.c_str(), nullptr, &texture);
    -
    535 if (FAILED(hResult))
    -
    536 {
    -
    537 Logger::Get().Log("Échec du chargement de la texture diffuse: " + std::string(texturePath.begin(), texturePath.end()), __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    538 return false;
    -
    539 }
    -
    540 textureContainer.diffuse.push_back(texture);
    -
    541 }
    -
    542
    -
    543 // Charger les textures normales
    -
    544 for (const auto& texturePath : textureContainer.normalPaths)
    -
    545 {
    -
    546 ID3D11ShaderResourceView* texture = nullptr;
    -
    547 hResult = DirectX::CreateWICTextureFromFile(device, deviceContext, texturePath.c_str(), nullptr, &texture);
    -
    548 if (FAILED(hResult))
    -
    549 {
    -
    550 Logger::Get().Log("Échec du chargement de la texture normale: " + std::string(texturePath.begin(), texturePath.end()), __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    551 return false;
    -
    552 }
    -
    553 textureContainer.normal.push_back(texture);
    -
    554 }
    -
    555
    -
    556 // Charger les textures spéculaires
    -
    557 for (const auto& texturePath : textureContainer.specularPaths)
    -
    558 {
    -
    559 ID3D11ShaderResourceView* texture = nullptr;
    -
    560 hResult = DirectX::CreateWICTextureFromFile(device, deviceContext, texturePath.c_str(), nullptr, &texture);
    -
    561 if (FAILED(hResult))
    -
    562 {
    -
    563 Logger::Get().Log("Échec du chargement de la texture spéculaire: " + std::string(texturePath.begin(), texturePath.end()), __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    564 return false;
    -
    565 }
    -
    566 textureContainer.specular.push_back(texture);
    -
    567 }
    -
    568
    -
    569 // Charger les textures alpha
    -
    570 for (const auto& texturePath : textureContainer.alphaPaths)
    -
    571 {
    -
    572 ID3D11ShaderResourceView* texture = nullptr;
    -
    573 hResult = DirectX::CreateWICTextureFromFile(device, deviceContext, texturePath.c_str(), nullptr, &texture);
    -
    574 if (FAILED(hResult))
    -
    575 {
    -
    576 Logger::Get().Log("Échec du chargement de la texture alpha: " + std::string(texturePath.begin(), texturePath.end()), __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    577 return false;
    -
    578 }
    -
    579 textureContainer.alpha.push_back(texture);
    -
    580 }
    -
    581
    -
    582 return true;
    -
    583}
    -
    584
    -
    585bool model_class::ChangeTexture(ID3D11Device* device, ID3D11DeviceContext* deviceContext, std::wstring filename, TextureType type, int index) {
    -
    586 Logger::Get().Log("Changing texture", __FILE__, __LINE__, Logger::LogLevel::Initialize);
    -
    587
    -
    588 HRESULT result;
    -
    589 ID3D11ShaderResourceView* newTexture = nullptr;
    -
    590
    -
    591 // Charger la nouvelle texture
    -
    592 result = DirectX::CreateWICTextureFromFile(device, deviceContext, filename.c_str(), nullptr, &newTexture);
    -
    593 if (FAILED(result)) {
    -
    594 Logger::Get().Log("Failed to load texture: " + std::string(filename.begin(), filename.end()), __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    595 return false;
    -
    596 }
    -
    597
    -
    598 // Récupérer le vecteur correspondant au type de texture
    -
    599 auto& textureVector = m_Textures.Get(type);
    -
    600
    -
    601 // Si l'index est hors limites, redimensionner le vecteur
    -
    602 if (index >= textureVector.size()) {
    -
    603 textureVector.resize(index + 1, nullptr);
    -
    604 }
    -
    605
    -
    606 // Libérer l'ancienne texture si elle existe
    -
    607 if (textureVector[index]) {
    -
    608 textureVector[index]->Release();
    -
    609 }
    -
    610
    -
    611 // Assigner la nouvelle texture
    -
    612 textureVector[index] = newTexture;
    -
    613
    -
    614 // Mettre à jour le chemin dans le conteneur approprié selon le type
    -
    615 switch (type) {
    -
    616 case TextureType::Diffuse:
    -
    617 if (index >= m_Textures.diffusePaths.size()) {
    -
    618 m_Textures.diffusePaths.resize(index + 1, L"");
    -
    619 }
    -
    620 m_Textures.diffusePaths[index] = filename;
    -
    621 break;
    -
    622 case TextureType::Normal:
    -
    623 if (index >= m_Textures.normalPaths.size()) {
    -
    624 m_Textures.normalPaths.resize(index + 1, L"");
    -
    625 }
    -
    626 m_Textures.normalPaths[index] = filename;
    -
    627 break;
    -
    628 case TextureType::Specular:
    -
    629 if (index >= m_Textures.specularPaths.size()) {
    -
    630 m_Textures.specularPaths.resize(index + 1, L"");
    -
    631 }
    -
    632 m_Textures.specularPaths[index] = filename;
    -
    633 break;
    -
    634 case TextureType::Alpha:
    -
    635 if (index >= m_Textures.alphaPaths.size()) {
    -
    636 m_Textures.alphaPaths.resize(index + 1, L"");
    -
    637 }
    -
    638 m_Textures.alphaPaths[index] = filename;
    -
    639 break;
    -
    640 }
    -
    641
    -
    642 Logger::Get().Log("Texture changed successfully", __FILE__, __LINE__, Logger::LogLevel::Initialize);
    -
    643 return true;
    -
    644}
    -
    645
    -
    646bool model_class::AddTexture(ID3D11Device* device, ID3D11DeviceContext* deviceContext, std::wstring filename, TextureType type) {
    -
    647 Logger::Get().Log("Adding texture", __FILE__, __LINE__, Logger::LogLevel::Initialize);
    -
    648
    -
    649 HRESULT result;
    -
    650 ID3D11ShaderResourceView* newTexture = nullptr;
    -
    651
    -
    652 // Charger la nouvelle texture
    -
    653 result = DirectX::CreateWICTextureFromFile(device, deviceContext, filename.c_str(), nullptr, &newTexture);
    -
    654 if (FAILED(result)) {
    -
    655 Logger::Get().Log("Failed to load texture: " + std::string(filename.begin(), filename.end()), __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    656 return false;
    -
    657 }
    -
    658
    -
    659 // Ajouter la texture au vecteur approprié selon le type
    -
    660 auto& textureVector = m_Textures.Get(type);
    -
    661 textureVector.push_back(newTexture);
    -
    662
    -
    663 // Ajouter le chemin de la texture au vecteur approprié selon le type
    -
    664 switch (type) {
    -
    665 case TextureType::Diffuse:
    -
    666 m_Textures.diffusePaths.push_back(filename);
    -
    667 break;
    -
    668 case TextureType::Normal:
    -
    669 m_Textures.normalPaths.push_back(filename);
    -
    670 break;
    -
    671 case TextureType::Specular:
    -
    672 m_Textures.specularPaths.push_back(filename);
    -
    673 break;
    -
    674 case TextureType::Alpha:
    -
    675 m_Textures.alphaPaths.push_back(filename);
    -
    676 break;
    -
    677 }
    -
    678
    -
    679 Logger::Get().Log("Texture added successfully", __FILE__, __LINE__, Logger::LogLevel::Initialize);
    -
    680 return true;
    -
    681}
    -
    682
    -
    683bool model_class::AddTexture(ID3D11ShaderResourceView* texture, TextureType type) {
    -
    684 if (!texture) {
    -
    685 Logger::Get().Log("Cannot add null texture", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    686 return false;
    -
    687 }
    -
    688
    -
    689 // Ajouter la texture au vecteur approprié
    -
    690 auto& textureVector = m_Textures.Get(type);
    -
    691 textureVector.push_back(texture);
    -
    692
    -
    693 // Ajouter un chemin vide ou générique pour maintenir la synchronisation
    -
    694 switch (type) {
    -
    695 case TextureType::Diffuse:
    -
    696 m_Textures.diffusePaths.push_back(L"[texture préchargée]");
    -
    697 break;
    -
    698 case TextureType::Normal:
    -
    699 m_Textures.normalPaths.push_back(L"[texture préchargée]");
    -
    700 break;
    -
    701 case TextureType::Specular:
    -
    702 m_Textures.specularPaths.push_back(L"[texture préchargée]");
    -
    703 break;
    -
    704 case TextureType::Alpha:
    -
    705 m_Textures.alphaPaths.push_back(L"[texture préchargée]");
    -
    706 break;
    -
    707 }
    -
    708 return true;
    -
    709}
    -
    710
    -
    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
    - - -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:0b5e2dc956984baa143524e309f2d3dad3aa17db7449d40ac0fa33493e52f5eb +size 108838 diff --git a/doxygen_docs/html/model__class_8h_source.html b/doxygen_docs/html/model__class_8h_source.html index d539f35..62e2dfb 100644 --- a/doxygen_docs/html/model__class_8h_source.html +++ b/doxygen_docs/html/model__class_8h_source.html @@ -1,394 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/inc/system/model_class.h Source File - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    model_class.h
    -
    -
    -
    1#ifndef _MODELCLASS_H_
    -
    2#define _MODELCLASS_H_
    -
    3
    -
    4
    -
    6// INCLUDES //
    -
    8#include "Logger.h"
    -
    9
    -
    10#include <d3d11.h>
    -
    11#include <directxmath.h>
    -
    12#include <fstream>
    -
    13#include <sstream>
    -
    14#include <vector>
    -
    15#include <string>
    -
    16#include <WICTextureLoader.h>
    -
    17using namespace DirectX;
    -
    18using namespace std;
    -
    19
    -
    21// MY CLASS INCLUDES //
    -
    23#include "texture_class.h"
    -
    24
    -
    25enum class TextureType
    -
    26{
    -
    27 Diffuse,
    -
    28 Normal,
    -
    29 Specular,
    -
    30 Alpha
    -
    31};
    -
    32
    -
    - -
    34{
    -
    35
    -
    36 // Textures
    -
    37 std::vector<ID3D11ShaderResourceView*> diffuse;
    -
    38 std::vector<ID3D11ShaderResourceView*> normal;
    -
    39 std::vector<ID3D11ShaderResourceView*> specular;
    -
    40 std::vector<ID3D11ShaderResourceView*> alpha;
    -
    41
    -
    42 // Textures Paths
    -
    43 std::vector<std::wstring> diffusePaths;
    -
    44 std::vector<std::wstring> normalPaths;
    -
    45 std::vector<std::wstring> specularPaths;
    -
    46 std::vector<std::wstring> alphaPaths;
    -
    47
    -
    48
    -
    49 // Get the vector of textures_ based on the type
    -
    50 std::vector<ID3D11ShaderResourceView*>& Get(TextureType type) const {
    -
    51 switch (type) {
    -
    52 case TextureType::Diffuse: return const_cast<std::vector<ID3D11ShaderResourceView*>&>(diffuse);
    -
    53 case TextureType::Normal: return const_cast<std::vector<ID3D11ShaderResourceView*>&>(normal);
    -
    54 case TextureType::Specular: return const_cast<std::vector<ID3D11ShaderResourceView*>&>(specular);
    -
    55 case TextureType::Alpha: return const_cast<std::vector<ID3D11ShaderResourceView*>&>(alpha);
    -
    56 default: return const_cast<std::vector<ID3D11ShaderResourceView*>&>(diffuse);
    -
    57 }
    -
    58 }
    -
    59
    -
    60 // Get the vector of textures_ paths based on the type
    -
    61 std::vector<std::wstring> GetPaths(TextureType type) const {
    -
    62 switch (type)
    -
    63 {
    -
    64 case TextureType::Diffuse: return std::vector<std::wstring>(diffusePaths);
    -
    65 case TextureType::Normal: return std::vector<std::wstring>(normalPaths);
    -
    66 case TextureType::Specular: return std::vector<std::wstring>(specularPaths);
    -
    67 case TextureType::Alpha: return std::vector<std::wstring>(alphaPaths);
    -
    68 default: return std::vector<std::wstring>(diffusePaths);
    -
    69 }
    -
    70 }
    -
    71
    -
    72
    -
    73 // Get The texture based on the type and index
    -
    74 ID3D11ShaderResourceView* GetTexture(TextureType type, int index) const {
    -
    75 auto& vec = Get(type);
    -
    76 if (index >= 0 && index < vec.size())
    -
    77 return vec[index];
    -
    78 return nullptr;
    -
    79 }
    -
    80
    -
    81 // Get The texture path based on the type and index
    -
    82 std::wstring GetTexturePath(TextureType type, int index) const
    -
    83 {
    -
    84 std::vector<std::wstring> path = GetPaths(type);
    -
    85 if (index >= 0 && index < path.size())
    -
    86 return path[index];
    -
    87 return L"";
    -
    88 }
    -
    89
    -
    90 // Release all textures_ and textures_ paths
    -
    91
    -
    92 void ReleaseAll() {
    -
    93 ReleaseVector(diffuse);
    -
    94 ReleaseVector(normal);
    -
    95 ReleaseVector(specular);
    -
    96 ReleaseVector(alpha);
    -
    97
    -
    98 ReleaseVector(diffusePaths);
    -
    99 ReleaseVector(normalPaths);
    -
    100 ReleaseVector(specularPaths);
    -
    101 ReleaseVector(alphaPaths);
    -
    102 }
    -
    103
    -
    104 // Assign a texture and its path to the appropriate vector based on the index
    -
    105 void AssignTexture(TextureContainer& textContainer, ID3D11ShaderResourceView* texture , const std::wstring paths, int index)
    -
    106 {
    -
    107 switch (index)
    -
    108 {
    -
    109 case 0:
    -
    110 textContainer.diffuse.push_back(texture);
    -
    111 textContainer.diffusePaths.push_back(paths);
    -
    112 break;
    -
    113 case 1:
    -
    114 textContainer.normal.push_back(texture);
    -
    115 textContainer.normalPaths.push_back(paths);
    -
    116 break;
    -
    117 case 2:
    -
    118 textContainer.specular.push_back(texture);
    -
    119 textContainer.specularPaths.push_back(paths);
    -
    120 break;
    -
    121 case 3:
    -
    122 textContainer.alpha.push_back(texture);
    -
    123 textContainer.alphaPaths.push_back(paths);
    -
    124 break;
    -
    125 default:
    -
    126 textContainer.diffuse.push_back(texture);
    -
    127 textContainer.diffusePaths.push_back(paths);
    -
    128 break;
    -
    129 }
    -
    130 }
    -
    131
    -
    132private:
    -
    133 void ReleaseVector(std::vector<ID3D11ShaderResourceView*>& vec) {
    -
    134 for (auto& tex : vec) {
    -
    135 if (tex) {
    -
    136 tex->Release();
    -
    137 tex = nullptr;
    -
    138 }
    -
    139 }
    -
    140 vec.clear();
    -
    141 }
    -
    142
    -
    143 void ReleaseVector(std::vector<std::wstring>& vec) {
    -
    144 vec.clear();
    -
    145 }
    -
    146};
    -
    -
    148// Class name: model_class
    -
    - -
    151{
    -
    152protected:
    -
    153
    -
    - -
    155 {
    -
    156 XMFLOAT3 position;
    -
    157 XMFLOAT2 texture;
    -
    158 XMFLOAT3 normal;
    -
    159 XMFLOAT3 tangent;
    -
    160 XMFLOAT3 binormal;
    -
    161 };
    -
    -
    162
    -
    - -
    164 {
    -
    165 float x, y, z;
    -
    166 float tu, tv;
    -
    167 float nx, ny, nz;
    -
    168 float tx, ty, tz;
    -
    169 float bx, by, bz;
    -
    170 };
    -
    -
    171
    -
    -
    172 struct Vertex {
    -
    173 float x, y, z;
    -
    174 };
    -
    -
    175
    -
    -
    176 struct Texture {
    -
    177 float u, v;
    -
    178 };
    -
    -
    179
    -
    -
    180 struct Normal {
    -
    181 float nx, ny, nz;
    -
    182 };
    -
    -
    183
    -
    - -
    185 {
    -
    186 float x, y, z;
    -
    187 float tu, tv;
    -
    188 float nx, ny, nz;
    -
    189 };
    -
    -
    190
    -
    - -
    192 {
    -
    193 float x, y, z;
    -
    194 };
    -
    -
    195
    -
    -
    196 struct Face {
    -
    197 int v1, v2, v3;
    -
    198 int t1, t2, t3;
    -
    199 int n1, n2, n3;
    -
    200 };
    -
    -
    201
    -
    202public:
    -
    203 model_class();
    -
    204 model_class(const model_class&) = delete;
    -
    205 model_class& operator=(const model_class&) = delete;
    -
    206 ~model_class();
    -
    207
    -
    208 //bool initialize(ID3D11Device*, ID3D11DeviceContext*, char*, std::vector<ID3D11ShaderResourceView*>);
    -
    209 // Nouvelle surcharge avec TextureContainer
    -
    210 bool Initialize(ID3D11Device*, ID3D11DeviceContext*, char*, const TextureContainer&);
    -
    211 // Nouvelle méthode - initialisation sans textures_
    -
    212 bool Initialize(ID3D11Device*, ID3D11DeviceContext*, char*);
    -
    213 void Shutdown();
    -
    214 void Render(ID3D11DeviceContext*);
    -
    215
    -
    216 int GetIndexCount();
    -
    217 int GetVertexCount() const { return m_vertexCount; }
    -
    218
    -
    219 // TEXTURE //
    -
    220
    -
    221 //ID3D11ShaderResourceView* get_texture(int index) const;
    -
    222 ID3D11ShaderResourceView* GetTexture(TextureType type, int index) const;
    -
    223
    -
    224 //bool ChangeTexture(ID3D11Device* device, ID3D11DeviceContext* deviceContext, std::wstring filename, int index);
    -
    225 bool ChangeTexture(ID3D11Device* device, ID3D11DeviceContext* deviceContext,std::wstring filename, TextureType type, int index);
    -
    226
    -
    227 // Méthodes pour ajouter une nouvelle texture
    -
    228 bool AddTexture(ID3D11Device* device, ID3D11DeviceContext* deviceContext,std::wstring filename, TextureType type);
    -
    229 bool AddTexture(ID3D11ShaderResourceView* texture, TextureType type);
    -
    230
    -
    231 void SetTextureContainer (TextureContainer& texturesContainer) { m_Textures = texturesContainer; }
    -
    232 TextureContainer GetTextureContainer() const { return m_Textures; }
    -
    233
    -
    234 bool PreloadTextures(ID3D11Device* device, ID3D11DeviceContext* deviceContext, TextureContainer& textureContainer);
    -
    235
    -
    236protected:
    -
    237 int m_vertexCount, m_indexCount;
    -
    238 ID3D11Buffer* m_vertexBuffer, * m_indexBuffer;
    -
    239
    -
    240private:
    -
    241 bool InitializeBuffers(ID3D11Device*);
    -
    242 void ShutdownBuffers();
    -
    243 void RenderBuffers(ID3D11DeviceContext*);
    -
    244 void ReleaseTextures();
    -
    245
    -
    246 bool LoadModel(char*);
    -
    247 bool LoadObjModel(char*);
    -
    248 bool LoadTxtModel(char*);
    -
    249 void ReleaseModel();
    -
    250
    -
    251 void CalculateModelVectors();
    -
    252 void CalculateTangentBinormal(TempVertexType, TempVertexType, TempVertexType, VectorType&, VectorType&);
    -
    253
    -
    254 TextureContainer m_Textures;
    -
    255 ModelType* m_model;
    -
    256};
    -
    -
    257
    -
    258#endif
    - - - - - - - - - - -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:c32c5b84dbcb8e4a809c9c134b02e300d2ee6b1458ec3896aaaad38694cb4623 +size 45864 diff --git a/doxygen_docs/html/model__path__component_8h_source.html b/doxygen_docs/html/model__path__component_8h_source.html index 677ef44..921adc5 100644 --- a/doxygen_docs/html/model__path__component_8h_source.html +++ b/doxygen_docs/html/model__path__component_8h_source.html @@ -1,144 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/inc/system/ecs/components/model_path_component.h Source File - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    model_path_component.h
    -
    -
    -
    1#pragma once
    -
    2#include "../component.h"
    -
    3#include <string>
    -
    4
    -
    5namespace ecs {
    -
    6
    -
    - -
    8public:
    -
    9 ModelPathComponent() = default;
    -
    10 explicit ModelPathComponent(const std::wstring& path) : m_path(path) {}
    -
    11 ~ModelPathComponent() = default;
    -
    12
    -
    13 void Initialize() override {}
    -
    14 void Update(float deltaTime) override {}
    -
    15
    -
    20 const std::wstring& GetPath() const { return m_path; }
    -
    25 void SetPath(const std::wstring& path) { m_path = path; }
    -
    26
    -
    27private:
    -
    28 std::wstring m_path;
    -
    29};
    -
    -
    30
    -
    31} // namespace ecs
    - - -
    void Update(float deltaTime) override
    -
    const std::wstring & GetPath() const
    - -
    void SetPath(const std::wstring &path)
    -
    Definition component.h:9
    -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:78a9792f4fe4ad5011e858f03939cdd096c4bc943bb501a52eb48251a4cb38a3 +size 12027 diff --git a/doxygen_docs/html/multi__texture__shader__class_8cpp_source.html b/doxygen_docs/html/multi__texture__shader__class_8cpp_source.html index b8ac138..8753927 100644 --- a/doxygen_docs/html/multi__texture__shader__class_8cpp_source.html +++ b/doxygen_docs/html/multi__texture__shader__class_8cpp_source.html @@ -1,509 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/src/shader/multi_texture_shader_class.cpp Source File - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    multi_texture_shader_class.cpp
    -
    -
    -
    1
    -
    2// Filename: multitextureshaderclass.cpp
    -
    4#include "multi_texture_shader_class.h"
    -
    5
    -
    6
    -
    7multi_texture_shader_class::multi_texture_shader_class()
    -
    8{
    -
    9 vertex_shader_ = 0;
    -
    10 pixel_shader_ = 0;
    -
    11 layout_ = 0;
    -
    12 matrix_buffer_ = 0;
    -
    13 sample_state_ = 0;
    -
    14}
    -
    15
    -
    16
    -
    17multi_texture_shader_class::multi_texture_shader_class(const multi_texture_shader_class& other)
    -
    18{
    -
    19}
    -
    20
    -
    21
    -
    22multi_texture_shader_class::~multi_texture_shader_class()
    -
    23{
    -
    24}
    -
    25
    -
    26
    -
    27bool multi_texture_shader_class::initialize(ID3D11Device* device, HWND hwnd)
    -
    28{
    -
    29 Logger::Get().Log("Initializing multi_texture_shader_class", __FILE__, __LINE__, Logger::LogLevel::Initialize);
    -
    30
    -
    31 bool result;
    -
    32 wchar_t vsFilename[128];
    -
    33 wchar_t psFilename[128];
    -
    34 int error;
    -
    35
    -
    36 // Set the filename of the vertex shader.
    -
    37 error = wcscpy_s(vsFilename, 128, L"src/hlsl/multitexture.vs");
    -
    38 if (error != 0)
    -
    39 {
    -
    40 Logger::Get().Log("Failed to set the filename of the vertex shader", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    41 return false;
    -
    42 }
    -
    43
    -
    44 // Set the filename of the pixel shader.
    -
    45 error = wcscpy_s(psFilename, 128, L"src/hlsl/multitexture.ps");
    -
    46 if (error != 0)
    -
    47 {
    -
    48 Logger::Get().Log("Failed to set the filename of the pixel shader", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    49 return false;
    -
    50 }
    -
    51
    -
    52 // initialize the vertex and pixel shaders.
    -
    53 result = initialize_shader(device, hwnd, vsFilename, psFilename);
    -
    54 if (!result)
    -
    55 {
    -
    56 Logger::Get().Log("Failed to initialize the vertex and pixel shaders", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    57 return false;
    -
    58 }
    -
    59
    -
    60 Logger::Get().Log("multi_texture_shader_class initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
    -
    61
    -
    62 return true;
    -
    63}
    -
    64
    -
    65void multi_texture_shader_class::shutdown()
    -
    66{
    -
    67 // shutdown the vertex and pixel shaders as well as the related objects.
    -
    68 shutdown_shader();
    -
    69
    -
    70 return;
    -
    71}
    -
    72
    -
    73bool multi_texture_shader_class::render(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix,
    -
    74 XMMATRIX projectionMatrix, ID3D11ShaderResourceView* texture1, ID3D11ShaderResourceView* texture2)
    -
    75{
    -
    76 bool result;
    -
    77
    -
    78
    -
    79 // Set the shader parameters that it will use for rendering.
    -
    80 result = set_shader_parameters(deviceContext, worldMatrix, viewMatrix, projectionMatrix, texture1, texture2);
    -
    81 if (!result)
    -
    82 {
    -
    83 Logger::Get().Log("Failed to set the shader parameters that it will use for rendering", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    84 return false;
    -
    85 }
    -
    86
    -
    87 // Now render the prepared buffers with the shader.
    -
    88 render_shader(deviceContext, indexCount);
    -
    89
    -
    90 return true;
    -
    91}
    -
    92
    -
    93bool multi_texture_shader_class::initialize_shader(ID3D11Device* device, HWND hwnd, WCHAR* vsFilename, WCHAR* psFilename)
    -
    94{
    -
    95 Logger::Get().Log("Initializing the shader", __FILE__, __LINE__, Logger::LogLevel::Initialize);
    -
    96
    -
    97 HRESULT result;
    -
    98 ID3D10Blob* errorMessage;
    -
    99 ID3D10Blob* vertexShaderBuffer;
    -
    100 ID3D10Blob* pixelShaderBuffer;
    -
    101 D3D11_INPUT_ELEMENT_DESC polygonLayout[3];
    -
    102 unsigned int numElements;
    -
    103 D3D11_BUFFER_DESC matrixBufferDesc;
    -
    104 D3D11_SAMPLER_DESC samplerDesc;
    -
    105
    -
    106
    -
    107 // initialize the pointers this function will use to null.
    -
    108 errorMessage = 0;
    -
    109 vertexShaderBuffer = 0;
    -
    110 pixelShaderBuffer = 0;
    -
    111
    -
    112 // Compile the vertex shader code.
    -
    113 result = D3DCompileFromFile(vsFilename, NULL, NULL, "MultiTextureVertexShader", "vs_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0,
    -
    114 &vertexShaderBuffer, &errorMessage);
    -
    115 if (FAILED(result))
    -
    116 {
    -
    117 // If the shader failed to compile it should have writen something to the error message.
    -
    118 if (errorMessage)
    -
    119 {
    -
    120 output_shader_error_message(errorMessage, hwnd, vsFilename);
    -
    121 }
    -
    122 // If there was nothing in the error message then it simply could not find the shader file itself.
    -
    123 else
    -
    124 {
    -
    125 Logger::Get().Log("Failed to compile the vertex shader code", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    126 }
    -
    127
    -
    128 return false;
    -
    129 }
    -
    130
    -
    131 // Compile the pixel shader code.
    -
    132 result = D3DCompileFromFile(psFilename, NULL, NULL, "MultiTexturePixelShader", "ps_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0,
    -
    133 &pixelShaderBuffer, &errorMessage);
    -
    134 if (FAILED(result))
    -
    135 {
    -
    136 // If the shader failed to compile it should have writen something to the error message.
    -
    137 if (errorMessage)
    -
    138 {
    -
    139 output_shader_error_message(errorMessage, hwnd, psFilename);
    -
    140 }
    -
    141 // If there was nothing in the error message then it simply could not find the file itself.
    -
    142 else
    -
    143 {
    -
    144 Logger::Get().Log("Failed to compile the pixel shader code", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    145 }
    -
    146
    -
    147 return false;
    -
    148 }
    -
    149
    -
    150 // Create the vertex shader from the buffer.
    -
    151 result = device->CreateVertexShader(vertexShaderBuffer->GetBufferPointer(), vertexShaderBuffer->GetBufferSize(), NULL, &vertex_shader_);
    -
    152 if (FAILED(result))
    -
    153 {
    -
    154 Logger::Get().Log("Failed to create the vertex shader from the buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    155 return false;
    -
    156 }
    -
    157
    -
    158 // Create the pixel shader from the buffer.
    -
    159 result = device->CreatePixelShader(pixelShaderBuffer->GetBufferPointer(), pixelShaderBuffer->GetBufferSize(), NULL, &pixel_shader_);
    -
    160 if (FAILED(result))
    -
    161 {
    -
    162 Logger::Get().Log("Failed to create the pixel shader from the buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    163 return false;
    -
    164 }
    -
    165
    -
    166 // Create the vertex input layout description.
    -
    167 polygonLayout[0].SemanticName = "POSITION";
    -
    168 polygonLayout[0].SemanticIndex = 0;
    -
    169 polygonLayout[0].Format = DXGI_FORMAT_R32G32B32_FLOAT;
    -
    170 polygonLayout[0].InputSlot = 0;
    -
    171 polygonLayout[0].AlignedByteOffset = 0;
    -
    172 polygonLayout[0].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
    -
    173 polygonLayout[0].InstanceDataStepRate = 0;
    -
    174
    -
    175 polygonLayout[1].SemanticName = "TEXCOORD";
    -
    176 polygonLayout[1].SemanticIndex = 0;
    -
    177 polygonLayout[1].Format = DXGI_FORMAT_R32G32_FLOAT;
    -
    178 polygonLayout[1].InputSlot = 0;
    -
    179 polygonLayout[1].AlignedByteOffset = D3D11_APPEND_ALIGNED_ELEMENT;
    -
    180 polygonLayout[1].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
    -
    181 polygonLayout[1].InstanceDataStepRate = 0;
    -
    182
    -
    183 polygonLayout[2].SemanticName = "NORMAL";
    -
    184 polygonLayout[2].SemanticIndex = 0;
    -
    185 polygonLayout[2].Format = DXGI_FORMAT_R32G32B32_FLOAT;
    -
    186 polygonLayout[2].InputSlot = 0;
    -
    187 polygonLayout[2].AlignedByteOffset = D3D11_APPEND_ALIGNED_ELEMENT;
    -
    188 polygonLayout[2].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
    -
    189 polygonLayout[2].InstanceDataStepRate = 0;
    -
    190
    -
    191 // Get a count of the elements in the layout.
    -
    192 numElements = sizeof(polygonLayout) / sizeof(polygonLayout[0]);
    -
    193
    -
    194 // Create the vertex input layout.
    -
    195 result = device->CreateInputLayout(polygonLayout, numElements, vertexShaderBuffer->GetBufferPointer(),
    -
    196 vertexShaderBuffer->GetBufferSize(), &layout_);
    -
    197 if (FAILED(result))
    -
    198 {
    -
    199 Logger::Get().Log("Failed to create the vertex input layout", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    200 return false;
    -
    201 }
    -
    202
    -
    203 // Release the vertex shader buffer and pixel shader buffer since they are no longer needed.
    -
    204 vertexShaderBuffer->Release();
    -
    205 vertexShaderBuffer = 0;
    -
    206
    -
    207 pixelShaderBuffer->Release();
    -
    208 pixelShaderBuffer = 0;
    -
    209
    -
    210 // Setup the description of the dynamic matrix constant buffer that is in the vertex shader.
    -
    211 matrixBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
    -
    212 matrixBufferDesc.ByteWidth = sizeof(matrix_buffer_type);
    -
    213 matrixBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
    -
    214 matrixBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
    -
    215 matrixBufferDesc.MiscFlags = 0;
    -
    216 matrixBufferDesc.StructureByteStride = 0;
    -
    217
    -
    218 // Create the constant buffer pointer so we can access the vertex shader constant buffer from within this class.
    -
    219 result = device->CreateBuffer(&matrixBufferDesc, NULL, &matrix_buffer_);
    -
    220 if (FAILED(result))
    -
    221 {
    -
    222 Logger::Get().Log("Failed to create the constant buffer pointer", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    223 return false;
    -
    224 }
    -
    225
    -
    226 // Create a texture sampler state description.
    -
    227 samplerDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR;
    -
    228 samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP;
    -
    229 samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP;
    -
    230 samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_WRAP;
    -
    231 samplerDesc.MipLODBias = 0.0f;
    -
    232 samplerDesc.MaxAnisotropy = 1;
    -
    233 samplerDesc.ComparisonFunc = D3D11_COMPARISON_ALWAYS;
    -
    234 samplerDesc.BorderColor[0] = 0;
    -
    235 samplerDesc.BorderColor[1] = 0;
    -
    236 samplerDesc.BorderColor[2] = 0;
    -
    237 samplerDesc.BorderColor[3] = 0;
    -
    238 samplerDesc.MinLOD = 0;
    -
    239 samplerDesc.MaxLOD = D3D11_FLOAT32_MAX;
    -
    240
    -
    241 // Create the texture sampler state.
    -
    242 result = device->CreateSamplerState(&samplerDesc, &sample_state_);
    -
    243 if (FAILED(result))
    -
    244 {
    -
    245 Logger::Get().Log("Failed to create the texture sampler state", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    246 return false;
    -
    247 }
    -
    248
    -
    249 Logger::Get().Log("Shader initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
    -
    250
    -
    251 return true;
    -
    252}
    -
    253
    -
    254void multi_texture_shader_class::shutdown_shader()
    -
    255{
    -
    256 Logger::Get().Log("Shutting down the shader", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
    -
    257
    -
    258 // Release the sampler state.
    -
    259 if (sample_state_)
    -
    260 {
    -
    261 sample_state_->Release();
    -
    262 sample_state_ = 0;
    -
    263 }
    -
    264
    -
    265 // Release the matrix constant buffer.
    -
    266 if (matrix_buffer_)
    -
    267 {
    -
    268 matrix_buffer_->Release();
    -
    269 matrix_buffer_ = 0;
    -
    270 }
    -
    271
    -
    272 // Release the layout.
    -
    273 if (layout_)
    -
    274 {
    -
    275 layout_->Release();
    -
    276 layout_ = 0;
    -
    277 }
    -
    278
    -
    279 // Release the pixel shader.
    -
    280 if (pixel_shader_)
    -
    281 {
    -
    282 pixel_shader_->Release();
    -
    283 pixel_shader_ = 0;
    -
    284 }
    -
    285
    -
    286 // Release the vertex shader.
    -
    287 if (vertex_shader_)
    -
    288 {
    -
    289 vertex_shader_->Release();
    -
    290 vertex_shader_ = 0;
    -
    291 }
    -
    292
    -
    293 Logger::Get().Log("Shader shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
    -
    294
    -
    295 return;
    -
    296}
    -
    297
    -
    298void multi_texture_shader_class::output_shader_error_message(ID3D10Blob* errorMessage, HWND hwnd, WCHAR* shaderFilename)
    -
    299{
    -
    300 char* compileErrors;
    -
    301 unsigned long long bufferSize, i;
    -
    302 ofstream fout;
    -
    303
    -
    304
    -
    305 // Get a pointer to the error message text buffer.
    -
    306 compileErrors = (char*)(errorMessage->GetBufferPointer());
    -
    307
    -
    308 // Get the length of the message.
    -
    309 bufferSize = errorMessage->GetBufferSize();
    -
    310
    -
    311 // Open a file to write the error message to.
    -
    312 fout.open("shader-error.txt");
    -
    313
    -
    314 // Write out the error message.
    -
    315 for (i = 0; i < bufferSize; i++)
    -
    316 {
    -
    317 fout << compileErrors[i];
    -
    318 }
    -
    319
    -
    320 // Close the file.
    -
    321 fout.close();
    -
    322
    -
    323 // Release the error message.
    -
    324 errorMessage->Release();
    -
    325 errorMessage = 0;
    -
    326
    -
    327 // Pop a message up on the screen to notify the user to check the text file for compile errors.
    -
    328 MessageBox(hwnd, L"Error compiling shader. Check shader-error.txt for message.", shaderFilename, MB_OK);
    -
    329
    -
    330 return;
    -
    331}
    -
    332
    -
    333bool multi_texture_shader_class::set_shader_parameters(ID3D11DeviceContext* deviceContext, XMMATRIX worldMatrix, XMMATRIX viewMatrix,
    -
    334 XMMATRIX projectionMatrix, ID3D11ShaderResourceView* texture1, ID3D11ShaderResourceView* texture2)
    -
    335{
    -
    336 HRESULT result;
    -
    337 D3D11_MAPPED_SUBRESOURCE mappedResource;
    -
    338 matrix_buffer_type* dataPtr;
    -
    339 unsigned int bufferNumber;
    -
    340
    -
    341
    -
    342 // Transpose the matrices to prepare them for the shader.
    -
    343 worldMatrix = XMMatrixTranspose(worldMatrix);
    -
    344 viewMatrix = XMMatrixTranspose(viewMatrix);
    -
    345 projectionMatrix = XMMatrixTranspose(projectionMatrix);
    -
    346
    -
    347 // Lock the constant buffer so it can be written to.
    -
    348 result = deviceContext->Map(matrix_buffer_, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
    -
    349 if (FAILED(result))
    -
    350 {
    -
    351 Logger::Get().Log("Failed to lock the constant buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    352 return false;
    -
    353 }
    -
    354
    -
    355 // Get a pointer to the data in the constant buffer.
    -
    356 dataPtr = (matrix_buffer_type*)mappedResource.pData;
    -
    357
    -
    358 // Copy the matrices into the constant buffer.
    -
    359 dataPtr->world = worldMatrix;
    -
    360 dataPtr->view = viewMatrix;
    -
    361 dataPtr->projection = projectionMatrix;
    -
    362
    -
    363 // Unlock the constant buffer.
    -
    364 deviceContext->Unmap(matrix_buffer_, 0);
    -
    365
    -
    366 // Set the position of the constant buffer in the vertex shader.
    -
    367 bufferNumber = 0;
    -
    368
    -
    369 // Finally set the constant buffer in the vertex shader with the updated values.
    -
    370 deviceContext->VSSetConstantBuffers(bufferNumber, 1, &matrix_buffer_);
    -
    371
    -
    372 // Set shader texture resources in the pixel shader.
    -
    373 deviceContext->PSSetShaderResources(0, 1, &texture1);
    -
    374 deviceContext->PSSetShaderResources(1, 1, &texture2);
    -
    375
    -
    376 return true;
    -
    377}
    -
    378
    -
    379void multi_texture_shader_class::render_shader(ID3D11DeviceContext* deviceContext, int indexCount)
    -
    380{
    -
    381 // Set the vertex input layout.
    -
    382 deviceContext->IASetInputLayout(layout_);
    -
    383
    -
    384 // Set the vertex and pixel shaders that will be used to render this triangle.
    -
    385 deviceContext->VSSetShader(vertex_shader_, NULL, 0);
    -
    386 deviceContext->PSSetShader(pixel_shader_, NULL, 0);
    -
    387
    -
    388 // Set the sampler state in the pixel shader.
    -
    389 deviceContext->PSSetSamplers(0, 1, &sample_state_);
    -
    390
    -
    391 // render the triangle.
    -
    392 deviceContext->DrawIndexed(indexCount, 0, 0);
    -
    393
    -
    394 return;
    -
    395}
    -
    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
    - -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:96bfbb0ba7d9540fe8e4543ebf1692dcbbd4a9f08b54649190fab32c7b7431ac +size 63761 diff --git a/doxygen_docs/html/multi__texture__shader__class_8h_source.html b/doxygen_docs/html/multi__texture__shader__class_8h_source.html index 3086f7a..1fd0749 100644 --- a/doxygen_docs/html/multi__texture__shader__class_8h_source.html +++ b/doxygen_docs/html/multi__texture__shader__class_8h_source.html @@ -1,169 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/inc/shader/multi_texture_shader_class.h Source File - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    multi_texture_shader_class.h
    -
    -
    -
    1
    -
    2// Filename: multitextureshaderclass.h
    -
    4#ifndef _MULTITEXTURESHADERCLASS_H_
    -
    5#define _MULTITEXTURESHADERCLASS_H_
    -
    6
    -
    7
    -
    9// INCLUDES //
    -
    11#include "Logger.h"
    -
    12#include <d3d11.h>
    -
    13#include <d3dcompiler.h>
    -
    14#include <directxmath.h>
    -
    15#include <fstream>
    -
    16using namespace DirectX;
    -
    17using namespace std;
    -
    18
    -
    19
    -
    21// Class name: multi_texture_shader_class
    -
    - -
    24{
    -
    25private:
    -
    26 struct matrix_buffer_type
    -
    27 {
    -
    28 XMMATRIX world;
    -
    29 XMMATRIX view;
    -
    30 XMMATRIX projection;
    -
    31 };
    -
    32
    -
    33public:
    - - - -
    37
    -
    38 bool initialize(ID3D11Device*, HWND);
    -
    39 void shutdown();
    -
    40 bool render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*);
    -
    41
    -
    42private:
    -
    43 bool initialize_shader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
    -
    44 void shutdown_shader();
    -
    45 void output_shader_error_message(ID3D10Blob*, HWND, WCHAR*);
    -
    46
    -
    47 bool set_shader_parameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*);
    -
    48 void render_shader(ID3D11DeviceContext*, int);
    -
    49
    -
    50private:
    -
    51 ID3D11VertexShader* vertex_shader_;
    -
    52 ID3D11PixelShader* pixel_shader_;
    -
    53 ID3D11InputLayout* layout_;
    -
    54 ID3D11Buffer* matrix_buffer_;
    -
    55 ID3D11SamplerState* sample_state_;
    -
    56
    -
    57};
    -
    -
    58
    -
    59#endif
    - -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:537c5a88237e7284fefa9c6f5444c589fa235b516aca3205507f0d0718c8bfe0 +size 12804 diff --git a/doxygen_docs/html/namespaceecs.html b/doxygen_docs/html/namespaceecs.html index 0a8e023..257d116 100644 --- a/doxygen_docs/html/namespaceecs.html +++ b/doxygen_docs/html/namespaceecs.html @@ -1,373 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: ecs Namespace Reference - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    - -
    ecs Namespace Reference
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - -

    -Classes

    class  Component
     
    class  Entity
     
    class  EntityManager
     
    class  IdentityComponent
     
    class  ModelPathComponent
     
    class  PhysicsComponent
     
    class  RenderComponent
     
    class  RenderSystem
     
    class  ShaderComponent
     
    class  TransformComponent
     
    - - - - - - - -

    -Typedefs

    using ComponentPtr = std::shared_ptr<Component>
     
    using ComponentTypeID = std::type_index
     
    using EntityID = uint32_t
     
    - - - - - - - -

    -Enumerations

    enum class  ObjectType { Sphere -, Cube -, Terrain -, Unknown - }
     
    enum class  TextureType {
    -  Diffuse -, Normal -, Specular -, Alpha -,
    -  Reflection -
    - }
     
    enum class  ShaderType {
    -  CEL_SHADING -, LIGHTING -, NORMAL_MAPPING -, SPECULAR_MAPPING -,
    -  REFLECTION -, REFRACTION -, TEXTURE -, SKYBOX -,
    -  SUNLIGHT -, ALPHA_MAPPING -
    - }
     
    - - - - -

    -Functions

    template<typename T >
    ComponentTypeID GetComponentTypeID ()
     
    -

    Detailed Description

    -

    namespace for the Entity-Component-System (ECS)

    -

    Typedef Documentation

    - -

    ◆ ComponentPtr

    - -
    -
    - - - - -
    using ecs::ComponentPtr = std::shared_ptr<Component>
    -
    -

    Type alias for a shared pointer to a Component.

    - -

    Definition at line 43 of file component.h.

    - -
    -
    - -

    ◆ ComponentTypeID

    - -
    -
    - - - - -
    using ecs::ComponentTypeID = std::type_index
    -
    -

    Type alias for a unique identifier for a component type.

    - -

    Definition at line 48 of file component.h.

    - -
    -
    - -

    ◆ EntityID

    - -
    -
    - - - - -
    using ecs::EntityID = uint32_t
    -
    -

    Type alias for a unique identifier for an entity.

    - -

    Definition at line 13 of file entity.h.

    - -
    -
    -

    Enumeration Type Documentation

    - -

    ◆ ObjectType

    - -
    -
    - - - - - -
    - - - - -
    enum class ecs::ObjectType
    -
    -strong
    -
    -

    Enum for different types of objects in the ECS. The object types is used to specify the collision type of the object.

    - -

    Definition at line 10 of file identity_component.h.

    -
    11 {
    -
    12 Sphere,
    -
    13 Cube,
    -
    14 Terrain,
    -
    15 Unknown
    -
    16 };
    -
    -
    -
    - -

    ◆ ShaderType

    - -
    -
    - - - - - -
    - - - - -
    enum class ecs::ShaderType
    -
    -strong
    -
    -

    Enum for different shader types used in rendering. This enum is used to specify the type of shader to be applied to a model.

    - -

    Definition at line 10 of file shader_component.h.

    -
    11{
    -
    12 CEL_SHADING,
    -
    13 LIGHTING,
    -
    14 NORMAL_MAPPING,
    -
    15 SPECULAR_MAPPING,
    -
    16 REFLECTION,
    -
    17 REFRACTION,
    -
    18 TEXTURE,
    -
    19 SKYBOX,
    -
    20 SUNLIGHT,
    -
    21 ALPHA_MAPPING
    -
    22};
    -
    -
    -
    - -

    ◆ TextureType

    - -
    -
    - - - - - -
    - - - - -
    enum class ecs::TextureType
    -
    -strong
    -
    -

    Enum for different types of textures used in rendering.

    - -

    Definition at line 20 of file render_component.h.

    -
    21 {
    -
    22 Diffuse,
    -
    23 Normal,
    -
    24 Specular,
    -
    25 Alpha,
    -
    26 Reflection
    -
    27 };
    -
    -
    -
    -

    Function Documentation

    - -

    ◆ GetComponentTypeID()

    - -
    -
    -
    -template<typename T >
    - - - - - - - -
    ComponentTypeID ecs::GetComponentTypeID ()
    -
    -

    Function to get the unique type ID for a component type.

    - -

    Definition at line 54 of file component.h.

    -
    54 {
    -
    55 static_assert(std::is_base_of<Component, T>::value, "T must derive from Component");
    -
    56 return std::type_index(typeid(T));
    -
    57}
    -
    -
    -
    -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:c3e541959dd9e32fad8e071a384b3ece1900f8225a9166b5abedeb480abbbe1b +size 20766 diff --git a/doxygen_docs/html/namespaceecs.js b/doxygen_docs/html/namespaceecs.js index 1c00734..bb94143 100644 --- a/doxygen_docs/html/namespaceecs.js +++ b/doxygen_docs/html/namespaceecs.js @@ -1,42 +1,3 @@ -var namespaceecs = -[ - [ "Component", "classecs_1_1_component.html", "classecs_1_1_component" ], - [ "Entity", "classecs_1_1_entity.html", "classecs_1_1_entity" ], - [ "EntityManager", "classecs_1_1_entity_manager.html", "classecs_1_1_entity_manager" ], - [ "IdentityComponent", "classecs_1_1_identity_component.html", "classecs_1_1_identity_component" ], - [ "ModelPathComponent", "classecs_1_1_model_path_component.html", "classecs_1_1_model_path_component" ], - [ "PhysicsComponent", "classecs_1_1_physics_component.html", "classecs_1_1_physics_component" ], - [ "RenderComponent", "classecs_1_1_render_component.html", "classecs_1_1_render_component" ], - [ "RenderSystem", "classecs_1_1_render_system.html", "classecs_1_1_render_system" ], - [ "ShaderComponent", "classecs_1_1_shader_component.html", "classecs_1_1_shader_component" ], - [ "TransformComponent", "classecs_1_1_transform_component.html", "classecs_1_1_transform_component" ], - [ "ComponentPtr", "namespaceecs.html#a42f956eb2e8f1c7becf039180c466677", null ], - [ "ComponentTypeID", "namespaceecs.html#a94d754c47297d56ce57eb14784809efc", null ], - [ "EntityID", "namespaceecs.html#af256e267ca18f2601f8e804fd95e9358", null ], - [ "ObjectType", "namespaceecs.html#ab36dd172176a3da5558233694cbad4ae", [ - [ "Sphere", "namespaceecs.html#ab36dd172176a3da5558233694cbad4aeab7095f057db3fefa7325ad93a04e14fd", null ], - [ "Cube", "namespaceecs.html#ab36dd172176a3da5558233694cbad4aeaa296104f0c61a9cf39f4824d05315e12", null ], - [ "Terrain", "namespaceecs.html#ab36dd172176a3da5558233694cbad4aea4ccfea7a25fae3c1d31555f0856d2b42", null ], - [ "Unknown", "namespaceecs.html#ab36dd172176a3da5558233694cbad4aea88183b946cc5f0e8c96b2e66e1c74a7e", null ] - ] ], - [ "ShaderType", "namespaceecs.html#a80994feeebc2747495a80b5d4b2a8440", [ - [ "CEL_SHADING", "namespaceecs.html#a80994feeebc2747495a80b5d4b2a8440a51aa1996b9fb3c4b10d05bb0014996f4", null ], - [ "LIGHTING", "namespaceecs.html#a80994feeebc2747495a80b5d4b2a8440a8b1aa4726295b67f4ca299670037daeb", null ], - [ "NORMAL_MAPPING", "namespaceecs.html#a80994feeebc2747495a80b5d4b2a8440ad00d52afb5a822bbf68e640353f7d9c9", null ], - [ "SPECULAR_MAPPING", "namespaceecs.html#a80994feeebc2747495a80b5d4b2a8440a0581061bcdd3d4e6fd33135bf51e1455", null ], - [ "REFLECTION", "namespaceecs.html#a80994feeebc2747495a80b5d4b2a8440aea337f99e850e6357edb2a5eb89482bf", null ], - [ "REFRACTION", "namespaceecs.html#a80994feeebc2747495a80b5d4b2a8440a295c955c204718fc0d3ff04d9dafe1fc", null ], - [ "TEXTURE", "namespaceecs.html#a80994feeebc2747495a80b5d4b2a8440a3f92f542bd9ec48f912b9350e22736ac", null ], - [ "SKYBOX", "namespaceecs.html#a80994feeebc2747495a80b5d4b2a8440ae3d53ff832d50102618d4fd24ca85a85", null ], - [ "SUNLIGHT", "namespaceecs.html#a80994feeebc2747495a80b5d4b2a8440abd775bbd4dea563ff763705377c1e4cc", null ], - [ "ALPHA_MAPPING", "namespaceecs.html#a80994feeebc2747495a80b5d4b2a8440a8c184a4aa8da322d304210cb3c55fd5e", null ] - ] ], - [ "TextureType", "namespaceecs.html#a6e9ad0276f69474fe9498437b7d1a8f2", [ - [ "Diffuse", "namespaceecs.html#a6e9ad0276f69474fe9498437b7d1a8f2a41178642cae095a6bdb909119b4d16e8", null ], - [ "Normal", "namespaceecs.html#a6e9ad0276f69474fe9498437b7d1a8f2a960b44c579bc2f6818d2daaf9e4c16f0", null ], - [ "Specular", "namespaceecs.html#a6e9ad0276f69474fe9498437b7d1a8f2a39b0044dd8789d333e7794f359406740", null ], - [ "Alpha", "namespaceecs.html#a6e9ad0276f69474fe9498437b7d1a8f2a6132295fcf5570fb8b0a944ef322a598", null ], - [ "Reflection", "namespaceecs.html#a6e9ad0276f69474fe9498437b7d1a8f2aaea1e492943ccbad7ee270ec1e064758", null ] - ] ], - [ "GetComponentTypeID", "namespaceecs.html#ae98a9f77225416bebd93a559a68a92eb", null ] -]; \ No newline at end of file +version https://git-lfs.github.com/spec/v1 +oid sha256:267188a304da3fd7bf95f44ab9f3f358de6fd64c8873225bd01269ce89325657 +size 3783 diff --git a/doxygen_docs/html/namespacemembers.html b/doxygen_docs/html/namespacemembers.html index 167773e..115bd60 100644 --- a/doxygen_docs/html/namespacemembers.html +++ b/doxygen_docs/html/namespacemembers.html @@ -1,117 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Namespace Members - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    Here is a list of all documented namespace members with links to the namespaces they belong to:
      -
    • ComponentPtr : ecs
    • -
    • ComponentTypeID : ecs
    • -
    • EntityID : ecs
    • -
    • GetComponentTypeID() : ecs
    • -
    • ObjectType : ecs
    • -
    • ShaderType : ecs
    • -
    • TextureType : ecs
    • -
    -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:dea4ded3e842ac0030d11509ad2d0a047d59475a2cd8131aceaa49ea23b5a719 +size 4995 diff --git a/doxygen_docs/html/namespacemembers_enum.html b/doxygen_docs/html/namespacemembers_enum.html index 117d84c..6faa10a 100644 --- a/doxygen_docs/html/namespacemembers_enum.html +++ b/doxygen_docs/html/namespacemembers_enum.html @@ -1,113 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Namespace Members - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    Here is a list of all documented namespace enums with links to the namespaces they belong to:
      -
    • ObjectType : ecs
    • -
    • ShaderType : ecs
    • -
    • TextureType : ecs
    • -
    -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:dca384657cecdc5b53aba0c36e08097f10ee603ef5ebd5b6cd6963257a2b6408 +size 4531 diff --git a/doxygen_docs/html/namespacemembers_func.html b/doxygen_docs/html/namespacemembers_func.html index bde5b81..e3cbf2d 100644 --- a/doxygen_docs/html/namespacemembers_func.html +++ b/doxygen_docs/html/namespacemembers_func.html @@ -1,111 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Namespace Members - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    Here is a list of all documented namespace functions with links to the namespaces they belong to:
      -
    • GetComponentTypeID() : ecs
    • -
    -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:0e110e79fc984e7709379ed36e1010c25d203f592411e42d8732e75afb956058 +size 4318 diff --git a/doxygen_docs/html/namespacemembers_type.html b/doxygen_docs/html/namespacemembers_type.html index c871768..94da47e 100644 --- a/doxygen_docs/html/namespacemembers_type.html +++ b/doxygen_docs/html/namespacemembers_type.html @@ -1,113 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Namespace Members - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    Here is a list of all documented namespace typedefs with links to the namespaces they belong to:
      -
    • ComponentPtr : ecs
    • -
    • ComponentTypeID : ecs
    • -
    • EntityID : ecs
    • -
    -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:d9172412f2fc80058de72bfcea946c49487362420f8b17f8a73a7709048e4640 +size 4538 diff --git a/doxygen_docs/html/namespaces.html b/doxygen_docs/html/namespaces.html index be5f3aa..6f00a3b 100644 --- a/doxygen_docs/html/namespaces.html +++ b/doxygen_docs/html/namespaces.html @@ -1,116 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Namespace List - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    Namespace List
    -
    -
    -
    Here is a list of all documented namespaces with brief descriptions:
    - - -
     Necs
    -
    -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:7e073ffffbac9b70f098dfd195b9df24ab9faa6e04b50073fc5ab31b7a0be7db +size 4594 diff --git a/doxygen_docs/html/namespaces_dup.js b/doxygen_docs/html/namespaces_dup.js index b7f96cb..1773bc0 100644 --- a/doxygen_docs/html/namespaces_dup.js +++ b/doxygen_docs/html/namespaces_dup.js @@ -1,4 +1,3 @@ -var namespaces_dup = -[ - [ "ecs", "namespaceecs.html", "namespaceecs" ] -]; \ No newline at end of file +version https://git-lfs.github.com/spec/v1 +oid sha256:4b4ab12fbd8573ecc3ea5154b4b72dc7121da3dc7aeaa8e5d52d4fded04456db +size 76 diff --git a/doxygen_docs/html/nav_f.png b/doxygen_docs/html/nav_f.png index 72a58a5..4b24ffc 100644 Binary files a/doxygen_docs/html/nav_f.png and b/doxygen_docs/html/nav_f.png differ diff --git a/doxygen_docs/html/nav_fd.png b/doxygen_docs/html/nav_fd.png index 032fbdd..efed867 100644 Binary files a/doxygen_docs/html/nav_fd.png and b/doxygen_docs/html/nav_fd.png differ diff --git a/doxygen_docs/html/nav_g.png b/doxygen_docs/html/nav_g.png index 2093a23..34942a1 100644 Binary files a/doxygen_docs/html/nav_g.png and b/doxygen_docs/html/nav_g.png differ diff --git a/doxygen_docs/html/nav_h.png b/doxygen_docs/html/nav_h.png index 33389b1..5e2fe5d 100644 Binary files a/doxygen_docs/html/nav_h.png and b/doxygen_docs/html/nav_h.png differ diff --git a/doxygen_docs/html/nav_hd.png b/doxygen_docs/html/nav_hd.png index de80f18..ab84f22 100644 Binary files a/doxygen_docs/html/nav_hd.png and b/doxygen_docs/html/nav_hd.png differ diff --git a/doxygen_docs/html/navtree.css b/doxygen_docs/html/navtree.css index 69211d4..7665c2b 100644 --- a/doxygen_docs/html/navtree.css +++ b/doxygen_docs/html/navtree.css @@ -1,149 +1,3 @@ -#nav-tree .children_ul { - margin:0; - padding:4px; -} - -#nav-tree ul { - list-style:none outside none; - margin:0px; - padding:0px; -} - -#nav-tree li { - white-space:nowrap; - margin:0px; - padding:0px; -} - -#nav-tree .plus { - margin:0px; -} - -#nav-tree .selected { - background-image: url('tab_a.png'); - background-repeat:repeat-x; - color: var(--nav-text-active-color); - text-shadow: var(--nav-text-active-shadow); -} - -#nav-tree .selected .arrow { - color: var(--nav-arrow-selected-color); - text-shadow: none; -} - -#nav-tree img { - margin:0px; - padding:0px; - border:0px; - vertical-align: middle; -} - -#nav-tree a { - text-decoration:none; - padding:0px; - margin:0px; -} - -#nav-tree .label { - margin:0px; - padding:0px; - font: 12px var(--font-family-nav); -} - -#nav-tree .label a { - padding:2px; -} - -#nav-tree .selected a { - text-decoration:none; - color:var(--nav-text-active-color); -} - -#nav-tree .children_ul { - margin:0px; - padding:0px; -} - -#nav-tree .item { - margin:0px; - padding:0px; -} - -#nav-tree { - padding: 0px 0px; - font-size:14px; - overflow:auto; -} - -#doc-content { - overflow:auto; - display:block; - padding:0px; - margin:0px; - -webkit-overflow-scrolling : touch; /* iOS 5+ */ -} - -#side-nav { - padding:0 6px 0 0; - margin: 0px; - display:block; - position: absolute; - left: 0px; - width: $width; - overflow : hidden; -} - -.ui-resizable .ui-resizable-handle { - display:block; -} - -.ui-resizable-e { - background-image:var(--nav-splitbar-image); - background-size:100%; - background-repeat:repeat-y; - background-attachment: scroll; - cursor:ew-resize; - height:100%; - right:0; - top:0; - width:6px; -} - -.ui-resizable-handle { - display:none; - font-size:0.1px; - position:absolute; - z-index:1; -} - -#nav-tree-contents { - margin: 6px 0px 0px 0px; -} - -#nav-tree { - background-repeat:repeat-x; - background-color: var(--nav-background-color); - -webkit-overflow-scrolling : touch; /* iOS 5+ */ -} - -#nav-sync { - position:absolute; - top:5px; - right:24px; - z-index:0; -} - -#nav-sync img { - opacity:0.3; -} - -#nav-sync img:hover { - opacity:0.9; -} - -@media print -{ - #nav-tree { display: none; } - div.ui-resizable-handle { display: none; position: relative; } -} - +version https://git-lfs.github.com/spec/v1 +oid sha256:a0f7830d5fe24feb9264e3140db4c70f90f7351251e9888a11b2fb9e06ad63b0 +size 2167 diff --git a/doxygen_docs/html/navtree.js b/doxygen_docs/html/navtree.js index 9027ce6..fb0fc50 100644 --- a/doxygen_docs/html/navtree.js +++ b/doxygen_docs/html/navtree.js @@ -1,483 +1,3 @@ -/* - @licstart The following is the entire license notice for the JavaScript code in this file. - - The MIT License (MIT) - - Copyright (C) 1997-2020 by Dimitri van Heesch - - Permission is hereby granted, free of charge, to any person obtaining a copy of this software - and associated documentation files (the "Software"), to deal in the Software without restriction, - including without limitation the rights to use, copy, modify, merge, publish, distribute, - sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all copies or - substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING - BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - @licend The above is the entire license notice for the JavaScript code in this file - */ - -function initNavTree(toroot,relpath) { - let navTreeSubIndices = []; - const ARROW_DOWN = '▼'; - const ARROW_RIGHT = '►'; - const NAVPATH_COOKIE_NAME = ''+'navpath'; - - const getData = function(varName) { - const i = varName.lastIndexOf('/'); - const n = i>=0 ? varName.substring(i+1) : varName; - return eval(n.replace(/-/g,'_')); - } - - const stripPath = function(uri) { - return uri.substring(uri.lastIndexOf('/')+1); - } - - const stripPath2 = function(uri) { - const i = uri.lastIndexOf('/'); - const s = uri.substring(i+1); - const m = uri.substring(0,i+1).match(/\/d\w\/d\w\w\/$/); - return m ? uri.substring(i-6) : s; - } - - const hashValue = function() { - return $(location).attr('hash').substring(1).replace(/[^\w-]/g,''); - } - - const hashUrl = function() { - return '#'+hashValue(); - } - - const pathName = function() { - return $(location).attr('pathname').replace(/[^-A-Za-z0-9+&@#/%?=~_|!:,.;()]/g, ''); - } - - const storeLink = function(link) { - if (!$("#nav-sync").hasClass('sync')) { - Cookie.writeSetting(NAVPATH_COOKIE_NAME,link,0); - } - } - - const deleteLink = function() { - Cookie.eraseSetting(NAVPATH_COOKIE_NAME); - } - - const cachedLink = function() { - return Cookie.readSetting(NAVPATH_COOKIE_NAME,''); - } - - const getScript = function(scriptName,func) { - const head = document.getElementsByTagName("head")[0]; - const script = document.createElement('script'); - script.id = scriptName; - script.type = 'text/javascript'; - script.onload = func; - script.src = scriptName+'.js'; - head.appendChild(script); - } - - const createIndent = function(o,domNode,node) { - let level=-1; - let n = node; - while (n.parentNode) { level++; n=n.parentNode; } - if (node.childrenData) { - const imgNode = document.createElement("span"); - imgNode.className = 'arrow'; - imgNode.style.paddingLeft=(16*level).toString()+'px'; - imgNode.innerHTML=ARROW_RIGHT; - node.plus_img = imgNode; - node.expandToggle = document.createElement("a"); - node.expandToggle.href = "javascript:void(0)"; - node.expandToggle.onclick = function() { - if (node.expanded) { - $(node.getChildrenUL()).slideUp("fast"); - node.plus_img.innerHTML=ARROW_RIGHT; - node.expanded = false; - } else { - expandNode(o, node, false, true); - } - } - node.expandToggle.appendChild(imgNode); - domNode.appendChild(node.expandToggle); - } else { - let span = document.createElement("span"); - span.className = 'arrow'; - span.style.width = 16*(level+1)+'px'; - span.innerHTML = ' '; - domNode.appendChild(span); - } - } - - let animationInProgress = false; - - const gotoAnchor = function(anchor,aname) { - let pos, docContent = $('#doc-content'); - let ancParent = $(anchor.parent()); - if (ancParent.hasClass('memItemLeft') || ancParent.hasClass('memtitle') || - ancParent.hasClass('fieldname') || ancParent.hasClass('fieldtype') || - ancParent.is(':header')) { - pos = ancParent.position().top; - } else if (anchor.position()) { - pos = anchor.position().top; - } - if (pos) { - const dcOffset = docContent.offset().top; - const dcHeight = docContent.height(); - const dcScrHeight = docContent[0].scrollHeight - const dcScrTop = docContent.scrollTop(); - let dist = Math.abs(Math.min(pos-dcOffset,dcScrHeight-dcHeight-dcScrTop)); - animationInProgress = true; - docContent.animate({ - scrollTop: pos + dcScrTop - dcOffset - },Math.max(50,Math.min(500,dist)),function() { - animationInProgress=false; - if (anchor.parent().attr('class')=='memItemLeft') { - let rows = $('.memberdecls tr[class$="'+hashValue()+'"]'); - glowEffect(rows.children(),300); // member without details - } else if (anchor.parent().attr('class')=='fieldname') { - glowEffect(anchor.parent().parent(),1000); // enum value - } else if (anchor.parent().attr('class')=='fieldtype') { - glowEffect(anchor.parent().parent(),1000); // struct field - } else if (anchor.parent().is(":header")) { - glowEffect(anchor.parent(),1000); // section header - } else { - glowEffect(anchor.next(),1000); // normal member - } - }); - } - } - - const newNode = function(o, po, text, link, childrenData, lastNode) { - const node = { - children : [], - childrenData : childrenData, - depth : po.depth + 1, - relpath : po.relpath, - isLast : lastNode, - li : document.createElement("li"), - parentNode : po, - itemDiv : document.createElement("div"), - labelSpan : document.createElement("span"), - label : document.createTextNode(text), - expanded : false, - childrenUL : null, - getChildrenUL : function() { - if (!this.childrenUL) { - this.childrenUL = document.createElement("ul"); - this.childrenUL.className = "children_ul"; - this.childrenUL.style.display = "none"; - this.li.appendChild(node.childrenUL); - } - return node.childrenUL; - }, - }; - - node.itemDiv.className = "item"; - node.labelSpan.className = "label"; - createIndent(o,node.itemDiv,node); - node.itemDiv.appendChild(node.labelSpan); - node.li.appendChild(node.itemDiv); - - const a = document.createElement("a"); - node.labelSpan.appendChild(a); - po.getChildrenUL().appendChild(node.li); - a.appendChild(node.label); - if (link) { - let url; - if (link.substring(0,1)=='^') { - url = link.substring(1); - link = url; - } else { - url = node.relpath+link; - } - a.className = stripPath(link.replace('#',':')); - if (link.indexOf('#')!=-1) { - const aname = '#'+link.split('#')[1]; - const srcPage = stripPath(pathName()); - const targetPage = stripPath(link.split('#')[0]); - a.href = srcPage!=targetPage ? url : aname; - a.onclick = function() { - storeLink(link); - aPPar = $(a).parent().parent(); - if (!aPPar.hasClass('selected')) { - $('.item').removeClass('selected'); - $('.item').removeAttr('id'); - aPPar.addClass('selected'); - aPPar.attr('id','selected'); - } - const anchor = $(aname); - gotoAnchor(anchor,aname); - }; - } else { - a.href = url; - a.onclick = () => storeLink(link); - } - } else if (childrenData != null) { - a.className = "nolink"; - a.href = "javascript:void(0)"; - a.onclick = node.expandToggle.onclick; - } - return node; - } - - const showRoot = function() { - const headerHeight = $("#top").height(); - const footerHeight = $("#nav-path").height(); - const windowHeight = $(window).height() - headerHeight - footerHeight; - (function() { // retry until we can scroll to the selected item - try { - const navtree=$('#nav-tree'); - navtree.scrollTo('#selected',100,{offset:-windowHeight/2}); - } catch (err) { - setTimeout(arguments.callee, 0); - } - })(); - } - - const expandNode = function(o, node, imm, setFocus) { - if (node.childrenData && !node.expanded) { - if (typeof(node.childrenData)==='string') { - const varName = node.childrenData; - getScript(node.relpath+varName,function() { - node.childrenData = getData(varName); - expandNode(o, node, imm, setFocus); - }); - } else { - if (!node.childrenVisited) { - getNode(o, node); - } - $(node.getChildrenUL()).slideDown("fast"); - node.plus_img.innerHTML = ARROW_DOWN; - node.expanded = true; - if (setFocus) { - $(node.expandToggle).focus(); - } - } - } - } - - const glowEffect = function(n,duration) { - n.addClass('glow').delay(duration).queue(function(next) { - $(this).removeClass('glow');next(); - }); - } - - const highlightAnchor = function() { - const aname = hashUrl(); - const anchor = $(aname); - gotoAnchor(anchor,aname); - } - - const selectAndHighlight = function(hash,n) { - let a; - if (hash) { - const link=stripPath(pathName())+':'+hash.substring(1); - a=$('.item a[class$="'+link+'"]'); - } - if (a && a.length) { - a.parent().parent().addClass('selected'); - a.parent().parent().attr('id','selected'); - highlightAnchor(); - } else if (n) { - $(n.itemDiv).addClass('selected'); - $(n.itemDiv).attr('id','selected'); - } - let topOffset=5; - if ($('#nav-tree-contents .item:first').hasClass('selected')) { - topOffset+=25; - } - $('#nav-sync').css('top',topOffset+'px'); - showRoot(); - } - - const showNode = function(o, node, index, hash) { - if (node && node.childrenData) { - if (typeof(node.childrenData)==='string') { - const varName = node.childrenData; - getScript(node.relpath+varName,function() { - node.childrenData = getData(varName); - showNode(o,node,index,hash); - }); - } else { - if (!node.childrenVisited) { - getNode(o, node); - } - $(node.getChildrenUL()).css({'display':'block'}); - node.plus_img.innerHTML = ARROW_DOWN; - node.expanded = true; - const n = node.children[o.breadcrumbs[index]]; - if (index+11 ? '#'+parts[1].replace(/[^\w-]/g,'') : ''; - } - if (hash.match(/^#l\d+$/)) { - const anchor=$('a[name='+hash.substring(1)+']'); - glowEffect(anchor.parent(),1000); // line number - hash=''; // strip line number anchors - } - const url=root+hash; - let i=-1; - while (NAVTREEINDEX[i+1]<=url) i++; - if (i==-1) { i=0; root=NAVTREE[0][1]; } // fallback: show index - if (navTreeSubIndices[i]) { - gotoNode(o,i,root,hash,relpath) - } else { - getScript(relpath+'navtreeindex'+i,function() { - navTreeSubIndices[i] = eval('NAVTREEINDEX'+i); - if (navTreeSubIndices[i]) { - gotoNode(o,i,root,hash,relpath); - } - }); - } - } - - const showSyncOff = function(n,relpath) { - n.html(''); - } - - const showSyncOn = function(n,relpath) { - n.html(''); - } - - const o = { - toroot : toroot, - node : { - childrenData : NAVTREE, - children : [], - childrenUL : document.createElement("ul"), - getChildrenUL : function() { return this.childrenUL }, - li : document.getElementById("nav-tree-contents"), - depth : 0, - relpath : relpath, - expanded : false, - isLast : true, - plus_img : document.createElement("span"), - }, - }; - o.node.li.appendChild(o.node.childrenUL); - o.node.plus_img.className = 'arrow'; - o.node.plus_img.innerHTML = ARROW_RIGHT; - - const navSync = $('#nav-sync'); - if (cachedLink()) { - showSyncOff(navSync,relpath); - navSync.removeClass('sync'); - } else { - showSyncOn(navSync,relpath); - } - - navSync.click(() => { - const navSync = $('#nav-sync'); - if (navSync.hasClass('sync')) { - navSync.removeClass('sync'); - showSyncOff(navSync,relpath); - storeLink(stripPath2(pathName())+hashUrl()); - } else { - navSync.addClass('sync'); - showSyncOn(navSync,relpath); - deleteLink(); - } - }); - - navTo(o,toroot,hashUrl(),relpath); - showRoot(); - - $(window).bind('hashchange', () => { - if (!animationInProgress) { - if (window.location.hash && window.location.hash.length>1) { - let a; - if ($(location).attr('hash')) { - const clslink=stripPath(pathName())+':'+hashValue(); - a=$('.item a[class$="'+clslink.replace(/ - - - - - - -Khaotic Engine Reborn: enginecustom/src/src/shader/normal_map_shader_class.cpp Source File - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    normal_map_shader_class.cpp
    -
    -
    -
    1#include "normal_map_shader_class.h"
    -
    2
    -
    3
    -
    4normal_map_shader_class::normal_map_shader_class()
    -
    5{
    -
    6 vertex_shader_ = 0;
    -
    7 pixel_shader_ = 0;
    -
    8 layout_ = 0;
    -
    9 matrix_buffer_ = 0;
    -
    10 sample_state_ = 0;
    -
    11 light_buffer_ = 0;
    -
    12}
    -
    13
    -
    14
    -
    15normal_map_shader_class::normal_map_shader_class(const normal_map_shader_class& other)
    -
    16{
    -
    17}
    -
    18
    -
    19
    -
    20normal_map_shader_class::~normal_map_shader_class()
    -
    21{
    -
    22}
    -
    23
    -
    24
    -
    25bool normal_map_shader_class::initialize(ID3D11Device* device, HWND hwnd)
    -
    26{
    -
    27 Logger::Get().Log("Initializing normal map shader", __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/normalmap.vs");
    -
    36 if (error != 0)
    -
    37 {
    -
    38 Logger::Get().Log("Failed to set the filename of the vertex shader", __FILE__, __LINE__);
    -
    39 return false;
    -
    40 }
    -
    41
    -
    42 // Set the filename of the pixel shader.
    -
    43 error = wcscpy_s(psFilename, 128, L"src/hlsl/normalmap.ps");
    -
    44 if (error != 0)
    -
    45 {
    -
    46 Logger::Get().Log("Failed to set the filename of the pixel shader", __FILE__, __LINE__);
    -
    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 the vertex and pixel shaders", __FILE__, __LINE__);
    -
    55 return false;
    -
    56 }
    -
    57
    -
    58 Logger::Get().Log("Successfully initialized normal map shader", __FILE__, __LINE__, Logger::LogLevel::Initialize);
    -
    59
    -
    60 return true;
    -
    61}
    -
    62
    -
    63
    -
    64void normal_map_shader_class::shutdown()
    -
    65{
    -
    66 // shutdown the vertex and pixel shaders as well as the related objects.
    -
    67 shutdown_shader();
    -
    68
    -
    69 return;
    -
    70}
    -
    71
    -
    72bool normal_map_shader_class::render(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix,
    -
    73 ID3D11ShaderResourceView* texture1, ID3D11ShaderResourceView* texture2, XMFLOAT3 lightDirection, XMFLOAT4 diffuseColor)
    -
    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, texture1, texture2, lightDirection, diffuseColor);
    -
    80 if (!result)
    -
    81 {
    -
    82 Logger::Get().Log("Failed to set the shader parameters that will be used for rendering", __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}
    -
    91
    -
    92
    -
    93bool normal_map_shader_class::initialize_shader(ID3D11Device* device, HWND hwnd, WCHAR* vsFilename, WCHAR* psFilename)
    -
    94{
    -
    95 Logger::Get().Log("Initializing normal map shader", __FILE__, __LINE__, Logger::LogLevel::Initialize);
    -
    96
    -
    97 HRESULT result;
    -
    98 ID3D10Blob* errorMessage;
    -
    99 ID3D10Blob* vertexShaderBuffer;
    -
    100 ID3D10Blob* pixelShaderBuffer;
    -
    101 D3D11_INPUT_ELEMENT_DESC polygonLayout[5];
    -
    102 unsigned int numElements;
    -
    103 D3D11_BUFFER_DESC matrixBufferDesc;
    -
    104 D3D11_SAMPLER_DESC samplerDesc;
    -
    105 D3D11_BUFFER_DESC lightBufferDesc;
    -
    106
    -
    107
    -
    108 // initialize the pointers this function will use to null.
    -
    109 errorMessage = 0;
    -
    110 vertexShaderBuffer = 0;
    -
    111 pixelShaderBuffer = 0;
    -
    112
    -
    113 // Compile the vertex shader code.
    -
    114 result = D3DCompileFromFile(vsFilename, NULL, NULL, "NormalMapVertexShader", "vs_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0,
    -
    115 &vertexShaderBuffer, &errorMessage);
    -
    116 if (FAILED(result))
    -
    117 {
    -
    118 // If the shader failed to compile it should have writen something to the error message.
    -
    119 if (errorMessage)
    -
    120 {
    -
    121 output_shader_error_message(errorMessage, hwnd, vsFilename);
    -
    122 }
    -
    123 // If there was nothing in the error message then it simply could not find the shader file itself.
    -
    124 else
    -
    125 {
    -
    126 Logger::Get().Log("Failed to compile the vertex shader code", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    127 }
    -
    128
    -
    129 return false;
    -
    130 }
    -
    131
    -
    132 // Compile the pixel shader code.
    -
    133 result = D3DCompileFromFile(psFilename, NULL, NULL, "NormalMapPixelShader", "ps_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0,
    -
    134 &pixelShaderBuffer, &errorMessage);
    -
    135 if (FAILED(result))
    -
    136 {
    -
    137 // If the shader failed to compile it should have writen something to the error message.
    -
    138 if (errorMessage)
    -
    139 {
    -
    140 output_shader_error_message(errorMessage, hwnd, psFilename);
    -
    141 }
    -
    142 // If there was nothing in the error message then it simply could not find the file itself.
    -
    143 else
    -
    144 {
    -
    145 Logger::Get().Log("Failed to compile the pixel shader code", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    146 }
    -
    147
    -
    148 return false;
    -
    149 }
    -
    150
    -
    151 // Create the vertex shader from the buffer.
    -
    152 result = device->CreateVertexShader(vertexShaderBuffer->GetBufferPointer(), vertexShaderBuffer->GetBufferSize(), NULL, &vertex_shader_);
    -
    153 if (FAILED(result))
    -
    154 {
    -
    155 Logger::Get().Log("Failed to create the vertex shader from the buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    156 return false;
    -
    157 }
    -
    158
    -
    159 // Create the pixel shader from the buffer.
    -
    160 result = device->CreatePixelShader(pixelShaderBuffer->GetBufferPointer(), pixelShaderBuffer->GetBufferSize(), NULL, &pixel_shader_);
    -
    161 if (FAILED(result))
    -
    162 {
    -
    163 Logger::Get().Log("Failed to create the pixel shader from the buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    164 return false;
    -
    165 }
    -
    166
    -
    167 // Create the vertex input layout description.
    -
    168 polygonLayout[0].SemanticName = "POSITION";
    -
    169 polygonLayout[0].SemanticIndex = 0;
    -
    170 polygonLayout[0].Format = DXGI_FORMAT_R32G32B32_FLOAT;
    -
    171 polygonLayout[0].InputSlot = 0;
    -
    172 polygonLayout[0].AlignedByteOffset = 0;
    -
    173 polygonLayout[0].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
    -
    174 polygonLayout[0].InstanceDataStepRate = 0;
    -
    175
    -
    176 polygonLayout[1].SemanticName = "TEXCOORD";
    -
    177 polygonLayout[1].SemanticIndex = 0;
    -
    178 polygonLayout[1].Format = DXGI_FORMAT_R32G32_FLOAT;
    -
    179 polygonLayout[1].InputSlot = 0;
    -
    180 polygonLayout[1].AlignedByteOffset = D3D11_APPEND_ALIGNED_ELEMENT;
    -
    181 polygonLayout[1].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
    -
    182 polygonLayout[1].InstanceDataStepRate = 0;
    -
    183
    -
    184 polygonLayout[2].SemanticName = "NORMAL";
    -
    185 polygonLayout[2].SemanticIndex = 0;
    -
    186 polygonLayout[2].Format = DXGI_FORMAT_R32G32B32_FLOAT;
    -
    187 polygonLayout[2].InputSlot = 0;
    -
    188 polygonLayout[2].AlignedByteOffset = D3D11_APPEND_ALIGNED_ELEMENT;
    -
    189 polygonLayout[2].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
    -
    190 polygonLayout[2].InstanceDataStepRate = 0;
    -
    191
    -
    192 polygonLayout[3].SemanticName = "TANGENT";
    -
    193 polygonLayout[3].SemanticIndex = 0;
    -
    194 polygonLayout[3].Format = DXGI_FORMAT_R32G32B32_FLOAT;
    -
    195 polygonLayout[3].InputSlot = 0;
    -
    196 polygonLayout[3].AlignedByteOffset = D3D11_APPEND_ALIGNED_ELEMENT;
    -
    197 polygonLayout[3].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
    -
    198 polygonLayout[3].InstanceDataStepRate = 0;
    -
    199
    -
    200 polygonLayout[4].SemanticName = "BINORMAL";
    -
    201 polygonLayout[4].SemanticIndex = 0;
    -
    202 polygonLayout[4].Format = DXGI_FORMAT_R32G32B32_FLOAT;
    -
    203 polygonLayout[4].InputSlot = 0;
    -
    204 polygonLayout[4].AlignedByteOffset = D3D11_APPEND_ALIGNED_ELEMENT;
    -
    205 polygonLayout[4].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
    -
    206 polygonLayout[4].InstanceDataStepRate = 0;
    -
    207
    -
    208 // Get a count of the elements in the layout.
    -
    209 numElements = sizeof(polygonLayout) / sizeof(polygonLayout[0]);
    -
    210
    -
    211 // Create the vertex input layout.
    -
    212 result = device->CreateInputLayout(polygonLayout, numElements, vertexShaderBuffer->GetBufferPointer(),
    -
    213 vertexShaderBuffer->GetBufferSize(), &layout_);
    -
    214 if (FAILED(result))
    -
    215 {
    -
    216 Logger::Get().Log("Failed to create the vertex input layout", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    217 return false;
    -
    218 }
    -
    219
    -
    220 // Release the vertex shader buffer and pixel shader buffer since they are no longer needed.
    -
    221 vertexShaderBuffer->Release();
    -
    222 vertexShaderBuffer = 0;
    -
    223
    -
    224 pixelShaderBuffer->Release();
    -
    225 pixelShaderBuffer = 0;
    -
    226
    -
    227 // Setup the description of the dynamic matrix constant buffer that is in the vertex shader.
    -
    228 matrixBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
    -
    229 matrixBufferDesc.ByteWidth = sizeof(matrix_buffer_type);
    -
    230 matrixBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
    -
    231 matrixBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
    -
    232 matrixBufferDesc.MiscFlags = 0;
    -
    233 matrixBufferDesc.StructureByteStride = 0;
    -
    234
    -
    235 // Create the constant buffer pointer so we can access the vertex shader constant buffer from within this class.
    -
    236 result = device->CreateBuffer(&matrixBufferDesc, NULL, &matrix_buffer_);
    -
    237 if (FAILED(result))
    -
    238 {
    -
    239 Logger::Get().Log("Failed to create the constant buffer pointer", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    240 return false;
    -
    241 }
    -
    242
    -
    243 // Create a texture sampler state description.
    -
    244 samplerDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR;
    -
    245 samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP;
    -
    246 samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP;
    -
    247 samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_WRAP;
    -
    248 samplerDesc.MipLODBias = 0.0f;
    -
    249 samplerDesc.MaxAnisotropy = 1;
    -
    250 samplerDesc.ComparisonFunc = D3D11_COMPARISON_ALWAYS;
    -
    251 samplerDesc.BorderColor[0] = 0;
    -
    252 samplerDesc.BorderColor[1] = 0;
    -
    253 samplerDesc.BorderColor[2] = 0;
    -
    254 samplerDesc.BorderColor[3] = 0;
    -
    255 samplerDesc.MinLOD = 0;
    -
    256 samplerDesc.MaxLOD = D3D11_FLOAT32_MAX;
    -
    257
    -
    258 // Create the texture sampler state.
    -
    259 result = device->CreateSamplerState(&samplerDesc, &sample_state_);
    -
    260 if (FAILED(result))
    -
    261 {
    -
    262 Logger::Get().Log("Failed to create the texture sampler state", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    263 return false;
    -
    264 }
    -
    265
    -
    266 // Setup the description of the light dynamic constant buffer that is in the pixel shader.
    -
    267 lightBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
    -
    268 lightBufferDesc.ByteWidth = sizeof(light_buffer_type);
    -
    269 lightBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
    -
    270 lightBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
    -
    271 lightBufferDesc.MiscFlags = 0;
    -
    272 lightBufferDesc.StructureByteStride = 0;
    -
    273
    -
    274 // Create the constant buffer pointer so we can access the vertex shader constant buffer from within this class.
    -
    275 result = device->CreateBuffer(&lightBufferDesc, NULL, &light_buffer_);
    -
    276 if (FAILED(result))
    -
    277 {
    -
    278 Logger::Get().Log("Failed to create the light constant buffer pointer", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    279 return false;
    -
    280 }
    -
    281
    -
    282 Logger::Get().Log("Successfully initialized normal map shader", __FILE__, __LINE__, Logger::LogLevel::Initialize);
    -
    283
    -
    284 return true;
    -
    285}
    -
    286
    -
    287
    -
    288void normal_map_shader_class::shutdown_shader()
    -
    289{
    -
    290 Logger::Get().Log("Shutting down normal map shader", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
    -
    291
    -
    292 // Release the light constant buffer.
    -
    293 if (light_buffer_)
    -
    294 {
    -
    295 light_buffer_->Release();
    -
    296 light_buffer_ = 0;
    -
    297 }
    -
    298
    -
    299 // Release the sampler state.
    -
    300 if (sample_state_)
    -
    301 {
    -
    302 sample_state_->Release();
    -
    303 sample_state_ = 0;
    -
    304 }
    -
    305
    -
    306 // Release the matrix constant buffer.
    -
    307 if (matrix_buffer_)
    -
    308 {
    -
    309 matrix_buffer_->Release();
    -
    310 matrix_buffer_ = 0;
    -
    311 }
    -
    312
    -
    313 // Release the layout.
    -
    314 if (layout_)
    -
    315 {
    -
    316 layout_->Release();
    -
    317 layout_ = 0;
    -
    318 }
    -
    319
    -
    320 // Release the pixel shader.
    -
    321 if (pixel_shader_)
    -
    322 {
    -
    323 pixel_shader_->Release();
    -
    324 pixel_shader_ = 0;
    -
    325 }
    -
    326
    -
    327 // Release the vertex shader.
    -
    328 if (vertex_shader_)
    -
    329 {
    -
    330 vertex_shader_->Release();
    -
    331 vertex_shader_ = 0;
    -
    332 }
    -
    333
    -
    334 Logger::Get().Log("Successfully shut down normal map shader", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
    -
    335
    -
    336 return;
    -
    337}
    -
    338
    -
    339
    -
    340void normal_map_shader_class::output_shader_error_message(ID3D10Blob* errorMessage, HWND hwnd, WCHAR* shaderFilename)
    -
    341{
    -
    342 char* compileErrors;
    -
    343 unsigned long long bufferSize, i;
    -
    344 ofstream fout;
    -
    345
    -
    346
    -
    347 // Get a pointer to the error message text buffer.
    -
    348 compileErrors = (char*)(errorMessage->GetBufferPointer());
    -
    349
    -
    350 // Get the length of the message.
    -
    351 bufferSize = errorMessage->GetBufferSize();
    -
    352
    -
    353 // Open a file to write the error message to.
    -
    354 fout.open("shader-error.txt");
    -
    355
    -
    356 // Write out the error message.
    -
    357 for (i = 0; i < bufferSize; i++)
    -
    358 {
    -
    359 fout << compileErrors[i];
    -
    360 }
    -
    361
    -
    362 // Close the file.
    -
    363 fout.close();
    -
    364
    -
    365 // Release the error message.
    -
    366 errorMessage->Release();
    -
    367 errorMessage = 0;
    -
    368
    -
    369 // Pop a message up on the screen to notify the user to check the text file for compile errors.
    -
    370 MessageBox(hwnd, L"Error compiling shader. Check shader-error.txt for message.", shaderFilename, MB_OK);
    -
    371
    -
    372 return;
    -
    373}
    -
    374
    -
    375
    -
    376bool normal_map_shader_class::set_shader_parameters(ID3D11DeviceContext* deviceContext, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix,
    -
    377 ID3D11ShaderResourceView* texture1, ID3D11ShaderResourceView* texture2, XMFLOAT3 lightDirection, XMFLOAT4 diffuseColor)
    -
    378{
    -
    379 HRESULT result;
    -
    380 D3D11_MAPPED_SUBRESOURCE mappedResource;
    -
    381 matrix_buffer_type* dataPtr;
    -
    382 unsigned int bufferNumber;
    -
    383 light_buffer_type* dataPtr2;
    -
    384
    -
    385
    -
    386 // Transpose the matrices to prepare them for the shader.
    -
    387 worldMatrix = XMMatrixTranspose(worldMatrix);
    -
    388 viewMatrix = XMMatrixTranspose(viewMatrix);
    -
    389 projectionMatrix = XMMatrixTranspose(projectionMatrix);
    -
    390
    -
    391 // Lock the constant buffer so it can be written to.
    -
    392 result = deviceContext->Map(matrix_buffer_, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
    -
    393 if (FAILED(result))
    -
    394 {
    -
    395 Logger::Get().Log("Failed to lock the constant buffer so it can be written to", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    396 return false;
    -
    397 }
    -
    398
    -
    399 // Get a pointer to the data in the constant buffer.
    -
    400 dataPtr = (matrix_buffer_type*)mappedResource.pData;
    -
    401
    -
    402 // Copy the matrices into the constant buffer.
    -
    403 dataPtr->world = worldMatrix;
    -
    404 dataPtr->view = viewMatrix;
    -
    405 dataPtr->projection = projectionMatrix;
    -
    406
    -
    407 // Unlock the constant buffer.
    -
    408 deviceContext->Unmap(matrix_buffer_, 0);
    -
    409
    -
    410 // Set the position of the constant buffer in the vertex shader.
    -
    411 bufferNumber = 0;
    -
    412
    -
    413 // Finally set the constant buffer in the vertex shader with the updated values.
    -
    414 deviceContext->VSSetConstantBuffers(bufferNumber, 1, &matrix_buffer_);
    -
    415
    -
    416 // Set shader texture resources in the pixel shader.
    -
    417 deviceContext->PSSetShaderResources(0, 1, &texture1);
    -
    418 deviceContext->PSSetShaderResources(1, 1, &texture2);
    -
    419
    -
    420 // Lock the light constant buffer so it can be written to.
    -
    421 result = deviceContext->Map(light_buffer_, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
    -
    422 if (FAILED(result))
    -
    423 {
    -
    424 Logger::Get().Log("Failed to lock the light constant buffer so it can be written to", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    425 return false;
    -
    426 }
    -
    427
    -
    428 // Get a pointer to the data in the constant buffer.
    -
    429 dataPtr2 = (light_buffer_type*)mappedResource.pData;
    -
    430
    -
    431 // Copy the lighting variables into the constant buffer.
    -
    432 dataPtr2->diffuse_color = diffuseColor;
    -
    433 dataPtr2->light_direction = lightDirection;
    -
    434 dataPtr2->padding = 0.0f;
    -
    435
    -
    436 // Unlock the constant buffer.
    -
    437 deviceContext->Unmap(light_buffer_, 0);
    -
    438
    -
    439 // Set the position of the light constant buffer in the pixel shader.
    -
    440 bufferNumber = 0;
    -
    441
    -
    442 // Finally set the light constant buffer in the pixel shader with the updated values.
    -
    443 deviceContext->PSSetConstantBuffers(bufferNumber, 1, &light_buffer_);
    -
    444
    -
    445 // Set shader texture resources in the pixel shader.
    -
    446 deviceContext->PSSetShaderResources(0, 1, &texture1);
    -
    447 deviceContext->PSSetShaderResources(1, 1, &texture2);
    -
    448
    -
    449 return true;
    -
    450}
    -
    451
    -
    452
    -
    453void normal_map_shader_class::render_shader(ID3D11DeviceContext* deviceContext, int indexCount)
    -
    454{
    -
    455 // Set the vertex input layout.
    -
    456 deviceContext->IASetInputLayout(layout_);
    -
    457
    -
    458 // Set the vertex and pixel shaders that will be used to render this triangle.
    -
    459 deviceContext->VSSetShader(vertex_shader_, NULL, 0);
    -
    460 deviceContext->PSSetShader(pixel_shader_, NULL, 0);
    -
    461
    -
    462 // Set the sampler state in the pixel shader.
    -
    463 deviceContext->PSSetSamplers(0, 1, &sample_state_);
    -
    464
    -
    465 // render the triangle.
    -
    466 deviceContext->DrawIndexed(indexCount, 0, 0);
    -
    467
    -
    468 return;
    -
    469}
    -
    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
    - -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:86b037fc980c053c11dcc689429f8cbaebf0f1e7b4a064b61a950a370b177262 +size 74572 diff --git a/doxygen_docs/html/normal__map__shader__class_8h_source.html b/doxygen_docs/html/normal__map__shader__class_8h_source.html index 043e995..b91a9c4 100644 --- a/doxygen_docs/html/normal__map__shader__class_8h_source.html +++ b/doxygen_docs/html/normal__map__shader__class_8h_source.html @@ -1,175 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/inc/shader/normal_map_shader_class.h Source File - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    normal_map_shader_class.h
    -
    -
    -
    1#ifndef _NORMALMAPSHADERCLASS_H_
    -
    2#define _NORMALMAPSHADERCLASS_H_
    -
    3
    -
    4
    -
    6// INCLUDES //
    -
    8#include "Logger.h"
    -
    9#include <d3d11.h>
    -
    10#include <d3dcompiler.h>
    -
    11#include <directxmath.h>
    -
    12#include <fstream>
    -
    13using namespace DirectX;
    -
    14using namespace std;
    -
    15
    -
    16
    -
    18// Class name: normal_map_shader_class
    -
    - -
    21{
    -
    22private:
    -
    23 struct matrix_buffer_type
    -
    24 {
    -
    25 XMMATRIX world;
    -
    26 XMMATRIX view;
    -
    27 XMMATRIX projection;
    -
    28 };
    -
    29
    -
    30 struct light_buffer_type
    -
    31 {
    -
    32 XMFLOAT4 diffuse_color;
    -
    33 XMFLOAT3 light_direction;
    -
    34 float padding;
    -
    35 };
    -
    36
    -
    37public:
    - - - -
    41
    -
    42 bool initialize(ID3D11Device*, HWND);
    -
    43 void shutdown();
    -
    44 bool render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, XMFLOAT3, XMFLOAT4);
    -
    45
    -
    46private:
    -
    47 bool initialize_shader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
    -
    48 void shutdown_shader();
    -
    49 void output_shader_error_message(ID3D10Blob*, HWND, WCHAR*);
    -
    50
    -
    51 bool set_shader_parameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, XMFLOAT3, XMFLOAT4);
    -
    52 void render_shader(ID3D11DeviceContext*, int);
    -
    53
    -
    54private:
    -
    55 ID3D11VertexShader* vertex_shader_;
    -
    56 ID3D11PixelShader* pixel_shader_;
    -
    57 ID3D11InputLayout* layout_;
    -
    58 ID3D11Buffer* matrix_buffer_;
    -
    59 ID3D11SamplerState* sample_state_;
    -
    60 ID3D11Buffer* light_buffer_;
    -
    61
    -
    62};
    -
    -
    63
    -
    64#endif
    - -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:5463e3105cd8514dc693e2b87fa4cd1796b9c074888b9ed032a55c4155ab9ded +size 13476 diff --git a/doxygen_docs/html/object_8cpp_source.html b/doxygen_docs/html/object_8cpp_source.html index c42906e..c2b54f6 100644 --- a/doxygen_docs/html/object_8cpp_source.html +++ b/doxygen_docs/html/object_8cpp_source.html @@ -1,555 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/src/system/object.cpp Source File - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    object.cpp
    -
    -
    -
    1#include "object.h"
    -
    2
    -
    3#include <comdef.h>
    -
    4
    -
    5#include "application_class.h"
    -
    6#include "d_3d_class.h"
    -
    7
    -
    8object::object(application_class& app) : m_Application(app)// initialize the reference here
    -
    9{
    -
    10 m_scaleMatrix = XMMatrixIdentity();
    -
    11 m_rotateMatrix = XMMatrixIdentity();
    -
    12 m_translateMatrix = XMMatrixIdentity();
    -
    13 m_srMatrix = XMMatrixIdentity();
    -
    14 m_worldMatrix = XMMatrixIdentity();
    -
    15 m_previousPosition = XMVectorZero();
    -
    16 m_velocity = XMVectorZero();
    -
    17 m_acceleration = XMVectorZero();
    -
    18 m_mass = NULL;
    -
    19 m_isGrounded = false;
    -
    20 m_id = NULL;
    -
    21 m_boundingRadius = 1.0f;
    -
    22}
    -
    23
    -
    24object::object()
    -
    25 : m_Application(*static_cast<application_class*>(nullptr)) // Remplacer suivant votre logique
    -
    26{
    -
    27 m_scaleMatrix = XMMatrixIdentity();
    -
    28 m_rotateMatrix = XMMatrixIdentity();
    -
    29 m_translateMatrix = XMMatrixIdentity();
    -
    30 m_srMatrix = XMMatrixIdentity();
    -
    31 m_worldMatrix = XMMatrixIdentity();
    -
    32 m_previousPosition = XMVectorZero();
    -
    33 m_velocity = XMVectorZero();
    -
    34 m_acceleration = XMVectorZero();
    -
    35 m_mass = NULL;
    -
    36 m_isGrounded = false;
    -
    37 m_id = NULL;
    -
    38 m_boundingRadius = 1.0f;
    -
    39}
    -
    40
    -
    41object::~object()
    -
    42{
    -
    43}
    -
    44
    -
    45bool object::Initialize(
    -
    46 ID3D11Device* device,
    -
    47 ID3D11DeviceContext* deviceContext,
    -
    48 char* modelFilename,
    -
    49 TextureContainer& texturesContainer
    -
    50 )
    -
    51{
    -
    52
    -
    53 std::string filename(modelFilename);
    -
    54 auto it = g_model_cache.find(filename);
    -
    55 if (it != g_model_cache.end())
    -
    56 {
    -
    57 m_model_ = it->second;
    -
    58 }
    -
    59 else
    -
    60 {
    -
    61 auto new_model = std::make_shared<model_class>();
    -
    62 if (!new_model->Initialize(device, deviceContext, modelFilename, texturesContainer))
    -
    63 {
    -
    64 return false;
    -
    65 }
    -
    66 g_model_cache[filename] = new_model;
    -
    67 m_model_ = new_model;
    -
    68 }
    -
    69
    -
    70 return true;
    -
    71}
    -
    72
    -
    73void object::SetScaleMatrix(XMMATRIX scaleMatrix)
    -
    74{
    -
    75 m_scaleMatrix = scaleMatrix;
    -
    76}
    -
    77
    -
    78void object::SetRotateMatrix(XMMATRIX rotateMatrix)
    -
    79{
    -
    80 m_rotateMatrix = rotateMatrix;
    -
    81}
    -
    82
    -
    83void object::SetTranslateMatrix(XMMATRIX translateMatrix)
    -
    84{
    -
    85 m_translateMatrix = translateMatrix;
    -
    86}
    -
    87
    -
    88void object::SetSRMatrix(XMMATRIX srMatrix)
    -
    89{
    -
    90 m_srMatrix = srMatrix;
    -
    91}
    -
    92
    -
    93void object::SetWorldMatrix(XMMATRIX worldMatrix)
    -
    94{
    -
    95 m_worldMatrix = worldMatrix;
    -
    96}
    -
    97
    -
    98XMMATRIX object::GetScaleMatrix() const
    -
    99{
    -
    100 return m_scaleMatrix;
    -
    101}
    -
    102
    -
    103XMMATRIX object::GetRotateMatrix() const
    -
    104{
    -
    105 return m_rotateMatrix;
    -
    106}
    -
    107
    -
    108XMMATRIX object::GetTranslateMatrix() const
    -
    109{
    -
    110 return m_translateMatrix;
    -
    111}
    -
    112
    -
    113XMMATRIX object::GetSRMatrix() const
    -
    114{
    -
    115 return m_srMatrix;
    -
    116}
    -
    117
    -
    118XMMATRIX object::GetWorldMatrix() const
    -
    119{
    -
    120 return m_worldMatrix;
    -
    121}
    -
    122
    -
    123XMVECTOR object::GetPosition()
    -
    124{
    -
    125 XMFLOAT4X4 matrix;
    -
    126 XMStoreFloat4x4(&matrix, m_translateMatrix);
    -
    127 return XMVectorSet(matrix._41, matrix._42, matrix._43, 0.0f);
    -
    128}
    -
    129
    -
    130XMVECTOR object::GetRotation()
    -
    131{
    -
    132 XMFLOAT4X4 matrix;
    -
    133 XMStoreFloat4x4(&matrix, m_rotateMatrix);
    -
    134 float rotationX = atan2f(matrix._32, matrix._33);
    -
    135 float rotationY = atan2f(-matrix._31, sqrtf(matrix._32 * matrix._32 + matrix._33 * matrix._33));
    -
    136 float rotationZ = atan2f(matrix._21, matrix._11);
    -
    137 return XMVectorSet(rotationX, rotationY, rotationZ, 0.0f);
    -
    138}
    -
    139
    -
    140XMVECTOR object::GetScale()
    -
    141{
    -
    142 XMFLOAT4X4 matrix;
    -
    143 XMStoreFloat4x4(&matrix, m_scaleMatrix);
    -
    144
    -
    145 // Utiliser des vecteurs pour les lignes de la matrice
    -
    146 XMVECTOR row1 = XMLoadFloat3(reinterpret_cast<XMFLOAT3*>(&matrix._11));
    -
    147 XMVECTOR row2 = XMLoadFloat3(reinterpret_cast<XMFLOAT3*>(&matrix._21));
    -
    148 XMVECTOR row3 = XMLoadFloat3(reinterpret_cast<XMFLOAT3*>(&matrix._31));
    -
    149
    -
    150 // Calculer les longueurs des vecteurs
    -
    151 XMVECTOR scale = XMVectorSet(
    -
    152 XMVectorGetX(XMVector3Length(row1)),
    -
    153 XMVectorGetX(XMVector3Length(row2)),
    -
    154 XMVectorGetX(XMVector3Length(row3)),
    -
    155 0.0f
    -
    156 );
    -
    157
    -
    158 return scale;
    -
    159}
    -
    160
    -
    161
    -
    162
    -
    163void object::SetPosition(XMVECTOR position)
    -
    164{
    -
    165 XMFLOAT4X4 matrix;
    -
    166 XMStoreFloat4x4(&matrix, m_translateMatrix);
    -
    167 matrix._41 = XMVectorGetX(position);
    -
    168 matrix._42 = XMVectorGetY(position);
    -
    169 matrix._43 = XMVectorGetZ(position);
    -
    170 m_translateMatrix = XMLoadFloat4x4(&matrix);
    -
    171}
    -
    172
    -
    173void object::SetRotation(XMVECTOR rotation)
    -
    174{
    -
    175 XMFLOAT4X4 matrix;
    -
    176 XMStoreFloat4x4(&matrix, m_rotateMatrix);
    -
    177 XMMATRIX rotationMatrix = XMMatrixRotationRollPitchYaw(XMVectorGetX(rotation), XMVectorGetY(rotation), XMVectorGetZ(rotation));
    -
    178 m_rotateMatrix = rotationMatrix;
    -
    179}
    -
    180
    -
    181void object::SetScale(XMVECTOR scale)
    -
    182{
    -
    183 XMFLOAT4X4 matrix;
    -
    184 XMStoreFloat4x4(&matrix, m_scaleMatrix);
    -
    185 matrix._11 = XMVectorGetX(scale);
    -
    186 matrix._22 = XMVectorGetY(scale);
    -
    187 matrix._33 = XMVectorGetZ(scale);
    -
    188 m_scaleMatrix = XMLoadFloat4x4(&matrix);
    -
    189}
    -
    190
    -
    191void object::UpdateWorldMatrix()
    -
    192{
    -
    193 m_worldMatrix = m_scaleMatrix * m_rotateMatrix * m_translateMatrix;
    -
    194}
    -
    195
    -
    196void object::UpdateSRMatrix()
    -
    197{
    -
    198 m_srMatrix = m_scaleMatrix * m_rotateMatrix;
    -
    199}
    -
    200
    -
    201void object::UpdateTranslateMatrix()
    -
    202{
    -
    203 m_translateMatrix = XMMatrixTranslationFromVector(GetPosition());
    -
    204}
    -
    205
    -
    206void object::UpdateRotateMatrix()
    -
    207{
    -
    208 m_rotateMatrix = XMMatrixRotationRollPitchYawFromVector(GetRotation());
    -
    209}
    -
    210
    -
    211void object::UpdateScaleMatrix()
    -
    212{
    -
    213 m_scaleMatrix = XMMatrixScalingFromVector(GetScale());
    -
    214}
    -
    215
    -
    216void object::Update()
    -
    217{
    -
    218 UpdateWorldMatrix();
    -
    219 UpdateSRMatrix();
    -
    220 UpdateTranslateMatrix();
    -
    221 UpdateRotateMatrix();
    -
    222 UpdateScaleMatrix();
    -
    223}
    -
    224
    -
    225std::string object::GetName()
    -
    226{
    -
    227 return m_name;
    -
    228}
    -
    229
    -
    230void object::SetName(std::string name)
    -
    231{
    -
    232 m_name = name;
    -
    233}
    -
    234
    -
    235void object::SetVelocity(XMVECTOR velocity)
    -
    236{
    -
    237 m_velocity = velocity;
    -
    238}
    -
    239
    -
    240void object::AddVelocity(float deltaTime)
    -
    241{
    -
    242 m_velocity += m_acceleration * deltaTime;
    -
    243}
    -
    244
    -
    245XMVECTOR object::GetVelocity() const
    -
    246{
    -
    247 return m_velocity;
    -
    248}
    -
    249
    -
    250void object::SetAcceleration(XMVECTOR acceleration)
    -
    251{
    -
    252 m_acceleration = acceleration;
    -
    253}
    -
    254
    -
    255XMVECTOR object::GetAcceleration() const
    -
    256{
    -
    257 return m_acceleration;
    -
    258}
    -
    259
    -
    260void object::SetMass(float mass)
    -
    261{
    -
    262 m_mass = mass;
    -
    263}
    -
    264
    -
    265float object::GetMass() const
    -
    266{
    -
    267 return m_mass;
    -
    268}
    -
    269
    -
    270void object::SetGrounded(bool isGrounded)
    -
    271{
    -
    272 m_isGrounded = isGrounded;
    -
    273}
    -
    274
    -
    275bool object::IsGrounded() const
    -
    276{
    -
    277 return m_isGrounded;
    -
    278}
    -
    279
    -
    280int object::SetId(int id)
    -
    281{
    -
    282 return m_id = id;
    -
    283}
    -
    284
    -
    285int object::GetId() const
    -
    286{
    -
    287 return m_id;
    -
    288}
    -
    289
    -
    290bool object::IsPhysicsEnabled() const
    -
    291{
    -
    292 return m_isPhysicsEnabled;
    -
    293}
    -
    294
    -
    295void object::SetPhysicsEnabled(bool state)
    -
    296{
    -
    297 m_isPhysicsEnabled = state;
    -
    298}
    -
    299
    -
    300float object::GetBoundingRadius() const
    -
    301{
    -
    302 return m_boundingRadius;
    -
    303}
    -
    304
    -
    305void object::UpdatePosition(float deltaTime)
    -
    306{
    -
    307 XMVECTOR position = GetPosition();
    -
    308 position = position + GetVelocity() * deltaTime;
    -
    309 SetPosition(position);
    -
    310}
    -
    311
    -
    312void object::SetType(ObjectType type)
    -
    313{
    -
    314 m_type = type;
    -
    315}
    -
    316
    -
    317std::string object::ObjectTypeToString(ObjectType type) {
    -
    318 switch (type) {
    -
    319 case ObjectType::Cube: return "Cube";
    -
    320 case ObjectType::Sphere: return "Sphere";
    -
    321 // Ajoutez d'autres cas si nécessaire
    -
    322 default: return "Unknown";
    -
    323 }
    -
    324}
    -
    325
    -
    326ObjectType object::StringToObjectType(const std::string& str) {
    -
    327 if (str == "Cube") return ObjectType::Cube;
    -
    328 if (str == "Sphere") return ObjectType::Sphere;
    -
    329 // Add other cases as needed
    -
    330 return ObjectType::Unknown;
    -
    331}
    -
    332
    -
    333std::string object::ShaderTypeToString(ShaderType type) {
    -
    334 switch (type) {
    -
    335 case ShaderType::ALPHA_MAPPING: return "ALPHA_MAPPING";
    -
    336 case ShaderType::CEL_SHADING: return "CEL_SHADING";
    -
    337 case ShaderType::NORMAL_MAPPING: return "NORMAL_MAPPING";
    -
    338 case ShaderType::SPECULAR_MAPPING: return "SPECULAR_MAPPING";
    -
    339 case ShaderType::TEXTURE: return "TEXTURE";
    -
    340 case ShaderType::LIGHTING: return "LIGHTING";
    -
    341 case ShaderType::SUNLIGHT: return "SUNLIGHT";
    -
    342 // Ajoutez d'autres cas si nécessaire
    -
    343 default: return "Unknown";
    -
    344 }
    -
    345}
    -
    346
    -
    347ShaderType object::StringToShaderType(const std::string& str) {
    -
    348 if (str == "ALPHA_MAPPING") return ShaderType::ALPHA_MAPPING;
    -
    349 if (str == "CEL_SHADING") return ShaderType::CEL_SHADING;
    -
    350 if (str == "NORMAL_MAPPING") return ShaderType::NORMAL_MAPPING;
    -
    351 if (str == "SPECULAR_MAPPING") return ShaderType::SPECULAR_MAPPING;
    -
    352 if (str == "TEXTURE") return ShaderType::TEXTURE;
    -
    353 if (str == "LIGHTING") return ShaderType::LIGHTING;
    -
    354 if (str == "SUNLIGHT") return ShaderType::SUNLIGHT;
    -
    355 // Add other cases as needed
    -
    356 return ShaderType::TEXTURE;
    -
    357}
    -
    358
    -
    359void object::LaunchObject()
    -
    360{
    -
    361 // Constants
    -
    362 const float gravity = -9.81f;
    -
    363
    -
    364 // Convert alpha from degrees to radians if needed
    -
    365 float alphaRadians = m_alpha * (XM_PI / 180.0f);
    -
    366
    -
    367 // Scale factors to make the physics simulation more visible
    -
    368 float scaleFactor = 200.0f; // Adjust this based on your world scale
    -
    369
    -
    370 // Calculate initial velocity magnitude using the same formula as the Python code
    -
    371 // v_eject = l1 * sqrt(k/m) * sqrt(1 - (m*g*sin(alpha)/(k*l1))^2)
    -
    372 float velocityMagnitude = m_initialStretch * sqrtf(m_springConstant / m_mass) *
    -
    373 sqrtf(1.0f - powf((m_mass * gravity * sinf(alphaRadians) / (m_springConstant * m_initialStretch)), 2.0f));
    -
    374
    -
    375 // Apply scale factor
    -
    376 velocityMagnitude *= scaleFactor;
    -
    377
    -
    378 // Calculate velocity components
    -
    379 XMVECTOR velocity = XMVectorSet(
    -
    380 velocityMagnitude * cosf(alphaRadians), // vx = v0 * cos(alpha)
    -
    381 velocityMagnitude * sinf(alphaRadians), // vy = v0 * sin(alpha)
    -
    382 0.0f, // z-component (0 for 2D trajectory)
    -
    383 0.0f
    -
    384 );
    -
    385
    -
    386 // Apply velocity to object
    -
    387 SetVelocity(velocity);
    -
    388
    -
    389 // Enable physics for the object to handle the trajectory
    -
    390 SetPhysicsEnabled(true);
    -
    391
    -
    392 // Reset grounded state
    -
    393 SetGrounded(false);
    -
    394
    -
    395 // Debug output
    -
    396 char buffer[256];
    -
    397 sprintf_s(buffer, "Launch velocity: %f m/s at angle %f degrees", XMVectorGetX(XMVector3Length(velocity)), m_alpha);
    -
    398 OutputDebugStringA(buffer);
    -
    399}
    -
    400
    -
    401bool object::LoadTexturesFromPath(std::vector<std::wstring>& texturePaths, TextureContainer& texturesContainer,
    -
    402 d_3d_class* m_Direct3D)
    -
    403{
    -
    404
    -
    405 HRESULT result;
    -
    406
    -
    407 int i = 0;
    -
    408 TextureType type;
    -
    409 for (const auto& texturePath : texturePaths)
    -
    410 {
    -
    411 ID3D11ShaderResourceView* texture = nullptr;
    -
    412 result = DirectX::CreateWICTextureFromFile(m_Direct3D->get_device(), m_Direct3D->get_device_context(), texturePath.c_str(), nullptr, &texture);
    -
    413 if (FAILED(result))
    -
    414 {
    -
    415
    -
    416 // Utiliser _com_error pour obtenir des informations détaillées sur l'erreur
    -
    417 _com_error err(result);
    -
    418 LPCTSTR errMsg = err.ErrorMessage();
    -
    419
    -
    420 //convertie errMessage en std::wstring
    -
    421 std::wstring ws(errMsg);
    -
    422 std::string str(ws.begin(), ws.end());
    -
    423
    -
    424 Logger::Get().Log("Failed to load texture: " + std::string(texturePath.begin(), texturePath.end()) +
    -
    425 "\nError: " + std::to_string(result) +
    -
    426 "\nDescription: " + str,
    -
    427 __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    428 return false; // Assurez-vous de retourner false ou de gérer l'erreur de manière appropriée
    -
    429 }
    -
    430 texturesContainer.AssignTexture(texturesContainer, texture,texturePath , i);
    -
    431 i++;
    -
    432
    -
    433 }
    -
    434
    -
    435 return true;
    -
    436}
    -
    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
    - - -
    ID3D11Device * get_device()
    Gets the Direct3D device.
    -
    ID3D11DeviceContext * get_device_context()
    Gets the Direct3D device context.
    - -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:f790a2ae8f42adec403ec2f6c64cf58f63cb80ffd64e2d8c1b3a0356638064cd +size 65713 diff --git a/doxygen_docs/html/object_8h_source.html b/doxygen_docs/html/object_8h_source.html index 9fb3f40..2900914 100644 --- a/doxygen_docs/html/object_8h_source.html +++ b/doxygen_docs/html/object_8h_source.html @@ -1,287 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/inc/system/object.h Source File - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    object.h
    -
    -
    -
    1#pragma once
    -
    2#include "model_class.h"
    -
    3#include <WICTextureLoader.h>
    -
    4#include <SimpleMath.h>
    -
    5
    -
    6#include "d_3d_class.h"
    -
    7
    -
    8enum class ObjectType
    -
    9{
    -
    10 Sphere,
    -
    11 Cube,
    -
    12 Unknown
    -
    13};
    -
    14
    -
    15enum class ShaderType
    -
    16{
    -
    17 CEL_SHADING,
    -
    18 LIGHTING,
    -
    19 NORMAL_MAPPING,
    -
    20 SPECULAR_MAPPING,
    -
    21 REFLECTION,
    -
    22 REFRACTION,
    -
    23 TEXTURE,
    -
    24 SKYBOX,
    -
    25 SUNLIGHT,
    -
    26 ALPHA_MAPPING
    -
    27};
    -
    28
    -
    -
    29class object
    -
    30{
    -
    31public:
    - -
    33 object();
    -
    34 ~object();
    -
    35
    -
    36 object(const object&) = delete;
    -
    37 object& operator=(const object&) = delete;
    -
    38
    -
    39 bool Initialize(
    -
    40 ID3D11Device* device,
    -
    41 ID3D11DeviceContext* deviceContext,
    -
    42 char* modelFilename,
    -
    43 TextureContainer& texturesContainer
    -
    44 );
    -
    45
    -
    46 void SetScaleMatrix(XMMATRIX scaleMatrix);
    -
    47 void SetRotateMatrix(XMMATRIX rotateMatrix);
    -
    48 void SetTranslateMatrix(XMMATRIX translateMatrix);
    -
    49 void SetSRMatrix(XMMATRIX srMatrix);
    -
    50 void SetWorldMatrix(XMMATRIX worldMatrix);
    -
    51
    -
    52 void SetPosition(XMVECTOR position);
    -
    53 void SetRotation(XMVECTOR rotation);
    -
    54 void SetScale(XMVECTOR scale);
    -
    55
    -
    56 XMMATRIX GetScaleMatrix() const;
    -
    57 XMMATRIX GetRotateMatrix() const;
    -
    58 XMMATRIX GetTranslateMatrix() const;
    -
    59 XMMATRIX GetSRMatrix() const;
    -
    60 XMMATRIX GetWorldMatrix() const;
    -
    61
    -
    62 XMVECTOR GetPosition();
    -
    63 XMVECTOR GetRotation();
    -
    64 XMVECTOR GetScale();
    -
    65
    -
    66 void SetVelocity(XMVECTOR);
    -
    67 void AddVelocity(float deltaTime);
    -
    68 XMVECTOR GetVelocity() const;
    -
    69 void SetAcceleration(XMVECTOR);
    -
    70 XMVECTOR GetAcceleration() const;
    -
    71 void SetMass(float);
    -
    72 float GetMass() const;
    -
    73 void SetGrounded(bool);
    -
    74 bool IsGrounded() const;
    -
    75 bool IsPhysicsEnabled() const;
    -
    76 void SetPhysicsEnabled(bool state);
    -
    77 void SetVisible (bool state) { m_isVisible = state; }
    -
    78 bool IsVisible() const { return m_isVisible; }
    -
    79
    -
    80 void UpdateWorldMatrix();
    -
    81 void UpdateSRMatrix();
    -
    82 void UpdateScaleMatrix();
    -
    83 void UpdateRotateMatrix();
    -
    84 void UpdateTranslateMatrix();
    -
    85
    -
    86 void UpdatePosition(float deltaTime);
    -
    87
    -
    88 void Update();
    -
    89
    -
    90 std::string GetName();
    -
    91 void SetName(std::string name);
    -
    92 int SetId(int id);
    -
    93 int GetId() const;
    -
    94 void SetType(ObjectType type);
    -
    95 ObjectType GetType() const { return m_type; };
    -
    96
    -
    97 ShaderType GetActiveShader() const { return m_activeShader; };
    -
    98 void SetActiveShader(ShaderType activeShader) { m_activeShader = activeShader; };
    -
    99
    -
    100 float GetBoundingRadius() const;
    -
    101 void SetBoundingRadius(float radius) { m_boundingRadius = radius; }
    -
    102
    -
    103 void SetModelPath(std::wstring& path) { m_modelPath = path; }
    -
    104 std::wstring& GetModelPath() { return m_modelPath; }
    -
    105
    -
    106 ShaderType StringToShaderType(const std::string& shaderType);
    -
    107 std::string ShaderTypeToString(ShaderType shaderType);
    -
    108
    -
    109 ObjectType StringToObjectType(const std::string& objectType);
    -
    110 std::string ObjectTypeToString(ObjectType objectType);
    -
    111
    -
    112 void LaunchObject();
    -
    113 bool LoadTexturesFromPath(std::vector<std::wstring>& texturePaths, TextureContainer& texturesContainer,d_3d_class* m_Direct3D);
    -
    114 bool SetupInstancing(ID3D11Device* device, const std::vector<XMMATRIX>& instanceTransforms);
    -
    115 void EnableInstancing(bool enabled);
    -
    116 void SetInstanceCount(int count);
    -
    117 bool IsInstancingEnabled() const;
    -
    118 int GetInstanceCount() const;
    -
    119 ID3D11Buffer* GetInstanceBuffer() const;
    -
    120 void SetAlpha(float alpha) { m_alpha = alpha; }
    -
    121 float GetAlpha() const { return m_alpha; }
    -
    122 void SetInitialStretch(float initialStretch) { m_initialStretch = initialStretch; }
    -
    123 float GetInitialStretch() const { return m_initialStretch; }
    -
    124 void SetSpringConstant(float springConstant) { m_springConstant = springConstant; }
    -
    125 float GetSpringConstant() const { return m_springConstant; }
    -
    126
    -
    127 bool IsGravityEnabled() const { return m_gravityEnabled; }
    -
    128 void SetGravityEnabled(bool state) { m_gravityEnabled = state; }
    -
    129
    -
    130 std::shared_ptr<model_class> get_model() const { return m_model_; }
    -
    131 void SetModel(std::shared_ptr<model_class> model) { m_model_ = model; }
    -
    132
    -
    133public :
    -
    134 bool m_demoSpinning = false;
    -
    135 XMVECTOR m_previousPosition;
    -
    136 XMVECTOR m_velocity;
    -
    137 int m_id;
    -
    138 bool m_gravityEnabled = true;
    -
    139
    -
    140private:
    -
    141
    -
    142 application_class& m_Application;
    -
    143
    -
    144 XMMATRIX m_scaleMatrix;
    -
    145 XMMATRIX m_rotateMatrix;
    -
    146 XMMATRIX m_translateMatrix;
    -
    147 XMMATRIX m_srMatrix;
    -
    148 XMMATRIX m_worldMatrix;
    -
    149
    -
    150 XMVECTOR m_acceleration;
    -
    151 float m_mass;
    -
    152 bool m_isGrounded;
    -
    153 bool m_isPhysicsEnabled;
    -
    154 bool m_isVisible;
    -
    155
    -
    156 std::string m_name;
    -
    157 ObjectType m_type = ObjectType::Unknown;
    -
    158 ShaderType m_activeShader = ShaderType::LIGHTING;
    -
    159
    -
    160 float m_boundingRadius;
    -
    161 std::wstring m_modelPath;
    -
    162 TextureContainer m_texturesContainer;
    -
    163 float m_alpha = 0.0f;
    -
    164 float m_initialStretch = 0.0f;
    -
    165 float m_springConstant = 10.0f;
    -
    166
    -
    167 std::shared_ptr<model_class> m_model_;
    -
    168
    -
    169};
    -
    - - - - -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:cb634f42fec7a782ad0bd4df1d6d22a85ff63b9e869a761b38fd3657e42914f1 +size 30810 diff --git a/doxygen_docs/html/open.png b/doxygen_docs/html/open.png index 30f75c7..fae6d8f 100644 Binary files a/doxygen_docs/html/open.png and b/doxygen_docs/html/open.png differ diff --git a/doxygen_docs/html/physics_8cpp_source.html b/doxygen_docs/html/physics_8cpp_source.html index 7435d60..9873c5f 100644 --- a/doxygen_docs/html/physics_8cpp_source.html +++ b/doxygen_docs/html/physics_8cpp_source.html @@ -1,295 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/src/system/physics.cpp Source File - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    physics.cpp
    -
    -
    -
    1#include "physics.h"
    -
    2
    -
    3
    -
    4physics::physics()
    -
    5{
    -
    6 m_gravity = XMVectorSet(0.0f, -9.81f, 0.0f, 0.0f); // initialize the gravity vector
    -
    7}
    -
    8
    -
    9physics::physics(const physics& other)
    -
    10{
    -
    11 m_gravity = other.m_gravity; // Copy the gravity value
    -
    12}
    -
    13
    -
    14physics::~physics()
    -
    15{
    -
    16}
    -
    17
    -
    18// Get the gravity value
    -
    19XMVECTOR physics::GetGravity() const
    -
    20{
    -
    21 return m_gravity;
    -
    22}
    -
    23
    -
    24// Define the gravity value
    -
    25void physics::SetGravity(XMVECTOR gravity)
    -
    26{
    -
    27 m_gravity = gravity;
    -
    28}
    -
    29
    -
    30// Apply gravity to an object
    -
    31void physics::ApplyGravity(object* object, float dragValue)
    -
    32{
    -
    33 if (this == nullptr || object == nullptr) // Verify if 'this' and 'object' are not null
    -
    34 {
    -
    35 return;
    -
    36 }
    -
    37
    -
    38 if (!object->IsGrounded()) // Verify if the object is grounded
    -
    39 {
    -
    40 // Calculate the acceleration caused by gravity
    -
    41 XMVECTOR gravityAcceleration = m_gravity / object->GetMass();
    -
    42
    -
    43 // Add the gravity acceleration to the object's current acceleration
    -
    44 object->SetAcceleration(object->GetAcceleration() + gravityAcceleration);
    -
    45
    -
    46 // Calculate the acceleration caused by drag
    -
    47 XMVECTOR dragAcceleration = -object->GetVelocity() * dragValue / object->GetMass();
    -
    48
    -
    49 // Add the drag acceleration to the object's current acceleration
    -
    50 object->SetAcceleration(object->GetAcceleration() + dragAcceleration);
    -
    51
    -
    52 // Get the object velocity
    -
    53 XMVECTOR velocity = object->GetVelocity();
    -
    54
    -
    55 // Update the velocity with the object's acceleration
    -
    56 velocity += object->GetAcceleration();
    -
    57
    -
    58 // Set the new velocity
    -
    59 object->SetVelocity(velocity);
    -
    60 }
    -
    61}
    -
    62
    -
    63void physics::AddForce(object* object, XMVECTOR force)
    -
    64{
    -
    65 if (object == nullptr) // Verify if the object is not null
    -
    66 {
    -
    67 return;
    -
    68 }
    -
    69
    -
    70 // Get the mass of the object
    -
    71 float mass = object->GetMass();
    -
    72
    -
    73 // Calculate the acceleration caused by the force
    -
    74 XMVECTOR acceleration = force / mass;
    -
    75
    -
    76 // Add the acceleration to the object's current acceleration
    -
    77 object->SetAcceleration(object->GetAcceleration() + acceleration);
    -
    78}
    -
    79
    -
    80bool physics::IsColliding(object* object1, object* object2)
    -
    81{
    -
    82 ObjectType type1 = object1->GetType();
    -
    83 ObjectType type2 = object2->GetType();
    -
    84
    -
    85 if (type1 == ObjectType::Unknown || type2 == ObjectType::Unknown)
    -
    86 {
    -
    87 return false;
    -
    88 }
    -
    89
    -
    90 if (type1 == ObjectType::Sphere && type2 == ObjectType::Sphere)
    -
    91 {
    -
    92 return SpheresOverlap(object1, object2);
    -
    93 }
    -
    94 if ((type1 == ObjectType::Cube && type2 == ObjectType::Sphere) ||
    -
    95 (type1 == ObjectType::Sphere && type2 == ObjectType::Cube))
    -
    96 {
    -
    97 if (type1 == ObjectType::Cube)
    -
    98 {
    -
    99 return SphereCubeOverlap(object1, object2);
    -
    100 }
    -
    101 else if (type1 == ObjectType::Sphere)
    -
    102 {
    -
    103 return SphereCubeOverlap(object2, object1);
    -
    104 }
    -
    105 }
    -
    106 else
    -
    107 {
    -
    108 return CubesOverlap(object1, object2);
    -
    109 }
    -
    110
    -
    111 return false;
    -
    112}
    -
    113
    -
    114
    -
    116// AABB method for collision detection //
    -
    118
    -
    119bool physics::CubesOverlap(object* cube1, object* cube2)
    -
    120{
    -
    121 XMVECTOR position1 = cube1->GetPosition();
    -
    122 XMVECTOR position2 = cube2->GetPosition();
    -
    123
    -
    124 XMVECTOR scale1 = cube1->GetScale();
    -
    125 XMVECTOR scale2 = cube2->GetScale();
    -
    126
    -
    127 XMVECTOR min1 = position1 - scale1;
    -
    128 XMVECTOR max1 = position1 + scale1;
    -
    129 XMVECTOR min2 = position2 - scale2;
    -
    130 XMVECTOR max2 = position2 + scale2;
    -
    131
    -
    132 return (min1.m128_f32[0] <= max2.m128_f32[0] && max1.m128_f32[0] >= min2.m128_f32[0] &&
    -
    133 min1.m128_f32[1] <= max2.m128_f32[1] && max1.m128_f32[1] >= min2.m128_f32[1] &&
    -
    134 min1.m128_f32[2] <= max2.m128_f32[2] && max1.m128_f32[2] >= min2.m128_f32[2]);
    -
    135}
    -
    136
    -
    137bool physics::SpheresOverlap(object* sphere1, object* sphere2)
    -
    138{
    -
    139 XMVECTOR position1 = sphere1->GetPosition();
    -
    140 XMVECTOR position2 = sphere2->GetPosition();
    -
    141
    -
    142 XMVECTOR scale1 = sphere1->GetScale() / 2;
    -
    143 XMVECTOR scale2 = sphere2->GetScale() / 2;
    -
    144
    -
    145 float distance = sqrt(
    -
    146 (position1.m128_f32[0] - position2.m128_f32[0]) * (position1.m128_f32[0] - position2.m128_f32[0]) +
    -
    147 (position1.m128_f32[1] - position2.m128_f32[1]) * (position1.m128_f32[1] - position2.m128_f32[1]) +
    -
    148 (position1.m128_f32[2] - position2.m128_f32[2]) * (position1.m128_f32[2] - position2.m128_f32[2])
    -
    149 );
    -
    150
    -
    151 float radius1 = XMVectorGetX(XMVector3Length(scale1));
    -
    152 float radius2 = XMVectorGetX(XMVector3Length(scale2));
    -
    153
    -
    154 return distance < radius1 + radius2;
    -
    155}
    -
    156
    -
    157bool physics::SphereCubeOverlap(object* cube, object* sphere)
    -
    158{
    -
    159 XMVECTOR position1 = cube->GetPosition();
    -
    160 XMVECTOR position2 = sphere->GetPosition();
    -
    161
    -
    162 XMVECTOR scale1 = cube->GetScale();
    -
    163 XMVECTOR scale2 = XMVectorScale(sphere->GetScale(), 0.5f);
    -
    164
    -
    165 XMVECTOR min1 = position1 - scale1;
    -
    166 XMVECTOR max1 = position1 + scale1;
    -
    167
    -
    168 // Get box closest point to sphere center by clamping
    -
    169 float x = max(min1.m128_f32[0], min(position2.m128_f32[0], max1.m128_f32[0]));
    -
    170 float y = max(min1.m128_f32[1], min(position2.m128_f32[1], max1.m128_f32[1]));
    -
    171 float z = max(min1.m128_f32[2], min(position2.m128_f32[2], max1.m128_f32[2]));
    -
    172
    -
    173 // This is the same as SpheresOverlap
    -
    174 float distance = sqrt(
    -
    175 (x - position2.m128_f32[0]) * (x - position2.m128_f32[0]) +
    -
    176 (y - position2.m128_f32[1]) * (y - position2.m128_f32[1]) +
    -
    177 (z - position2.m128_f32[2]) * (z - position2.m128_f32[2])
    -
    178 );
    -
    179
    -
    180 float radius = XMVectorGetX(XMVector3Length(scale2));
    -
    181
    -
    182 return distance < radius;
    -
    183}
    - - -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:0b1cdb02a99f40ee7f7f5254863661f2b994b44de5095cd99639ac6c9bb423dd +size 30334 diff --git a/doxygen_docs/html/physics_8h_source.html b/doxygen_docs/html/physics_8h_source.html index 084fa74..5482833 100644 --- a/doxygen_docs/html/physics_8h_source.html +++ b/doxygen_docs/html/physics_8h_source.html @@ -1,143 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/inc/system/physics.h Source File - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    physics.h
    -
    -
    -
    1#ifndef _PHYSICS_H_
    -
    2#define _PHYSICS_H_
    -
    3
    -
    4#include "object.h"
    -
    5#include "math.h"
    -
    6
    -
    -
    7class physics : public object
    -
    8{
    -
    9public:
    -
    10 physics();
    -
    11 explicit physics(const physics&); // Use explicit to avoid implicit conversion
    -
    12 ~physics();
    -
    13
    -
    14 XMVECTOR GetGravity() const; // Get the gravity value
    -
    15 void SetGravity(XMVECTOR gravity); // Define the gravity value
    -
    16 void ApplyGravity(object*, float); // Apply gravity to an object
    -
    17 void AddForce(object*, XMVECTOR);
    -
    18 bool IsColliding(object*, object*);
    -
    19 bool CubesOverlap(object*, object*);
    -
    20 bool SpheresOverlap(object*, object*);
    -
    21 bool SphereCubeOverlap(object*, object*);
    -
    22
    -
    23private:
    -
    24 XMVECTOR m_gravity;
    -
    25};
    -
    -
    26
    -
    27#endif
    - - -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:a97851ac11c5630a6408175d3057536579272e9a12972972b799a4f3093b3d23 +size 9744 diff --git a/doxygen_docs/html/physics__component_8h_source.html b/doxygen_docs/html/physics__component_8h_source.html index 91dae7b..db2a253 100644 --- a/doxygen_docs/html/physics__component_8h_source.html +++ b/doxygen_docs/html/physics__component_8h_source.html @@ -1,252 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/inc/system/ecs/components/physics_component.h Source File - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    physics_component.h
    -
    -
    -
    1#pragma once
    -
    2#include "../component.h"
    -
    3#include <DirectXMath.h>
    -
    4
    -
    5using namespace DirectX;
    -
    6
    -
    7namespace ecs {
    -
    8
    -
    -
    9class PhysicsComponent : public Component {
    -
    10public:
    -
    - -
    16 m_Velocity = XMVectorZero();
    -
    17 m_Acceleration = XMVectorZero();
    -
    18 m_PreviousPosition = XMVectorZero();
    -
    19 m_Mass = 1.0f;
    -
    20 m_BoundingRadius = 1.0f;
    -
    21 m_IsGrounded = false;
    -
    22 m_IsPhysicsEnabled = false;
    -
    23 m_GravityEnabled = true;
    -
    24 }
    -
    -
    25
    -
    26 ~PhysicsComponent() = default;
    -
    27
    -
    -
    33 void Initialize() override {
    -
    34 // Initialisation du composant physique
    -
    35 }
    -
    -
    36
    -
    -
    48 void Update(float deltaTime) override {
    -
    49 if (!m_IsPhysicsEnabled) return;
    -
    50
    -
    51 // Mise à jour de la vélocité basée sur l'accélération
    -
    52 m_Velocity = m_Velocity + m_Acceleration * deltaTime;
    -
    53
    -
    54 // Si la physique est activée et qu'une fonction de mise à jour de position est définie
    -
    55 if (m_UpdatePositionCallback) {
    -
    56 m_UpdatePositionCallback(m_Velocity * deltaTime);
    -
    57 }
    -
    58 }
    -
    -
    59
    -
    -
    70 void LaunchObject(float alpha, float initialStretch, float springConstant) {
    -
    71 // Constants
    -
    72 const float gravity = -9.81f;
    -
    73
    -
    74 // Convert alpha from degrees to radians if needed
    -
    75 float alphaRadians = alpha * (XM_PI / 180.0f);
    -
    76
    -
    77 // Scale factors to make the physics simulation more visible
    -
    78 float scaleFactor = 200.0f; // Adjust this based on your world scale
    -
    79
    -
    80 // Calculate initial velocity magnitude
    -
    81 float velocityMagnitude = initialStretch * sqrtf(springConstant / m_Mass) *
    -
    82 sqrtf(1.0f - powf((m_Mass * gravity * sinf(alphaRadians) /
    -
    83 (springConstant * initialStretch)), 2.0f));
    -
    84
    -
    85 // Apply scale factor
    -
    86 velocityMagnitude *= scaleFactor;
    -
    87
    -
    88 // Calculate velocity components
    -
    89 XMVECTOR velocity = XMVectorSet(
    -
    90 velocityMagnitude * cosf(alphaRadians), // vx = v0 * cos(alpha)
    -
    91 velocityMagnitude * sinf(alphaRadians), // vy = v0 * sin(alpha)
    -
    92 0.0f, // z-component (0 for 2D trajectory)
    -
    93 0.0f
    -
    94 );
    -
    95
    -
    96 // Apply velocity
    -
    97 SetVelocity(velocity);
    -
    98
    -
    99 // Enable physics and reset grounded state
    -
    100 SetPhysicsEnabled(true);
    -
    101 SetGrounded(false);
    -
    102 }
    -
    -
    103
    -
    108 void SetVelocity(XMVECTOR velocity) { m_Velocity = velocity; }
    -
    113 void SetAcceleration(XMVECTOR acceleration) { m_Acceleration = acceleration; }
    -
    118 void SetMass(float mass) { m_Mass = mass; }
    -
    123 void SetGrounded(bool isGrounded) { m_IsGrounded = isGrounded; }
    -
    128 void SetPhysicsEnabled(bool enabled) { m_IsPhysicsEnabled = enabled; }
    -
    133 void SetBoundingRadius(float radius) { m_BoundingRadius = radius; }
    -
    138 void SetPreviousPosition(XMVECTOR position) { m_PreviousPosition = position; }
    -
    143 void SetGravityEnabled(bool enabled) { m_GravityEnabled = enabled; }
    -
    149 void SetUpdatePositionCallback(std::function<void(XMVECTOR)> callback) { m_UpdatePositionCallback = callback; }
    -
    150
    -
    155 XMVECTOR GetVelocity() const { return m_Velocity; }
    -
    160 XMVECTOR GetAcceleration() const { return m_Acceleration; }
    -
    165 float GetMass() const { return m_Mass; }
    -
    170 bool IsGrounded() const { return m_IsGrounded; }
    -
    175 bool IsPhysicsEnabled() const { return m_IsPhysicsEnabled; }
    -
    180 float GetBoundingRadius() const { return m_BoundingRadius; }
    -
    186 XMVECTOR GetPreviousPosition() const { return m_PreviousPosition; }
    -
    191 bool IsGravityEnabled() const { return m_GravityEnabled; }
    -
    198private:
    -
    199 XMVECTOR m_Velocity;
    -
    200 XMVECTOR m_Acceleration;
    -
    201 XMVECTOR m_PreviousPosition;
    -
    202 float m_Mass;
    -
    203 float m_BoundingRadius;
    -
    204 bool m_IsGrounded;
    -
    205 bool m_IsPhysicsEnabled;
    -
    206 bool m_GravityEnabled;
    -
    207
    -
    208 // Callback pour mettre à jour la position (sera connecté au TransformComponent)
    -
    209 std::function<void(XMVECTOR)> m_UpdatePositionCallback;
    -
    210};
    -
    -
    211
    -
    212} // namespace ecs
    - - - -
    void LaunchObject(float alpha, float initialStretch, float springConstant)
    -
    void SetGravityEnabled(bool enabled)
    - -
    void SetAcceleration(XMVECTOR acceleration)
    -
    void SetVelocity(XMVECTOR velocity)
    -
    void Update(float deltaTime) override
    -
    void SetUpdatePositionCallback(std::function< void(XMVECTOR)> callback)
    -
    void SetPreviousPosition(XMVECTOR position)
    - -
    void Initialize() override
    -
    void SetGrounded(bool isGrounded)
    -
    void SetBoundingRadius(float radius)
    -
    XMVECTOR GetVelocity() const
    -
    float GetBoundingRadius() const
    - - -
    XMVECTOR GetAcceleration() const
    - -
    XMVECTOR GetPreviousPosition() const
    -
    void SetPhysicsEnabled(bool enabled)
    -
    Definition component.h:9
    -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:041e1f00e61cac79aef34acb874c34773698ae030885c5db9840d18ba35d51e7 +size 35670 diff --git a/doxygen_docs/html/plus.svg b/doxygen_docs/html/plus.svg index 0752016..f6d2c3f 100644 --- a/doxygen_docs/html/plus.svg +++ b/doxygen_docs/html/plus.svg @@ -1,9 +1,3 @@ - - - - - - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:d61742bec8a971f30ae95299e6563256662fe8e2bc68382833a959e063a10063 +size 696 diff --git a/doxygen_docs/html/plusd.svg b/doxygen_docs/html/plusd.svg index 0c65bfe..f4c02e3 100644 --- a/doxygen_docs/html/plusd.svg +++ b/doxygen_docs/html/plusd.svg @@ -1,9 +1,3 @@ - - - - - - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:85b5f198191092946af4ca07025e904eb8ade8930176626e8a6e88ac1bdb247c +size 696 diff --git a/doxygen_docs/html/position__class_8cpp_source.html b/doxygen_docs/html/position__class_8cpp_source.html index feb9348..7bd31d3 100644 --- a/doxygen_docs/html/position__class_8cpp_source.html +++ b/doxygen_docs/html/position__class_8cpp_source.html @@ -1,352 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/src/system/position_class.cpp Source File - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    position_class.cpp
    -
    -
    -
    1#include "position_class.h"
    -
    2
    -
    3position_class::position_class()
    -
    4{
    -
    5 m_frameTime = 0.0f;
    -
    6 m_rotationY = 0.0f;
    -
    7 m_rotationX = 0.0f;
    -
    8 m_positionX = 0.0f;
    -
    9 m_positionY = 0.0f;
    -
    10 m_positionZ = 0.0f;
    -
    11 m_leftTurnSpeed = 0.0f;
    -
    12 m_rightTurnSpeed = 0.0f;
    -
    13 m_horizontalTurnSpeed = 0.0f;
    -
    14 m_verticalTurnSpeed = 0.0f;
    -
    15 m_cameraSpeed = 4.0f;
    -
    16 m_speed = m_cameraSpeed;
    -
    17}
    -
    18
    -
    19
    -
    20position_class::position_class(const position_class& other)
    -
    21{
    -
    22}
    -
    23
    -
    24
    -
    25position_class::~position_class()
    -
    26{
    -
    27}
    -
    28
    -
    29void position_class::SetFrameTime(float time)
    -
    30{
    -
    31 m_frameTime = time;
    -
    32 return;
    -
    33}
    -
    34
    -
    35void position_class::GetRotation(float& y, float& x) const
    -
    36{
    -
    37 y = m_rotationY;
    -
    38 x = m_rotationX;
    -
    39 return;
    -
    40}
    -
    41
    -
    42void position_class::GetPosition(float& x, float& y, float& z) const
    -
    43{
    -
    44 x = m_positionX;
    -
    45 y = m_positionY;
    -
    46 z = m_positionZ;
    -
    47 return;
    -
    48}
    -
    49
    -
    50void position_class::TurnLeft(bool keydown)
    -
    51{
    -
    52 // If the key is pressed increase the speed at which the camera turns left. If not slow down the turn speed.
    -
    53 if (keydown)
    -
    54 {
    -
    55 m_leftTurnSpeed += m_frameTime * 1.5f;
    -
    56
    -
    57 if (m_leftTurnSpeed > (m_frameTime * 200.0f))
    -
    58 {
    -
    59 m_leftTurnSpeed = m_frameTime * 200.0f;
    -
    60 }
    -
    61 }
    -
    62 else
    -
    63 {
    -
    64 m_leftTurnSpeed -= m_frameTime * 1.0f;
    -
    65
    -
    66 if (m_leftTurnSpeed < 0.0f)
    -
    67 {
    -
    68 m_leftTurnSpeed = 0.0f;
    -
    69 }
    -
    70 }
    -
    71
    -
    72 // Update the rotation using the turning speed.
    -
    73 m_rotationY -= m_leftTurnSpeed;
    -
    74 if (m_rotationY < 0.0f)
    -
    75 {
    -
    76 m_rotationY += 360.0f;
    -
    77 }
    -
    78
    -
    79 return;
    -
    80}
    -
    81
    -
    82
    -
    83void position_class::TurnRight(bool keydown)
    -
    84{
    -
    85 // If the key is pressed increase the speed at which the camera turns right. If not slow down the turn speed.
    -
    86 if (keydown)
    -
    87 {
    -
    88 m_rightTurnSpeed += m_frameTime * 1.5f;
    -
    89
    -
    90 if (m_rightTurnSpeed > (m_frameTime * 200.0f))
    -
    91 {
    -
    92 m_rightTurnSpeed = m_frameTime * 200.0f;
    -
    93 }
    -
    94 }
    -
    95 else
    -
    96 {
    -
    97 m_rightTurnSpeed -= m_frameTime * 1.0f;
    -
    98
    -
    99 if (m_rightTurnSpeed < 0.0f)
    -
    100 {
    -
    101 m_rightTurnSpeed = 0.0f;
    -
    102 }
    -
    103 }
    -
    104
    -
    105 // Update the rotation using the turning speed.
    -
    106 m_rotationY += m_rightTurnSpeed;
    -
    107 if (m_rotationY > 360.0f)
    -
    108 {
    -
    109 m_rotationY -= 360.0f;
    -
    110 }
    -
    111
    -
    112 return;
    -
    113}
    -
    114
    -
    115void position_class::TurnMouse(float deltaX, float deltaY, float sensitivity, bool rightMouseDown)
    -
    116{
    -
    117 // The turning speed is proportional to the horizontal mouse movement
    -
    118 m_horizontalTurnSpeed = deltaX * sensitivity;
    -
    119
    -
    120 if (rightMouseDown)
    -
    121 {
    -
    122 // Update the rotation using the turning speed
    -
    123 m_rotationY += m_horizontalTurnSpeed;
    -
    124 if (m_rotationY < 0.0f)
    -
    125 {
    -
    126 m_rotationY += 360.0f;
    -
    127 }
    -
    128 else if (m_rotationY > 360.0f)
    -
    129 {
    -
    130 m_rotationY -= 360.0f;
    -
    131 }
    -
    132
    -
    133 // The turning speed is proportional to the vertical mouse movement
    -
    134 m_verticalTurnSpeed = deltaY * sensitivity;
    -
    135
    -
    136 // Update the rotation using the turning speed
    -
    137 m_rotationX += m_verticalTurnSpeed;
    -
    138 if (m_rotationX < -90.0f)
    -
    139 {
    -
    140 m_rotationX = -90.0f;
    -
    141 }
    -
    142 else if (m_rotationX > 90.0f)
    -
    143 {
    -
    144 m_rotationX = 90.0f;
    -
    145 }
    -
    146 }
    -
    147 return;
    -
    148}
    -
    149
    -
    150void position_class::MoveCamera(bool forward, bool backward, bool left, bool right, bool up, bool down, bool scrollUp, bool scrollDown, bool rightClick)
    -
    151{
    -
    152 float radiansY, radiansX, speed;
    -
    153
    -
    154 // Set the speed of the camera if the right click is down.
    -
    155 if (scrollUp && rightClick)
    -
    156 {
    -
    157 m_cameraSpeed *= 1.1f;
    -
    158 }
    -
    159 if (scrollDown && rightClick)
    -
    160 {
    -
    161 m_cameraSpeed *= 0.9f;
    -
    162
    -
    163 if (m_cameraSpeed < 0.25f) // Minimum speed.
    -
    164 {
    -
    165 m_cameraSpeed = 0.25f;
    -
    166 }
    -
    167 }
    -
    168
    -
    169 // Convert degrees to radians.
    -
    170 radiansY = m_rotationY * 0.0174532925f;
    -
    171 radiansX = m_rotationX * 0.0174532925f;
    -
    172
    -
    174 // Update the position. //
    -
    176
    -
    177 // Moves the camera forward on a greater scale than the arrows.
    -
    178 if (scrollUp && !rightClick)
    -
    179 {
    -
    180 speed = m_speed * 20 * m_frameTime;
    -
    181 m_positionX += sinf(radiansY) * cosf(radiansX) * speed;
    -
    182 m_positionZ += cosf(radiansY) * cosf(radiansX) * speed;
    -
    183 m_positionY -= sinf(radiansX) * speed;
    -
    184 }
    -
    185
    -
    186 // Moves the camera backward on a greater scale than the arrows.
    -
    187 if (scrollDown && !rightClick)
    -
    188 {
    -
    189 speed = m_speed * 20 * m_frameTime;
    -
    190 m_positionX -= sinf(radiansY) * cosf(radiansX) * speed;
    -
    191 m_positionZ -= cosf(radiansY) * cosf(radiansX) * speed;
    -
    192 m_positionY += sinf(radiansX) * speed;
    -
    193 }
    -
    194
    -
    195 // Set the speed of the camera.
    -
    196 speed = m_cameraSpeed * m_frameTime;
    -
    197
    -
    198 // If moving forward, the position moves in the direction of the camera and accordingly to its angle.
    -
    199 if (forward)
    -
    200 {
    -
    201 m_positionX += sinf(radiansY) * cosf(radiansX) * speed;
    -
    202 m_positionZ += cosf(radiansY) * cosf(radiansX) * speed;
    -
    203 m_positionY -= sinf(radiansX) * speed;
    -
    204 }
    -
    205
    -
    206 // If moving backward, the position moves in the opposite direction of the camera and accordingly to its angle.
    -
    207 if (backward)
    -
    208 {
    -
    209 m_positionX -= sinf(radiansY) * cosf(radiansX) * speed;
    -
    210 m_positionZ -= cosf(radiansY) * cosf(radiansX) * speed;
    -
    211 m_positionY += sinf(radiansX) * speed;
    -
    212 }
    -
    213
    -
    214 // If moving left, the position moves to the left of the camera and accordingly to its angle.
    -
    215 if (left)
    -
    216 {
    -
    217 m_positionX -= cosf(radiansY) * speed;
    -
    218 m_positionZ += sinf(radiansY) * speed;
    -
    219 }
    -
    220
    -
    221 // If moving right, the position moves to the right of the camera and accordingly to its angle.
    -
    222 if (right)
    -
    223 {
    -
    224 m_positionX += cosf(radiansY) * speed;
    -
    225 m_positionZ -= sinf(radiansY) * speed;
    -
    226 }
    -
    227
    -
    228 // If moving up, the position moves up.
    -
    229 if (up)
    -
    230 {
    -
    231 m_positionY += speed;
    -
    232 }
    -
    233
    -
    234 // If moving down, the position moves down.
    -
    235 if (down)
    -
    236 {
    -
    237 m_positionY -= speed;
    -
    238 }
    -
    239
    -
    240 return;
    -
    241}
    - -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:d782825cac815bc9547fccf906655c4214b0e418ebd5b724bfb908c2d6ca6548 +size 35515 diff --git a/doxygen_docs/html/position__class_8h_source.html b/doxygen_docs/html/position__class_8h_source.html index e73bfdc..c68f00b 100644 --- a/doxygen_docs/html/position__class_8h_source.html +++ b/doxygen_docs/html/position__class_8h_source.html @@ -1,148 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/inc/system/position_class.h Source File - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    position_class.h
    -
    -
    -
    1#ifndef _POSITIONCLASS_H_
    -
    2#define _POSITIONCLASS_H_
    -
    3
    -
    4
    -
    6// INCLUDES //
    -
    8#include <math.h>
    -
    9
    -
    10
    -
    12// Class name: position_class
    -
    - -
    15{
    -
    16public:
    - - - -
    20
    -
    21 void SetFrameTime(float);
    -
    22 void GetRotation(float&, float&) const;
    -
    23 void GetPosition(float&, float&, float&) const;
    -
    24
    -
    25 void TurnLeft(bool);
    -
    26 void TurnRight(bool);
    -
    27 void TurnMouse(float, float, float, bool);
    -
    28 void MoveCamera(bool, bool, bool, bool, bool, bool, bool, bool, bool);
    -
    29
    -
    30private:
    -
    31 float m_frameTime;
    -
    32 float m_rotationY, m_rotationX;
    -
    33 float m_positionX, m_positionY, m_positionZ;
    -
    34 float m_leftTurnSpeed, m_rightTurnSpeed, m_horizontalTurnSpeed, m_verticalTurnSpeed, m_cameraSpeed, m_speed;
    -
    35};
    -
    -
    36
    -
    37#endif
    - -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:57825891a01f168c544d9d9f2652a9666cf1f65afac05790989b62d87007f9aa +size 10581 diff --git a/doxygen_docs/html/reflection__shader__class_8cpp_source.html b/doxygen_docs/html/reflection__shader__class_8cpp_source.html index 66d9bca..b82834c 100644 --- a/doxygen_docs/html/reflection__shader__class_8cpp_source.html +++ b/doxygen_docs/html/reflection__shader__class_8cpp_source.html @@ -1,549 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/src/shader/reflection_shader_class.cpp Source File - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    reflection_shader_class.cpp
    -
    -
    -
    1#include "reflection_shader_class.h"
    -
    2
    -
    3reflection_shader_class::reflection_shader_class()
    -
    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}
    -
    12
    -
    13reflection_shader_class::reflection_shader_class(const reflection_shader_class& other)
    -
    14{
    -
    15
    -
    16}
    -
    17
    -
    18reflection_shader_class::~reflection_shader_class()
    -
    19{
    -
    20}
    -
    21
    -
    22bool reflection_shader_class::initialize(ID3D11Device* device, HWND hwnd)
    -
    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}
    -
    59
    -
    60void reflection_shader_class::shutdown()
    -
    61{
    -
    62 // shutdown the vertex and pixel shaders as well as the related objects.
    -
    63 shutdown_shader();
    -
    64
    -
    65 return;
    -
    66}
    -
    67
    -
    68bool reflection_shader_class::render(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix,
    -
    69 ID3D11ShaderResourceView* texture, ID3D11ShaderResourceView* reflectionTexture, XMMATRIX reflectionMatrix)
    -
    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}
    -
    87
    -
    88bool reflection_shader_class::initialize_shader(ID3D11Device* device, HWND hwnd, WCHAR* vsFilename, WCHAR* psFilename)
    -
    89{
    -
    90 Logger::Get().Log("Initializing reflection shader", __FILE__, __LINE__, Logger::LogLevel::Initialize);
    -
    91
    -
    92 HRESULT result;
    -
    93 ID3D10Blob* errorMessage;
    -
    94 ID3D10Blob* vertexShaderBuffer;
    -
    95 ID3D10Blob* pixelShaderBuffer;
    -
    96 D3D11_INPUT_ELEMENT_DESC polygonLayout[2];
    -
    97 unsigned int numElements;
    -
    98 D3D11_BUFFER_DESC matrixBufferDesc;
    -
    99 D3D11_SAMPLER_DESC samplerDesc;
    -
    100 D3D11_BUFFER_DESC reflectionBufferDesc;
    -
    101
    -
    102
    -
    103 // initialize the pointers this function will use to null.
    -
    104 errorMessage = 0;
    -
    105 vertexShaderBuffer = 0;
    -
    106 pixelShaderBuffer = 0;
    -
    107
    -
    108 // Compile the vertex shader code.
    -
    109 result = D3DCompileFromFile(vsFilename, NULL, NULL, "ReflectionVertexShader", "vs_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0,
    -
    110 &vertexShaderBuffer, &errorMessage);
    -
    111 if (FAILED(result))
    -
    112 {
    -
    113 // If the shader failed to compile it should have writen something to the error message.
    -
    114 if (errorMessage)
    -
    115 {
    -
    116 output_shader_error_message(errorMessage, hwnd, vsFilename);
    -
    117 }
    -
    118 // If there was nothing in the error message then it simply could not find the shader file itself.
    -
    119 else
    -
    120 {
    -
    121 Logger::Get().Log("Error compiling shader", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    122 }
    -
    123
    -
    124 return false;
    -
    125 }
    -
    126 // Compile the pixel shader code.
    -
    127 result = D3DCompileFromFile(psFilename, NULL, NULL, "ReflectionPixelShader", "ps_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0,
    -
    128 &pixelShaderBuffer, &errorMessage);
    -
    129 if (FAILED(result))
    -
    130 {
    -
    131 // If the shader failed to compile it should have writen something to the error message.
    -
    132 if (errorMessage)
    -
    133 {
    -
    134 output_shader_error_message(errorMessage, hwnd, psFilename);
    -
    135 }
    -
    136 // If there was nothing in the error message then it simply could not find the file itself.
    -
    137 else
    -
    138 {
    -
    139 Logger::Get().Log("Error compiling shader", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    140 }
    -
    141
    -
    142 return false;
    -
    143 }
    -
    144
    -
    145 // Create the vertex shader from the buffer.
    -
    146 result = device->CreateVertexShader(vertexShaderBuffer->GetBufferPointer(), vertexShaderBuffer->GetBufferSize(), NULL, &vertex_shader_);
    -
    147 if (FAILED(result))
    -
    148 {
    -
    149 Logger::Get().Log("Error creating vertex shader", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    150 return false;
    -
    151 }
    -
    152
    -
    153 // Create the pixel shader from the buffer.
    -
    154 result = device->CreatePixelShader(pixelShaderBuffer->GetBufferPointer(), pixelShaderBuffer->GetBufferSize(), NULL, &pixel_shader_);
    -
    155 if (FAILED(result))
    -
    156 {
    -
    157 Logger::Get().Log("Error creating pixel shader", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    158 return false;
    -
    159 }
    -
    160
    -
    161 // Create the vertex input layout description.
    -
    162 polygonLayout[0].SemanticName = "POSITION";
    -
    163 polygonLayout[0].SemanticIndex = 0;
    -
    164 polygonLayout[0].Format = DXGI_FORMAT_R32G32B32_FLOAT;
    -
    165 polygonLayout[0].InputSlot = 0;
    -
    166 polygonLayout[0].AlignedByteOffset = 0;
    -
    167 polygonLayout[0].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
    -
    168 polygonLayout[0].InstanceDataStepRate = 0;
    -
    169
    -
    170 polygonLayout[1].SemanticName = "TEXCOORD";
    -
    171 polygonLayout[1].SemanticIndex = 0;
    -
    172 polygonLayout[1].Format = DXGI_FORMAT_R32G32_FLOAT;
    -
    173 polygonLayout[1].InputSlot = 0;
    -
    174 polygonLayout[1].AlignedByteOffset = D3D11_APPEND_ALIGNED_ELEMENT;
    -
    175 polygonLayout[1].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
    -
    176 polygonLayout[1].InstanceDataStepRate = 0;
    -
    177
    -
    178 // Get a count of the elements in the layout.
    -
    179 numElements = sizeof(polygonLayout) / sizeof(polygonLayout[0]);
    -
    180
    -
    181 // Create the vertex input layout.
    -
    182 result = device->CreateInputLayout(polygonLayout, numElements, vertexShaderBuffer->GetBufferPointer(),
    -
    183 vertexShaderBuffer->GetBufferSize(), &layout_);
    -
    184 if (FAILED(result))
    -
    185 {
    -
    186 Logger::Get().Log("Error creating input layout", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    187 return false;
    -
    188 }
    -
    189
    -
    190 // Release the vertex shader buffer and pixel shader buffer since they are no longer needed.
    -
    191 vertexShaderBuffer->Release();
    -
    192 vertexShaderBuffer = 0;
    -
    193
    -
    194 pixelShaderBuffer->Release();
    -
    195 pixelShaderBuffer = 0;
    -
    196
    -
    197 // Setup the description of the dynamic matrix constant buffer that is in the vertex shader.
    -
    198 matrixBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
    -
    199 matrixBufferDesc.ByteWidth = sizeof(matrix_buffer_type);
    -
    200 matrixBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
    -
    201 matrixBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
    -
    202 matrixBufferDesc.MiscFlags = 0;
    -
    203 matrixBufferDesc.StructureByteStride = 0;
    -
    204
    -
    205 // Create the constant buffer pointer so we can access the vertex shader constant buffer from within this class.
    -
    206 result = device->CreateBuffer(&matrixBufferDesc, NULL, &matrix_buffer_);
    -
    207 if (FAILED(result))
    -
    208 {
    -
    209 Logger::Get().Log("Error creating constant buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    210 return false;
    -
    211 }
    -
    212 // Create a texture sampler state description.
    -
    213 samplerDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR;
    -
    214 samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP;
    -
    215 samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP;
    -
    216 samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP;
    -
    217 samplerDesc.MipLODBias = 0.0f;
    -
    218 samplerDesc.MaxAnisotropy = 1;
    -
    219 samplerDesc.ComparisonFunc = D3D11_COMPARISON_ALWAYS;
    -
    220 samplerDesc.BorderColor[0] = 0;
    -
    221 samplerDesc.BorderColor[1] = 0;
    -
    222 samplerDesc.BorderColor[2] = 0;
    -
    223 samplerDesc.BorderColor[3] = 0;
    -
    224 samplerDesc.MinLOD = 0;
    -
    225 samplerDesc.MaxLOD = D3D11_FLOAT32_MAX;
    -
    226
    -
    227 // Create the texture sampler state.
    -
    228 result = device->CreateSamplerState(&samplerDesc, &sample_state_);
    -
    229 if (FAILED(result))
    -
    230 {
    -
    231 Logger::Get().Log("Error creating sampler state", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    232 return false;
    -
    233 }
    -
    234 // Setup the description of the reflection dynamic constant buffer that is in the vertex shader.
    -
    235 reflectionBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
    -
    236 reflectionBufferDesc.ByteWidth = sizeof(reflection_buffer_type);
    -
    237 reflectionBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
    -
    238 reflectionBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
    -
    239 reflectionBufferDesc.MiscFlags = 0;
    -
    240 reflectionBufferDesc.StructureByteStride = 0;
    -
    241
    -
    242 // Create the constant buffer pointer so we can access the vertex shader constant buffer from within this class.
    -
    243 result = device->CreateBuffer(&reflectionBufferDesc, NULL, &reflection_buffer_);
    -
    244 if (FAILED(result))
    -
    245 {
    -
    246 Logger::Get().Log("Error creating constant buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    247 return false;
    -
    248 }
    -
    249
    -
    250 Logger::Get().Log("Reflection shader initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
    -
    251
    -
    252 return true;
    -
    253}
    -
    254
    -
    255void reflection_shader_class::shutdown_shader()
    -
    256{
    -
    257 Logger::Get().Log("Shutting down reflection shader", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
    -
    258
    -
    259 // Release the reflection constant buffer.
    -
    260 if (reflection_buffer_)
    -
    261 {
    -
    262 reflection_buffer_->Release();
    -
    263 reflection_buffer_ = 0;
    -
    264 }
    -
    265
    -
    266 // Release the sampler state.
    -
    267 if (sample_state_)
    -
    268 {
    -
    269 sample_state_->Release();
    -
    270 sample_state_ = 0;
    -
    271 }
    -
    272
    -
    273 // Release the matrix constant buffer.
    -
    274 if (matrix_buffer_)
    -
    275 {
    -
    276 matrix_buffer_->Release();
    -
    277 matrix_buffer_ = 0;
    -
    278 }
    -
    279
    -
    280 // Release the layout.
    -
    281 if (layout_)
    -
    282 {
    -
    283 layout_->Release();
    -
    284 layout_ = 0;
    -
    285 }
    -
    286
    -
    287 // Release the pixel shader.
    -
    288 if (pixel_shader_)
    -
    289 {
    -
    290 pixel_shader_->Release();
    -
    291 pixel_shader_ = 0;
    -
    292 }
    -
    293
    -
    294 // Release the vertex shader.
    -
    295 if (vertex_shader_)
    -
    296 {
    -
    297 vertex_shader_->Release();
    -
    298 vertex_shader_ = 0;
    -
    299 }
    -
    300
    -
    301 Logger::Get().Log("Reflection shader shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
    -
    302
    -
    303 return;
    -
    304}
    -
    305
    -
    306
    -
    307void reflection_shader_class::output_shader_error_message(ID3D10Blob* errorMessage, HWND hwnd, WCHAR* shaderFilename)
    -
    308{
    -
    309 char* compileErrors;
    -
    310 unsigned long long bufferSize, i;
    -
    311 ofstream fout;
    -
    312
    -
    313
    -
    314 // Get a pointer to the error message text buffer.
    -
    315 compileErrors = (char*)(errorMessage->GetBufferPointer());
    -
    316
    -
    317 // Get the length of the message.
    -
    318 bufferSize = errorMessage->GetBufferSize();
    -
    319
    -
    320 // Open a file to write the error message to.
    -
    321 fout.open("shader-error.txt");
    -
    322
    -
    323 // Write out the error message.
    -
    324 for (i = 0; i < bufferSize; i++)
    -
    325 {
    -
    326 fout << compileErrors[i];
    -
    327 }
    -
    328
    -
    329 // Close the file.
    -
    330 fout.close();
    -
    331
    -
    332 // Release the error message.
    -
    333 errorMessage->Release();
    -
    334 errorMessage = 0;
    -
    335
    -
    336 // Pop a message up on the screen to notify the user to check the text file for compile errors.
    -
    337 MessageBox(hwnd, L"Error compiling shader. Check shader-error.txt for message.", shaderFilename, MB_OK);
    -
    338
    -
    339 return;
    -
    340}
    -
    341
    -
    342bool reflection_shader_class::set_shader_parameters(ID3D11DeviceContext* deviceContext, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix,
    -
    343 ID3D11ShaderResourceView* texture, ID3D11ShaderResourceView* reflectionTexture, XMMATRIX reflectionMatrix)
    -
    344{
    -
    345 HRESULT result;
    -
    346 D3D11_MAPPED_SUBRESOURCE mappedResource;
    -
    347 matrix_buffer_type* dataPtr;
    -
    348 unsigned int bufferNumber;
    -
    349 reflection_buffer_type* dataPtr2;
    -
    350
    -
    351
    -
    352 // Transpose the matrices to prepare them for the shader.
    -
    353 worldMatrix = XMMatrixTranspose(worldMatrix);
    -
    354 viewMatrix = XMMatrixTranspose(viewMatrix);
    -
    355 projectionMatrix = XMMatrixTranspose(projectionMatrix);
    -
    356
    -
    357 // Transpose the relfection matrix to prepare it for the shader.
    -
    358 reflectionMatrix = XMMatrixTranspose(reflectionMatrix);
    -
    359
    -
    360 // Lock the constant buffer so it can be written to.
    -
    361 result = deviceContext->Map(matrix_buffer_, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
    -
    362 if (FAILED(result))
    -
    363 {
    -
    364 Logger::Get().Log("Error mapping constant buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    365 return false;
    -
    366 }
    -
    367
    -
    368 // Get a pointer to the data in the constant buffer.
    -
    369 dataPtr = (matrix_buffer_type*)mappedResource.pData;
    -
    370
    -
    371 // Copy the matrices into the constant buffer.
    -
    372 dataPtr->world = worldMatrix;
    -
    373 dataPtr->view = viewMatrix;
    -
    374 dataPtr->projection = projectionMatrix;
    -
    375
    -
    376 // Unlock the constant buffer.
    -
    377 deviceContext->Unmap(matrix_buffer_, 0);
    -
    378
    -
    379 // Set the position of the constant buffer in the vertex shader.
    -
    380 bufferNumber = 0;
    -
    381
    -
    382 // Finally set the constant buffer in the vertex shader with the updated values.
    -
    383 deviceContext->VSSetConstantBuffers(bufferNumber, 1, &matrix_buffer_);
    -
    384
    -
    385 // Lock the reflection constant buffer so it can be written to.
    -
    386 result = deviceContext->Map(reflection_buffer_, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
    -
    387 if (FAILED(result))
    -
    388 {
    -
    389 Logger::Get().Log("Error mapping constant buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    390 return false;
    -
    391 }
    -
    392
    -
    393 // Get a pointer to the data in the matrix constant buffer.
    -
    394 dataPtr2 = (reflection_buffer_type*)mappedResource.pData;
    -
    395
    -
    396 // Copy the matrix into the reflection constant buffer.
    -
    397 dataPtr2->reflection_matrix = reflectionMatrix;
    -
    398
    -
    399 // Unlock the reflection constant buffer.
    -
    400 deviceContext->Unmap(reflection_buffer_, 0);
    -
    401
    -
    402 // Set the position of the reflection constant buffer in the vertex shader.
    -
    403 bufferNumber = 1;
    -
    404
    -
    405 // Now set the reflection constant buffer in the vertex shader with the updated values.
    -
    406 deviceContext->VSSetConstantBuffers(bufferNumber, 1, &reflection_buffer_);
    -
    407
    -
    408 // Set shader texture resource in the pixel shader.
    -
    409 deviceContext->PSSetShaderResources(0, 1, &texture);
    -
    410
    -
    411 // Set the reflection texture resource in the pixel shader.
    -
    412 deviceContext->PSSetShaderResources(1, 1, &reflectionTexture);
    -
    413
    -
    414 return true;
    -
    415}
    -
    416
    -
    417
    -
    418void reflection_shader_class::render_shader(ID3D11DeviceContext* deviceContext, int indexCount)
    -
    419{
    -
    420 // Set the vertex input layout.
    -
    421 deviceContext->IASetInputLayout(layout_);
    -
    422
    -
    423 // Set the vertex and pixel shaders that will be used to render the geometry.
    -
    424 deviceContext->VSSetShader(vertex_shader_, NULL, 0);
    -
    425 deviceContext->PSSetShader(pixel_shader_, NULL, 0);
    -
    426
    -
    427 // Set the sampler state in the pixel shader.
    -
    428 deviceContext->PSSetSamplers(0, 1, &sample_state_);
    -
    429
    -
    430 // render the geometry.
    -
    431 deviceContext->DrawIndexed(indexCount, 0, 0);
    -
    432
    -
    433 return;
    -
    434}
    -
    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
    - -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:444e9e9f360d0e06b860977e4b35de4b0881dcfe54b0c91d2295e192d6770c2a +size 69966 diff --git a/doxygen_docs/html/reflection__shader__class_8h_source.html b/doxygen_docs/html/reflection__shader__class_8h_source.html index 6022c08..5aeea9b 100644 --- a/doxygen_docs/html/reflection__shader__class_8h_source.html +++ b/doxygen_docs/html/reflection__shader__class_8h_source.html @@ -1,175 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/inc/shader/reflection_shader_class.h Source File - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    reflection_shader_class.h
    -
    -
    -
    1
    -
    2// Filename: reflectionshaderclass.h
    -
    4#ifndef _REFLECTIONSHADERCLASS_H_
    -
    5#define _REFLECTIONSHADERCLASS_H_
    -
    6
    -
    7
    -
    9// INCLUDES //
    -
    11#include "Logger.h"
    -
    12#include <d3d11.h>
    -
    13#include <d3dcompiler.h>
    -
    14#include <directxmath.h>
    -
    15#include <fstream>
    -
    16using namespace DirectX;
    -
    17using namespace std;
    -
    18
    -
    19
    -
    21// Class name: reflection_shader_class
    -
    - -
    24{
    -
    25private:
    -
    26 struct matrix_buffer_type
    -
    27 {
    -
    28 XMMATRIX world;
    -
    29 XMMATRIX view;
    -
    30 XMMATRIX projection;
    -
    31 };
    -
    32
    -
    33 struct reflection_buffer_type
    -
    34 {
    -
    35 XMMATRIX reflection_matrix;
    -
    36 };
    -
    37
    -
    38public:
    - - - -
    42
    -
    43 bool initialize(ID3D11Device*, HWND);
    -
    44 void shutdown();
    -
    45 bool render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, XMMATRIX);
    -
    46
    -
    47private:
    -
    48 bool initialize_shader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
    -
    49 void shutdown_shader();
    -
    50 void output_shader_error_message(ID3D10Blob*, HWND, WCHAR*);
    -
    51
    -
    52 bool set_shader_parameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, XMMATRIX);
    -
    53 void render_shader(ID3D11DeviceContext*, int);
    -
    54
    -
    55private:
    -
    56 ID3D11VertexShader* vertex_shader_;
    -
    57 ID3D11PixelShader* pixel_shader_;
    -
    58 ID3D11InputLayout* layout_;
    -
    59 ID3D11Buffer* matrix_buffer_;
    -
    60 ID3D11SamplerState* sample_state_;
    -
    61 ID3D11Buffer* reflection_buffer_;
    -
    62
    -
    63};
    -
    -
    64
    -
    65#endif
    - -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:0b1dd5697b37974f67d318c1d7826c45793a32dfc2b929a9e47738de9da9914b +size 13441 diff --git a/doxygen_docs/html/refraction__shader__class_8cpp_source.html b/doxygen_docs/html/refraction__shader__class_8cpp_source.html index 7321a79..60dec0c 100644 --- a/doxygen_docs/html/refraction__shader__class_8cpp_source.html +++ b/doxygen_docs/html/refraction__shader__class_8cpp_source.html @@ -1,586 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/src/shader/refraction_shader_class.cpp Source File - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    refraction_shader_class.cpp
    -
    -
    -
    1#include "refraction_shader_class.h"
    -
    2
    -
    3
    -
    4refraction_shader_class::refraction_shader_class()
    -
    5{
    -
    6 vertex_shader_ = 0;
    -
    7 pixel_shader_ = 0;
    -
    8 layout_ = 0;
    -
    9 matrix_buffer_ = 0;
    -
    10 sample_state_ = 0;
    -
    11 light_buffer_ = 0;
    -
    12 clip_plane_buffer_ = 0;
    -
    13}
    -
    14
    -
    15
    -
    16refraction_shader_class::refraction_shader_class(const refraction_shader_class& other)
    -
    17{
    -
    18}
    -
    19
    -
    20
    -
    21refraction_shader_class::~refraction_shader_class()
    -
    22{
    -
    23}
    -
    24
    -
    25
    -
    26bool refraction_shader_class::initialize(ID3D11Device* device, HWND hwnd)
    -
    27{
    -
    28 bool result;
    -
    29 wchar_t vsFilename[128];
    -
    30 wchar_t psFilename[128];
    -
    31 int error;
    -
    32
    -
    33 // Set the filename of the vertex shader.
    -
    34 error = wcscpy_s(vsFilename, 128, L"src/hlsl/refraction.vs");
    -
    35 if (error != 0)
    -
    36 {
    -
    37 return false;
    -
    38 }
    -
    39
    -
    40 // Set the filename of the pixel shader.
    -
    41 error = wcscpy_s(psFilename, 128, L"src/hlsl/refraction.ps");
    -
    42 if (error != 0)
    -
    43 {
    -
    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 return false;
    -
    52 }
    -
    53
    -
    54 return true;
    -
    55}
    -
    56
    -
    57
    -
    58void refraction_shader_class::shutdown()
    -
    59{
    -
    60 // shutdown the vertex and pixel shaders as well as the related objects.
    -
    61 shutdown_shader();
    -
    62
    -
    63 return;
    -
    64}
    -
    65
    -
    66bool refraction_shader_class::render(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix,
    -
    67 ID3D11ShaderResourceView* texture, XMFLOAT3 lightDirection, XMFLOAT4 ambientColor[], XMFLOAT4 diffuseColor[], XMFLOAT4 lightPosition[], XMFLOAT4 clipPlane)
    -
    68{
    -
    69 bool result;
    -
    70
    -
    71
    -
    72 // Set the shader parameters that it will use for rendering.
    -
    73 result = set_shader_parameters(deviceContext, worldMatrix, viewMatrix, projectionMatrix, texture, lightDirection, ambientColor, diffuseColor, lightPosition, clipPlane);
    -
    74 if (!result)
    -
    75 {
    -
    76 return false;
    -
    77 }
    -
    78
    -
    79 // Now render the prepared buffers with the shader.
    -
    80 render_shader(deviceContext, indexCount);
    -
    81
    -
    82 return true;
    -
    83}
    -
    84
    -
    85
    -
    86bool refraction_shader_class::initialize_shader(ID3D11Device* device, HWND hwnd, WCHAR* vsFilename, WCHAR* psFilename)
    -
    87{
    -
    88 HRESULT result;
    -
    89 ID3D10Blob* errorMessage;
    -
    90 ID3D10Blob* vertexShaderBuffer;
    -
    91 ID3D10Blob* pixelShaderBuffer;
    -
    92 D3D11_INPUT_ELEMENT_DESC polygonLayout[3];
    -
    93 unsigned int numElements;
    -
    94 D3D11_BUFFER_DESC matrixBufferDesc;
    -
    95 D3D11_SAMPLER_DESC samplerDesc;
    -
    96 D3D11_BUFFER_DESC lightBufferDesc;
    -
    97 D3D11_BUFFER_DESC clipPlaneBufferDesc;
    -
    98
    -
    99
    -
    100 // initialize the pointers this function will use to null.
    -
    101 errorMessage = 0;
    -
    102 vertexShaderBuffer = 0;
    -
    103 pixelShaderBuffer = 0;
    -
    104
    -
    105 // Compile the vertex shader code.
    -
    106 result = D3DCompileFromFile(vsFilename, NULL, NULL, "RefractionVertexShader", "vs_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0,
    -
    107 &vertexShaderBuffer, &errorMessage);
    -
    108 if (FAILED(result))
    -
    109 {
    -
    110 // If the shader failed to compile it should have writen something to the error message.
    -
    111 if (errorMessage)
    -
    112 {
    -
    113 output_shader_error_message(errorMessage, hwnd, vsFilename);
    -
    114 }
    -
    115 // If there was nothing in the error message then it simply could not find the shader file itself.
    -
    116 else
    -
    117 {
    -
    118 MessageBox(hwnd, vsFilename, L"Missing Shader File", MB_OK);
    -
    119 }
    -
    120
    -
    121 return false;
    -
    122 }
    -
    123
    -
    124 // Compile the pixel shader code.
    -
    125 result = D3DCompileFromFile(psFilename, NULL, NULL, "RefractionPixelShader", "ps_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0,
    -
    126 &pixelShaderBuffer, &errorMessage);
    -
    127 if (FAILED(result))
    -
    128 {
    -
    129 // If the shader failed to compile it should have writen something to the error message.
    -
    130 if (errorMessage)
    -
    131 {
    -
    132 output_shader_error_message(errorMessage, hwnd, psFilename);
    -
    133 }
    -
    134 // If there was nothing in the error message then it simply could not find the file itself.
    -
    135 else
    -
    136 {
    -
    137 MessageBox(hwnd, psFilename, L"Missing Shader File", MB_OK);
    -
    138 }
    -
    139
    -
    140 return false;
    -
    141 }
    -
    142
    -
    143 // Create the vertex shader from the buffer.
    -
    144 result = device->CreateVertexShader(vertexShaderBuffer->GetBufferPointer(), vertexShaderBuffer->GetBufferSize(), NULL, &vertex_shader_);
    -
    145 if (FAILED(result))
    -
    146 {
    -
    147 return false;
    -
    148 }
    -
    149
    -
    150 // Create the pixel shader from the buffer.
    -
    151 result = device->CreatePixelShader(pixelShaderBuffer->GetBufferPointer(), pixelShaderBuffer->GetBufferSize(), NULL, &pixel_shader_);
    -
    152 if (FAILED(result))
    -
    153 {
    -
    154 return false;
    -
    155 }
    -
    156
    -
    157 // Create the vertex input layout description.
    -
    158 polygonLayout[0].SemanticName = "POSITION";
    -
    159 polygonLayout[0].SemanticIndex = 0;
    -
    160 polygonLayout[0].Format = DXGI_FORMAT_R32G32B32_FLOAT;
    -
    161 polygonLayout[0].InputSlot = 0;
    -
    162 polygonLayout[0].AlignedByteOffset = 0;
    -
    163 polygonLayout[0].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
    -
    164 polygonLayout[0].InstanceDataStepRate = 0;
    -
    165
    -
    166 polygonLayout[1].SemanticName = "TEXCOORD";
    -
    167 polygonLayout[1].SemanticIndex = 0;
    -
    168 polygonLayout[1].Format = DXGI_FORMAT_R32G32_FLOAT;
    -
    169 polygonLayout[1].InputSlot = 0;
    -
    170 polygonLayout[1].AlignedByteOffset = D3D11_APPEND_ALIGNED_ELEMENT;
    -
    171 polygonLayout[1].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
    -
    172 polygonLayout[1].InstanceDataStepRate = 0;
    -
    173
    -
    174 polygonLayout[2].SemanticName = "NORMAL";
    -
    175 polygonLayout[2].SemanticIndex = 0;
    -
    176 polygonLayout[2].Format = DXGI_FORMAT_R32G32B32_FLOAT;
    -
    177 polygonLayout[2].InputSlot = 0;
    -
    178 polygonLayout[2].AlignedByteOffset = D3D11_APPEND_ALIGNED_ELEMENT;
    -
    179 polygonLayout[2].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
    -
    180 polygonLayout[2].InstanceDataStepRate = 0;
    -
    181
    -
    182 // Get a count of the elements in the layout.
    -
    183 numElements = sizeof(polygonLayout) / sizeof(polygonLayout[0]);
    -
    184
    -
    185 // Create the vertex input layout.
    -
    186 result = device->CreateInputLayout(polygonLayout, numElements, vertexShaderBuffer->GetBufferPointer(),
    -
    187 vertexShaderBuffer->GetBufferSize(), &layout_);
    -
    188 if (FAILED(result))
    -
    189 {
    -
    190 return false;
    -
    191 }
    -
    192
    -
    193 // Release the vertex shader buffer and pixel shader buffer since they are no longer needed.
    -
    194 vertexShaderBuffer->Release();
    -
    195 vertexShaderBuffer = 0;
    -
    196
    -
    197 pixelShaderBuffer->Release();
    -
    198 pixelShaderBuffer = 0;
    -
    199
    -
    200 // Setup the description of the dynamic matrix constant buffer that is in the vertex shader.
    -
    201 matrixBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
    -
    202 matrixBufferDesc.ByteWidth = sizeof(matrix_buffer_type);
    -
    203 matrixBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
    -
    204 matrixBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
    -
    205 matrixBufferDesc.MiscFlags = 0;
    -
    206 matrixBufferDesc.StructureByteStride = 0;
    -
    207
    -
    208 // Create the constant buffer pointer so we can access the vertex shader constant buffer from within this class.
    -
    209 result = device->CreateBuffer(&matrixBufferDesc, NULL, &matrix_buffer_);
    -
    210 if (FAILED(result))
    -
    211 {
    -
    212 return false;
    -
    213 }
    -
    214
    -
    215 // Create a texture sampler state description.
    -
    216 samplerDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR;
    -
    217 samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP;
    -
    218 samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP;
    -
    219 samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP;
    -
    220 samplerDesc.MipLODBias = 0.0f;
    -
    221 samplerDesc.MaxAnisotropy = 1;
    -
    222 samplerDesc.ComparisonFunc = D3D11_COMPARISON_ALWAYS;
    -
    223 samplerDesc.BorderColor[0] = 0;
    -
    224 samplerDesc.BorderColor[1] = 0;
    -
    225 samplerDesc.BorderColor[2] = 0;
    -
    226 samplerDesc.BorderColor[3] = 0;
    -
    227 samplerDesc.MinLOD = 0;
    -
    228 samplerDesc.MaxLOD = D3D11_FLOAT32_MAX;
    -
    229
    -
    230 // Create the texture sampler state.
    -
    231 result = device->CreateSamplerState(&samplerDesc, &sample_state_);
    -
    232 if (FAILED(result))
    -
    233 {
    -
    234 return false;
    -
    235 }
    -
    236
    -
    237 // Setup the description of the light dynamic constant buffer that is in the pixel shader.
    -
    238 // Note that ByteWidth always needs to be a multiple of 16 if using D3D11_BIND_CONSTANT_BUFFER or CreateBuffer will fail.
    -
    239 lightBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
    -
    240 lightBufferDesc.ByteWidth = sizeof(light_buffer_type);
    -
    241 lightBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
    -
    242 lightBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
    -
    243 lightBufferDesc.MiscFlags = 0;
    -
    244 lightBufferDesc.StructureByteStride = 0;
    -
    245
    -
    246 // Create the constant buffer pointer so we can access the vertex shader constant buffer from within this class.
    -
    247 result = device->CreateBuffer(&lightBufferDesc, NULL, &light_buffer_);
    -
    248 if (FAILED(result))
    -
    249 {
    -
    250 return false;
    -
    251 }
    -
    252
    -
    253 // Setup the description of the clip plane dynamic constant buffer that is in the vertex shader.
    -
    254 clipPlaneBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
    -
    255 clipPlaneBufferDesc.ByteWidth = sizeof(clip_plane_buffer_type);
    -
    256 clipPlaneBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
    -
    257 clipPlaneBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
    -
    258 clipPlaneBufferDesc.MiscFlags = 0;
    -
    259 clipPlaneBufferDesc.StructureByteStride = 0;
    -
    260
    -
    261 // Create the constant buffer pointer so we can access the vertex shader constant buffer from within this class.
    -
    262 result = device->CreateBuffer(&clipPlaneBufferDesc, NULL, &clip_plane_buffer_);
    -
    263 if (FAILED(result))
    -
    264 {
    -
    265 return false;
    -
    266 }
    -
    267
    -
    268 return true;
    -
    269}
    -
    270
    -
    271
    -
    272void refraction_shader_class::shutdown_shader()
    -
    273{
    -
    274 // Release the clip plane constant buffer.
    -
    275 if (clip_plane_buffer_)
    -
    276 {
    -
    277 clip_plane_buffer_->Release();
    -
    278 clip_plane_buffer_ = 0;
    -
    279 }
    -
    280
    -
    281 // Release the light constant buffer.
    -
    282 if (light_buffer_)
    -
    283 {
    -
    284 light_buffer_->Release();
    -
    285 light_buffer_ = 0;
    -
    286 }
    -
    287
    -
    288 // Release the sampler state.
    -
    289 if (sample_state_)
    -
    290 {
    -
    291 sample_state_->Release();
    -
    292 sample_state_ = 0;
    -
    293 }
    -
    294
    -
    295 // Release the matrix constant buffer.
    -
    296 if (matrix_buffer_)
    -
    297 {
    -
    298 matrix_buffer_->Release();
    -
    299 matrix_buffer_ = 0;
    -
    300 }
    -
    301
    -
    302 // Release the layout.
    -
    303 if (layout_)
    -
    304 {
    -
    305 layout_->Release();
    -
    306 layout_ = 0;
    -
    307 }
    -
    308
    -
    309 // Release the pixel shader.
    -
    310 if (pixel_shader_)
    -
    311 {
    -
    312 pixel_shader_->Release();
    -
    313 pixel_shader_ = 0;
    -
    314 }
    -
    315
    -
    316 // Release the vertex shader.
    -
    317 if (vertex_shader_)
    -
    318 {
    -
    319 vertex_shader_->Release();
    -
    320 vertex_shader_ = 0;
    -
    321 }
    -
    322
    -
    323 return;
    -
    324}
    -
    325
    -
    326
    -
    327void refraction_shader_class::output_shader_error_message(ID3D10Blob* errorMessage, HWND hwnd, WCHAR* shaderFilename)
    -
    328{
    -
    329 char* compileErrors;
    -
    330 unsigned long long bufferSize, i;
    -
    331 ofstream fout;
    -
    332
    -
    333
    -
    334 // Get a pointer to the error message text buffer.
    -
    335 compileErrors = (char*)(errorMessage->GetBufferPointer());
    -
    336
    -
    337 // Get the length of the message.
    -
    338 bufferSize = errorMessage->GetBufferSize();
    -
    339
    -
    340 // Open a file to write the error message to.
    -
    341 fout.open("shader-error.txt");
    -
    342
    -
    343 // Write out the error message.
    -
    344 for (i = 0; i < bufferSize; i++)
    -
    345 {
    -
    346 fout << compileErrors[i];
    -
    347 }
    -
    348
    -
    349 // Close the file.
    -
    350 fout.close();
    -
    351
    -
    352 // Release the error message.
    -
    353 errorMessage->Release();
    -
    354 errorMessage = 0;
    -
    355
    -
    356 // Pop a message up on the screen to notify the user to check the text file for compile errors.
    -
    357 MessageBox(hwnd, L"Error compiling shader. Check shader-error.txt for message.", shaderFilename, MB_OK);
    -
    358
    -
    359 return;
    -
    360}
    -
    361
    -
    362
    -
    363bool refraction_shader_class::set_shader_parameters(ID3D11DeviceContext* deviceContext, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix,
    -
    364 ID3D11ShaderResourceView* texture, XMFLOAT3 lightDirection, XMFLOAT4 ambientColor[], XMFLOAT4 diffuseColor[], XMFLOAT4 lightPosition[], XMFLOAT4 clipPlane)
    -
    365{
    -
    366 HRESULT result;
    -
    367 D3D11_MAPPED_SUBRESOURCE mappedResource;
    -
    368 matrix_buffer_type* dataPtr;
    -
    369 unsigned int bufferNumber;
    -
    370 clip_plane_buffer_type* dataPtr2;
    -
    371 light_buffer_type* dataPtr3;
    -
    372
    -
    373
    -
    374 // Transpose the matrices to prepare them for the shader.
    -
    375 worldMatrix = XMMatrixTranspose(worldMatrix);
    -
    376 viewMatrix = XMMatrixTranspose(viewMatrix);
    -
    377 projectionMatrix = XMMatrixTranspose(projectionMatrix);
    -
    378
    -
    379 // Lock the constant buffer so it can be written to.
    -
    380 result = deviceContext->Map(matrix_buffer_, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
    -
    381 if (FAILED(result))
    -
    382 {
    -
    383 return false;
    -
    384 }
    -
    385
    -
    386 // Get a pointer to the data in the constant buffer.
    -
    387 dataPtr = (matrix_buffer_type*)mappedResource.pData;
    -
    388
    -
    389 // Copy the matrices into the constant buffer.
    -
    390 dataPtr->world = worldMatrix;
    -
    391 dataPtr->view = viewMatrix;
    -
    392 dataPtr->projection = projectionMatrix;
    -
    393
    -
    394 // Unlock the constant buffer.
    -
    395 deviceContext->Unmap(matrix_buffer_, 0);
    -
    396
    -
    397 // Set the position of the constant buffer in the vertex shader.
    -
    398 bufferNumber = 0;
    -
    399
    -
    400 // Finally set the constant buffer in the vertex shader with the updated values.
    -
    401 deviceContext->VSSetConstantBuffers(bufferNumber, 1, &matrix_buffer_);
    -
    402
    -
    403 // Lock the clip plane constant buffer so it can be written to.
    -
    404 result = deviceContext->Map(clip_plane_buffer_, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
    -
    405 if(FAILED(result))
    -
    406 {
    -
    407 return false;
    -
    408 }
    -
    409
    -
    410 // Get a pointer to the data in the clip plane constant buffer.
    -
    411 dataPtr2 = (clip_plane_buffer_type*)mappedResource.pData;
    -
    412
    -
    413 // Copy the clip plane into the clip plane constant buffer.
    -
    414 dataPtr2->clip_plane = clipPlane;
    -
    415
    -
    416 // Unlock the buffer.
    -
    417 deviceContext->Unmap(clip_plane_buffer_, 0);
    -
    418
    -
    419 // Set the position of the clip plane constant buffer in the vertex shader.
    -
    420 bufferNumber = 1;
    -
    421
    -
    422 // Now set the clip plane constant buffer in the vertex shader with the updated values.
    -
    423 deviceContext->VSSetConstantBuffers(bufferNumber, 1, &clip_plane_buffer_);
    -
    424
    -
    425 // Set shader texture resource in the pixel shader.
    -
    426 deviceContext->PSSetShaderResources(0, 1, &texture);
    -
    427
    -
    428 // Lock the light constant buffer so it can be written to.
    -
    429 result = deviceContext->Map(light_buffer_, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
    -
    430 if(FAILED(result))
    -
    431 {
    -
    432 return false;
    -
    433 }
    -
    434
    -
    435 // Get a pointer to the data in the constant buffer.
    -
    436 dataPtr3 = (light_buffer_type*)mappedResource.pData;
    -
    437
    -
    438 // Copy the lighting variables into the constant buffer.
    -
    439 dataPtr3->ambient_color = ambientColor[0];
    -
    440 dataPtr3->diffuse_color = diffuseColor[0];
    -
    441 dataPtr3->light_position = lightPosition[0];
    -
    442 dataPtr3->light_direction = lightDirection;
    -
    443
    -
    444 // Unlock the constant buffer.
    -
    445 deviceContext->Unmap(light_buffer_, 0);
    -
    446
    -
    447 // Set the position of the light constant buffer in the pixel shader.
    -
    448 bufferNumber = 0;
    -
    449
    -
    450 // Finally set the light constant buffer in the pixel shader with the updated values.
    -
    451 deviceContext->PSSetConstantBuffers(bufferNumber, 1, &light_buffer_);
    -
    452
    -
    453 return true;
    -
    454}
    -
    455
    -
    456
    -
    457void refraction_shader_class::render_shader(ID3D11DeviceContext* deviceContext, int indexCount)
    -
    458{
    -
    459 // Set the vertex input layout.
    -
    460 deviceContext->IASetInputLayout(layout_);
    -
    461
    -
    462 // Set the vertex and pixel shaders that will be used to render the geometry.
    -
    463 deviceContext->VSSetShader(vertex_shader_, NULL, 0);
    -
    464 deviceContext->PSSetShader(pixel_shader_, NULL, 0);
    -
    465
    -
    466 // Set the sampler state in the pixel shader.
    -
    467 deviceContext->PSSetSamplers(0, 1, &sample_state_);
    -
    468
    -
    469 // render the geometry.
    -
    470 deviceContext->DrawIndexed(indexCount, 0, 0);
    -
    471
    -
    472 return;
    -
    473}
    - -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:667db90033dc82c4071ffe1d78c84f1a594a3263f580615ac61d1a5926aceaae +size 69048 diff --git a/doxygen_docs/html/refraction__shader__class_8h_source.html b/doxygen_docs/html/refraction__shader__class_8h_source.html index bed287b..f1bcf65 100644 --- a/doxygen_docs/html/refraction__shader__class_8h_source.html +++ b/doxygen_docs/html/refraction__shader__class_8h_source.html @@ -1,183 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/inc/shader/refraction_shader_class.h Source File - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    refraction_shader_class.h
    -
    -
    -
    1#ifndef _REFRACTIONSHADERCLASS_H_
    -
    2#define _REFRACTIONSHADERCLASS_H_
    -
    3
    -
    4
    -
    6// INCLUDES //
    -
    8#include <d3d11.h>
    -
    9#include <d3dcompiler.h>
    -
    10#include <directxmath.h>
    -
    11#include <fstream>
    -
    12using namespace DirectX;
    -
    13using namespace std;
    -
    14
    -
    15
    -
    17// Class name: refraction_shader_class
    -
    - -
    20{
    -
    21private:
    -
    22 struct matrix_buffer_type
    -
    23 {
    -
    24 XMMATRIX world;
    -
    25 XMMATRIX view;
    -
    26 XMMATRIX projection;
    -
    27 };
    -
    28
    -
    29 struct light_buffer_type
    -
    30 {
    -
    31 XMFLOAT4 ambient_color;
    -
    32 XMFLOAT4 diffuse_color;
    -
    33 XMFLOAT4 light_position;
    -
    34 XMFLOAT3 light_direction;
    -
    35 float padding;
    -
    36 };
    -
    37
    -
    38 struct clip_plane_buffer_type
    -
    39 {
    -
    40 XMFLOAT4 clip_plane;
    -
    41 };
    -
    42
    -
    43public:
    - - - -
    47
    -
    48 bool initialize(ID3D11Device*, HWND);
    -
    49 void shutdown();
    -
    50 bool render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*,
    -
    51 XMFLOAT3, XMFLOAT4[], XMFLOAT4[], XMFLOAT4[], XMFLOAT4);
    -
    52
    -
    53private:
    -
    54 bool initialize_shader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
    -
    55 void shutdown_shader();
    -
    56 void output_shader_error_message(ID3D10Blob*, HWND, WCHAR*);
    -
    57
    -
    58 bool set_shader_parameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*,
    -
    59 XMFLOAT3, XMFLOAT4[], XMFLOAT4[], XMFLOAT4[], XMFLOAT4);
    -
    60 void render_shader(ID3D11DeviceContext*, int);
    -
    61
    -
    62private:
    -
    63 ID3D11VertexShader* vertex_shader_;
    -
    64 ID3D11PixelShader* pixel_shader_;
    -
    65 ID3D11InputLayout* layout_;
    -
    66 ID3D11SamplerState* sample_state_;
    -
    67 ID3D11Buffer* matrix_buffer_;
    -
    68 ID3D11Buffer* light_buffer_;
    -
    69 ID3D11Buffer* clip_plane_buffer_;
    -
    70};
    -
    -
    71
    -
    72#endif
    - -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:3885151469b98e9c693ea54f03b85d743b80d05f25828e5174579f80937573c8 +size 14367 diff --git a/doxygen_docs/html/render__component_8h_source.html b/doxygen_docs/html/render__component_8h_source.html index 9219c55..27bf316 100644 --- a/doxygen_docs/html/render__component_8h_source.html +++ b/doxygen_docs/html/render__component_8h_source.html @@ -1,265 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/inc/system/ecs/components/render_component.h Source File - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    render_component.h
    -
    -
    -
    1#pragma once
    -
    2#include "../component.h"
    -
    3#include "model_class.h"
    -
    4#include <memory>
    -
    5#include <string>
    -
    6#include <map>
    -
    7#include <WICTextureLoader.h>
    -
    8
    -
    9// Déclaration externe de la variable globale définie dans application_class.h
    -
    14extern std::map<std::string, std::shared_ptr<model_class>> g_model_cache;
    -
    15
    -
    16namespace ecs {
    -
    -
    20 enum class TextureType
    -
    21 {
    -
    22 Diffuse,
    -
    23 Normal,
    -
    24 Specular,
    -
    25 Alpha,
    -
    26 Reflection
    -
    27 };
    -
    -
    28
    -
    -
    29class RenderComponent : public Component {
    -
    30public:
    -
    34 RenderComponent() : m_model(nullptr), m_isVisible(true) {}
    -
    35 ~RenderComponent() = default;
    -
    36
    -
    37 void Initialize() override {}
    -
    38 void Update(float deltaTime) override {}
    -
    39
    -
    -
    46 bool InitializeWithModel(std::shared_ptr<model_class> model) {
    -
    47 if (!model) return false;
    -
    48 m_model = model;
    -
    49 return true;
    -
    50 }
    -
    -
    51
    -
    -
    61 bool InitializeFromFile(ID3D11Device* device, ID3D11DeviceContext* deviceContext,
    -
    62 const char* modelFilename, TextureContainer& textureContainer) {
    -
    63 // Vérifier si le modèle existe déjà dans le cache
    -
    64 std::string filename(modelFilename);
    -
    65 auto it = g_model_cache.find(filename);
    -
    66 if (it != g_model_cache.end()) {
    -
    67 m_model = it->second;
    -
    68 } else {
    -
    69 // Créer un nouveau modèle
    -
    70 auto new_model = std::make_shared<model_class>();
    -
    71 if (!new_model->Initialize(device, deviceContext, const_cast<char*>(modelFilename), textureContainer)) {
    -
    72 return false;
    -
    73 }
    -
    74 g_model_cache[filename] = new_model;
    -
    75 m_model = new_model;
    -
    76 }
    -
    77
    -
    78 m_modelFilePath = modelFilename;
    -
    79 return true;
    -
    80 }
    -
    -
    81
    -
    -
    91 bool LoadTexturesFromPath(std::vector<std::wstring>& texturePaths, TextureContainer& texturesContainer,
    -
    92 ID3D11Device* device, ID3D11DeviceContext* deviceContext) {
    -
    93 HRESULT result;
    -
    94
    -
    95 int i = 0;
    -
    96 for (const auto& texturePath : texturePaths) {
    -
    97 ID3D11ShaderResourceView* texture = nullptr;
    -
    98 result = DirectX::CreateWICTextureFromFile(device, deviceContext, texturePath.c_str(), nullptr, &texture);
    -
    99 if (FAILED(result)) {
    -
    100 return false;
    -
    101 }
    -
    102 texturesContainer.AssignTexture(texturesContainer, texture, texturePath, i);
    -
    103 i++;
    -
    104 }
    -
    105
    -
    106 return true;
    -
    107 }
    -
    -
    108
    -
    113 std::shared_ptr<model_class> GetModel() const { return m_model; }
    -
    119 void SetModel(std::shared_ptr<model_class> model) { m_model = model; }
    -
    120
    -
    125 const std::string& GetModelFilePath() const { return m_modelFilePath; }
    -
    131 void SetModelFilePath(const std::string& path) { m_modelFilePath = path; }
    -
    132
    -
    137 bool IsVisible() const { return m_isVisible; }
    -
    143 void SetVisible(bool visible) { m_isVisible = visible; }
    -
    144
    -
    -
    152 ID3D11ShaderResourceView* GetTexture(TextureType type, int index = 0) {
    -
    153 if (!m_model) return nullptr;
    -
    154
    -
    155 switch (type) {
    -
    156 case TextureType::Diffuse:
    -
    157 return m_model->GetTexture(::TextureType::Diffuse, index);
    -
    158 case TextureType::Normal:
    -
    159 return m_model->GetTexture(::TextureType::Normal, index);
    -
    160 case TextureType::Specular:
    -
    161 return m_model->GetTexture(::TextureType::Specular, index);
    -
    162 case TextureType::Alpha:
    -
    163 return m_model->GetTexture(::TextureType::Alpha, index);
    -
    164 default:
    -
    165 return nullptr;
    -
    166 }
    -
    167 }
    -
    -
    168
    -
    -
    174 int GetIndexCount() const {
    -
    175 return m_model ? m_model->GetIndexCount() : 0;
    -
    176 }
    -
    -
    177
    -
    -
    183 void Render(ID3D11DeviceContext* deviceContext) {
    -
    184 if (m_model && m_isVisible) {
    -
    185 m_model->Render(deviceContext);
    -
    186 }
    -
    187 }
    -
    -
    188
    -
    189private:
    -
    190 std::shared_ptr<model_class> m_model;
    -
    191 std::string m_modelFilePath;
    -
    192 bool m_isVisible;
    -
    193};
    -
    -
    194
    -
    195} // namespace ecs
    - - -
    bool InitializeFromFile(ID3D11Device *device, ID3D11DeviceContext *deviceContext, const char *modelFilename, TextureContainer &textureContainer)
    -
    std::shared_ptr< model_class > GetModel() const
    -
    bool InitializeWithModel(std::shared_ptr< model_class > model)
    -
    void Render(ID3D11DeviceContext *deviceContext)
    -
    bool LoadTexturesFromPath(std::vector< std::wstring > &texturePaths, TextureContainer &texturesContainer, ID3D11Device *device, ID3D11DeviceContext *deviceContext)
    -
    void Update(float deltaTime) override
    -
    ID3D11ShaderResourceView * GetTexture(TextureType type, int index=0)
    - -
    void Initialize() override
    -
    const std::string & GetModelFilePath() const
    -
    void SetModel(std::shared_ptr< model_class > model)
    -
    void SetModelFilePath(const std::string &path)
    - - -
    void SetVisible(bool visible)
    -
    Definition component.h:9
    - - -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:29cc28c32623b084271ba643c4ceafbcd1b080380e3ebdde9075c59b1c81ea95 +size 34239 diff --git a/doxygen_docs/html/render__system_8h_source.html b/doxygen_docs/html/render__system_8h_source.html index 06ce253..a0ee15e 100644 --- a/doxygen_docs/html/render__system_8h_source.html +++ b/doxygen_docs/html/render__system_8h_source.html @@ -1,351 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/inc/system/ecs/systems/render_system.h Source File - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    render_system.h
    -
    -
    -
    1#pragma once
    -
    2#include "../entity_manager.h"
    -
    3#include "../components/render_component.h"
    -
    4#include "../components/transform_component.h"
    -
    5#include "../components/shader_component.h"
    -
    6#include "shader_manager_class.h"
    -
    7#include <DirectXMath.h>
    -
    8
    -
    9namespace ecs {
    -
    10
    -
    - -
    12public:
    -
    -
    19 RenderSystem(ID3D11DeviceContext* deviceContext, shader_manager_class* shaderManager)
    -
    20 : m_deviceContext(deviceContext), m_shaderManager(shaderManager) {}
    -
    -
    21
    -
    -
    38 bool RenderEntity(std::shared_ptr<Entity> entity,
    -
    39 const DirectX::XMMATRIX& viewMatrix,
    -
    40 const DirectX::XMMATRIX& projectionMatrix,
    -
    41 const DirectX::XMFLOAT4* diffuseColors,
    -
    42 const DirectX::XMFLOAT4* lightPositions,
    -
    43 const DirectX::XMFLOAT4* ambientColors,
    -
    44 const DirectX::XMFLOAT3& cameraPosition,
    -
    45 const DirectX::XMFLOAT4& sunlightDiffuse,
    -
    46 const DirectX::XMFLOAT4& sunlightAmbient,
    -
    47 const DirectX::XMFLOAT3& sunlightDirection,
    -
    48 float sunlightIntensity) {
    -
    49
    -
    50 // Vérifier si l'entité a tous les composants nécessaires
    -
    51 auto transform = entity->GetComponent<TransformComponent>();
    -
    52 auto render = entity->GetComponent<RenderComponent>();
    -
    53 auto shader = entity->GetComponent<ShaderComponent>();
    -
    54
    -
    55 if (!transform || !render || !shader || !render->GetModel())
    -
    56 return false;
    -
    57
    -
    58 // Calculer la matrice monde
    -
    59 XMMATRIX scaleMatrix = transform->GetScaleMatrix();
    -
    60 XMMATRIX rotateMatrix = transform->GetRotateMatrix();
    -
    61 XMMATRIX translateMatrix = transform->GetTranslateMatrix();
    -
    62
    -
    63 XMMATRIX worldMatrix = XMMatrixMultiply(
    -
    64 XMMatrixMultiply(scaleMatrix, rotateMatrix),
    -
    65 translateMatrix
    -
    66 );
    -
    67
    -
    68 // Rendre le modèle
    -
    69 render->Render(m_deviceContext);
    -
    70
    -
    71 // Sélectionner le shader approprié
    -
    72 switch (shader->GetActiveShader()) {
    -
    73 case ShaderType::ALPHA_MAPPING:
    -
    74 return m_shaderManager->render_alpha_map_shader(
    -
    75 m_deviceContext,
    -
    76 render->GetIndexCount(),
    -
    77 worldMatrix,
    -
    78 viewMatrix,
    -
    79 projectionMatrix,
    -
    80 render->GetTexture(TextureType::Diffuse, 0),
    -
    81 render->GetTexture(TextureType::Diffuse, 1),
    -
    82 render->GetTexture(TextureType::Alpha, 0)
    -
    83 );
    -
    84
    -
    85 case ShaderType::CEL_SHADING:
    -
    86 return m_shaderManager->render_cel_shading_shader(
    -
    87 m_deviceContext,
    -
    88 render->GetIndexCount(),
    -
    89 worldMatrix,
    -
    90 viewMatrix,
    -
    91 projectionMatrix,
    -
    92 render->GetTexture(TextureType::Diffuse, 0),
    -
    93 sunlightDiffuse,
    -
    94 sunlightAmbient,
    -
    95 sunlightDirection,
    -
    96 sunlightIntensity
    -
    97 );
    -
    98
    -
    99 case ShaderType::NORMAL_MAPPING:
    -
    100 return m_shaderManager->render_normal_map_shader(
    -
    101 m_deviceContext,
    -
    102 render->GetIndexCount(),
    -
    103 worldMatrix,
    -
    104 viewMatrix,
    -
    105 projectionMatrix,
    -
    106 render->GetTexture(TextureType::Diffuse, 0),
    -
    107 render->GetTexture(TextureType::Normal, 0),
    -
    108 sunlightDirection,
    -
    109 sunlightDiffuse
    -
    110 );
    -
    111
    -
    112 case ShaderType::SPECULAR_MAPPING:
    -
    113
    -
    114 return m_shaderManager->render_spec_map_shader(
    -
    115 m_deviceContext,
    -
    116 render->GetIndexCount(),
    -
    117 worldMatrix,
    -
    118 viewMatrix,
    -
    119 projectionMatrix,
    -
    120 render->GetTexture(TextureType::Diffuse, 0),
    -
    121 render->GetTexture(TextureType::Normal, 0),
    -
    122 render->GetTexture(TextureType::Specular, 0),
    -
    123 sunlightDirection,
    -
    124 sunlightDiffuse,
    -
    125 cameraPosition,
    -
    126 sunlightDiffuse, // Couleur speculaire (à ajuster)
    -
    127 16.0f // Puissance speculaire (à ajuster)
    -
    128 );
    -
    129
    -
    130 case ShaderType::LIGHTING:
    -
    131 {
    -
    132 // Créer des copies locales non constantes des tableaux
    -
    133 DirectX::XMFLOAT4 localDiffuseColors[4];
    -
    134 DirectX::XMFLOAT4 localLightPositions[4];
    -
    135 DirectX::XMFLOAT4 localAmbientColors[4];
    -
    136
    -
    137 // Copier les données
    -
    138 for (int i = 0; i < 4; i++) {
    -
    139 localDiffuseColors[i] = diffuseColors[i];
    -
    140 localLightPositions[i] = lightPositions[i];
    -
    141 localAmbientColors[i] = ambientColors[i];
    -
    142 }
    -
    143
    -
    144 return m_shaderManager->renderlight_shader(
    -
    145 m_deviceContext,
    -
    146 render->GetIndexCount(),
    -
    147 worldMatrix,
    -
    148 viewMatrix,
    -
    149 projectionMatrix,
    -
    150 render->GetTexture(TextureType::Diffuse, 0),
    -
    151 localDiffuseColors,
    -
    152 localLightPositions,
    -
    153 localAmbientColors
    -
    154 );
    -
    155 }
    -
    156
    -
    157 case ShaderType::SUNLIGHT:
    -
    158 return m_shaderManager->render_sunlight_shader(
    -
    159 m_deviceContext,
    -
    160 render->GetIndexCount(),
    -
    161 worldMatrix,
    -
    162 viewMatrix,
    -
    163 projectionMatrix,
    -
    164 render->GetTexture(TextureType::Diffuse, 0),
    -
    165 sunlightDiffuse,
    -
    166 sunlightAmbient,
    -
    167 sunlightDirection,
    -
    168 sunlightIntensity
    -
    169 );
    -
    170
    -
    171 case ShaderType::SKYBOX:
    -
    172 return m_shaderManager->render_skybox_shader(
    -
    173 m_deviceContext,
    -
    174 render->GetIndexCount(),
    -
    175 worldMatrix,
    -
    176 viewMatrix,
    -
    177 projectionMatrix,
    -
    178 render->GetTexture(TextureType::Diffuse, 0),
    -
    179 sunlightDiffuse,
    -
    180 sunlightAmbient,
    -
    181 sunlightDirection,
    -
    182 sunlightIntensity
    -
    183 );
    -
    184
    -
    185 case ShaderType::TEXTURE:
    -
    186 default:
    -
    187 return m_shaderManager->render_texture_shader(
    -
    188 m_deviceContext,
    -
    189 render->GetIndexCount(),
    -
    190 worldMatrix,
    -
    191 viewMatrix,
    -
    192 projectionMatrix,
    -
    193 render->GetTexture(TextureType::Diffuse, 0)
    -
    194 );
    -
    195 }
    -
    196 }
    -
    -
    197
    -
    - -
    215 const DirectX::XMMATRIX& viewMatrix,
    -
    216 const DirectX::XMMATRIX& projectionMatrix,
    -
    217 const DirectX::XMFLOAT4* diffuseColors,
    -
    218 const DirectX::XMFLOAT4* lightPositions,
    -
    219 const DirectX::XMFLOAT4* ambientColors,
    -
    220 const DirectX::XMFLOAT3& cameraPos,
    -
    221 const DirectX::XMFLOAT4& sunlightDiffuse,
    -
    222 const DirectX::XMFLOAT4& sunlightAmbient,
    -
    223 const DirectX::XMFLOAT3& sunlightDirection,
    -
    224 float sunlightIntensity) {
    -
    225
    -
    226 int renderCount = 0;
    -
    227
    -
    228 // Récupérer toutes les entités qui ont les composants RenderComponent et TransformComponent
    -
    229 auto entities = entityManager->GetEntitiesWithComponent<RenderComponent>();
    -
    230
    -
    231 for (auto& entity : entities) {
    -
    232 auto render = entity->GetComponent<RenderComponent>();
    -
    233
    -
    234 // Vérifier si l'entité a un TransformComponent
    -
    235 auto transform = entity->GetComponent<TransformComponent>();
    -
    236 if (!transform) continue;
    -
    237
    -
    238 // Vérifier si le modèle est visible
    -
    239 if (!render->IsVisible()) continue;
    -
    240
    -
    241 // Effectuer le rendu
    -
    242 if (RenderEntity(entity, viewMatrix, projectionMatrix,
    -
    243 diffuseColors, lightPositions, ambientColors,cameraPos,
    -
    244 sunlightDiffuse, sunlightAmbient, sunlightDirection,
    -
    245 sunlightIntensity)) {
    -
    246 renderCount++;
    -
    247 }
    -
    248 }
    -
    249
    -
    250 return renderCount;
    -
    251 }
    -
    -
    252
    -
    253private:
    -
    254 ID3D11DeviceContext* m_deviceContext;
    -
    255 shader_manager_class* m_shaderManager;
    -
    256};
    -
    -
    257
    -
    258} // namespace ecs
    - -
    std::vector< std::shared_ptr< Entity > > GetEntitiesWithComponent()
    - - -
    RenderSystem(ID3D11DeviceContext *deviceContext, shader_manager_class *shaderManager)
    -
    int RenderAllEntities(EntityManager *entityManager, const DirectX::XMMATRIX &viewMatrix, const DirectX::XMMATRIX &projectionMatrix, const DirectX::XMFLOAT4 *diffuseColors, const DirectX::XMFLOAT4 *lightPositions, const DirectX::XMFLOAT4 *ambientColors, const DirectX::XMFLOAT3 &cameraPos, const DirectX::XMFLOAT4 &sunlightDiffuse, const DirectX::XMFLOAT4 &sunlightAmbient, const DirectX::XMFLOAT3 &sunlightDirection, float sunlightIntensity)
    -
    bool RenderEntity(std::shared_ptr< Entity > entity, const DirectX::XMMATRIX &viewMatrix, const DirectX::XMMATRIX &projectionMatrix, const DirectX::XMFLOAT4 *diffuseColors, const DirectX::XMFLOAT4 *lightPositions, const DirectX::XMFLOAT4 *ambientColors, const DirectX::XMFLOAT3 &cameraPosition, const DirectX::XMFLOAT4 &sunlightDiffuse, const DirectX::XMFLOAT4 &sunlightAmbient, const DirectX::XMFLOAT3 &sunlightDirection, float sunlightIntensity)
    - - - -
    Definition component.h:9
    -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:0673db3dcbd30445b2975385de9eae82e6087ac64390f77fb97ab3fd08fae96f +size 42781 diff --git a/doxygen_docs/html/render__texture__class_8cpp_source.html b/doxygen_docs/html/render__texture__class_8cpp_source.html index 76043d6..1472017 100644 --- a/doxygen_docs/html/render__texture__class_8cpp_source.html +++ b/doxygen_docs/html/render__texture__class_8cpp_source.html @@ -1,376 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/src/system/render_texture_class.cpp Source File - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    render_texture_class.cpp
    -
    -
    -
    1#include "render_texture_class.h"
    -
    2
    -
    3render_texture_class::render_texture_class()
    -
    4{
    -
    5 m_renderTargetTexture = 0;
    -
    6 m_renderTargetView = 0;
    -
    7 m_shaderResourceView = 0;
    -
    8 m_depthStencilBuffer = 0;
    -
    9 m_depthStencilView = 0;
    -
    10}
    -
    11
    -
    12
    -
    13render_texture_class::render_texture_class(const render_texture_class& other)
    -
    14{
    -
    15}
    -
    16
    -
    17
    -
    18render_texture_class::~render_texture_class()
    -
    19{
    -
    20}
    -
    21
    -
    22bool render_texture_class::Initialize(ID3D11Device * device, int textureWidth, int textureHeight, float screenDepth, float screenNear, int format)
    -
    23{
    -
    24 Logger::Get().Log("Initializing render_texture_class", __FILE__, __LINE__, Logger::LogLevel::Initialize);
    -
    25
    -
    26 D3D11_TEXTURE2D_DESC textureDesc;
    -
    27 HRESULT result;
    -
    28 D3D11_RENDER_TARGET_VIEW_DESC renderTargetViewDesc;
    -
    29 D3D11_SHADER_RESOURCE_VIEW_DESC shaderResourceViewDesc;
    -
    30 D3D11_TEXTURE2D_DESC depthBufferDesc;
    -
    31 D3D11_DEPTH_STENCIL_VIEW_DESC depthStencilViewDesc;
    -
    32 DXGI_FORMAT textureFormat;
    -
    33
    -
    34
    -
    35 // Set the texture format.
    -
    36 switch (format)
    -
    37 {
    -
    38 case 1:
    -
    39 {
    -
    40 textureFormat = DXGI_FORMAT_R8G8B8A8_UNORM;
    -
    41 break;
    -
    42 }
    -
    43 default:
    -
    44 {
    -
    45 textureFormat = DXGI_FORMAT_R8G8B8A8_UNORM;
    -
    46 break;
    -
    47 }
    -
    48 }
    -
    49
    -
    50 // Store the width and height of the render texture.
    -
    51 m_textureWidth = textureWidth;
    -
    52 m_textureHeight = textureHeight;
    -
    53
    -
    54 // Initialize the render target texture description.
    -
    55 ZeroMemory(&textureDesc, sizeof(textureDesc));
    -
    56
    -
    57 // Setup the render target texture description.
    -
    58 textureDesc.Width = textureWidth;
    -
    59 textureDesc.Height = textureHeight;
    -
    60 textureDesc.MipLevels = 1;
    -
    61 textureDesc.ArraySize = 1;
    -
    62 textureDesc.Format = textureFormat;
    -
    63 textureDesc.SampleDesc.Count = 1;
    -
    64 textureDesc.Usage = D3D11_USAGE_DEFAULT;
    -
    65 textureDesc.BindFlags = D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE;
    -
    66 textureDesc.CPUAccessFlags = 0;
    -
    67 textureDesc.MiscFlags = 0;
    -
    68
    -
    69 // Create the render target texture.
    -
    70 result = device->CreateTexture2D(&textureDesc, NULL, &m_renderTargetTexture);
    -
    71 if (FAILED(result))
    -
    72 {
    -
    73 Logger::Get().Log("Failed to create render target texture", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    74 return false;
    -
    75 }
    -
    76
    -
    77 // Setup the description of the render target view.
    -
    78 renderTargetViewDesc.Format = textureDesc.Format;
    -
    79 renderTargetViewDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
    -
    80 renderTargetViewDesc.Texture2D.MipSlice = 0;
    -
    81
    -
    82 // Create the render target view.
    -
    83 result = device->CreateRenderTargetView(m_renderTargetTexture, &renderTargetViewDesc, &m_renderTargetView);
    -
    84 if (FAILED(result))
    -
    85 {
    -
    86 Logger::Get().Log("Failed to create render target view", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    87 return false;
    -
    88 }
    -
    89
    -
    90 // Setup the description of the shader resource view.
    -
    91 shaderResourceViewDesc.Format = textureDesc.Format;
    -
    92 shaderResourceViewDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
    -
    93 shaderResourceViewDesc.Texture2D.MostDetailedMip = 0;
    -
    94 shaderResourceViewDesc.Texture2D.MipLevels = 1;
    -
    95
    -
    96 // Create the shader resource view.
    -
    97 result = device->CreateShaderResourceView(m_renderTargetTexture, &shaderResourceViewDesc, &m_shaderResourceView);
    -
    98 if (FAILED(result))
    -
    99 {
    -
    100 Logger::Get().Log("Failed to create shader resource view", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    101 return false;
    -
    102 }
    -
    103
    -
    104 // Initialize the description of the depth buffer.
    -
    105 ZeroMemory(&depthBufferDesc, sizeof(depthBufferDesc));
    -
    106
    -
    107 // Set up the description of the depth buffer.
    -
    108 depthBufferDesc.Width = textureWidth;
    -
    109 depthBufferDesc.Height = textureHeight;
    -
    110 depthBufferDesc.MipLevels = 1;
    -
    111 depthBufferDesc.ArraySize = 1;
    -
    112 depthBufferDesc.Format = DXGI_FORMAT_D24_UNORM_S8_UINT;
    -
    113 depthBufferDesc.SampleDesc.Count = 1;
    -
    114 depthBufferDesc.SampleDesc.Quality = 0;
    -
    115 depthBufferDesc.Usage = D3D11_USAGE_DEFAULT;
    -
    116 depthBufferDesc.BindFlags = D3D11_BIND_DEPTH_STENCIL;
    -
    117 depthBufferDesc.CPUAccessFlags = 0;
    -
    118 depthBufferDesc.MiscFlags = 0;
    -
    119
    -
    120 // Create the texture for the depth buffer using the filled out description.
    -
    121 result = device->CreateTexture2D(&depthBufferDesc, NULL, &m_depthStencilBuffer);
    -
    122 if (FAILED(result))
    -
    123 {
    -
    124 Logger::Get().Log("Failed to create depth buffer texture", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    125 return false;
    -
    126 }
    -
    127
    -
    128 // Initailze the depth stencil view description.
    -
    129 ZeroMemory(&depthStencilViewDesc, sizeof(depthStencilViewDesc));
    -
    130
    -
    131 // Set up the depth stencil view description.
    -
    132 depthStencilViewDesc.Format = DXGI_FORMAT_D24_UNORM_S8_UINT;
    -
    133 depthStencilViewDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D;
    -
    134 depthStencilViewDesc.Texture2D.MipSlice = 0;
    -
    135
    -
    136 // Create the depth stencil view.
    -
    137 result = device->CreateDepthStencilView(m_depthStencilBuffer, &depthStencilViewDesc, &m_depthStencilView);
    -
    138 if (FAILED(result))
    -
    139 {
    -
    140 Logger::Get().Log("Failed to create depth stencil view", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    141 return false;
    -
    142 }
    -
    143
    -
    144 // Setup the viewport for rendering.
    -
    145 m_viewport.Width = (float)textureWidth;
    -
    146 m_viewport.Height = (float)textureHeight;
    -
    147 m_viewport.MinDepth = 0.0f;
    -
    148 m_viewport.MaxDepth = 1.0f;
    -
    149 m_viewport.TopLeftX = 0;
    -
    150 m_viewport.TopLeftY = 0;
    -
    151
    -
    152 // Setup the projection matrix.
    -
    153 m_projectionMatrix = XMMatrixPerspectiveFovLH((3.141592654f / 4.0f), ((float)textureWidth / (float)textureHeight), screenNear, screenDepth);
    -
    154
    -
    155 // Create an orthographic projection matrix for 2D rendering.
    -
    156 m_orthoMatrix = XMMatrixOrthographicLH((float)textureWidth, (float)textureHeight, screenNear, screenDepth);
    -
    157
    -
    158 Logger::Get().Log("render_texture_class initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
    -
    159
    -
    160 return true;
    -
    161}
    -
    162
    -
    163void render_texture_class::Shutdown()
    -
    164{
    -
    165 Logger::Get().Log("Shutting down render_texture_class", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
    -
    166
    -
    167 if (m_depthStencilView)
    -
    168 {
    -
    169 m_depthStencilView->Release();
    -
    170 m_depthStencilView = 0;
    -
    171 }
    -
    172
    -
    173 if (m_depthStencilBuffer)
    -
    174 {
    -
    175 m_depthStencilBuffer->Release();
    -
    176 m_depthStencilBuffer = 0;
    -
    177 }
    -
    178
    -
    179 if (m_shaderResourceView)
    -
    180 {
    -
    181 m_shaderResourceView->Release();
    -
    182 m_shaderResourceView = 0;
    -
    183 }
    -
    184
    -
    185 if (m_renderTargetView)
    -
    186 {
    -
    187 m_renderTargetView->Release();
    -
    188 m_renderTargetView = 0;
    -
    189 }
    -
    190
    -
    191 if (m_renderTargetTexture)
    -
    192 {
    -
    193 m_renderTargetTexture->Release();
    -
    194 m_renderTargetTexture = 0;
    -
    195 }
    -
    196
    -
    197 Logger::Get().Log("render_texture_class shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
    -
    198
    -
    199 return;
    -
    200}
    -
    201
    -
    202void render_texture_class::SetRenderTarget(ID3D11DeviceContext * deviceContext)
    -
    203{
    -
    204 // Bind the render target view and depth stencil buffer to the output render pipeline.
    -
    205 deviceContext->OMSetRenderTargets(1, &m_renderTargetView, m_depthStencilView);
    -
    206
    -
    207 // Set the viewport.
    -
    208 deviceContext->RSSetViewports(1, &m_viewport);
    -
    209
    -
    210 return;
    -
    211}
    -
    212
    -
    213void render_texture_class::ClearRenderTarget(ID3D11DeviceContext * deviceContext, float red, float green, float blue, float alpha)
    -
    214{
    -
    215 float color[4];
    -
    216
    -
    217
    -
    218 // Setup the color to clear the buffer to.
    -
    219 color[0] = red;
    -
    220 color[1] = green;
    -
    221 color[2] = blue;
    -
    222 color[3] = alpha;
    -
    223
    -
    224 // Clear the back buffer.
    -
    225 deviceContext->ClearRenderTargetView(m_renderTargetView, color);
    -
    226
    -
    227 // Clear the depth buffer.
    -
    228 deviceContext->ClearDepthStencilView(m_depthStencilView, D3D11_CLEAR_DEPTH, 1.0f, 0);
    -
    229
    -
    230 return;
    -
    231}
    -
    232
    -
    233ID3D11ShaderResourceView* render_texture_class::GetShaderResourceView()
    -
    234{
    -
    235 return m_shaderResourceView;
    -
    236}
    -
    237
    -
    238void render_texture_class::GetProjectionMatrix(XMMATRIX & projectionMatrix)
    -
    239{
    -
    240 projectionMatrix = m_projectionMatrix;
    -
    241 return;
    -
    242}
    -
    243
    -
    244
    -
    245void render_texture_class::GetOrthoMatrix(XMMATRIX & orthoMatrix)
    -
    246{
    -
    247 orthoMatrix = m_orthoMatrix;
    -
    248 return;
    -
    249}
    -
    250
    -
    251
    -
    252int render_texture_class::GetTextureWidth()
    -
    253{
    -
    254 return m_textureWidth;
    -
    255}
    -
    256
    -
    257
    -
    258int render_texture_class::GetTextureHeight()
    -
    259{
    -
    260 return m_textureHeight;
    -
    261}
    -
    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
    - -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:7ae0dc07ef3d0d4a75de976a58e4d40dd589afad8364d410be987bfcb4cb9247 +size 42259 diff --git a/doxygen_docs/html/render__texture__class_8h_source.html b/doxygen_docs/html/render__texture__class_8h_source.html index 6a255b8..e7f5e87 100644 --- a/doxygen_docs/html/render__texture__class_8h_source.html +++ b/doxygen_docs/html/render__texture__class_8h_source.html @@ -1,163 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/inc/system/render_texture_class.h Source File - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    render_texture_class.h
    -
    -
    -
    1
    -
    2// Filename: rendertextureclass.h
    -
    4#ifndef _RENDERTEXTURECLASS_H_
    -
    5#define _RENDERTEXTURECLASS_H_
    -
    6
    -
    7
    -
    9// INCLUDES //
    -
    11#include "Logger.h"
    -
    12#include <d3d11.h>
    -
    13#include <directxmath.h>
    -
    14using namespace DirectX;
    -
    15
    -
    16
    -
    18// Class name: render_texture_class
    -
    - -
    21{
    -
    22public:
    - - - -
    26
    -
    27 bool Initialize(ID3D11Device*, int, int, float, float, int);
    -
    28 void Shutdown();
    -
    29
    -
    30 void SetRenderTarget(ID3D11DeviceContext*);
    -
    31 void ClearRenderTarget(ID3D11DeviceContext*, float, float, float, float);
    -
    32 ID3D11ShaderResourceView* GetShaderResourceView();
    -
    33
    -
    34 void GetProjectionMatrix(XMMATRIX&);
    -
    35 void GetOrthoMatrix(XMMATRIX&);
    -
    36
    -
    37 int GetTextureWidth();
    -
    38 int GetTextureHeight();
    -
    39
    -
    40private:
    -
    41 int m_textureWidth, m_textureHeight;
    -
    42 ID3D11Texture2D* m_renderTargetTexture;
    -
    43 ID3D11RenderTargetView* m_renderTargetView;
    -
    44 ID3D11ShaderResourceView* m_shaderResourceView;
    -
    45 ID3D11Texture2D* m_depthStencilBuffer;
    -
    46 ID3D11DepthStencilView* m_depthStencilView;
    -
    47 D3D11_VIEWPORT m_viewport;
    -
    48 XMMATRIX m_projectionMatrix;
    -
    49 XMMATRIX m_orthoMatrix;
    -
    50
    -
    51};
    -
    -
    52
    -
    53#endif
    - -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:d8919880e0b4c0b54f30c1bcee78baf04a054cc0d05ca5b7718147de11b94552 +size 12040 diff --git a/doxygen_docs/html/resize.js b/doxygen_docs/html/resize.js index 178d03b..c800c4e 100644 --- a/doxygen_docs/html/resize.js +++ b/doxygen_docs/html/resize.js @@ -1,147 +1,3 @@ -/* - @licstart The following is the entire license notice for the JavaScript code in this file. - - The MIT License (MIT) - - Copyright (C) 1997-2020 by Dimitri van Heesch - - Permission is hereby granted, free of charge, to any person obtaining a copy of this software - and associated documentation files (the "Software"), to deal in the Software without restriction, - including without limitation the rights to use, copy, modify, merge, publish, distribute, - sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all copies or - substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING - BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - @licend The above is the entire license notice for the JavaScript code in this file - */ - -function initResizable(treeview) { - let sidenav,navtree,content,header,footer,barWidth=6; - const RESIZE_COOKIE_NAME = ''+'width'; - - function resizeWidth() { - const sidenavWidth = $(sidenav).outerWidth(); - content.css({marginLeft:parseInt(sidenavWidth)+"px"}); - if (typeof page_layout!=='undefined' && page_layout==1) { - footer.css({marginLeft:parseInt(sidenavWidth)+"px"}); - } - Cookie.writeSetting(RESIZE_COOKIE_NAME,sidenavWidth-barWidth); - } - - function restoreWidth(navWidth) { - content.css({marginLeft:parseInt(navWidth)+barWidth+"px"}); - if (typeof page_layout!=='undefined' && page_layout==1) { - footer.css({marginLeft:parseInt(navWidth)+barWidth+"px"}); - } - sidenav.css({width:navWidth + "px"}); - } - - function resizeHeight(treeview) { - const headerHeight = header.outerHeight(); - const windowHeight = $(window).height(); - let contentHeight; - if (treeview) - { - const footerHeight = footer.outerHeight(); - let navtreeHeight,sideNavHeight; - if (typeof page_layout==='undefined' || page_layout==0) { /* DISABLE_INDEX=NO */ - contentHeight = windowHeight - headerHeight - footerHeight; - navtreeHeight = contentHeight; - sideNavHeight = contentHeight; - } else if (page_layout==1) { /* DISABLE_INDEX=YES */ - contentHeight = windowHeight - footerHeight; - navtreeHeight = windowHeight - headerHeight; - sideNavHeight = windowHeight; - } - navtree.css({height:navtreeHeight + "px"}); - sidenav.css({height:sideNavHeight + "px"}); - } - else - { - contentHeight = windowHeight - headerHeight; - } - content.css({height:contentHeight + "px"}); - if (location.hash.slice(1)) { - (document.getElementById(location.hash.slice(1))||document.body).scrollIntoView(); - } - } - - function collapseExpand() { - let newWidth; - if (sidenav.width()>0) { - newWidth=0; - } else { - const width = Cookie.readSetting(RESIZE_COOKIE_NAME,250); - newWidth = (width>250 && width<$(window).width()) ? width : 250; - } - restoreWidth(newWidth); - const sidenavWidth = $(sidenav).outerWidth(); - Cookie.writeSetting(RESIZE_COOKIE_NAME,sidenavWidth-barWidth); - } - - header = $("#top"); - content = $("#doc-content"); - footer = $("#nav-path"); - sidenav = $("#side-nav"); - if (!treeview) { -// title = $("#titlearea"); -// titleH = $(title).height(); -// let animating = false; -// content.on("scroll", function() { -// slideOpts = { duration: 200, -// step: function() { -// contentHeight = $(window).height() - header.outerHeight(); -// content.css({ height : contentHeight + "px" }); -// }, -// done: function() { animating=false; } -// }; -// if (content.scrollTop()>titleH && title.css('display')!='none' && !animating) { -// title.slideUp(slideOpts); -// animating=true; -// } else if (content.scrollTop()<=titleH && title.css('display')=='none' && !animating) { -// title.slideDown(slideOpts); -// animating=true; -// } -// }); - } else { - navtree = $("#nav-tree"); - $(".side-nav-resizable").resizable({resize: function(e, ui) { resizeWidth(); } }); - $(sidenav).resizable({ minWidth: 0 }); - } - $(window).resize(function() { resizeHeight(treeview); }); - if (treeview) - { - const device = navigator.userAgent.toLowerCase(); - const touch_device = device.match(/(iphone|ipod|ipad|android)/); - if (touch_device) { /* wider split bar for touch only devices */ - $(sidenav).css({ paddingRight:'20px' }); - $('.ui-resizable-e').css({ width:'20px' }); - $('#nav-sync').css({ right:'34px' }); - barWidth=20; - } - const width = Cookie.readSetting(RESIZE_COOKIE_NAME,250); - if (width) { restoreWidth(width); } else { resizeWidth(); } - } - resizeHeight(treeview); - const url = location.href; - const i=url.indexOf("#"); - if (i>=0) window.location.hash=url.substr(i); - const _preventDefault = function(evt) { evt.preventDefault(); }; - if (treeview) - { - $("#splitbar").bind("dragstart", _preventDefault).bind("selectstart", _preventDefault); - $(".ui-resizable-handle").dblclick(collapseExpand); - // workaround for firefox - $("body").css({overflow: "hidden"}); - } - $(window).on('load',function() { resizeHeight(treeview); }); -} -/* @license-end */ +version https://git-lfs.github.com/spec/v1 +oid sha256:cadf4cd5369db2cb128738ca28b373287a5b868a2067866ec0f4dc85a1fd2f70 +size 5722 diff --git a/doxygen_docs/html/scene__manager_8cpp_source.html b/doxygen_docs/html/scene__manager_8cpp_source.html index 626f792..7773232 100644 --- a/doxygen_docs/html/scene__manager_8cpp_source.html +++ b/doxygen_docs/html/scene__manager_8cpp_source.html @@ -1,616 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/src/system/scene_manager.cpp Source File - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    scene_manager.cpp
    -
    -
    -
    1#include "scene_manager.h"
    -
    2#include "application_class.h"
    -
    3
    -
    4scene_manager::scene_manager()
    -
    5{
    -
    6}
    -
    7
    -
    8scene_manager::~scene_manager()
    -
    9{
    -
    10 shutdown();
    -
    11}
    -
    12
    -
    - -
    14{
    -
    15 if (!app) {
    -
    16 Logger::Get().Log("Application pointer is null", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    17 return false;
    -
    18 }
    -
    19
    -
    20 app_ = app;
    -
    21 return true;
    -
    22}
    -
    -
    23
    -
    - -
    25{
    -
    26 app_ = nullptr;
    -
    27 return true;
    -
    28}
    -
    -
    29
    -
    - -
    31
    -
    32 Logger::Get().Log("Saving scene as...", __FILE__, __LINE__, Logger::LogLevel::Info);
    -
    33
    -
    34 OPENFILENAME ofn;
    -
    35 wchar_t szFile[260] = { 0 };
    -
    36
    -
    37 ZeroMemory(&ofn, sizeof(ofn));
    -
    38 ofn.lStructSize = sizeof(ofn);
    -
    39 ofn.hwndOwner = app_->get_hwnd();
    -
    40 ofn.lpstrFile = szFile;
    -
    41 ofn.nMaxFile = sizeof(szFile);
    -
    42 ofn.lpstrFilter = L"Ker Scene\0*.ker\0";
    -
    43 ofn.nFilterIndex = 1;
    -
    44 ofn.lpstrFileTitle = NULL;
    -
    45 ofn.nMaxFileTitle = 0;
    -
    46 ofn.lpstrInitialDir = NULL;
    -
    47 ofn.Flags = OFN_PATHMUSTEXIST | OFN_OVERWRITEPROMPT;
    -
    48 ofn.lpstrDefExt = L"ker";
    -
    49
    -
    50 if (GetSaveFileName(&ofn) == TRUE) {
    -
    51 std::filesystem::path filepath = ofn.lpstrFile;
    -
    52
    -
    53 // Mettre à jour le chemin de scène
    -
    54 scene_path_ = convert_w_string_to_string(filepath.wstring());
    -
    55 //object_vec_ = app_->get_kobjects(); // TODO
    -
    56
    -
    57 // Sauvegarder la scène avec le nouveau chemin
    -
    58 save_scene();
    -
    59
    -
    60 Logger::Get().Log("Scene saved as: " + scene_path_, __FILE__, __LINE__, Logger::LogLevel::Info);
    -
    61 return false;
    -
    62 }
    -
    63
    -
    64 return true;
    -
    65}
    -
    -
    66
    -
    - -
    68 Logger::Get().Log("Loading scene from " , __FILE__, __LINE__, Logger::LogLevel::Info);
    -
    69
    -
    70 object_id_ = app_->get_object_id();
    -
    71 w_folder_ = app_->get_w_folder();
    -
    72 direct_3d_ = app_->get_direct_3d();
    -
    73 std::wstring scenePath = get_scene_path();
    -
    74
    -
    75 if (!scenePath.empty()) {
    -
    76 scene_path_ = convert_w_string_to_string(scenePath);
    -
    77 }
    -
    78
    -
    79 std::ifstream inFile(scene_path_);
    -
    80 if (!inFile.is_open()) {
    -
    81 Logger::Get().Log("Failed to open file for loading scene: " + scene_path_, __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    82 return false;
    -
    83 }
    -
    84
    -
    85 // Réinitialiser l'ID d'objet le plus élevé
    -
    86 object_id_ = 0;
    -
    87
    -
    88 // Récupérer l'EntityManager pour créer de nouvelles entités
    -
    89 auto entity_manager = app_->get_entity_manager();
    -
    90
    -
    91 // Supprimer toutes les entités existantes
    -
    92 entity_manager->Clear();
    -
    93
    -
    94 // Sauvegarder le répertoire de travail actuel
    -
    95 std::wstring currentDirectory = w_folder_;
    -
    96
    -
    97 std::string line;
    -
    98 while (std::getline(inFile, line)) {
    -
    99 std::istringstream iss(line);
    -
    100 int id;
    -
    101 std::string name;
    -
    102 XMFLOAT3 position, rotation, scale;
    -
    103 std::string modelPath;
    -
    104 std::string shaderTypeStr;
    -
    105 float boundingRadius;
    -
    106 std::string objectTypeStr;
    -
    107 float mass;
    -
    108 bool physicsEnabled;
    -
    109
    -
    110 // Lire les données de base de l'entité
    -
    111 iss >> id >> name
    -
    112 >> position.x >> position.y >> position.z
    -
    113 >> rotation.x >> rotation.y >> rotation.z
    -
    114 >> scale.x >> scale.y >> scale.z;
    -
    115
    -
    116 // Lire le chemin du modèle - vérifier s'il est vide
    -
    117 iss >> modelPath;
    -
    118
    -
    119 // Si le chemin du modèle est vide ou commence par une lettre majuscule (probablement un type de shader),
    -
    120 // c'est qu'il a été omis - utilisez une valeur par défaut
    -
    121 if (modelPath.empty() || (modelPath[0] >= 'A' && modelPath[0] <= 'Z')) {
    -
    122 // Reculer le curseur de lecture pour lire le type de shader à la place
    -
    123 iss.seekg(-static_cast<int>(modelPath.length()), std::ios::cur);
    -
    124 modelPath = "assets/Model/TXT/cube.txt"; // Valeur par défaut
    -
    125 }
    -
    126
    -
    127 iss >> shaderTypeStr
    -
    128 >> boundingRadius >> objectTypeStr
    -
    129 >> mass >> physicsEnabled;
    -
    130
    -
    131 if (iss.fail()) {
    -
    132 Logger::Get().Log("Failed to parse entity data: " + line, __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    133 continue;
    -
    134 }
    -
    135
    -
    136 // Mettre à jour l'ID d'objet le plus élevé si nécessaire
    -
    137 if (id >= object_id_) {
    -
    138 object_id_ = id + 1;
    -
    139 }
    -
    140
    -
    141 // Convertir le chemin du modèle en wstring
    -
    142 std::wstring wModelPath(modelPath.begin(), modelPath.end());
    -
    143
    -
    144 // Vérifier si le chemin est relatif
    -
    145 if (modelPath != "NoModel" && modelPath.length() > 1 && modelPath[1] != ':') {
    -
    146 // C'est un chemin relatif, préfixer avec le répertoire de travail
    -
    147 if (currentDirectory.back() != L'/' && currentDirectory.back() != L'\\') {
    -
    148 // Ajouter un séparateur si nécessaire
    -
    149 wModelPath = currentDirectory + L"\\" + wModelPath;
    -
    150 } else {
    -
    151 wModelPath = currentDirectory + wModelPath;
    -
    152 }
    -
    153 }
    -
    154
    -
    155 // Créer le conteneur de textures pour stocker les chemins
    -
    156 TextureContainer objectTextures;
    -
    157
    -
    158 // Vider les conteneurs de chemins de textures
    -
    159 objectTextures.diffusePaths.clear();
    -
    160 objectTextures.normalPaths.clear();
    -
    161 objectTextures.specularPaths.clear();
    -
    162 objectTextures.alphaPaths.clear();
    -
    163
    -
    164 // Lire les chemins des textures diffuses
    -
    165 int diffuseTextureCount;
    -
    166 iss >> diffuseTextureCount;
    -
    167 for (int i = 0; i < diffuseTextureCount; i++) {
    -
    168 std::string texturePath;
    -
    169 iss >> texturePath;
    -
    170 std::wstring wTexturePath(texturePath.begin(), texturePath.end());
    -
    171 objectTextures.diffusePaths.push_back(wTexturePath);
    -
    172 }
    -
    173
    -
    174 // Lire les chemins des textures normales
    -
    175 int normalTextureCount;
    -
    176 iss >> normalTextureCount;
    -
    177 for (int i = 0; i < normalTextureCount; i++) {
    -
    178 std::string texturePath;
    -
    179 iss >> texturePath;
    -
    180 std::wstring wTexturePath(texturePath.begin(), texturePath.end());
    -
    181 objectTextures.normalPaths.push_back(wTexturePath);
    -
    182 }
    -
    183
    -
    184 // Lire les chemins des textures spéculaires
    -
    185 int specularTextureCount;
    -
    186 iss >> specularTextureCount;
    -
    187 for (int i = 0; i < specularTextureCount; i++) {
    -
    188 std::string texturePath;
    -
    189 iss >> texturePath;
    -
    190 std::wstring wTexturePath(texturePath.begin(), texturePath.end());
    -
    191 objectTextures.specularPaths.push_back(wTexturePath);
    -
    192 }
    -
    193
    -
    194 // Lire les chemins des textures alpha
    -
    195 int alphaTextureCount;
    -
    196 iss >> alphaTextureCount;
    -
    197 for (int i = 0; i < alphaTextureCount; i++) {
    -
    198 std::string texturePath;
    -
    199 iss >> texturePath;
    -
    200 std::wstring wTexturePath(texturePath.begin(), texturePath.end());
    -
    201 objectTextures.alphaPaths.push_back(wTexturePath);
    -
    202 }
    -
    203
    -
    204 // Vérifier si on a un modèle à charger
    -
    205 if (modelPath == "NoModel") {
    -
    206 Logger::Get().Log("Skipping entity without model: " + name, __FILE__, __LINE__, Logger::LogLevel::Warning);
    -
    207 continue;
    -
    208 }
    -
    209
    -
    210 // Récupérer le cache de modèles de l'application
    -
    211 auto& modelCache = app_->get_model_cache();
    -
    212 std::shared_ptr<model_class> sharedModel;
    -
    213
    -
    214 // Vérifier si le modèle existe déjà dans le cache
    -
    215 std::string modelKey = modelPath;
    -
    216 auto it = modelCache.find(modelKey);
    -
    217 if (it != modelCache.end()) {
    -
    218 // Utiliser le modèle existant du cache
    -
    219 Logger::Get().Log("Using cached model for: " + modelKey, __FILE__, __LINE__, Logger::LogLevel::Info);
    -
    220 sharedModel = it->second;
    -
    221 } else {
    -
    222 // Créer un nouveau modèle
    -
    223 char modelFilename[256];
    -
    224 size_t convertedChars = 0;
    -
    225 wcstombs_s(&convertedChars, modelFilename, sizeof(modelFilename), wModelPath.c_str(), _TRUNCATE);
    -
    226
    -
    227 Logger::Get().Log("Loading model: " + std::string(modelFilename), __FILE__, __LINE__, Logger::LogLevel::Info);
    -
    228
    -
    229 // Créer et initialiser le modèle
    -
    230 auto newModel = std::make_shared<model_class>();
    -
    231
    -
    232 // Précharger les textures
    -
    233 if (!newModel->PreloadTextures(direct_3d_->get_device(), direct_3d_->get_device_context(), objectTextures)) {
    -
    234 Logger::Get().Log("Failed to preload textures for: " + name, __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    235 continue;
    -
    236 }
    -
    237
    -
    238 if (!newModel->Initialize(direct_3d_->get_device(), direct_3d_->get_device_context(), modelFilename, objectTextures)) {
    -
    239 Logger::Get().Log("Failed to initialize model: " + name, __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    240 continue;
    -
    241 }
    -
    242
    -
    243 // Ajouter le modèle au cache
    -
    244 modelCache[modelKey] = newModel;
    -
    245 sharedModel = newModel;
    -
    246 }
    -
    247
    -
    248 // Créer une nouvelle entité avec l'EntityManager
    -
    249 auto entity = entity_manager->CreateEntity();
    -
    250
    -
    251 // Ajouter un composant d'identité
    -
    252 auto identityComponent = entity->AddComponent<ecs::IdentityComponent>(id);
    -
    253 identityComponent->SetName(name);
    -
    254 identityComponent->SetType(ecs::IdentityComponent::StringToObjectType(objectTypeStr));
    -
    255
    -
    256 // Ajouter un composant de transformation
    -
    257 auto transformComponent = entity->AddComponent<ecs::TransformComponent>();
    -
    258 transformComponent->SetPosition(XMLoadFloat3(&position));
    -
    259 transformComponent->SetRotation(XMLoadFloat3(&rotation));
    -
    260 transformComponent->SetScale(XMLoadFloat3(&scale));
    -
    261 transformComponent->UpdateWorldMatrix();
    -
    262
    -
    263 // Ajouter un composant de rendu avec le modèle
    -
    264 auto renderComponent = entity->AddComponent<ecs::RenderComponent>();
    -
    265 renderComponent->InitializeWithModel(sharedModel);
    -
    266
    -
    267 // Ajouter un composant de shader
    -
    268 auto shaderComponent = entity->AddComponent<ecs::ShaderComponent>();
    -
    269 shaderComponent->SetActiveShader(ecs::ShaderComponent::StringToShaderType(shaderTypeStr));
    -
    270
    -
    271 // Ajouter un composant de chemin de modèle
    -
    272 auto modelPathComponent = entity->AddComponent<ecs::ModelPathComponent>();
    -
    273 modelPathComponent->SetPath(wModelPath);
    -
    274
    -
    275 // Ajouter un composant de physique si nécessaire
    -
    276 auto physicsComponent = entity->AddComponent<ecs::PhysicsComponent>();
    -
    277 physicsComponent->Initialize();
    -
    278 physicsComponent->SetMass(mass);
    -
    279 physicsComponent->SetBoundingRadius(boundingRadius);
    -
    280 physicsComponent->SetPhysicsEnabled(physicsEnabled);
    -
    281
    -
    282 Logger::Get().Log("Entity loaded: " + name + " with ID: " + std::to_string(id), __FILE__, __LINE__, Logger::LogLevel::Info);
    -
    283 }
    -
    284
    -
    285 // Mettre à jour l'ID global dans l'application
    -
    286 app_->set_object_id(object_id_);
    -
    287
    -
    288 // Mettre à jour les statistiques après le chargement
    - -
    290
    -
    291 Logger::Get().Log("Scene loaded successfully from " + scene_path_, __FILE__, __LINE__, Logger::LogLevel::Info);
    -
    292 return true;
    -
    293}
    -
    -
    294
    -
    - -
    296
    -
    297 entity_ = app_->get_entity_manager()->GetAllEntities();
    -
    298
    -
    299 if (scene_path_.empty()) {
    -
    300 // Si le chemin de la scène est vide, fallback vers la fonction de sauvegarde as
    -
    301 if (!save_scene_as()) {
    -
    302 Logger::Get().Log("Scene save cancelled by user", __FILE__, __LINE__, Logger::LogLevel::Info);
    -
    303 return false;
    -
    304 }
    -
    305 }
    -
    306
    -
    307 std::ofstream outFile(scene_path_);
    -
    308 if (!outFile.is_open()) {
    -
    309 Logger::Get().Log("Failed to open file for saving scene", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    310 return false;
    -
    311 }
    -
    312
    -
    313 for (const auto& object : entity_) {
    -
    314 XMFLOAT3 position, scale, rotation;
    -
    315 int id = 0;
    -
    316 int mass = 0;
    -
    317 float boundingRadius = 0;
    -
    318 std::string name = "NONE";
    -
    319 std::string shaderType = "NONE";
    -
    320 std::string objectType = "NONE";
    -
    321 std::wstring model_path = L"";
    -
    322 bool physics_enabled = false;
    -
    323
    -
    324 auto transform = object->GetComponent<ecs::TransformComponent>();
    -
    325 if (transform) {
    -
    326 // convert XMVECTOR to XMFLOAT3
    -
    327 XMStoreFloat3(&position, transform->GetPosition());
    -
    328 XMStoreFloat3(&rotation, transform->GetRotation());
    -
    329 XMStoreFloat3(&scale, transform->GetScale());
    -
    330 }
    -
    331
    -
    332
    -
    333 auto identity = object->GetComponent<ecs::IdentityComponent>();
    -
    334 if (identity) {
    -
    335
    -
    336 id = identity->GetId();
    -
    337 name = identity->GetName();
    -
    338 objectType = identity->ObjectTypeToString(identity->GetType());
    -
    339
    -
    340 }
    -
    341
    -
    342 auto model_path_component = object->GetComponent<ecs::ModelPathComponent>();
    -
    343 if (model_path_component) {
    -
    344
    -
    345 model_path = model_path_component->GetPath();
    -
    346 }
    -
    347
    -
    348 auto shader = object->GetComponent<ecs::ShaderComponent>();
    -
    349 if (shader)
    -
    350 {
    -
    351 shaderType = shader->ShaderTypeToString(shader->GetActiveShader());
    -
    352 }
    -
    353
    -
    354 auto physics = object->GetComponent<ecs::PhysicsComponent>();
    -
    355 if (physics) {
    -
    356 physics_enabled = physics->IsPhysicsEnabled();
    -
    357 mass = physics->GetMass();
    -
    358 boundingRadius = physics->GetBoundingRadius();
    -
    359 }
    -
    360
    -
    361 // Écrire les données de base de l'objet
    -
    362 outFile << id << " "
    -
    363 << name << " "
    -
    364 << position.x << " " << position.y << " " << position.z << " "
    -
    365 << rotation.x << " " << rotation.y << " " << rotation.z << " "
    -
    366 << scale.x << " " << scale.y << " " << scale.z << " "
    -
    367 << convert_w_string_to_string(model_path) << " "
    -
    368 << shaderType << " "
    -
    369 << boundingRadius << " "
    -
    370 << objectType << " "
    -
    371 << mass << " "
    -
    372 << physics_enabled;
    -
    373
    -
    374 // Sauvegarder les chemins des textures_
    -
    375 // Format: nombre de textures_ diffuses, puis les chemins
    -
    376 // Même chose pour les autres types de textures_
    -
    377
    -
    378
    -
    379 auto render = object->GetComponent<ecs::RenderComponent>();
    -
    380 if (render)
    -
    381 {
    -
    382 const auto& model = render->GetModel();
    -
    383
    -
    384 const auto& textureContainer = model->GetTextureContainer();
    -
    385
    -
    386 const auto& diffusePaths = textureContainer.GetPaths(TextureType::Diffuse);
    -
    387 outFile << " " << diffusePaths.size();
    -
    388 for (const auto& path : diffusePaths) {
    -
    389 outFile << " " << convert_w_string_to_string(path);
    -
    390 }
    -
    391
    -
    392 const auto& normalPaths = textureContainer.GetPaths(TextureType::Normal);
    -
    393 outFile << " " << normalPaths.size();
    -
    394 for (const auto& path : normalPaths) {
    -
    395 outFile << " " << convert_w_string_to_string(path);
    -
    396 }
    -
    397 const auto& specularPaths = textureContainer.GetPaths(TextureType::Specular);
    -
    398 outFile << " " << specularPaths.size();
    -
    399 for (const auto& path : specularPaths) {
    -
    400 outFile << " " << convert_w_string_to_string(path);
    -
    401 }
    -
    402 const auto& alphaPaths = textureContainer.GetPaths(TextureType::Alpha);
    -
    403 outFile << " " << alphaPaths.size();
    -
    404 for (const auto& path : alphaPaths) {
    -
    405 outFile << " " << convert_w_string_to_string(path);
    -
    406 }
    -
    407 }
    -
    408
    -
    409
    -
    410 outFile << std::endl;
    -
    411 }
    -
    412
    -
    413 outFile.close();
    -
    414 Logger::Get().Log("Scene saved successfully to " + scene_path_, __FILE__, __LINE__, Logger::LogLevel::Info);
    -
    415 return true;
    -
    416}
    -
    -
    417
    -
    - -
    419{
    -
    420 OPENFILENAME ofn;
    -
    421 wchar_t szFile[260];
    -
    422
    -
    423 ZeroMemory(&ofn, sizeof(ofn));
    -
    424 ofn.lStructSize = sizeof(ofn);
    -
    425 ofn.hwndOwner = app_->get_hwnd();
    -
    426 ofn.lpstrFile = szFile;
    -
    427 ofn.lpstrFile[0] = '\0';
    -
    428 ofn.nMaxFile = sizeof(szFile);
    -
    429 ofn.lpstrFilter = L"Ker Scene\0*.ker\0";
    -
    430 ofn.nFilterIndex = 1;
    -
    431 ofn.lpstrFileTitle = NULL;
    -
    432 ofn.nMaxFileTitle = 0;
    -
    433 ofn.lpstrInitialDir = NULL;
    -
    434 ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
    -
    435
    -
    436 if (GetOpenFileName(&ofn) == TRUE)
    -
    437 {
    -
    438 std::filesystem::path filepath = ofn.lpstrFile;
    -
    439 return filepath.wstring();
    -
    440 }
    -
    441 return L"";
    -
    442}
    -
    -
    443
    -
    -
    444std::string scene_manager::convert_w_string_to_string(const std::wstring& wstr)
    -
    445{
    -
    446 if (wstr.empty()) return std::string();
    -
    447
    -
    448 int size_needed = WideCharToMultiByte(CP_UTF8, 0, &wstr[0], (int)wstr.size(), NULL, 0, NULL, NULL);
    -
    449 std::string str(size_needed, 0);
    -
    450 WideCharToMultiByte(CP_UTF8, 0, &wstr[0], (int)wstr.size(), &str[0], size_needed, NULL, NULL);
    -
    451 return str;
    -
    452}
    -
    -
    453
    -
    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
    - -
    std::filesystem::path get_w_folder() const
    - - -
    std::map< std::string, std::shared_ptr< model_class > > & get_model_cache()
    - -
    ecs::EntityManager * get_entity_manager() const
    -
    void set_object_id(int object_id)
    -
    ID3D11Device * get_device()
    Gets the Direct3D device.
    -
    ID3D11DeviceContext * get_device_context()
    Gets the Direct3D device context.
    - -
    std::vector< std::shared_ptr< Entity > > GetAllEntities()
    - -
    static ObjectType StringToObjectType(const std::string &str)
    -
    void SetName(const std::string &name)
    - -
    void SetPath(const std::wstring &path)
    - -
    void Initialize() override
    - -
    bool InitializeWithModel(std::shared_ptr< model_class > model)
    - -
    void SetActiveShader(ShaderType shader)
    -
    static ShaderType StringToShaderType(const std::string &str)
    - -
    void SetPosition(XMVECTOR position)
    - -
    bool initialize(application_class *app)
    - - - - -
    std::string convert_w_string_to_string(const std::wstring &w_str)
    -
    std::wstring get_scene_path()
    - -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:c49080684f4a5da2e6e8dd147acf374e3e00076d38b533135ec9d3cfa4187757 +size 95616 diff --git a/doxygen_docs/html/scene__manager_8h_source.html b/doxygen_docs/html/scene__manager_8h_source.html index 8f2323a..67c68bc 100644 --- a/doxygen_docs/html/scene__manager_8h_source.html +++ b/doxygen_docs/html/scene__manager_8h_source.html @@ -1,164 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/inc/system/scene_manager.h Source File - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    scene_manager.h
    -
    -
    -
    1#pragma once
    -
    2#include <filesystem>
    -
    3#include <string>
    -
    4#include <vector>
    -
    5
    -
    6#include "ecs/entity.h"
    -
    7
    -
    8class d_3d_class;
    -
    9class object;
    - -
    11
    -
    - -
    13{
    -
    14public:
    -
    15
    - - -
    18
    - -
    29 bool shutdown();
    -
    30
    -
    38 bool save_scene_as();
    -
    45 bool save_scene();
    -
    51 bool load_scene();
    -
    52
    -
    57 std::wstring get_scene_path();
    -
    63 std::string convert_w_string_to_string(const std::wstring& w_str);
    -
    64
    -
    65private:
    -
    66
    -
    67 std::vector<std::shared_ptr<ecs::Entity>> entity_;
    -
    68
    - -
    70 std::string scene_path_;
    -
    71 std::vector<object*> object_vec_;
    -
    72 int object_id_;
    -
    73 std::filesystem::path w_folder_;
    -
    74 d_3d_class* direct_3d_;
    -
    75};
    -
    - - - - -
    bool initialize(application_class *app)
    - - - - -
    std::string convert_w_string_to_string(const std::wstring &w_str)
    -
    std::wstring get_scene_path()
    -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:d691c07c696d22a6517e9bd284c8358cfe541e73d11ce26bd0b6c147db9d5125 +size 14575 diff --git a/doxygen_docs/html/scene_manager_8h_source.html b/doxygen_docs/html/scene_manager_8h_source.html index b08c329..f807613 100644 --- a/doxygen_docs/html/scene_manager_8h_source.html +++ b/doxygen_docs/html/scene_manager_8h_source.html @@ -1,155 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/inc/system/sceneManager.h Source File - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    sceneManager.h
    -
    -
    -
    1#pragma once
    -
    2#include <string>
    -
    3
    -
    - -
    5{
    -
    6public:
    -
    7 static sceneManager& Get()
    -
    8 {
    -
    9 static sceneManager instance;
    -
    10 return instance;
    -
    11 }
    -
    12
    -
    13 sceneManager(sceneManager const&) = delete;
    -
    14 void operator=(sceneManager const&) = delete;
    -
    15
    -
    16 void SetSceneFilePath(const std::string& path) { m_sceneFilePath = path; }
    -
    17 void SetSceneFileName(const std::string& name) { m_sceneFileName = name; }
    -
    18
    -
    19 bool SaveScene()
    -
    20 {
    -
    21 // Implement the save scene logic here
    -
    22 return true;
    -
    23 }
    -
    24
    -
    25 bool LoadScene()
    -
    26 {
    -
    27
    -
    28
    -
    29 // Implement the load scene logic here
    -
    30 return true;
    -
    31 }
    -
    32
    -
    33private:
    -
    34 sceneManager() = default;
    -
    35 ~sceneManager() = default;
    -
    36
    -
    37 // Scene file path
    -
    38 std::string m_sceneFilePath;
    -
    39 std::string m_sceneFileName;
    -
    40};
    -
    - -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:cc737afbde50e7190cc8612423c0307821dd89a8d2e9492f04633a0c76ea505f +size 10818 diff --git a/doxygen_docs/html/search/all_0.js b/doxygen_docs/html/search/all_0.js index 8ee0348..e2429ae 100644 --- a/doxygen_docs/html/search/all_0.js +++ b/doxygen_docs/html/search/all_0.js @@ -1,8 +1,3 @@ -var searchData= -[ - ['add_5fcube_0',['add_cube',['../classapplication__class.html#aaa09afdc106fb3f82788c42272811657',1,'application_class']]], - ['add_5fkobject_1',['add_kobject',['../classapplication__class.html#a9a39dfe69bca6fe96a339ab47b2f0539',1,'application_class']]], - ['addcomponent_2',['AddComponent',['../classecs_1_1_entity.html#a240b05cecbe32a6222082f3b4a789a98',1,'ecs::Entity']]], - ['alpha_5fmap_5fshader_5fclass_3',['alpha_map_shader_class',['../classalpha__map__shader__class.html',1,'']]], - ['application_5fclass_4',['application_class',['../classapplication__class.html',1,'application_class'],['../classapplication__class.html#ab3b678dde613c8568a2124482ed45a73',1,'application_class::application_class()']]] -]; +version https://git-lfs.github.com/spec/v1 +oid sha256:152f213de09c36745e04c0db4c825d8c2fe79fef6ce124ae75ce973b493f130b +size 732 diff --git a/doxygen_docs/html/search/all_1.js b/doxygen_docs/html/search/all_1.js index eb92be5..f77293b 100644 --- a/doxygen_docs/html/search/all_1.js +++ b/doxygen_docs/html/search/all_1.js @@ -1,5 +1,3 @@ -var searchData= -[ - ['begin_5fscene_0',['begin_scene',['../classd__3d__class.html#acaf14bacf9de484d9f4deb4e148d272c',1,'d_3d_class']]], - ['bitmap_5fclass_1',['bitmap_class',['../classbitmap__class.html',1,'']]] -]; +version https://git-lfs.github.com/spec/v1 +oid sha256:5560ebf26f2b07f806454f057b311f3e370d2c9f4bad894435c11b3c17129b84 +size 215 diff --git a/doxygen_docs/html/search/all_10.js b/doxygen_docs/html/search/all_10.js index 3f26eff..357c4cb 100644 --- a/doxygen_docs/html/search/all_10.js +++ b/doxygen_docs/html/search/all_10.js @@ -1,16 +1,3 @@ -var searchData= -[ - ['tempvertextype_0',['TempVertexType',['../structmodel__class_1_1_temp_vertex_type.html',1,'model_class']]], - ['text_5fclass_1',['text_class',['../classtext__class.html',1,'']]], - ['texture_2',['Texture',['../structmodel__class_1_1_texture.html',1,'model_class']]], - ['texture_5fclass_3',['texture_class',['../classtexture__class.html',1,'']]], - ['texture_5fshader_5fclass_4',['texture_shader_class',['../classtexture__shader__class.html',1,'']]], - ['texturecontainer_5',['TextureContainer',['../struct_texture_container.html',1,'']]], - ['texturetype_6',['TextureType',['../namespaceecs.html#a6e9ad0276f69474fe9498437b7d1a8f2',1,'ecs']]], - ['timer_5fclass_7',['timer_class',['../classtimer__class.html',1,'']]], - ['transformcomponent_8',['TransformComponent',['../classecs_1_1_transform_component.html',1,'ecs::TransformComponent'],['../classecs_1_1_transform_component.html#a66dc72687d5a68513beb31b5ae28564f',1,'ecs::TransformComponent::TransformComponent()']]], - ['translate_5fshader_5fclass_9',['translate_shader_class',['../classtranslate__shader__class.html',1,'']]], - ['transparent_5fshader_5fclass_10',['transparent_shader_class',['../classtransparent__shader__class.html',1,'']]], - ['turn_5fz_5fbuffer_5foff_11',['turn_z_buffer_off',['../classd__3d__class.html#af10a177e15842ad232f394d30f80a4e6',1,'d_3d_class']]], - ['turn_5fz_5fbuffer_5fon_12',['turn_z_buffer_on',['../classd__3d__class.html#a00a377d6a09653fd3f7e68af8afcea3a',1,'d_3d_class']]] -]; +version https://git-lfs.github.com/spec/v1 +oid sha256:d4f77adb7ed84e34448fe9e619043d8fcadce64aba7ff277c8b91bd4fcc34224 +size 1489 diff --git a/doxygen_docs/html/search/all_11.js b/doxygen_docs/html/search/all_11.js index 7315c7d..8e437be 100644 --- a/doxygen_docs/html/search/all_11.js +++ b/doxygen_docs/html/search/all_11.js @@ -1,8 +1,3 @@ -var searchData= -[ - ['update_0',['Update',['../classecs_1_1_component.html#a59c0f739c4ff19227e27ed7b9f6352e0',1,'ecs::Component::Update()'],['../classecs_1_1_model_path_component.html#a64d1c1fa22bb222e6c85f5312ea8795b',1,'ecs::ModelPathComponent::Update()'],['../classecs_1_1_physics_component.html#a83aaa878464b8ef2dbc0e7a927689d79',1,'ecs::PhysicsComponent::Update()'],['../classecs_1_1_render_component.html#a6cfff9944a89629f5f7a7d1451446f0d',1,'ecs::RenderComponent::Update()'],['../classecs_1_1_shader_component.html#a2ebc1ef592626fc729884677c771ccbf',1,'ecs::ShaderComponent::Update()']]], - ['update_5fstats_5fafter_5fmodification_1',['update_stats_after_modification',['../classapplication__class.html#aa453b06f65ab6344907f0c65670de202',1,'application_class']]], - ['updatecomponents_2',['UpdateComponents',['../classecs_1_1_entity.html#a239d0855906f8c66371d7d1fa895a11f',1,'ecs::Entity']]], - ['updateentities_3',['UpdateEntities',['../classecs_1_1_entity_manager.html#aac0b39f03cc669d8bc8f3073daa2079c',1,'ecs::EntityManager']]], - ['updateworldmatrix_4',['UpdateWorldMatrix',['../classecs_1_1_transform_component.html#a28d1fe5ba04d4ff6f9eb136ea656e35e',1,'ecs::TransformComponent']]] -]; +version https://git-lfs.github.com/spec/v1 +oid sha256:3fabc8f8b547039ec0d28478cacfc8eceae1e70c0ea2b67f5ed51267a8d90e9c +size 1198 diff --git a/doxygen_docs/html/search/all_12.js b/doxygen_docs/html/search/all_12.js index 66e397b..894bd0b 100644 --- a/doxygen_docs/html/search/all_12.js +++ b/doxygen_docs/html/search/all_12.js @@ -1,6 +1,3 @@ -var searchData= -[ - ['vectortype_0',['VectorType',['../structmodel__class_1_1_vector_type.html',1,'model_class']]], - ['vertex_1',['Vertex',['../structmodel__class_1_1_vertex.html',1,'model_class']]], - ['vertextype_2',['VertexType',['../structmodel__class_1_1_vertex_type.html',1,'model_class']]] -]; +version https://git-lfs.github.com/spec/v1 +oid sha256:238cd994726153369b43df39e723271b6f44389b80290809f5dc77c1443930e3 +size 301 diff --git a/doxygen_docs/html/search/all_13.js b/doxygen_docs/html/search/all_13.js index 59aae1f..f9e2119 100644 --- a/doxygen_docs/html/search/all_13.js +++ b/doxygen_docs/html/search/all_13.js @@ -1,16 +1,3 @@ -var searchData= -[ - ['water_5fshader_5fclass_0',['water_shader_class',['../classwater__shader__class.html',1,'']]], - ['widget_5fentry_1',['widget_entry',['../structwidget__entry.html',1,'']]], - ['widgetaddobject_2',['WidgetAddObject',['../classimgui_manager.html#a59142ebf31199eabc0e95fb4e03f0dcc',1,'imguiManager']]], - ['widgetbutton_3',['WidgetButton',['../classimgui_manager.html#a50050d9440111762dcaac05555994175',1,'imguiManager']]], - ['widgetenginesettingswindow_4',['WidgetEngineSettingsWindow',['../classimgui_manager.html#a343ac602d7ef491b66bdb0d22b4cca54',1,'imguiManager']]], - ['widgetfps_5',['WidgetFPS',['../classimgui_manager.html#aa3b3c6844e2616b5a4b230d0f223cb74',1,'imguiManager']]], - ['widgetlightwindow_6',['WidgetLightWindow',['../classimgui_manager.html#a16bf45ab2eca6c63053b9ce52d84a245',1,'imguiManager']]], - ['widgetlogwindow_7',['WidgetLogWindow',['../classimgui_manager.html#acc1037d25c4c832d469867cfda2ece8d',1,'imguiManager']]], - ['widgetobjectwindow_8',['WidgetObjectWindow',['../classimgui_manager.html#a0933378a4a5bea9a7f0eefc9631ac369',1,'imguiManager']]], - ['widgetrenderstats_9',['WidgetRenderStats',['../classimgui_manager.html#aef824217cf1d2248b63eba6f577dbed6',1,'imguiManager']]], - ['widgetrenderwindow_10',['WidgetRenderWindow',['../classimgui_manager.html#ab8dfce7344b08009a6e4343f66418cbf',1,'imguiManager']]], - ['widgetspeedslider_11',['WidgetSpeedSlider',['../classimgui_manager.html#af69a453ffe53d8db207fd7d4d76f20ab',1,'imguiManager']]], - ['widgetterrainwindow_12',['WidgetTerrainWindow',['../classimgui_manager.html#ab5bc0ab6cfd9369bdadb72d589716e0d',1,'imguiManager']]] -]; +version https://git-lfs.github.com/spec/v1 +oid sha256:7b9ce91abbdc8edfa2c7d5ccde008aa0cb9820d1aab2ebbe69b8f5126d0a8e42 +size 1632 diff --git a/doxygen_docs/html/search/all_2.js b/doxygen_docs/html/search/all_2.js index 88e6730..ec6c8d5 100644 --- a/doxygen_docs/html/search/all_2.js +++ b/doxygen_docs/html/search/all_2.js @@ -1,17 +1,3 @@ -var searchData= -[ - ['camera_5fclass_0',['camera_class',['../classcamera__class.html',1,'camera_class'],['../classcamera__class.html#ac18562f9e46ca033440ba9df2d180e20',1,'camera_class::camera_class()']]], - ['celshade_5fclass_1',['celshade_class',['../classcelshade__class.html',1,'']]], - ['checkcube_2',['CheckCube',['../classfrustum.html#aa631d4d670499da25b2c3720cc15c855',1,'frustum']]], - ['clear_3',['Clear',['../classecs_1_1_entity_manager.html#a6c31a8b7c0a01e473566fd801db91a55',1,'ecs::EntityManager']]], - ['color_5fshader_5fclass_4',['color_shader_class',['../classcolor__shader__class.html',1,'']]], - ['component_5',['Component',['../classecs_1_1_component.html',1,'ecs']]], - ['componentptr_6',['ComponentPtr',['../namespaceecs.html#a42f956eb2e8f1c7becf039180c466677',1,'ecs']]], - ['componenttypeid_7',['ComponentTypeID',['../namespaceecs.html#a94d754c47297d56ce57eb14784809efc',1,'ecs']]], - ['construct_5ffrustum_8',['construct_frustum',['../classapplication__class.html#a7b959a12a5574b263556937f1c94e255',1,'application_class']]], - ['constructfrustum_9',['ConstructFrustum',['../classfrustum.html#a17fbc652d86a362739d01c66ab8aa036',1,'frustum']]], - ['constructskybox_10',['ConstructSkybox',['../class_skybox.html#a583a0753edede891759ecb62cf82a86f',1,'Skybox']]], - ['convert_5fw_5fstring_5fto_5fstring_11',['convert_w_string_to_string',['../classscene__manager.html#acfa372b48d1b5119177fe985508cab18',1,'scene_manager']]], - ['create_5fbig_5fcube_12',['create_big_cube',['../classapplication__class.html#a7b0482e4b79a4c3bf32e1f40ccb48678',1,'application_class']]], - ['createentity_13',['CreateEntity',['../classecs_1_1_entity_manager.html#a696dcb2fd36215b0a9214880d21033a2',1,'ecs::EntityManager']]] -]; +version https://git-lfs.github.com/spec/v1 +oid sha256:0a6f432161bf08a7d5564dfcaeb7834cda3091555a33048e60b35344f1820619 +size 1724 diff --git a/doxygen_docs/html/search/all_3.js b/doxygen_docs/html/search/all_3.js index 212ee7e..dc104ba 100644 --- a/doxygen_docs/html/search/all_3.js +++ b/doxygen_docs/html/search/all_3.js @@ -1,10 +1,3 @@ -var searchData= -[ - ['d_5f3d_5fclass_0',['d_3d_class',['../classd__3d__class.html',1,'d_3d_class'],['../classd__3d__class.html#a9858f0cfaa93dec1b76ccea6e31c85bc',1,'d_3d_class::d_3d_class()']]], - ['delete_5fentity_5fby_5fid_1',['delete_entity_by_id',['../classapplication__class.html#a5ade90e873b7b6a31c148672dd0305cb',1,'application_class']]], - ['delete_5fterrain_2',['delete_terrain',['../classapplication__class.html#a69bce73916e1180493ac74030dbb77ba',1,'application_class']]], - ['depth_5fshader_5fclass_3',['depth_shader_class',['../classdepth__shader__class.html',1,'']]], - ['destroyentity_4',['DestroyEntity',['../classecs_1_1_entity_manager.html#a4cb0da19e3a95b7cb1390843882176a9',1,'ecs::EntityManager']]], - ['disable_5falpha_5fblending_5',['disable_alpha_blending',['../classd__3d__class.html#a971e5902f64a1885238bb94dc071ab18',1,'d_3d_class']]], - ['display_5fplane_5fclass_6',['display_plane_class',['../classdisplay__plane__class.html',1,'']]] -]; +version https://git-lfs.github.com/spec/v1 +oid sha256:8e0dc8152ded38729bb8b06b79b966823632620c7de2a61bbb5a373890261a73 +size 964 diff --git a/doxygen_docs/html/search/all_4.js b/doxygen_docs/html/search/all_4.js index 3ba43fe..c341967 100644 --- a/doxygen_docs/html/search/all_4.js +++ b/doxygen_docs/html/search/all_4.js @@ -1,9 +1,3 @@ -var searchData= -[ - ['ecs_0',['ecs',['../namespaceecs.html',1,'']]], - ['enable_5falpha_5fblending_1',['enable_alpha_blending',['../classd__3d__class.html#a93b990eb289ab87c5e488353b9a90d7c',1,'d_3d_class']]], - ['end_5fscene_2',['end_scene',['../classd__3d__class.html#a0c3bc2a6265c0922ac7fa20264036bb9',1,'d_3d_class']]], - ['entity_3',['Entity',['../classecs_1_1_entity.html',1,'ecs::Entity'],['../classecs_1_1_entity.html#aa505e8d9a076bd37b83e319c33a8fb3e',1,'ecs::Entity::Entity(EntityID id)'],['../classecs_1_1_entity.html#a1cace49b2034c62e076d8e5354a1e15f',1,'ecs::Entity::Entity(const Entity &)=delete'],['../classecs_1_1_entity.html#a318d92a576baeaf8d684fd9ee400ebe8',1,'ecs::Entity::Entity(Entity &&)=default']]], - ['entityid_4',['EntityID',['../namespaceecs.html#af256e267ca18f2601f8e804fd95e9358',1,'ecs']]], - ['entitymanager_5',['EntityManager',['../classecs_1_1_entity_manager.html',1,'ecs::EntityManager'],['../classecs_1_1_entity_manager.html#acba3847d62f7cd79e22d5ffa490c1f53',1,'ecs::EntityManager::EntityManager()']]] -]; +version https://git-lfs.github.com/spec/v1 +oid sha256:f6930d4c7872c27589728b5c0fab2ef51d8d12609787544163580bad2444d6c6 +size 1053 diff --git a/doxygen_docs/html/search/all_5.js b/doxygen_docs/html/search/all_5.js index 6ab8177..308551f 100644 --- a/doxygen_docs/html/search/all_5.js +++ b/doxygen_docs/html/search/all_5.js @@ -1,11 +1,3 @@ -var searchData= -[ - ['face_0',['Face',['../structmodel__class_1_1_face.html',1,'model_class']]], - ['font_5fclass_1',['font_class',['../classfont__class.html',1,'']]], - ['font_5fshader_5fclass_2',['font_shader_class',['../classfont__shader__class.html',1,'']]], - ['fps_5fclass_3',['fps_class',['../classfps__class.html',1,'']]], - ['fps_5flimiter_4',['fps_limiter',['../classfps__limiter.html',1,'fps_limiter'],['../classfps__limiter.html#af20845a17030a3c44b0f7e7fc08c016f',1,'fps_limiter::fps_limiter()']]], - ['frame_5',['frame',['../classapplication__class.html#a0d9b9cbfbe1a2efa52606fcbbdfb40ca',1,'application_class']]], - ['frustum_6',['frustum',['../classfrustum.html',1,'']]], - ['frustumclass_7',['FrustumClass',['../class_frustum_class.html',1,'']]] -]; +version https://git-lfs.github.com/spec/v1 +oid sha256:b4253507dbe9271863f3f03e311e91e6c90d5f48c3d6e5742a377d27c2fda029 +size 765 diff --git a/doxygen_docs/html/search/all_6.js b/doxygen_docs/html/search/all_6.js index 7f41ab6..63d4cae 100644 --- a/doxygen_docs/html/search/all_6.js +++ b/doxygen_docs/html/search/all_6.js @@ -1,78 +1,3 @@ -var searchData= -[ - ['generate_5fterrain_0',['generate_terrain',['../classapplication__class.html#aca20ad22e0c95f5404e3c47a11317025',1,'application_class']]], - ['get_1',['Get',['../class_logger.html#a08e3e1b899767a6d833136c9fb4f15c2',1,'Logger']]], - ['get_5faspect_5fratio_2',['get_aspect_ratio',['../classapplication__class.html#a1bbbc70e5a68278f410e9b2b93942230',1,'application_class']]], - ['get_5fback_5fbuffer_5fsrv_3',['get_back_buffer_srv',['../classapplication__class.html#a0e7b21b1421fd52bb3740fb25f26e4a7',1,'application_class']]], - ['get_5fcan_5ffixed_5fupdate_4',['get_can_fixed_update',['../classapplication__class.html#abf98d275e281e99e54a68d3b53ba7b94',1,'application_class']]], - ['get_5fdevice_5',['get_device',['../classd__3d__class.html#a0979aea3c4bb6815908fbe188fc1c67e',1,'d_3d_class']]], - ['get_5fdevice_5fcontext_6',['get_device_context',['../classd__3d__class.html#a4ad87066c014351689f12981234beadb',1,'d_3d_class']]], - ['get_5fentity_5fmanager_7',['get_entity_manager',['../classapplication__class.html#ab6487040a8f3f90c62eaaeec09504071',1,'application_class']]], - ['get_5ffps_8',['get_fps',['../classapplication__class.html#a8a2103b81e5a5f73ebce656b96467ee3',1,'application_class']]], - ['get_5ffrustum_9',['get_frustum',['../classapplication__class.html#a29f11f9f0ab0f41af7b1b657d9310209',1,'application_class']]], - ['get_5ffrustum_5ftolerance_10',['get_frustum_tolerance',['../classapplication__class.html#aa271ce1d2803a5a1fcd9becad215ecb0',1,'application_class']]], - ['get_5fhwnd_11',['get_hwnd',['../classapplication__class.html#a692f521b7d27a89a95848dd912342c1f',1,'application_class']]], - ['get_5flight_5fcolor_12',['get_light_color',['../classapplication__class.html#a85c04a3f2d050cb750d7986ebc7e76a5',1,'application_class']]], - ['get_5flight_5fposition_13',['get_light_position',['../classapplication__class.html#a54f4915b1878fde4dc60ff26be5712ee',1,'application_class']]], - ['get_5flights_14',['get_lights',['../classapplication__class.html#a9b1ca112e8d8fd01a7061d9a638e9f3e',1,'application_class']]], - ['get_5fmodel_5fcache_15',['get_model_cache',['../classapplication__class.html#a6eff226c2686a261a394b1c046096c5e',1,'application_class']]], - ['get_5fobject_5fid_16',['get_object_id',['../classapplication__class.html#a32624a7be14230d2120de382c2c2e298',1,'application_class']]], - ['get_5fortho_5fmatrix_17',['get_ortho_matrix',['../classd__3d__class.html#aa24cb2be2ecf760dd8ff350e88534130',1,'d_3d_class']]], - ['get_5fphysics_18',['get_physics',['../classapplication__class.html#ab1924a7177c04594ec5dab7fe4c0104f',1,'application_class']]], - ['get_5fphysics_5ftick_5frate_19',['get_physics_tick_rate',['../classapplication__class.html#a118113b8ab8ad1065b032d57150fa7dd',1,'application_class']]], - ['get_5fposition_20',['get_position',['../classcamera__class.html#af416c69abe70579751cd404cba8bf388',1,'camera_class']]], - ['get_5fprojection_5fmatrix_21',['get_projection_matrix',['../classd__3d__class.html#a64893c249b126bdc97f63c00e7c78758',1,'d_3d_class']]], - ['get_5freflection_5ftexture_22',['get_reflection_texture',['../classapplication__class.html#a25592af930b0ee6c34d667fc0f8d69e1',1,'application_class']]], - ['get_5freflection_5fview_5fmatrix_23',['get_reflection_view_matrix',['../classcamera__class.html#ac4d85cc166aec75e54528dc9dee8a075',1,'camera_class']]], - ['get_5frefraction_5ftexture_24',['get_refraction_texture',['../classapplication__class.html#a8d993ac51d86d09c2b03b612ed914a74',1,'application_class']]], - ['get_5frender_5fcount_25',['get_render_count',['../classapplication__class.html#acc0c095b41d72833d974229cc64d0689',1,'application_class']]], - ['get_5frender_5ftexture_26',['get_render_texture',['../classapplication__class.html#a3ec69cb088888911ab1e32490c39f3e6',1,'application_class']]], - ['get_5frotation_27',['get_rotation',['../classcamera__class.html#aa8073c109a536d48478257a3e1e889cd',1,'camera_class']]], - ['get_5fscene_5fpath_28',['get_scene_path',['../classscene__manager.html#ad47f7f853f78ac866a566e6d224066a2',1,'scene_manager']]], - ['get_5fscene_5ftexture_29',['get_scene_texture',['../classapplication__class.html#a69a84a1345d56bb8d81e7d3427ce969e',1,'application_class']]], - ['get_5fscreen_5fheight_30',['get_screen_height',['../classapplication__class.html#a468b1ed714bae99f4f2fcf7a93407bfb',1,'application_class']]], - ['get_5fscreen_5fwidth_31',['get_screen_width',['../classapplication__class.html#ae4bf8de77c3edaac71aaba75193c3be9',1,'application_class']]], - ['get_5fshould_5fquit_32',['get_should_quit',['../classapplication__class.html#afea1cdf2706dc45cdae0396b7948f2b0',1,'application_class']]], - ['get_5fspeed_33',['get_speed',['../classapplication__class.html#ad724a8b8867f487bc602406ae20e1301',1,'application_class']]], - ['get_5fstats_34',['get_stats',['../classapplication__class.html#adfd9213758db871e03aada83dee961b3',1,'application_class']]], - ['get_5fsun_5flight_35',['get_sun_light',['../classapplication__class.html#ad757f3dc7ad49b74643fca7947889ed6',1,'application_class']]], - ['get_5fswap_5fchain_36',['get_swap_chain',['../classd__3d__class.html#aa25b4b30b0ee3160c4d6c86ceeedd70d',1,'d_3d_class']]], - ['get_5fterrain_5fentity_5fcount_37',['get_terrain_entity_count',['../classapplication__class.html#afe1ff7bf39935cae054c8f3743e923e1',1,'application_class']]], - ['get_5fvideo_5fcard_5finfo_38',['get_video_card_info',['../classd__3d__class.html#a7373ca22ab51dd0f8949a917fa057f19',1,'d_3d_class']]], - ['get_5fview_5fmatrix_39',['get_view_matrix',['../classcamera__class.html#ac17736821f337ce7fd52b9857095de68',1,'camera_class']]], - ['get_5fvsync_40',['get_vsync',['../classapplication__class.html#aa79efde57fb87b64bf95b47ee87c3bff',1,'application_class']]], - ['get_5fw_5ffolder_41',['get_w_folder',['../classapplication__class.html#a2f6b5156b585944bb912d93fa1595af2',1,'application_class']]], - ['get_5fwindow_5fsize_42',['get_window_size',['../classapplication__class.html#a3c76d728525b1ee4558a41383f9f2217',1,'application_class']]], - ['get_5fworld_5fmatrix_43',['get_world_matrix',['../classd__3d__class.html#a2a910b75177d248036bb4418038406f1',1,'d_3d_class']]], - ['getacceleration_44',['GetAcceleration',['../classecs_1_1_physics_component.html#ae40284b6a494abd2ad1d8a4bbb641117',1,'ecs::PhysicsComponent']]], - ['getactiveshader_45',['GetActiveShader',['../classecs_1_1_shader_component.html#aad636c8a9e23f0ef494a2fe66d1ae6b4',1,'ecs::ShaderComponent']]], - ['getallentities_46',['GetAllEntities',['../classecs_1_1_entity_manager.html#ad4116858dc1c324cdd558e5ac6c7f21b',1,'ecs::EntityManager']]], - ['getboundingradius_47',['GetBoundingRadius',['../classecs_1_1_physics_component.html#acb77c488322bbb5776e08fd9be5908d7',1,'ecs::PhysicsComponent']]], - ['getcomponent_48',['GetComponent',['../classecs_1_1_entity.html#a1debe96608ed65b741812a9340c52220',1,'ecs::Entity']]], - ['getcomponenttypeid_49',['GetComponentTypeID',['../namespaceecs.html#ae98a9f77225416bebd93a559a68a92eb',1,'ecs']]], - ['getentitieswithcomponent_50',['GetEntitiesWithComponent',['../classecs_1_1_entity_manager.html#a42887acde34ab3d1cd13c0396b053d72',1,'ecs::EntityManager']]], - ['getentity_51',['GetEntity',['../classecs_1_1_entity_manager.html#a79acf6578756702d83d509dbf1fce0d8',1,'ecs::EntityManager']]], - ['getentitycount_52',['GetEntityCount',['../classecs_1_1_entity_manager.html#ad84a022bfad4f381179c1e007d7c9c8a',1,'ecs::EntityManager']]], - ['getid_53',['GetID',['../classecs_1_1_entity.html#a9fab84a0393816b3a911588fc1f7121a',1,'ecs::Entity']]], - ['getid_54',['GetId',['../classecs_1_1_identity_component.html#af7fcece7aaa148512ba153d1d3a4cc1c',1,'ecs::IdentityComponent']]], - ['getindexcount_55',['GetIndexCount',['../classecs_1_1_render_component.html#ae01aca10690322ec92899e99bf5e244e',1,'ecs::RenderComponent']]], - ['getlogbuffer_56',['GetLogBuffer',['../class_logger.html#a0fc50378d880b648733da39e61fa51e3',1,'Logger']]], - ['getloglevelinfo_57',['GetLogLevelInfo',['../class_logger.html#a44f087518b3a028018146b07b2bc8e3b',1,'Logger']]], - ['getmass_58',['GetMass',['../classecs_1_1_physics_component.html#acbe98be444ae347a32951435472e5a28',1,'ecs::PhysicsComponent']]], - ['getmodel_59',['GetModel',['../classecs_1_1_render_component.html#a2797ae01f7f42594a0291529d0ec8ef0',1,'ecs::RenderComponent']]], - ['getmodelfilepath_60',['GetModelFilePath',['../classecs_1_1_render_component.html#aa9bc77dc2ea430ec9008bda7993f766c',1,'ecs::RenderComponent']]], - ['getname_61',['GetName',['../classecs_1_1_identity_component.html#a6f97e89a74db7fda99f144c66c17935f',1,'ecs::IdentityComponent']]], - ['getpath_62',['GetPath',['../classecs_1_1_model_path_component.html#a7996bbc72216b56b0b26cef13acad6cc',1,'ecs::ModelPathComponent']]], - ['getposition_63',['GetPosition',['../classecs_1_1_transform_component.html#a2936d569829c3c440d3bf5bde6353efe',1,'ecs::TransformComponent']]], - ['getpreviousposition_64',['GetPreviousPosition',['../classecs_1_1_physics_component.html#af3e592a83a8145612bea36927c222082',1,'ecs::PhysicsComponent']]], - ['getrotatematrix_65',['GetRotateMatrix',['../classecs_1_1_transform_component.html#aedc64114b30f9aa629caf6548bfc3c07',1,'ecs::TransformComponent']]], - ['getrotation_66',['GetRotation',['../classecs_1_1_transform_component.html#a50130c13fb3f0d01a473eead605aaa40',1,'ecs::TransformComponent']]], - ['getscale_67',['GetScale',['../classecs_1_1_transform_component.html#af5cb7911c9deab8a49c9f8ae3ce099c5',1,'ecs::TransformComponent']]], - ['getscalematrix_68',['GetScaleMatrix',['../classecs_1_1_transform_component.html#aca8c9c9d0266636b7431696a6905b419',1,'ecs::TransformComponent']]], - ['gettexture_69',['GetTexture',['../classecs_1_1_render_component.html#a8d3c778be73e8cbb27b3ea102698a7f2',1,'ecs::RenderComponent']]], - ['gettranslatematrix_70',['GetTranslateMatrix',['../classecs_1_1_transform_component.html#a2c5c5b5d1081b942ab7d5776d4418044',1,'ecs::TransformComponent']]], - ['gettype_71',['GetType',['../classecs_1_1_identity_component.html#abc33d5a325706c7c115b88fd9635a4cd',1,'ecs::IdentityComponent']]], - ['getvelocity_72',['GetVelocity',['../classecs_1_1_physics_component.html#abc1702442a7fa0915f7760b20d5a17ae',1,'ecs::PhysicsComponent']]], - ['getwindowsize_73',['GetWindowSize',['../classimgui_manager.html#a8422f5e3790983a2c878d61968c6a657',1,'imguiManager']]], - ['getworldmatrix_74',['GetWorldMatrix',['../classecs_1_1_transform_component.html#a0d9f3426b6952e0468705820835ac331',1,'ecs::TransformComponent']]] -]; +version https://git-lfs.github.com/spec/v1 +oid sha256:f7fcef2d399925bc9f46e21e7879bdbb6f4a6716e75bbaaf722f2d1c45a302db +size 10396 diff --git a/doxygen_docs/html/search/all_7.js b/doxygen_docs/html/search/all_7.js index 0c92048..803c447 100644 --- a/doxygen_docs/html/search/all_7.js +++ b/doxygen_docs/html/search/all_7.js @@ -1,4 +1,3 @@ -var searchData= -[ - ['hascomponent_0',['HasComponent',['../classecs_1_1_entity.html#a29deb83cc77c7c2466d0f76f7b340869',1,'ecs::Entity']]] -]; +version https://git-lfs.github.com/spec/v1 +oid sha256:fb73cb7417627bf1797e25ea32d27147154b6fc3a8c9dac1824251633e1ea7f0 +size 141 diff --git a/doxygen_docs/html/search/all_8.js b/doxygen_docs/html/search/all_8.js index 1146d94..a8c70a6 100644 --- a/doxygen_docs/html/search/all_8.js +++ b/doxygen_docs/html/search/all_8.js @@ -1,17 +1,3 @@ -var searchData= -[ - ['identitycomponent_0',['IdentityComponent',['../classecs_1_1_identity_component.html',1,'ecs::IdentityComponent'],['../classecs_1_1_identity_component.html#a253122e10cbe22c42831d250d48a8316',1,'ecs::IdentityComponent::IdentityComponent()']]], - ['imguimanager_1',['imguiManager',['../classimgui_manager.html',1,'imguiManager'],['../classimgui_manager.html#ab323084ef02c7df421977b9342edfd5f',1,'imguiManager::imguiManager()']]], - ['imguiwidgetrenderer_2',['ImGuiWidgetRenderer',['../classimgui_manager.html#ad5b5109acef17047334dba7e7aebf3aa',1,'imguiManager']]], - ['initialize_3',['Initialize',['../classecs_1_1_component.html#a9372874f51e5f63584d65fc378d39459',1,'ecs::Component::Initialize()'],['../classecs_1_1_identity_component.html#a04b2bb43ccf6c4842704f30463033b3b',1,'ecs::IdentityComponent::Initialize()'],['../classecs_1_1_model_path_component.html#a8819a3be58b6748ced6763a598e2f7f8',1,'ecs::ModelPathComponent::Initialize()'],['../classecs_1_1_physics_component.html#ab58952fc61030f1047beb2d6dbec82cf',1,'ecs::PhysicsComponent::Initialize()'],['../classecs_1_1_render_component.html#aa92950c4ebad0379f626493bda1a79bb',1,'ecs::RenderComponent::Initialize()'],['../classecs_1_1_shader_component.html#a69a5ca163458465936525b14270fe46e',1,'ecs::ShaderComponent::Initialize()'],['../classimgui_manager.html#a282c73b89df97bffb545dfa618f354ef',1,'imguiManager::Initialize()'],['../class_skybox.html#af048306ba3fc893e485393452e8af429',1,'Skybox::Initialize()']]], - ['initialize_4',['initialize',['../classapplication__class.html#a3be4f6532857c72283450ce43907f309',1,'application_class::initialize()'],['../classd__3d__class.html#aeba928a71d4440004fff00603ed06658',1,'d_3d_class::initialize()'],['../classscene__manager.html#a005af8b21eabedba5230c1c6266794c6',1,'scene_manager::initialize()']]], - ['initializefromfile_5',['InitializeFromFile',['../classecs_1_1_render_component.html#a0aeb040ec34ba3619f08269e5744597e',1,'ecs::RenderComponent']]], - ['initializewithmodel_6',['InitializeWithModel',['../classecs_1_1_render_component.html#a5014687c529c5dd29c1689da1dd64776',1,'ecs::RenderComponent']]], - ['input_7',['input',['../structinput.html',1,'']]], - ['input_5fclass_8',['input_class',['../classinput__class.html',1,'']]], - ['is_5fwindowed_9',['is_windowed',['../classapplication__class.html#aac1577a0fe08e8007980b6b1778da478',1,'application_class']]], - ['isgravityenabled_10',['IsGravityEnabled',['../classecs_1_1_physics_component.html#a29ed13dad5513dff62d8427e856bd74d',1,'ecs::PhysicsComponent']]], - ['isgrounded_11',['IsGrounded',['../classecs_1_1_physics_component.html#ae3438c93efe882c97086e0f9bc2f54dd',1,'ecs::PhysicsComponent']]], - ['isphysicsenabled_12',['IsPhysicsEnabled',['../classecs_1_1_physics_component.html#ab1d2d882d7ff058a67d3e266257edb95',1,'ecs::PhysicsComponent']]], - ['isvisible_13',['IsVisible',['../classecs_1_1_render_component.html#ad77b9089172b2567767aac2ac05118ea',1,'ecs::RenderComponent']]] -]; +version https://git-lfs.github.com/spec/v1 +oid sha256:d1fdd422b366d377a0501c9d83cd8ab8592db8547d233c392e06f7d76085fe6a +size 2964 diff --git a/doxygen_docs/html/search/all_9.js b/doxygen_docs/html/search/all_9.js index 8bef310..e8e0971 100644 --- a/doxygen_docs/html/search/all_9.js +++ b/doxygen_docs/html/search/all_9.js @@ -1,14 +1,3 @@ -var searchData= -[ - ['launchobject_0',['LaunchObject',['../classecs_1_1_physics_component.html#a156fb8329b7b2434ee94ab8c03fdc6e2',1,'ecs::PhysicsComponent']]], - ['light_5fclass_1',['light_class',['../classlight__class.html',1,'']]], - ['light_5fmap_5fshader_5fclass_2',['light_map_shader_class',['../classlight__map__shader__class.html',1,'']]], - ['light_5fshader_5fclass_3',['light_shader_class',['../classlight__shader__class.html',1,'']]], - ['load_5fscene_4',['load_scene',['../classscene__manager.html#a3dbd419184dd60e2ce0d3c660c4fdff2',1,'scene_manager']]], - ['loadtexturesfrompath_5',['LoadTexturesFromPath',['../classecs_1_1_render_component.html#a64e1e92929e2384d09c31b8d2afb258d',1,'ecs::RenderComponent']]], - ['log_6',['Log',['../class_logger.html#a94f47ba0ef38ea7bcf1056f64d2645e4',1,'Logger::Log(const std::string &message, const std::string &fileName, int lineNumber, LogLevel level=LogLevel::Info)'],['../class_logger.html#ac9b431db882705fe2f33687938874676',1,'Logger::Log(const std::string &message, LogLevel level)']]], - ['logentry_7',['LogEntry',['../struct_logger_1_1_log_entry.html',1,'Logger']]], - ['logger_8',['Logger',['../class_logger.html',1,'Logger'],['../class_logger.html#a0d21ab21689125fbb5e91584e4f37baa',1,'Logger::Logger(Logger const &)=delete'],['../class_logger.html#abc41bfb031d896170c7675fa96a6b30c',1,'Logger::Logger()']]], - ['loglevel_9',['LogLevel',['../class_logger.html#ac744681e23720966b5f430ec2060da36',1,'Logger']]], - ['loglevelinfo_10',['LogLevelInfo',['../struct_logger_1_1_log_level_info.html',1,'Logger']]] -]; +version https://git-lfs.github.com/spec/v1 +oid sha256:3b91ef7dd537516da7716a7ffd787bc2c1263d22ff72960f4c24d8bd747ff91a +size 1582 diff --git a/doxygen_docs/html/search/all_a.js b/doxygen_docs/html/search/all_a.js index 165b5ce..554d36f 100644 --- a/doxygen_docs/html/search/all_a.js +++ b/doxygen_docs/html/search/all_a.js @@ -1,10 +1,3 @@ -var searchData= -[ - ['managelogfiles_0',['ManageLogFiles',['../class_logger.html#a62b3e15fa3c170e5090a846fd0e9283e',1,'Logger']]], - ['master_5fshader_1',['master_shader',['../classmaster__shader.html',1,'']]], - ['model_5fclass_2',['model_class',['../classmodel__class.html',1,'']]], - ['modellistclass_3',['ModelListClass',['../class_model_list_class.html',1,'']]], - ['modelpathcomponent_4',['ModelPathComponent',['../classecs_1_1_model_path_component.html',1,'ecs']]], - ['modeltype_5',['ModelType',['../structmodel__class_1_1_model_type.html',1,'model_class']]], - ['multi_5ftexture_5fshader_5fclass_6',['multi_texture_shader_class',['../classmulti__texture__shader__class.html',1,'']]] -]; +version https://git-lfs.github.com/spec/v1 +oid sha256:53b3e584edc11c1b365c30adff31564de19f8e07586193076df86bdf25af1ddf +size 695 diff --git a/doxygen_docs/html/search/all_b.js b/doxygen_docs/html/search/all_b.js index 368041a..6b2a682 100644 --- a/doxygen_docs/html/search/all_b.js +++ b/doxygen_docs/html/search/all_b.js @@ -1,6 +1,3 @@ -var searchData= -[ - ['newframe_0',['NewFrame',['../classimgui_manager.html#ae3d0eda2efd0dadc1aab2384083c941c',1,'imguiManager']]], - ['normal_1',['Normal',['../structmodel__class_1_1_normal.html',1,'model_class']]], - ['normal_5fmap_5fshader_5fclass_2',['normal_map_shader_class',['../classnormal__map__shader__class.html',1,'']]] -]; +version https://git-lfs.github.com/spec/v1 +oid sha256:df045603f0cc83be72388d7992c56c8b9694d8f874a3a89711226a6040805c59 +size 334 diff --git a/doxygen_docs/html/search/all_c.js b/doxygen_docs/html/search/all_c.js index 7081eac..c7ed7fd 100644 --- a/doxygen_docs/html/search/all_c.js +++ b/doxygen_docs/html/search/all_c.js @@ -1,6 +1,3 @@ -var searchData= -[ - ['object_0',['object',['../classobject.html',1,'']]], - ['objecttype_1',['ObjectType',['../namespaceecs.html#ab36dd172176a3da5558233694cbad4ae',1,'ecs']]], - ['objecttypetostring_2',['ObjectTypeToString',['../classecs_1_1_identity_component.html#a46f22b04d81b17bea5807d5b9d32b328',1,'ecs::IdentityComponent']]] -]; +version https://git-lfs.github.com/spec/v1 +oid sha256:558aafc1067bb7a7c82dd8c503875b83316e00e60c9b2d34970ccc9eaee2424f +size 334 diff --git a/doxygen_docs/html/search/all_d.js b/doxygen_docs/html/search/all_d.js index 122aa11..3be9c31 100644 --- a/doxygen_docs/html/search/all_d.js +++ b/doxygen_docs/html/search/all_d.js @@ -1,7 +1,3 @@ -var searchData= -[ - ['physics_0',['physics',['../classphysics.html',1,'']]], - ['physics_5fthread_5ffunction_1',['physics_thread_function',['../classapplication__class.html#aa583e172e6a2d45cb9b4841634b9eea4',1,'application_class']]], - ['physicscomponent_2',['PhysicsComponent',['../classecs_1_1_physics_component.html',1,'ecs::PhysicsComponent'],['../classecs_1_1_physics_component.html#a13c45de519868a3e035fc8a3cb4c3da0',1,'ecs::PhysicsComponent::PhysicsComponent()']]], - ['position_5fclass_3',['position_class',['../classposition__class.html',1,'']]] -]; +version https://git-lfs.github.com/spec/v1 +oid sha256:ace6065ce9d140958fc97067ef546fb5011ef2aee1d24d88db51cb2048e18fba +size 558 diff --git a/doxygen_docs/html/search/all_e.js b/doxygen_docs/html/search/all_e.js index 77c47c5..0b051c0 100644 --- a/doxygen_docs/html/search/all_e.js +++ b/doxygen_docs/html/search/all_e.js @@ -1,18 +1,3 @@ -var searchData= -[ - ['reflection_5fshader_5fclass_0',['reflection_shader_class',['../classreflection__shader__class.html',1,'']]], - ['refraction_5fshader_5fclass_1',['refraction_shader_class',['../classrefraction__shader__class.html',1,'']]], - ['release_5fresources_2',['release_resources',['../classd__3d__class.html#a17c8aa0768ac5005f1e9cb27dac70a0e',1,'d_3d_class']]], - ['removecomponent_3',['RemoveComponent',['../classecs_1_1_entity.html#a87fe0ec023ff9df7bcfff0eb13a90bb7',1,'ecs::Entity']]], - ['render_4',['Render',['../classecs_1_1_render_component.html#a61dc5966b89474a415e3d19d28760a64',1,'ecs::RenderComponent::Render()'],['../classimgui_manager.html#aec282a32a74a9153697b66e47d683b3d',1,'imguiManager::Render()']]], - ['render_5',['render',['../classcamera__class.html#a0820187f209f9628e6b2a8af34d71057',1,'camera_class']]], - ['render_5freflection_6',['render_reflection',['../classcamera__class.html#a58b36223405de07000d108129c998075',1,'camera_class']]], - ['render_5ftexture_5fclass_7',['render_texture_class',['../classrender__texture__class.html',1,'']]], - ['renderallentities_8',['RenderAllEntities',['../classecs_1_1_render_system.html#a8d65c73dad3be4070153c3f568d5a139',1,'ecs::RenderSystem']]], - ['rendercomponent_9',['RenderComponent',['../classecs_1_1_render_component.html',1,'ecs::RenderComponent'],['../classecs_1_1_render_component.html#a9b8099cc84f4ca11f9cfca7d80081d6b',1,'ecs::RenderComponent::RenderComponent()']]], - ['renderentity_10',['RenderEntity',['../classecs_1_1_render_system.html#aef4d62c3ef06a880712d183a2848de2f',1,'ecs::RenderSystem']]], - ['rendersystem_11',['RenderSystem',['../classecs_1_1_render_system.html',1,'ecs::RenderSystem'],['../classecs_1_1_render_system.html#a4db69fd99c18112dcbaa931a01bb9780',1,'ecs::RenderSystem::RenderSystem()']]], - ['reset_5fresources_12',['reset_resources',['../classd__3d__class.html#a1d13282bf58145a96b3a77285b075a7a',1,'d_3d_class']]], - ['reset_5fviewport_13',['reset_viewport',['../classd__3d__class.html#a63f75e9982d09b8cd8d06a1f79c01246',1,'d_3d_class']]], - ['resize_5fswap_5fchain_14',['resize_swap_chain',['../classd__3d__class.html#a953be067f947e9be5b6fbdf1ac35bb60',1,'d_3d_class']]] -]; +version https://git-lfs.github.com/spec/v1 +oid sha256:b73fdd9f88e486e1714fafd8d6c27c06f6435df2c7a3d4797f637a40dc175c9b +size 2187 diff --git a/doxygen_docs/html/search/all_f.js b/doxygen_docs/html/search/all_f.js index 42c831a..77606c8 100644 --- a/doxygen_docs/html/search/all_f.js +++ b/doxygen_docs/html/search/all_f.js @@ -1,72 +1,3 @@ -var searchData= -[ - ['save_5fscene_0',['save_scene',['../classscene__manager.html#a7c221340be779b7e1cac9a54ec7a87d0',1,'scene_manager']]], - ['save_5fscene_5fas_1',['save_scene_as',['../classscene__manager.html#aa09ff2f050320a30b65bda4f162ace2c',1,'scene_manager']]], - ['scene_5fmanager_2',['scene_manager',['../classscene__manager.html',1,'']]], - ['scenemanager_3',['sceneManager',['../classscene_manager.html',1,'']]], - ['set_5fback_5fbuffer_5frender_5ftarget_4',['set_back_buffer_render_target',['../classd__3d__class.html#a2e36ee106e2d9066c96ded6a3e97ac0c',1,'d_3d_class']]], - ['set_5fcan_5ffixed_5fupdate_5',['set_can_fixed_update',['../classapplication__class.html#aa0a44059eae0a8df0cb65a7962d598ed',1,'application_class']]], - ['set_5fcel_5fshading_6',['set_cel_shading',['../classapplication__class.html#a1bdce1b8c5a23cd60dd35c441a670601',1,'application_class']]], - ['set_5ffrustum_7',['set_frustum',['../classapplication__class.html#abd47278db9d786b80833c787900c145b',1,'application_class']]], - ['set_5ffrustum_5ftolerance_8',['set_frustum_tolerance',['../classapplication__class.html#a2f41c2a8f5f18aca2859b02e804c7a1a',1,'application_class']]], - ['set_5fhwnd_9',['set_hwnd',['../classapplication__class.html#a40392869f0ff57982fef8098dd3354fe',1,'application_class']]], - ['set_5flight_5fcolor_10',['set_light_color',['../classapplication__class.html#a79b165193754e7361b0a467f5e70c72b',1,'application_class']]], - ['set_5flight_5fposition_11',['set_light_position',['../classapplication__class.html#a1715fe1c06659636399b60e859e6b2ae',1,'application_class']]], - ['set_5fobject_5fid_12',['set_object_id',['../classapplication__class.html#ae586e8e9431b6d6168c335a9ae0f08ca',1,'application_class']]], - ['set_5fpath_13',['set_path',['../classapplication__class.html#a4ead7c7ba402fb9619000d201c0cf95f',1,'application_class']]], - ['set_5fphysics_5ftick_5frate_14',['set_physics_tick_rate',['../classapplication__class.html#a8b03fc0a380762e268606262914e55a8',1,'application_class']]], - ['set_5fposition_15',['set_position',['../classcamera__class.html#a4b9ac7f98297d2007abd1ed3d326d381',1,'camera_class']]], - ['set_5frender_5fcount_16',['set_render_count',['../classapplication__class.html#a1f607939202c0cb805df935eb38dabe7',1,'application_class']]], - ['set_5frotation_17',['set_rotation',['../classcamera__class.html#a410c4bbfd5ba10d0785f5ac9178f9b3f',1,'camera_class']]], - ['set_5fscreen_5fheight_18',['set_screen_height',['../classapplication__class.html#ae5ed92985e95d9f34a152cae2d7345d7',1,'application_class']]], - ['set_5fscreen_5fwidth_19',['set_screen_width',['../classapplication__class.html#aca66fefd8c7c473e2700a69f13a4cb6b',1,'application_class']]], - ['set_5fshould_5fquit_20',['set_should_quit',['../classapplication__class.html#a96068cd56a5bb2ed0c02db3b70272be2',1,'application_class']]], - ['set_5fspeed_21',['set_speed',['../classapplication__class.html#a7b1a11759ecc6b80542c7f4f3cf4e8e9',1,'application_class']]], - ['set_5fvsync_22',['set_vsync',['../classapplication__class.html#a642858510be15dc3d2890ccc5f6df31f',1,'application_class::set_vsync()'],['../classd__3d__class.html#ab0f3edaca84f6371ebbdb6291a60b59c',1,'d_3d_class::set_vsync()']]], - ['set_5fw_5ffolder_23',['set_w_folder',['../classapplication__class.html#a5dbf967cc3d2a08b07c13b6aa44fafe1',1,'application_class']]], - ['set_5fwindow_5fsize_24',['set_window_size',['../classapplication__class.html#ab0418282e11e00cebb3a63747384a24b',1,'application_class']]], - ['set_5fwindowed_25',['set_windowed',['../classapplication__class.html#a7faa4a3a5150086acaec8bc223a4bf7e',1,'application_class']]], - ['setacceleration_26',['SetAcceleration',['../classecs_1_1_physics_component.html#a462dd9f0b3452e9c98d5dea7d9959f50',1,'ecs::PhysicsComponent']]], - ['setactiveshader_27',['SetActiveShader',['../classecs_1_1_shader_component.html#a4664380323123817e65900a12fa9496f',1,'ecs::ShaderComponent']]], - ['setapp_28',['SetApp',['../classimgui_manager.html#a958907b5ec5b0a928a98198af01a4c46',1,'imguiManager']]], - ['setboundingradius_29',['SetBoundingRadius',['../classecs_1_1_physics_component.html#ab95922862da80f63814d47f8c2b69cea',1,'ecs::PhysicsComponent']]], - ['setgravityenabled_30',['SetGravityEnabled',['../classecs_1_1_physics_component.html#a19fa3fa510051cc0d8a0ddb21e92f9fe',1,'ecs::PhysicsComponent']]], - ['setgrounded_31',['SetGrounded',['../classecs_1_1_physics_component.html#ab750af34ccb7fd9f2cb4cea2c7a9a253',1,'ecs::PhysicsComponent']]], - ['setid_32',['SetId',['../classecs_1_1_identity_component.html#a69797f6d9f9926293d2e0b4e84e3bbb3',1,'ecs::IdentityComponent']]], - ['setmass_33',['SetMass',['../classecs_1_1_physics_component.html#af091ab5887798b0407700d4712795a0c',1,'ecs::PhysicsComponent']]], - ['setmodel_34',['SetModel',['../classecs_1_1_render_component.html#ab3a01e06c359132815a5a35ed950a19a',1,'ecs::RenderComponent']]], - ['setmodelfilepath_35',['SetModelFilePath',['../classecs_1_1_render_component.html#acac2902002c2ca0618c41525d1584088',1,'ecs::RenderComponent']]], - ['setname_36',['SetName',['../classecs_1_1_identity_component.html#aa04b3e5f2e40271ba50dfd35c3217013',1,'ecs::IdentityComponent']]], - ['setpath_37',['SetPath',['../classecs_1_1_model_path_component.html#aeef7076b697463196a2ce5440ca10f89',1,'ecs::ModelPathComponent']]], - ['setphysicsenabled_38',['SetPhysicsEnabled',['../classecs_1_1_physics_component.html#afb716a1474b17b0bcf1c4eb7b6f3c758',1,'ecs::PhysicsComponent']]], - ['setposition_39',['SetPosition',['../classecs_1_1_transform_component.html#ad825453d2a065640aa71618c00612249',1,'ecs::TransformComponent']]], - ['setpreviousposition_40',['SetPreviousPosition',['../classecs_1_1_physics_component.html#a9fd15ccd7dfe9955116ac5d52e01a6e7',1,'ecs::PhysicsComponent']]], - ['setrotatematrix_41',['SetRotateMatrix',['../classecs_1_1_transform_component.html#a5d868ff759cb7709328938681d62f913',1,'ecs::TransformComponent']]], - ['setrotation_42',['SetRotation',['../classecs_1_1_transform_component.html#a67f155836cd31a336324bb1ea4b3741a',1,'ecs::TransformComponent']]], - ['setscale_43',['SetScale',['../classecs_1_1_transform_component.html#ac98d110ada557fce53563306700516b7',1,'ecs::TransformComponent']]], - ['setscalematrix_44',['SetScaleMatrix',['../classecs_1_1_transform_component.html#aa1d23303805dd960452dd16a5c077835',1,'ecs::TransformComponent']]], - ['settranslatematrix_45',['SetTranslateMatrix',['../classecs_1_1_transform_component.html#ae6c18c31f088f065f059b490773b3a08',1,'ecs::TransformComponent']]], - ['settype_46',['SetType',['../classecs_1_1_identity_component.html#a7cbca5e7e2c877b45c900df4660c0e35',1,'ecs::IdentityComponent']]], - ['setupdatepositioncallback_47',['SetUpdatePositionCallback',['../classecs_1_1_physics_component.html#a93d17ee763b557489210f35b54829976',1,'ecs::PhysicsComponent']]], - ['setupdockspace_48',['SetupDockspace',['../classimgui_manager.html#a1496a85b51414a2d6fdbfa6bd53414ea',1,'imguiManager']]], - ['setvelocity_49',['SetVelocity',['../classecs_1_1_physics_component.html#a5a4f3b4503ce9b199da87f5e11673501',1,'ecs::PhysicsComponent']]], - ['setvisible_50',['SetVisible',['../classecs_1_1_render_component.html#ae0beed54f3cfe42213e1767da1b36d46',1,'ecs::RenderComponent']]], - ['setwindowsize_51',['SetWindowSize',['../classimgui_manager.html#a7342adf62f12e139de6fbe6399ff7129',1,'imguiManager']]], - ['shader_5fmanager_5fclass_52',['shader_manager_class',['../classshader__manager__class.html',1,'']]], - ['shadercomponent_53',['ShaderComponent',['../classecs_1_1_shader_component.html',1,'ecs::ShaderComponent'],['../classecs_1_1_shader_component.html#a58198e14a710f43735b0e22d5f9d8296',1,'ecs::ShaderComponent::ShaderComponent()']]], - ['shadertype_54',['ShaderType',['../namespaceecs.html#a80994feeebc2747495a80b5d4b2a8440',1,'ecs']]], - ['shadertypetostring_55',['ShaderTypeToString',['../classecs_1_1_shader_component.html#a08335ddbedf7eecadcd0db95c4d45c63',1,'ecs::ShaderComponent']]], - ['shadow_5fmap_56',['shadow_map',['../classshadow__map.html',1,'']]], - ['should_5frun_57',['should_run',['../classfps__limiter.html#ad0ce9120462473ec9ee26df5f5fb13cf',1,'fps_limiter']]], - ['shutdown_58',['Shutdown',['../classimgui_manager.html#af6a2337e560cfd2fa52605f52e4e2d25',1,'imguiManager']]], - ['shutdown_59',['shutdown',['../classapplication__class.html#af2ef20892819f21303002a0f3005e73d',1,'application_class::shutdown()'],['../classd__3d__class.html#ac6f9c4ea768ab32707ddb7a095ca60b3',1,'d_3d_class::shutdown()'],['../classscene__manager.html#aa7f5a91b60edcbee862b5a2b173b8713',1,'scene_manager::shutdown()']]], - ['skybox_60',['Skybox',['../class_skybox.html',1,'Skybox'],['../class_skybox.html#a77a92db4492ed94ed4bd101b05ffb1f4',1,'Skybox::Skybox()']]], - ['skybox_5fshader_5fclass_61',['skybox_shader_class',['../classskybox__shader__class.html',1,'']]], - ['spec_5fmap_5fshader_5fclass_62',['spec_map_shader_class',['../classspec__map__shader__class.html',1,'']]], - ['sprite_5fclass_63',['sprite_class',['../classsprite__class.html',1,'']]], - ['stats_64',['stats',['../classstats.html',1,'']]], - ['stringtoobjecttype_65',['StringToObjectType',['../classecs_1_1_identity_component.html#a9a92b2a27ec5399096a3ad196d2dec3f',1,'ecs::IdentityComponent']]], - ['stringtoshadertype_66',['StringToShaderType',['../classecs_1_1_shader_component.html#abd16c8adfd191f96594716b235780950',1,'ecs::ShaderComponent']]], - ['sunlight_5fshader_5fclass_67',['sunlight_shader_class',['../classsunlight__shader__class.html',1,'']]], - ['system_5fclass_68',['system_class',['../classsystem__class.html',1,'']]] -]; +version https://git-lfs.github.com/spec/v1 +oid sha256:d7c878b07f38e59cf1f691c597d7cd53e5b8246a873a1a997deb128b6acaa690 +size 9507 diff --git a/doxygen_docs/html/search/classes_0.js b/doxygen_docs/html/search/classes_0.js index 917478f..0c369c9 100644 --- a/doxygen_docs/html/search/classes_0.js +++ b/doxygen_docs/html/search/classes_0.js @@ -1,5 +1,3 @@ -var searchData= -[ - ['alpha_5fmap_5fshader_5fclass_0',['alpha_map_shader_class',['../classalpha__map__shader__class.html',1,'']]], - ['application_5fclass_1',['application_class',['../classapplication__class.html',1,'']]] -]; +version https://git-lfs.github.com/spec/v1 +oid sha256:885af512a0e739e2ed1071b25fe72d78ce8d45f70b42c4449e3908193e98c7e8 +size 225 diff --git a/doxygen_docs/html/search/classes_1.js b/doxygen_docs/html/search/classes_1.js index adf833d..ce08064 100644 --- a/doxygen_docs/html/search/classes_1.js +++ b/doxygen_docs/html/search/classes_1.js @@ -1,4 +1,3 @@ -var searchData= -[ - ['bitmap_5fclass_0',['bitmap_class',['../classbitmap__class.html',1,'']]] -]; +version https://git-lfs.github.com/spec/v1 +oid sha256:b33df0eb19a89b7d7bb7135286dd5ccac185b46c4b8d6bd3ac17614c07f6458a +size 97 diff --git a/doxygen_docs/html/search/classes_10.js b/doxygen_docs/html/search/classes_10.js index 6c1f328..6962129 100644 --- a/doxygen_docs/html/search/classes_10.js +++ b/doxygen_docs/html/search/classes_10.js @@ -1,5 +1,3 @@ -var searchData= -[ - ['water_5fshader_5fclass_0',['water_shader_class',['../classwater__shader__class.html',1,'']]], - ['widget_5fentry_1',['widget_entry',['../structwidget__entry.html',1,'']]] -]; +version https://git-lfs.github.com/spec/v1 +oid sha256:0f9a69ebfae0277338e0f23b852a465a55e9761950b77a19d8967a92f9b6360c +size 196 diff --git a/doxygen_docs/html/search/classes_2.js b/doxygen_docs/html/search/classes_2.js index fb4384a..0cbe627 100644 --- a/doxygen_docs/html/search/classes_2.js +++ b/doxygen_docs/html/search/classes_2.js @@ -1,7 +1,3 @@ -var searchData= -[ - ['camera_5fclass_0',['camera_class',['../classcamera__class.html',1,'']]], - ['celshade_5fclass_1',['celshade_class',['../classcelshade__class.html',1,'']]], - ['color_5fshader_5fclass_2',['color_shader_class',['../classcolor__shader__class.html',1,'']]], - ['component_3',['Component',['../classecs_1_1_component.html',1,'ecs']]] -]; +version https://git-lfs.github.com/spec/v1 +oid sha256:45ef207f19f2b5a2a8887a6cebc2f7144e10c02008ed7c9c8cc66f017be785a2 +size 354 diff --git a/doxygen_docs/html/search/classes_3.js b/doxygen_docs/html/search/classes_3.js index 5dfa8ef..526fa61 100644 --- a/doxygen_docs/html/search/classes_3.js +++ b/doxygen_docs/html/search/classes_3.js @@ -1,6 +1,3 @@ -var searchData= -[ - ['d_5f3d_5fclass_0',['d_3d_class',['../classd__3d__class.html',1,'']]], - ['depth_5fshader_5fclass_1',['depth_shader_class',['../classdepth__shader__class.html',1,'']]], - ['display_5fplane_5fclass_2',['display_plane_class',['../classdisplay__plane__class.html',1,'']]] -]; +version https://git-lfs.github.com/spec/v1 +oid sha256:8cc0da1674070517733f252c8ce9dc08c4348d7f8e73d52e175c737240877de4 +size 293 diff --git a/doxygen_docs/html/search/classes_4.js b/doxygen_docs/html/search/classes_4.js index 31a04a8..94a05d6 100644 --- a/doxygen_docs/html/search/classes_4.js +++ b/doxygen_docs/html/search/classes_4.js @@ -1,5 +1,3 @@ -var searchData= -[ - ['entity_0',['Entity',['../classecs_1_1_entity.html',1,'ecs']]], - ['entitymanager_1',['EntityManager',['../classecs_1_1_entity_manager.html',1,'ecs']]] -]; +version https://git-lfs.github.com/spec/v1 +oid sha256:c0afa8010c26c673400de771723de050e7bb0ebc0ea2cd9257e02996406edf93 +size 176 diff --git a/doxygen_docs/html/search/classes_5.js b/doxygen_docs/html/search/classes_5.js index 347efab..1427932 100644 --- a/doxygen_docs/html/search/classes_5.js +++ b/doxygen_docs/html/search/classes_5.js @@ -1,10 +1,3 @@ -var searchData= -[ - ['face_0',['Face',['../structmodel__class_1_1_face.html',1,'model_class']]], - ['font_5fclass_1',['font_class',['../classfont__class.html',1,'']]], - ['font_5fshader_5fclass_2',['font_shader_class',['../classfont__shader__class.html',1,'']]], - ['fps_5fclass_3',['fps_class',['../classfps__class.html',1,'']]], - ['fps_5flimiter_4',['fps_limiter',['../classfps__limiter.html',1,'']]], - ['frustum_5',['frustum',['../classfrustum.html',1,'']]], - ['frustumclass_6',['FrustumClass',['../class_frustum_class.html',1,'']]] -]; +version https://git-lfs.github.com/spec/v1 +oid sha256:306353eeca9faaf988ff342a16e7cc7b76b59ae9d32bdd98ea69b72d3940d091 +size 542 diff --git a/doxygen_docs/html/search/classes_6.js b/doxygen_docs/html/search/classes_6.js index 05adfbf..680fd2a 100644 --- a/doxygen_docs/html/search/classes_6.js +++ b/doxygen_docs/html/search/classes_6.js @@ -1,7 +1,3 @@ -var searchData= -[ - ['identitycomponent_0',['IdentityComponent',['../classecs_1_1_identity_component.html',1,'ecs']]], - ['imguimanager_1',['imguiManager',['../classimgui_manager.html',1,'']]], - ['input_2',['input',['../structinput.html',1,'']]], - ['input_5fclass_3',['input_class',['../classinput__class.html',1,'']]] -]; +version https://git-lfs.github.com/spec/v1 +oid sha256:caa8eb3541f7e8934abf662bdbd9820f2fbcb1e7209f4cd4d75c5797138487f8 +size 324 diff --git a/doxygen_docs/html/search/classes_7.js b/doxygen_docs/html/search/classes_7.js index 81a478f..57498fc 100644 --- a/doxygen_docs/html/search/classes_7.js +++ b/doxygen_docs/html/search/classes_7.js @@ -1,9 +1,3 @@ -var searchData= -[ - ['light_5fclass_0',['light_class',['../classlight__class.html',1,'']]], - ['light_5fmap_5fshader_5fclass_1',['light_map_shader_class',['../classlight__map__shader__class.html',1,'']]], - ['light_5fshader_5fclass_2',['light_shader_class',['../classlight__shader__class.html',1,'']]], - ['logentry_3',['LogEntry',['../struct_logger_1_1_log_entry.html',1,'Logger']]], - ['logger_4',['Logger',['../class_logger.html',1,'']]], - ['loglevelinfo_5',['LogLevelInfo',['../struct_logger_1_1_log_level_info.html',1,'Logger']]] -]; +version https://git-lfs.github.com/spec/v1 +oid sha256:8080925a59d078ec5dbfd69fa630b92c8ce4219e414e2e5ab68675e86a04c625 +size 539 diff --git a/doxygen_docs/html/search/classes_8.js b/doxygen_docs/html/search/classes_8.js index 7565429..48bd671 100644 --- a/doxygen_docs/html/search/classes_8.js +++ b/doxygen_docs/html/search/classes_8.js @@ -1,9 +1,3 @@ -var searchData= -[ - ['master_5fshader_0',['master_shader',['../classmaster__shader.html',1,'']]], - ['model_5fclass_1',['model_class',['../classmodel__class.html',1,'']]], - ['modellistclass_2',['ModelListClass',['../class_model_list_class.html',1,'']]], - ['modelpathcomponent_3',['ModelPathComponent',['../classecs_1_1_model_path_component.html',1,'ecs']]], - ['modeltype_4',['ModelType',['../structmodel__class_1_1_model_type.html',1,'model_class']]], - ['multi_5ftexture_5fshader_5fclass_5',['multi_texture_shader_class',['../classmulti__texture__shader__class.html',1,'']]] -]; +version https://git-lfs.github.com/spec/v1 +oid sha256:ec350a1882011bb697074c02cbccfa02fd5bfe8e17905d85d637199809c68802 +size 582 diff --git a/doxygen_docs/html/search/classes_9.js b/doxygen_docs/html/search/classes_9.js index 4393976..35f5d15 100644 --- a/doxygen_docs/html/search/classes_9.js +++ b/doxygen_docs/html/search/classes_9.js @@ -1,5 +1,3 @@ -var searchData= -[ - ['normal_0',['Normal',['../structmodel__class_1_1_normal.html',1,'model_class']]], - ['normal_5fmap_5fshader_5fclass_1',['normal_map_shader_class',['../classnormal__map__shader__class.html',1,'']]] -]; +version https://git-lfs.github.com/spec/v1 +oid sha256:4e1f238d3eb86153152d1522d4a81a75eab7ef1cb68598b850579eb3479d100a +size 221 diff --git a/doxygen_docs/html/search/classes_a.js b/doxygen_docs/html/search/classes_a.js index fc6136d..314fa9c 100644 --- a/doxygen_docs/html/search/classes_a.js +++ b/doxygen_docs/html/search/classes_a.js @@ -1,4 +1,3 @@ -var searchData= -[ - ['object_0',['object',['../classobject.html',1,'']]] -]; +version https://git-lfs.github.com/spec/v1 +oid sha256:8f46df4b511385e81df023a84b69cf37933ab0a080bd11e5da3e4ab3aa8ad35d +size 76 diff --git a/doxygen_docs/html/search/classes_b.js b/doxygen_docs/html/search/classes_b.js index 1c2a9dc..6c6ed8c 100644 --- a/doxygen_docs/html/search/classes_b.js +++ b/doxygen_docs/html/search/classes_b.js @@ -1,6 +1,3 @@ -var searchData= -[ - ['physics_0',['physics',['../classphysics.html',1,'']]], - ['physicscomponent_1',['PhysicsComponent',['../classecs_1_1_physics_component.html',1,'ecs']]], - ['position_5fclass_2',['position_class',['../classposition__class.html',1,'']]] -]; +version https://git-lfs.github.com/spec/v1 +oid sha256:996f9ce00b0e837ee6474de5dbc41f372f52e797907b5c3be2dfcf3ebf28227f +size 260 diff --git a/doxygen_docs/html/search/classes_c.js b/doxygen_docs/html/search/classes_c.js index 94b2c12..b446b27 100644 --- a/doxygen_docs/html/search/classes_c.js +++ b/doxygen_docs/html/search/classes_c.js @@ -1,8 +1,3 @@ -var searchData= -[ - ['reflection_5fshader_5fclass_0',['reflection_shader_class',['../classreflection__shader__class.html',1,'']]], - ['refraction_5fshader_5fclass_1',['refraction_shader_class',['../classrefraction__shader__class.html',1,'']]], - ['render_5ftexture_5fclass_2',['render_texture_class',['../classrender__texture__class.html',1,'']]], - ['rendercomponent_3',['RenderComponent',['../classecs_1_1_render_component.html',1,'ecs']]], - ['rendersystem_4',['RenderSystem',['../classecs_1_1_render_system.html',1,'ecs']]] -]; +version https://git-lfs.github.com/spec/v1 +oid sha256:0e52980bffdbe2eb0a421619d863585f7eac58d1390e436d0062ebbc0e394c8d +size 531 diff --git a/doxygen_docs/html/search/classes_d.js b/doxygen_docs/html/search/classes_d.js index c11b3b9..3519255 100644 --- a/doxygen_docs/html/search/classes_d.js +++ b/doxygen_docs/html/search/classes_d.js @@ -1,15 +1,3 @@ -var searchData= -[ - ['scene_5fmanager_0',['scene_manager',['../classscene__manager.html',1,'']]], - ['scenemanager_1',['sceneManager',['../classscene_manager.html',1,'']]], - ['shader_5fmanager_5fclass_2',['shader_manager_class',['../classshader__manager__class.html',1,'']]], - ['shadercomponent_3',['ShaderComponent',['../classecs_1_1_shader_component.html',1,'ecs']]], - ['shadow_5fmap_4',['shadow_map',['../classshadow__map.html',1,'']]], - ['skybox_5',['Skybox',['../class_skybox.html',1,'']]], - ['skybox_5fshader_5fclass_6',['skybox_shader_class',['../classskybox__shader__class.html',1,'']]], - ['spec_5fmap_5fshader_5fclass_7',['spec_map_shader_class',['../classspec__map__shader__class.html',1,'']]], - ['sprite_5fclass_8',['sprite_class',['../classsprite__class.html',1,'']]], - ['stats_9',['stats',['../classstats.html',1,'']]], - ['sunlight_5fshader_5fclass_10',['sunlight_shader_class',['../classsunlight__shader__class.html',1,'']]], - ['system_5fclass_11',['system_class',['../classsystem__class.html',1,'']]] -]; +version https://git-lfs.github.com/spec/v1 +oid sha256:b48dabc4169081da1f92bbab342861de56d8ee4934837b67c8103156418ee0d4 +size 1029 diff --git a/doxygen_docs/html/search/classes_e.js b/doxygen_docs/html/search/classes_e.js index 8b18942..c029fcf 100644 --- a/doxygen_docs/html/search/classes_e.js +++ b/doxygen_docs/html/search/classes_e.js @@ -1,13 +1,3 @@ -var searchData= -[ - ['tempvertextype_0',['TempVertexType',['../structmodel__class_1_1_temp_vertex_type.html',1,'model_class']]], - ['text_5fclass_1',['text_class',['../classtext__class.html',1,'']]], - ['texture_2',['Texture',['../structmodel__class_1_1_texture.html',1,'model_class']]], - ['texture_5fclass_3',['texture_class',['../classtexture__class.html',1,'']]], - ['texture_5fshader_5fclass_4',['texture_shader_class',['../classtexture__shader__class.html',1,'']]], - ['texturecontainer_5',['TextureContainer',['../struct_texture_container.html',1,'']]], - ['timer_5fclass_6',['timer_class',['../classtimer__class.html',1,'']]], - ['transformcomponent_7',['TransformComponent',['../classecs_1_1_transform_component.html',1,'ecs']]], - ['translate_5fshader_5fclass_8',['translate_shader_class',['../classtranslate__shader__class.html',1,'']]], - ['transparent_5fshader_5fclass_9',['transparent_shader_class',['../classtransparent__shader__class.html',1,'']]] -]; +version https://git-lfs.github.com/spec/v1 +oid sha256:f76d31b3ec913c4b9c64ded14b63e3ff786b0135fe2baa7bdd7a75c05c14e907 +size 967 diff --git a/doxygen_docs/html/search/classes_f.js b/doxygen_docs/html/search/classes_f.js index 66e397b..894bd0b 100644 --- a/doxygen_docs/html/search/classes_f.js +++ b/doxygen_docs/html/search/classes_f.js @@ -1,6 +1,3 @@ -var searchData= -[ - ['vectortype_0',['VectorType',['../structmodel__class_1_1_vector_type.html',1,'model_class']]], - ['vertex_1',['Vertex',['../structmodel__class_1_1_vertex.html',1,'model_class']]], - ['vertextype_2',['VertexType',['../structmodel__class_1_1_vertex_type.html',1,'model_class']]] -]; +version https://git-lfs.github.com/spec/v1 +oid sha256:238cd994726153369b43df39e723271b6f44389b80290809f5dc77c1443930e3 +size 301 diff --git a/doxygen_docs/html/search/close.svg b/doxygen_docs/html/search/close.svg index 337d6cc..fc63d59 100644 --- a/doxygen_docs/html/search/close.svg +++ b/doxygen_docs/html/search/close.svg @@ -1,18 +1,3 @@ - - - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:0fca47408229664b0ceb6abd29c94dda65696baffebc9c930e4fba0382488117 +size 947 diff --git a/doxygen_docs/html/search/enums_0.js b/doxygen_docs/html/search/enums_0.js index 3a70541..65fa718 100644 --- a/doxygen_docs/html/search/enums_0.js +++ b/doxygen_docs/html/search/enums_0.js @@ -1,4 +1,3 @@ -var searchData= -[ - ['loglevel_0',['LogLevel',['../class_logger.html#ac744681e23720966b5f430ec2060da36',1,'Logger']]] -]; +version https://git-lfs.github.com/spec/v1 +oid sha256:d400081fbb066ff2970886e3acbe8975003761ce885dc3665b7e533f79dcba6d +size 121 diff --git a/doxygen_docs/html/search/enums_1.js b/doxygen_docs/html/search/enums_1.js index 81023c1..9e99388 100644 --- a/doxygen_docs/html/search/enums_1.js +++ b/doxygen_docs/html/search/enums_1.js @@ -1,4 +1,3 @@ -var searchData= -[ - ['objecttype_0',['ObjectType',['../namespaceecs.html#ab36dd172176a3da5558233694cbad4ae',1,'ecs']]] -]; +version https://git-lfs.github.com/spec/v1 +oid sha256:331c4b0b9af29c3f1356884b19562c2d184bc5c09cb2896916d6d377817f6ec9 +size 122 diff --git a/doxygen_docs/html/search/enums_2.js b/doxygen_docs/html/search/enums_2.js index ce5c1ab..8a1f110 100644 --- a/doxygen_docs/html/search/enums_2.js +++ b/doxygen_docs/html/search/enums_2.js @@ -1,4 +1,3 @@ -var searchData= -[ - ['shadertype_0',['ShaderType',['../namespaceecs.html#a80994feeebc2747495a80b5d4b2a8440',1,'ecs']]] -]; +version https://git-lfs.github.com/spec/v1 +oid sha256:6ba179fbf7692ef9cddb732c35a8340346a371d4d926d32daaea479d9545fe59 +size 122 diff --git a/doxygen_docs/html/search/enums_3.js b/doxygen_docs/html/search/enums_3.js index 964f5ba..a7a2836 100644 --- a/doxygen_docs/html/search/enums_3.js +++ b/doxygen_docs/html/search/enums_3.js @@ -1,4 +1,3 @@ -var searchData= -[ - ['texturetype_0',['TextureType',['../namespaceecs.html#a6e9ad0276f69474fe9498437b7d1a8f2',1,'ecs']]] -]; +version https://git-lfs.github.com/spec/v1 +oid sha256:6d9eccb3aa56b380839ff8b5b4583ad1ab9b5eb78efc426d0e1fd48b107f1bcf +size 124 diff --git a/doxygen_docs/html/search/functions_0.js b/doxygen_docs/html/search/functions_0.js index 9f4def0..75f467a 100644 --- a/doxygen_docs/html/search/functions_0.js +++ b/doxygen_docs/html/search/functions_0.js @@ -1,7 +1,3 @@ -var searchData= -[ - ['add_5fcube_0',['add_cube',['../classapplication__class.html#aaa09afdc106fb3f82788c42272811657',1,'application_class']]], - ['add_5fkobject_1',['add_kobject',['../classapplication__class.html#a9a39dfe69bca6fe96a339ab47b2f0539',1,'application_class']]], - ['addcomponent_2',['AddComponent',['../classecs_1_1_entity.html#a240b05cecbe32a6222082f3b4a789a98',1,'ecs::Entity']]], - ['application_5fclass_3',['application_class',['../classapplication__class.html#ab3b678dde613c8568a2124482ed45a73',1,'application_class']]] -]; +version https://git-lfs.github.com/spec/v1 +oid sha256:4c35d2455ce409a7d10641a49475b879c7e0448889c9ce3deb1ea996efd8bec9 +size 540 diff --git a/doxygen_docs/html/search/functions_1.js b/doxygen_docs/html/search/functions_1.js index 08e781f..affc121 100644 --- a/doxygen_docs/html/search/functions_1.js +++ b/doxygen_docs/html/search/functions_1.js @@ -1,4 +1,3 @@ -var searchData= -[ - ['begin_5fscene_0',['begin_scene',['../classd__3d__class.html#acaf14bacf9de484d9f4deb4e148d272c',1,'d_3d_class']]] -]; +version https://git-lfs.github.com/spec/v1 +oid sha256:51e4a0d8f662d17341085656561a20fe41b240d8af7542386276abdb9287c107 +size 138 diff --git a/doxygen_docs/html/search/functions_10.js b/doxygen_docs/html/search/functions_10.js index d4efaf3..ed38337 100644 --- a/doxygen_docs/html/search/functions_10.js +++ b/doxygen_docs/html/search/functions_10.js @@ -1,6 +1,3 @@ -var searchData= -[ - ['transformcomponent_0',['TransformComponent',['../classecs_1_1_transform_component.html#a66dc72687d5a68513beb31b5ae28564f',1,'ecs::TransformComponent']]], - ['turn_5fz_5fbuffer_5foff_1',['turn_z_buffer_off',['../classd__3d__class.html#af10a177e15842ad232f394d30f80a4e6',1,'d_3d_class']]], - ['turn_5fz_5fbuffer_5fon_2',['turn_z_buffer_on',['../classd__3d__class.html#a00a377d6a09653fd3f7e68af8afcea3a',1,'d_3d_class']]] -]; +version https://git-lfs.github.com/spec/v1 +oid sha256:fefa1cc0f70cfc5e6b2ff1b7c02b9c90c996db8cbfda517e37d3821614bec627 +size 444 diff --git a/doxygen_docs/html/search/functions_11.js b/doxygen_docs/html/search/functions_11.js index 7315c7d..8e437be 100644 --- a/doxygen_docs/html/search/functions_11.js +++ b/doxygen_docs/html/search/functions_11.js @@ -1,8 +1,3 @@ -var searchData= -[ - ['update_0',['Update',['../classecs_1_1_component.html#a59c0f739c4ff19227e27ed7b9f6352e0',1,'ecs::Component::Update()'],['../classecs_1_1_model_path_component.html#a64d1c1fa22bb222e6c85f5312ea8795b',1,'ecs::ModelPathComponent::Update()'],['../classecs_1_1_physics_component.html#a83aaa878464b8ef2dbc0e7a927689d79',1,'ecs::PhysicsComponent::Update()'],['../classecs_1_1_render_component.html#a6cfff9944a89629f5f7a7d1451446f0d',1,'ecs::RenderComponent::Update()'],['../classecs_1_1_shader_component.html#a2ebc1ef592626fc729884677c771ccbf',1,'ecs::ShaderComponent::Update()']]], - ['update_5fstats_5fafter_5fmodification_1',['update_stats_after_modification',['../classapplication__class.html#aa453b06f65ab6344907f0c65670de202',1,'application_class']]], - ['updatecomponents_2',['UpdateComponents',['../classecs_1_1_entity.html#a239d0855906f8c66371d7d1fa895a11f',1,'ecs::Entity']]], - ['updateentities_3',['UpdateEntities',['../classecs_1_1_entity_manager.html#aac0b39f03cc669d8bc8f3073daa2079c',1,'ecs::EntityManager']]], - ['updateworldmatrix_4',['UpdateWorldMatrix',['../classecs_1_1_transform_component.html#a28d1fe5ba04d4ff6f9eb136ea656e35e',1,'ecs::TransformComponent']]] -]; +version https://git-lfs.github.com/spec/v1 +oid sha256:3fabc8f8b547039ec0d28478cacfc8eceae1e70c0ea2b67f5ed51267a8d90e9c +size 1198 diff --git a/doxygen_docs/html/search/functions_12.js b/doxygen_docs/html/search/functions_12.js index c97ffa9..1f9c40f 100644 --- a/doxygen_docs/html/search/functions_12.js +++ b/doxygen_docs/html/search/functions_12.js @@ -1,14 +1,3 @@ -var searchData= -[ - ['widgetaddobject_0',['WidgetAddObject',['../classimgui_manager.html#a59142ebf31199eabc0e95fb4e03f0dcc',1,'imguiManager']]], - ['widgetbutton_1',['WidgetButton',['../classimgui_manager.html#a50050d9440111762dcaac05555994175',1,'imguiManager']]], - ['widgetenginesettingswindow_2',['WidgetEngineSettingsWindow',['../classimgui_manager.html#a343ac602d7ef491b66bdb0d22b4cca54',1,'imguiManager']]], - ['widgetfps_3',['WidgetFPS',['../classimgui_manager.html#aa3b3c6844e2616b5a4b230d0f223cb74',1,'imguiManager']]], - ['widgetlightwindow_4',['WidgetLightWindow',['../classimgui_manager.html#a16bf45ab2eca6c63053b9ce52d84a245',1,'imguiManager']]], - ['widgetlogwindow_5',['WidgetLogWindow',['../classimgui_manager.html#acc1037d25c4c832d469867cfda2ece8d',1,'imguiManager']]], - ['widgetobjectwindow_6',['WidgetObjectWindow',['../classimgui_manager.html#a0933378a4a5bea9a7f0eefc9631ac369',1,'imguiManager']]], - ['widgetrenderstats_7',['WidgetRenderStats',['../classimgui_manager.html#aef824217cf1d2248b63eba6f577dbed6',1,'imguiManager']]], - ['widgetrenderwindow_8',['WidgetRenderWindow',['../classimgui_manager.html#ab8dfce7344b08009a6e4343f66418cbf',1,'imguiManager']]], - ['widgetspeedslider_9',['WidgetSpeedSlider',['../classimgui_manager.html#af69a453ffe53d8db207fd7d4d76f20ab',1,'imguiManager']]], - ['widgetterrainwindow_10',['WidgetTerrainWindow',['../classimgui_manager.html#ab5bc0ab6cfd9369bdadb72d589716e0d',1,'imguiManager']]] -]; +version https://git-lfs.github.com/spec/v1 +oid sha256:b036dfb6c933ff62fe55ff1e5736735af014c05cfc09e29cbd3529f4ff360fab +size 1454 diff --git a/doxygen_docs/html/search/functions_2.js b/doxygen_docs/html/search/functions_2.js index 1482443..85bd168 100644 --- a/doxygen_docs/html/search/functions_2.js +++ b/doxygen_docs/html/search/functions_2.js @@ -1,12 +1,3 @@ -var searchData= -[ - ['camera_5fclass_0',['camera_class',['../classcamera__class.html#ac18562f9e46ca033440ba9df2d180e20',1,'camera_class']]], - ['checkcube_1',['CheckCube',['../classfrustum.html#aa631d4d670499da25b2c3720cc15c855',1,'frustum']]], - ['clear_2',['Clear',['../classecs_1_1_entity_manager.html#a6c31a8b7c0a01e473566fd801db91a55',1,'ecs::EntityManager']]], - ['construct_5ffrustum_3',['construct_frustum',['../classapplication__class.html#a7b959a12a5574b263556937f1c94e255',1,'application_class']]], - ['constructfrustum_4',['ConstructFrustum',['../classfrustum.html#a17fbc652d86a362739d01c66ab8aa036',1,'frustum']]], - ['constructskybox_5',['ConstructSkybox',['../class_skybox.html#a583a0753edede891759ecb62cf82a86f',1,'Skybox']]], - ['convert_5fw_5fstring_5fto_5fstring_6',['convert_w_string_to_string',['../classscene__manager.html#acfa372b48d1b5119177fe985508cab18',1,'scene_manager']]], - ['create_5fbig_5fcube_7',['create_big_cube',['../classapplication__class.html#a7b0482e4b79a4c3bf32e1f40ccb48678',1,'application_class']]], - ['createentity_8',['CreateEntity',['../classecs_1_1_entity_manager.html#a696dcb2fd36215b0a9214880d21033a2',1,'ecs::EntityManager']]] -]; +version https://git-lfs.github.com/spec/v1 +oid sha256:1ab3838cc851e00860d66ded58ee9b0688d4e69a51cb3def4040c65746f8a09b +size 1181 diff --git a/doxygen_docs/html/search/functions_3.js b/doxygen_docs/html/search/functions_3.js index f97b306..a9b3e99 100644 --- a/doxygen_docs/html/search/functions_3.js +++ b/doxygen_docs/html/search/functions_3.js @@ -1,8 +1,3 @@ -var searchData= -[ - ['d_5f3d_5fclass_0',['d_3d_class',['../classd__3d__class.html#a9858f0cfaa93dec1b76ccea6e31c85bc',1,'d_3d_class']]], - ['delete_5fentity_5fby_5fid_1',['delete_entity_by_id',['../classapplication__class.html#a5ade90e873b7b6a31c148672dd0305cb',1,'application_class']]], - ['delete_5fterrain_2',['delete_terrain',['../classapplication__class.html#a69bce73916e1180493ac74030dbb77ba',1,'application_class']]], - ['destroyentity_3',['DestroyEntity',['../classecs_1_1_entity_manager.html#a4cb0da19e3a95b7cb1390843882176a9',1,'ecs::EntityManager']]], - ['disable_5falpha_5fblending_4',['disable_alpha_blending',['../classd__3d__class.html#a971e5902f64a1885238bb94dc071ab18',1,'d_3d_class']]] -]; +version https://git-lfs.github.com/spec/v1 +oid sha256:3fb72c5aa0087b4bcddb1f96a5090bf5903d5457e4a39ec5201c8c24699e2530 +size 706 diff --git a/doxygen_docs/html/search/functions_4.js b/doxygen_docs/html/search/functions_4.js index aeb1fce..f231db9 100644 --- a/doxygen_docs/html/search/functions_4.js +++ b/doxygen_docs/html/search/functions_4.js @@ -1,7 +1,3 @@ -var searchData= -[ - ['enable_5falpha_5fblending_0',['enable_alpha_blending',['../classd__3d__class.html#a93b990eb289ab87c5e488353b9a90d7c',1,'d_3d_class']]], - ['end_5fscene_1',['end_scene',['../classd__3d__class.html#a0c3bc2a6265c0922ac7fa20264036bb9',1,'d_3d_class']]], - ['entity_2',['Entity',['../classecs_1_1_entity.html#aa505e8d9a076bd37b83e319c33a8fb3e',1,'ecs::Entity::Entity(EntityID id)'],['../classecs_1_1_entity.html#a1cace49b2034c62e076d8e5354a1e15f',1,'ecs::Entity::Entity(const Entity &)=delete'],['../classecs_1_1_entity.html#a318d92a576baeaf8d684fd9ee400ebe8',1,'ecs::Entity::Entity(Entity &&)=default']]], - ['entitymanager_3',['EntityManager',['../classecs_1_1_entity_manager.html#acba3847d62f7cd79e22d5ffa490c1f53',1,'ecs::EntityManager']]] -]; +version https://git-lfs.github.com/spec/v1 +oid sha256:81b774c8ed4d41cb4ebc18f8aa710cb45bfe27259998a03b6763de0d9d3dbeb3 +size 776 diff --git a/doxygen_docs/html/search/functions_5.js b/doxygen_docs/html/search/functions_5.js index 06d037f..ef5a120 100644 --- a/doxygen_docs/html/search/functions_5.js +++ b/doxygen_docs/html/search/functions_5.js @@ -1,5 +1,3 @@ -var searchData= -[ - ['fps_5flimiter_0',['fps_limiter',['../classfps__limiter.html#af20845a17030a3c44b0f7e7fc08c016f',1,'fps_limiter']]], - ['frame_1',['frame',['../classapplication__class.html#a0d9b9cbfbe1a2efa52606fcbbdfb40ca',1,'application_class']]] -]; +version https://git-lfs.github.com/spec/v1 +oid sha256:aa3212bdd43db13903a9e37a6b963e1ee864bcc1bd4f0902477881fe59abccd0 +size 256 diff --git a/doxygen_docs/html/search/functions_6.js b/doxygen_docs/html/search/functions_6.js index 7f41ab6..63d4cae 100644 --- a/doxygen_docs/html/search/functions_6.js +++ b/doxygen_docs/html/search/functions_6.js @@ -1,78 +1,3 @@ -var searchData= -[ - ['generate_5fterrain_0',['generate_terrain',['../classapplication__class.html#aca20ad22e0c95f5404e3c47a11317025',1,'application_class']]], - ['get_1',['Get',['../class_logger.html#a08e3e1b899767a6d833136c9fb4f15c2',1,'Logger']]], - ['get_5faspect_5fratio_2',['get_aspect_ratio',['../classapplication__class.html#a1bbbc70e5a68278f410e9b2b93942230',1,'application_class']]], - ['get_5fback_5fbuffer_5fsrv_3',['get_back_buffer_srv',['../classapplication__class.html#a0e7b21b1421fd52bb3740fb25f26e4a7',1,'application_class']]], - ['get_5fcan_5ffixed_5fupdate_4',['get_can_fixed_update',['../classapplication__class.html#abf98d275e281e99e54a68d3b53ba7b94',1,'application_class']]], - ['get_5fdevice_5',['get_device',['../classd__3d__class.html#a0979aea3c4bb6815908fbe188fc1c67e',1,'d_3d_class']]], - ['get_5fdevice_5fcontext_6',['get_device_context',['../classd__3d__class.html#a4ad87066c014351689f12981234beadb',1,'d_3d_class']]], - ['get_5fentity_5fmanager_7',['get_entity_manager',['../classapplication__class.html#ab6487040a8f3f90c62eaaeec09504071',1,'application_class']]], - ['get_5ffps_8',['get_fps',['../classapplication__class.html#a8a2103b81e5a5f73ebce656b96467ee3',1,'application_class']]], - ['get_5ffrustum_9',['get_frustum',['../classapplication__class.html#a29f11f9f0ab0f41af7b1b657d9310209',1,'application_class']]], - ['get_5ffrustum_5ftolerance_10',['get_frustum_tolerance',['../classapplication__class.html#aa271ce1d2803a5a1fcd9becad215ecb0',1,'application_class']]], - ['get_5fhwnd_11',['get_hwnd',['../classapplication__class.html#a692f521b7d27a89a95848dd912342c1f',1,'application_class']]], - ['get_5flight_5fcolor_12',['get_light_color',['../classapplication__class.html#a85c04a3f2d050cb750d7986ebc7e76a5',1,'application_class']]], - ['get_5flight_5fposition_13',['get_light_position',['../classapplication__class.html#a54f4915b1878fde4dc60ff26be5712ee',1,'application_class']]], - ['get_5flights_14',['get_lights',['../classapplication__class.html#a9b1ca112e8d8fd01a7061d9a638e9f3e',1,'application_class']]], - ['get_5fmodel_5fcache_15',['get_model_cache',['../classapplication__class.html#a6eff226c2686a261a394b1c046096c5e',1,'application_class']]], - ['get_5fobject_5fid_16',['get_object_id',['../classapplication__class.html#a32624a7be14230d2120de382c2c2e298',1,'application_class']]], - ['get_5fortho_5fmatrix_17',['get_ortho_matrix',['../classd__3d__class.html#aa24cb2be2ecf760dd8ff350e88534130',1,'d_3d_class']]], - ['get_5fphysics_18',['get_physics',['../classapplication__class.html#ab1924a7177c04594ec5dab7fe4c0104f',1,'application_class']]], - ['get_5fphysics_5ftick_5frate_19',['get_physics_tick_rate',['../classapplication__class.html#a118113b8ab8ad1065b032d57150fa7dd',1,'application_class']]], - ['get_5fposition_20',['get_position',['../classcamera__class.html#af416c69abe70579751cd404cba8bf388',1,'camera_class']]], - ['get_5fprojection_5fmatrix_21',['get_projection_matrix',['../classd__3d__class.html#a64893c249b126bdc97f63c00e7c78758',1,'d_3d_class']]], - ['get_5freflection_5ftexture_22',['get_reflection_texture',['../classapplication__class.html#a25592af930b0ee6c34d667fc0f8d69e1',1,'application_class']]], - ['get_5freflection_5fview_5fmatrix_23',['get_reflection_view_matrix',['../classcamera__class.html#ac4d85cc166aec75e54528dc9dee8a075',1,'camera_class']]], - ['get_5frefraction_5ftexture_24',['get_refraction_texture',['../classapplication__class.html#a8d993ac51d86d09c2b03b612ed914a74',1,'application_class']]], - ['get_5frender_5fcount_25',['get_render_count',['../classapplication__class.html#acc0c095b41d72833d974229cc64d0689',1,'application_class']]], - ['get_5frender_5ftexture_26',['get_render_texture',['../classapplication__class.html#a3ec69cb088888911ab1e32490c39f3e6',1,'application_class']]], - ['get_5frotation_27',['get_rotation',['../classcamera__class.html#aa8073c109a536d48478257a3e1e889cd',1,'camera_class']]], - ['get_5fscene_5fpath_28',['get_scene_path',['../classscene__manager.html#ad47f7f853f78ac866a566e6d224066a2',1,'scene_manager']]], - ['get_5fscene_5ftexture_29',['get_scene_texture',['../classapplication__class.html#a69a84a1345d56bb8d81e7d3427ce969e',1,'application_class']]], - ['get_5fscreen_5fheight_30',['get_screen_height',['../classapplication__class.html#a468b1ed714bae99f4f2fcf7a93407bfb',1,'application_class']]], - ['get_5fscreen_5fwidth_31',['get_screen_width',['../classapplication__class.html#ae4bf8de77c3edaac71aaba75193c3be9',1,'application_class']]], - ['get_5fshould_5fquit_32',['get_should_quit',['../classapplication__class.html#afea1cdf2706dc45cdae0396b7948f2b0',1,'application_class']]], - ['get_5fspeed_33',['get_speed',['../classapplication__class.html#ad724a8b8867f487bc602406ae20e1301',1,'application_class']]], - ['get_5fstats_34',['get_stats',['../classapplication__class.html#adfd9213758db871e03aada83dee961b3',1,'application_class']]], - ['get_5fsun_5flight_35',['get_sun_light',['../classapplication__class.html#ad757f3dc7ad49b74643fca7947889ed6',1,'application_class']]], - ['get_5fswap_5fchain_36',['get_swap_chain',['../classd__3d__class.html#aa25b4b30b0ee3160c4d6c86ceeedd70d',1,'d_3d_class']]], - ['get_5fterrain_5fentity_5fcount_37',['get_terrain_entity_count',['../classapplication__class.html#afe1ff7bf39935cae054c8f3743e923e1',1,'application_class']]], - ['get_5fvideo_5fcard_5finfo_38',['get_video_card_info',['../classd__3d__class.html#a7373ca22ab51dd0f8949a917fa057f19',1,'d_3d_class']]], - ['get_5fview_5fmatrix_39',['get_view_matrix',['../classcamera__class.html#ac17736821f337ce7fd52b9857095de68',1,'camera_class']]], - ['get_5fvsync_40',['get_vsync',['../classapplication__class.html#aa79efde57fb87b64bf95b47ee87c3bff',1,'application_class']]], - ['get_5fw_5ffolder_41',['get_w_folder',['../classapplication__class.html#a2f6b5156b585944bb912d93fa1595af2',1,'application_class']]], - ['get_5fwindow_5fsize_42',['get_window_size',['../classapplication__class.html#a3c76d728525b1ee4558a41383f9f2217',1,'application_class']]], - ['get_5fworld_5fmatrix_43',['get_world_matrix',['../classd__3d__class.html#a2a910b75177d248036bb4418038406f1',1,'d_3d_class']]], - ['getacceleration_44',['GetAcceleration',['../classecs_1_1_physics_component.html#ae40284b6a494abd2ad1d8a4bbb641117',1,'ecs::PhysicsComponent']]], - ['getactiveshader_45',['GetActiveShader',['../classecs_1_1_shader_component.html#aad636c8a9e23f0ef494a2fe66d1ae6b4',1,'ecs::ShaderComponent']]], - ['getallentities_46',['GetAllEntities',['../classecs_1_1_entity_manager.html#ad4116858dc1c324cdd558e5ac6c7f21b',1,'ecs::EntityManager']]], - ['getboundingradius_47',['GetBoundingRadius',['../classecs_1_1_physics_component.html#acb77c488322bbb5776e08fd9be5908d7',1,'ecs::PhysicsComponent']]], - ['getcomponent_48',['GetComponent',['../classecs_1_1_entity.html#a1debe96608ed65b741812a9340c52220',1,'ecs::Entity']]], - ['getcomponenttypeid_49',['GetComponentTypeID',['../namespaceecs.html#ae98a9f77225416bebd93a559a68a92eb',1,'ecs']]], - ['getentitieswithcomponent_50',['GetEntitiesWithComponent',['../classecs_1_1_entity_manager.html#a42887acde34ab3d1cd13c0396b053d72',1,'ecs::EntityManager']]], - ['getentity_51',['GetEntity',['../classecs_1_1_entity_manager.html#a79acf6578756702d83d509dbf1fce0d8',1,'ecs::EntityManager']]], - ['getentitycount_52',['GetEntityCount',['../classecs_1_1_entity_manager.html#ad84a022bfad4f381179c1e007d7c9c8a',1,'ecs::EntityManager']]], - ['getid_53',['GetID',['../classecs_1_1_entity.html#a9fab84a0393816b3a911588fc1f7121a',1,'ecs::Entity']]], - ['getid_54',['GetId',['../classecs_1_1_identity_component.html#af7fcece7aaa148512ba153d1d3a4cc1c',1,'ecs::IdentityComponent']]], - ['getindexcount_55',['GetIndexCount',['../classecs_1_1_render_component.html#ae01aca10690322ec92899e99bf5e244e',1,'ecs::RenderComponent']]], - ['getlogbuffer_56',['GetLogBuffer',['../class_logger.html#a0fc50378d880b648733da39e61fa51e3',1,'Logger']]], - ['getloglevelinfo_57',['GetLogLevelInfo',['../class_logger.html#a44f087518b3a028018146b07b2bc8e3b',1,'Logger']]], - ['getmass_58',['GetMass',['../classecs_1_1_physics_component.html#acbe98be444ae347a32951435472e5a28',1,'ecs::PhysicsComponent']]], - ['getmodel_59',['GetModel',['../classecs_1_1_render_component.html#a2797ae01f7f42594a0291529d0ec8ef0',1,'ecs::RenderComponent']]], - ['getmodelfilepath_60',['GetModelFilePath',['../classecs_1_1_render_component.html#aa9bc77dc2ea430ec9008bda7993f766c',1,'ecs::RenderComponent']]], - ['getname_61',['GetName',['../classecs_1_1_identity_component.html#a6f97e89a74db7fda99f144c66c17935f',1,'ecs::IdentityComponent']]], - ['getpath_62',['GetPath',['../classecs_1_1_model_path_component.html#a7996bbc72216b56b0b26cef13acad6cc',1,'ecs::ModelPathComponent']]], - ['getposition_63',['GetPosition',['../classecs_1_1_transform_component.html#a2936d569829c3c440d3bf5bde6353efe',1,'ecs::TransformComponent']]], - ['getpreviousposition_64',['GetPreviousPosition',['../classecs_1_1_physics_component.html#af3e592a83a8145612bea36927c222082',1,'ecs::PhysicsComponent']]], - ['getrotatematrix_65',['GetRotateMatrix',['../classecs_1_1_transform_component.html#aedc64114b30f9aa629caf6548bfc3c07',1,'ecs::TransformComponent']]], - ['getrotation_66',['GetRotation',['../classecs_1_1_transform_component.html#a50130c13fb3f0d01a473eead605aaa40',1,'ecs::TransformComponent']]], - ['getscale_67',['GetScale',['../classecs_1_1_transform_component.html#af5cb7911c9deab8a49c9f8ae3ce099c5',1,'ecs::TransformComponent']]], - ['getscalematrix_68',['GetScaleMatrix',['../classecs_1_1_transform_component.html#aca8c9c9d0266636b7431696a6905b419',1,'ecs::TransformComponent']]], - ['gettexture_69',['GetTexture',['../classecs_1_1_render_component.html#a8d3c778be73e8cbb27b3ea102698a7f2',1,'ecs::RenderComponent']]], - ['gettranslatematrix_70',['GetTranslateMatrix',['../classecs_1_1_transform_component.html#a2c5c5b5d1081b942ab7d5776d4418044',1,'ecs::TransformComponent']]], - ['gettype_71',['GetType',['../classecs_1_1_identity_component.html#abc33d5a325706c7c115b88fd9635a4cd',1,'ecs::IdentityComponent']]], - ['getvelocity_72',['GetVelocity',['../classecs_1_1_physics_component.html#abc1702442a7fa0915f7760b20d5a17ae',1,'ecs::PhysicsComponent']]], - ['getwindowsize_73',['GetWindowSize',['../classimgui_manager.html#a8422f5e3790983a2c878d61968c6a657',1,'imguiManager']]], - ['getworldmatrix_74',['GetWorldMatrix',['../classecs_1_1_transform_component.html#a0d9f3426b6952e0468705820835ac331',1,'ecs::TransformComponent']]] -]; +version https://git-lfs.github.com/spec/v1 +oid sha256:f7fcef2d399925bc9f46e21e7879bdbb6f4a6716e75bbaaf722f2d1c45a302db +size 10396 diff --git a/doxygen_docs/html/search/functions_7.js b/doxygen_docs/html/search/functions_7.js index 0c92048..803c447 100644 --- a/doxygen_docs/html/search/functions_7.js +++ b/doxygen_docs/html/search/functions_7.js @@ -1,4 +1,3 @@ -var searchData= -[ - ['hascomponent_0',['HasComponent',['../classecs_1_1_entity.html#a29deb83cc77c7c2466d0f76f7b340869',1,'ecs::Entity']]] -]; +version https://git-lfs.github.com/spec/v1 +oid sha256:fb73cb7417627bf1797e25ea32d27147154b6fc3a8c9dac1824251633e1ea7f0 +size 141 diff --git a/doxygen_docs/html/search/functions_8.js b/doxygen_docs/html/search/functions_8.js index 6c96789..9336274 100644 --- a/doxygen_docs/html/search/functions_8.js +++ b/doxygen_docs/html/search/functions_8.js @@ -1,15 +1,3 @@ -var searchData= -[ - ['identitycomponent_0',['IdentityComponent',['../classecs_1_1_identity_component.html#a253122e10cbe22c42831d250d48a8316',1,'ecs::IdentityComponent']]], - ['imguimanager_1',['imguiManager',['../classimgui_manager.html#ab323084ef02c7df421977b9342edfd5f',1,'imguiManager']]], - ['imguiwidgetrenderer_2',['ImGuiWidgetRenderer',['../classimgui_manager.html#ad5b5109acef17047334dba7e7aebf3aa',1,'imguiManager']]], - ['initialize_3',['Initialize',['../classecs_1_1_component.html#a9372874f51e5f63584d65fc378d39459',1,'ecs::Component::Initialize()'],['../classecs_1_1_identity_component.html#a04b2bb43ccf6c4842704f30463033b3b',1,'ecs::IdentityComponent::Initialize()'],['../classecs_1_1_model_path_component.html#a8819a3be58b6748ced6763a598e2f7f8',1,'ecs::ModelPathComponent::Initialize()'],['../classecs_1_1_physics_component.html#ab58952fc61030f1047beb2d6dbec82cf',1,'ecs::PhysicsComponent::Initialize()'],['../classecs_1_1_render_component.html#aa92950c4ebad0379f626493bda1a79bb',1,'ecs::RenderComponent::Initialize()'],['../classecs_1_1_shader_component.html#a69a5ca163458465936525b14270fe46e',1,'ecs::ShaderComponent::Initialize()'],['../classimgui_manager.html#a282c73b89df97bffb545dfa618f354ef',1,'imguiManager::Initialize()'],['../class_skybox.html#af048306ba3fc893e485393452e8af429',1,'Skybox::Initialize()']]], - ['initialize_4',['initialize',['../classapplication__class.html#a3be4f6532857c72283450ce43907f309',1,'application_class::initialize()'],['../classd__3d__class.html#aeba928a71d4440004fff00603ed06658',1,'d_3d_class::initialize()'],['../classscene__manager.html#a005af8b21eabedba5230c1c6266794c6',1,'scene_manager::initialize()']]], - ['initializefromfile_5',['InitializeFromFile',['../classecs_1_1_render_component.html#a0aeb040ec34ba3619f08269e5744597e',1,'ecs::RenderComponent']]], - ['initializewithmodel_6',['InitializeWithModel',['../classecs_1_1_render_component.html#a5014687c529c5dd29c1689da1dd64776',1,'ecs::RenderComponent']]], - ['is_5fwindowed_7',['is_windowed',['../classapplication__class.html#aac1577a0fe08e8007980b6b1778da478',1,'application_class']]], - ['isgravityenabled_8',['IsGravityEnabled',['../classecs_1_1_physics_component.html#a29ed13dad5513dff62d8427e856bd74d',1,'ecs::PhysicsComponent']]], - ['isgrounded_9',['IsGrounded',['../classecs_1_1_physics_component.html#ae3438c93efe882c97086e0f9bc2f54dd',1,'ecs::PhysicsComponent']]], - ['isphysicsenabled_10',['IsPhysicsEnabled',['../classecs_1_1_physics_component.html#ab1d2d882d7ff058a67d3e266257edb95',1,'ecs::PhysicsComponent']]], - ['isvisible_11',['IsVisible',['../classecs_1_1_render_component.html#ad77b9089172b2567767aac2ac05118ea',1,'ecs::RenderComponent']]] -]; +version https://git-lfs.github.com/spec/v1 +oid sha256:c7da7d7818871655676ca023e46855351b652f600ab6fe6ae2e8da6d20ea3220 +size 2678 diff --git a/doxygen_docs/html/search/functions_9.js b/doxygen_docs/html/search/functions_9.js index 073395e..f533636 100644 --- a/doxygen_docs/html/search/functions_9.js +++ b/doxygen_docs/html/search/functions_9.js @@ -1,8 +1,3 @@ -var searchData= -[ - ['launchobject_0',['LaunchObject',['../classecs_1_1_physics_component.html#a156fb8329b7b2434ee94ab8c03fdc6e2',1,'ecs::PhysicsComponent']]], - ['load_5fscene_1',['load_scene',['../classscene__manager.html#a3dbd419184dd60e2ce0d3c660c4fdff2',1,'scene_manager']]], - ['loadtexturesfrompath_2',['LoadTexturesFromPath',['../classecs_1_1_render_component.html#a64e1e92929e2384d09c31b8d2afb258d',1,'ecs::RenderComponent']]], - ['log_3',['Log',['../class_logger.html#a94f47ba0ef38ea7bcf1056f64d2645e4',1,'Logger::Log(const std::string &message, const std::string &fileName, int lineNumber, LogLevel level=LogLevel::Info)'],['../class_logger.html#ac9b431db882705fe2f33687938874676',1,'Logger::Log(const std::string &message, LogLevel level)']]], - ['logger_4',['Logger',['../class_logger.html#a0d21ab21689125fbb5e91584e4f37baa',1,'Logger::Logger(Logger const &)=delete'],['../class_logger.html#abc41bfb031d896170c7675fa96a6b30c',1,'Logger::Logger()']]] -]; +version https://git-lfs.github.com/spec/v1 +oid sha256:e9a11480f1f131580f8f7436d658fc5ea1cda04a8b9f4e3e5cbaf9f547e49f25 +size 982 diff --git a/doxygen_docs/html/search/functions_a.js b/doxygen_docs/html/search/functions_a.js index 8aecb68..33afd1a 100644 --- a/doxygen_docs/html/search/functions_a.js +++ b/doxygen_docs/html/search/functions_a.js @@ -1,4 +1,3 @@ -var searchData= -[ - ['managelogfiles_0',['ManageLogFiles',['../class_logger.html#a62b3e15fa3c170e5090a846fd0e9283e',1,'Logger']]] -]; +version https://git-lfs.github.com/spec/v1 +oid sha256:f5a31c8de6acf8d2c4ecb559d81c26b7321bdd571ce0ac4a54e15b2d5cc301aa +size 133 diff --git a/doxygen_docs/html/search/functions_b.js b/doxygen_docs/html/search/functions_b.js index 92cade0..cbb1ed1 100644 --- a/doxygen_docs/html/search/functions_b.js +++ b/doxygen_docs/html/search/functions_b.js @@ -1,4 +1,3 @@ -var searchData= -[ - ['newframe_0',['NewFrame',['../classimgui_manager.html#ae3d0eda2efd0dadc1aab2384083c941c',1,'imguiManager']]] -]; +version https://git-lfs.github.com/spec/v1 +oid sha256:27d6219b561b66200097dbcbfdb4ed373b9c89daddd70420971abc2639b0dbc8 +size 133 diff --git a/doxygen_docs/html/search/functions_c.js b/doxygen_docs/html/search/functions_c.js index 0027ecd..ace4acd 100644 --- a/doxygen_docs/html/search/functions_c.js +++ b/doxygen_docs/html/search/functions_c.js @@ -1,4 +1,3 @@ -var searchData= -[ - ['objecttypetostring_0',['ObjectTypeToString',['../classecs_1_1_identity_component.html#a46f22b04d81b17bea5807d5b9d32b328',1,'ecs::IdentityComponent']]] -]; +version https://git-lfs.github.com/spec/v1 +oid sha256:ac3282aa2e0d9d571662f0e90c45fd7a8e2545fa8e18bad186c6a68378f44846 +size 176 diff --git a/doxygen_docs/html/search/functions_d.js b/doxygen_docs/html/search/functions_d.js index 510c295..3a432de 100644 --- a/doxygen_docs/html/search/functions_d.js +++ b/doxygen_docs/html/search/functions_d.js @@ -1,5 +1,3 @@ -var searchData= -[ - ['physics_5fthread_5ffunction_0',['physics_thread_function',['../classapplication__class.html#aa583e172e6a2d45cb9b4841634b9eea4',1,'application_class']]], - ['physicscomponent_1',['PhysicsComponent',['../classecs_1_1_physics_component.html#a13c45de519868a3e035fc8a3cb4c3da0',1,'ecs::PhysicsComponent']]] -]; +version https://git-lfs.github.com/spec/v1 +oid sha256:a5e1576fdfec8d48cdc547d64c788e9ef19d292b30eb45d26c6fc9875932d3f7 +size 327 diff --git a/doxygen_docs/html/search/functions_e.js b/doxygen_docs/html/search/functions_e.js index 6030030..de824aa 100644 --- a/doxygen_docs/html/search/functions_e.js +++ b/doxygen_docs/html/search/functions_e.js @@ -1,15 +1,3 @@ -var searchData= -[ - ['release_5fresources_0',['release_resources',['../classd__3d__class.html#a17c8aa0768ac5005f1e9cb27dac70a0e',1,'d_3d_class']]], - ['removecomponent_1',['RemoveComponent',['../classecs_1_1_entity.html#a87fe0ec023ff9df7bcfff0eb13a90bb7',1,'ecs::Entity']]], - ['render_2',['Render',['../classecs_1_1_render_component.html#a61dc5966b89474a415e3d19d28760a64',1,'ecs::RenderComponent::Render()'],['../classimgui_manager.html#aec282a32a74a9153697b66e47d683b3d',1,'imguiManager::Render()']]], - ['render_3',['render',['../classcamera__class.html#a0820187f209f9628e6b2a8af34d71057',1,'camera_class']]], - ['render_5freflection_4',['render_reflection',['../classcamera__class.html#a58b36223405de07000d108129c998075',1,'camera_class']]], - ['renderallentities_5',['RenderAllEntities',['../classecs_1_1_render_system.html#a8d65c73dad3be4070153c3f568d5a139',1,'ecs::RenderSystem']]], - ['rendercomponent_6',['RenderComponent',['../classecs_1_1_render_component.html#a9b8099cc84f4ca11f9cfca7d80081d6b',1,'ecs::RenderComponent']]], - ['renderentity_7',['RenderEntity',['../classecs_1_1_render_system.html#aef4d62c3ef06a880712d183a2848de2f',1,'ecs::RenderSystem']]], - ['rendersystem_8',['RenderSystem',['../classecs_1_1_render_system.html#a4db69fd99c18112dcbaa931a01bb9780',1,'ecs::RenderSystem']]], - ['reset_5fresources_9',['reset_resources',['../classd__3d__class.html#a1d13282bf58145a96b3a77285b075a7a',1,'d_3d_class']]], - ['reset_5fviewport_10',['reset_viewport',['../classd__3d__class.html#a63f75e9982d09b8cd8d06a1f79c01246',1,'d_3d_class']]], - ['resize_5fswap_5fchain_11',['resize_swap_chain',['../classd__3d__class.html#a953be067f947e9be5b6fbdf1ac35bb60',1,'d_3d_class']]] -]; +version https://git-lfs.github.com/spec/v1 +oid sha256:f7b1fbcf4c7cdf8b312d471c29adecd790f59b6f13d463155aea15541696bcff +size 1691 diff --git a/doxygen_docs/html/search/functions_f.js b/doxygen_docs/html/search/functions_f.js index dc805ae..340ed01 100644 --- a/doxygen_docs/html/search/functions_f.js +++ b/doxygen_docs/html/search/functions_f.js @@ -1,61 +1,3 @@ -var searchData= -[ - ['save_5fscene_0',['save_scene',['../classscene__manager.html#a7c221340be779b7e1cac9a54ec7a87d0',1,'scene_manager']]], - ['save_5fscene_5fas_1',['save_scene_as',['../classscene__manager.html#aa09ff2f050320a30b65bda4f162ace2c',1,'scene_manager']]], - ['set_5fback_5fbuffer_5frender_5ftarget_2',['set_back_buffer_render_target',['../classd__3d__class.html#a2e36ee106e2d9066c96ded6a3e97ac0c',1,'d_3d_class']]], - ['set_5fcan_5ffixed_5fupdate_3',['set_can_fixed_update',['../classapplication__class.html#aa0a44059eae0a8df0cb65a7962d598ed',1,'application_class']]], - ['set_5fcel_5fshading_4',['set_cel_shading',['../classapplication__class.html#a1bdce1b8c5a23cd60dd35c441a670601',1,'application_class']]], - ['set_5ffrustum_5',['set_frustum',['../classapplication__class.html#abd47278db9d786b80833c787900c145b',1,'application_class']]], - ['set_5ffrustum_5ftolerance_6',['set_frustum_tolerance',['../classapplication__class.html#a2f41c2a8f5f18aca2859b02e804c7a1a',1,'application_class']]], - ['set_5fhwnd_7',['set_hwnd',['../classapplication__class.html#a40392869f0ff57982fef8098dd3354fe',1,'application_class']]], - ['set_5flight_5fcolor_8',['set_light_color',['../classapplication__class.html#a79b165193754e7361b0a467f5e70c72b',1,'application_class']]], - ['set_5flight_5fposition_9',['set_light_position',['../classapplication__class.html#a1715fe1c06659636399b60e859e6b2ae',1,'application_class']]], - ['set_5fobject_5fid_10',['set_object_id',['../classapplication__class.html#ae586e8e9431b6d6168c335a9ae0f08ca',1,'application_class']]], - ['set_5fpath_11',['set_path',['../classapplication__class.html#a4ead7c7ba402fb9619000d201c0cf95f',1,'application_class']]], - ['set_5fphysics_5ftick_5frate_12',['set_physics_tick_rate',['../classapplication__class.html#a8b03fc0a380762e268606262914e55a8',1,'application_class']]], - ['set_5fposition_13',['set_position',['../classcamera__class.html#a4b9ac7f98297d2007abd1ed3d326d381',1,'camera_class']]], - ['set_5frender_5fcount_14',['set_render_count',['../classapplication__class.html#a1f607939202c0cb805df935eb38dabe7',1,'application_class']]], - ['set_5frotation_15',['set_rotation',['../classcamera__class.html#a410c4bbfd5ba10d0785f5ac9178f9b3f',1,'camera_class']]], - ['set_5fscreen_5fheight_16',['set_screen_height',['../classapplication__class.html#ae5ed92985e95d9f34a152cae2d7345d7',1,'application_class']]], - ['set_5fscreen_5fwidth_17',['set_screen_width',['../classapplication__class.html#aca66fefd8c7c473e2700a69f13a4cb6b',1,'application_class']]], - ['set_5fshould_5fquit_18',['set_should_quit',['../classapplication__class.html#a96068cd56a5bb2ed0c02db3b70272be2',1,'application_class']]], - ['set_5fspeed_19',['set_speed',['../classapplication__class.html#a7b1a11759ecc6b80542c7f4f3cf4e8e9',1,'application_class']]], - ['set_5fvsync_20',['set_vsync',['../classapplication__class.html#a642858510be15dc3d2890ccc5f6df31f',1,'application_class::set_vsync()'],['../classd__3d__class.html#ab0f3edaca84f6371ebbdb6291a60b59c',1,'d_3d_class::set_vsync()']]], - ['set_5fw_5ffolder_21',['set_w_folder',['../classapplication__class.html#a5dbf967cc3d2a08b07c13b6aa44fafe1',1,'application_class']]], - ['set_5fwindow_5fsize_22',['set_window_size',['../classapplication__class.html#ab0418282e11e00cebb3a63747384a24b',1,'application_class']]], - ['set_5fwindowed_23',['set_windowed',['../classapplication__class.html#a7faa4a3a5150086acaec8bc223a4bf7e',1,'application_class']]], - ['setacceleration_24',['SetAcceleration',['../classecs_1_1_physics_component.html#a462dd9f0b3452e9c98d5dea7d9959f50',1,'ecs::PhysicsComponent']]], - ['setactiveshader_25',['SetActiveShader',['../classecs_1_1_shader_component.html#a4664380323123817e65900a12fa9496f',1,'ecs::ShaderComponent']]], - ['setapp_26',['SetApp',['../classimgui_manager.html#a958907b5ec5b0a928a98198af01a4c46',1,'imguiManager']]], - ['setboundingradius_27',['SetBoundingRadius',['../classecs_1_1_physics_component.html#ab95922862da80f63814d47f8c2b69cea',1,'ecs::PhysicsComponent']]], - ['setgravityenabled_28',['SetGravityEnabled',['../classecs_1_1_physics_component.html#a19fa3fa510051cc0d8a0ddb21e92f9fe',1,'ecs::PhysicsComponent']]], - ['setgrounded_29',['SetGrounded',['../classecs_1_1_physics_component.html#ab750af34ccb7fd9f2cb4cea2c7a9a253',1,'ecs::PhysicsComponent']]], - ['setid_30',['SetId',['../classecs_1_1_identity_component.html#a69797f6d9f9926293d2e0b4e84e3bbb3',1,'ecs::IdentityComponent']]], - ['setmass_31',['SetMass',['../classecs_1_1_physics_component.html#af091ab5887798b0407700d4712795a0c',1,'ecs::PhysicsComponent']]], - ['setmodel_32',['SetModel',['../classecs_1_1_render_component.html#ab3a01e06c359132815a5a35ed950a19a',1,'ecs::RenderComponent']]], - ['setmodelfilepath_33',['SetModelFilePath',['../classecs_1_1_render_component.html#acac2902002c2ca0618c41525d1584088',1,'ecs::RenderComponent']]], - ['setname_34',['SetName',['../classecs_1_1_identity_component.html#aa04b3e5f2e40271ba50dfd35c3217013',1,'ecs::IdentityComponent']]], - ['setpath_35',['SetPath',['../classecs_1_1_model_path_component.html#aeef7076b697463196a2ce5440ca10f89',1,'ecs::ModelPathComponent']]], - ['setphysicsenabled_36',['SetPhysicsEnabled',['../classecs_1_1_physics_component.html#afb716a1474b17b0bcf1c4eb7b6f3c758',1,'ecs::PhysicsComponent']]], - ['setposition_37',['SetPosition',['../classecs_1_1_transform_component.html#ad825453d2a065640aa71618c00612249',1,'ecs::TransformComponent']]], - ['setpreviousposition_38',['SetPreviousPosition',['../classecs_1_1_physics_component.html#a9fd15ccd7dfe9955116ac5d52e01a6e7',1,'ecs::PhysicsComponent']]], - ['setrotatematrix_39',['SetRotateMatrix',['../classecs_1_1_transform_component.html#a5d868ff759cb7709328938681d62f913',1,'ecs::TransformComponent']]], - ['setrotation_40',['SetRotation',['../classecs_1_1_transform_component.html#a67f155836cd31a336324bb1ea4b3741a',1,'ecs::TransformComponent']]], - ['setscale_41',['SetScale',['../classecs_1_1_transform_component.html#ac98d110ada557fce53563306700516b7',1,'ecs::TransformComponent']]], - ['setscalematrix_42',['SetScaleMatrix',['../classecs_1_1_transform_component.html#aa1d23303805dd960452dd16a5c077835',1,'ecs::TransformComponent']]], - ['settranslatematrix_43',['SetTranslateMatrix',['../classecs_1_1_transform_component.html#ae6c18c31f088f065f059b490773b3a08',1,'ecs::TransformComponent']]], - ['settype_44',['SetType',['../classecs_1_1_identity_component.html#a7cbca5e7e2c877b45c900df4660c0e35',1,'ecs::IdentityComponent']]], - ['setupdatepositioncallback_45',['SetUpdatePositionCallback',['../classecs_1_1_physics_component.html#a93d17ee763b557489210f35b54829976',1,'ecs::PhysicsComponent']]], - ['setupdockspace_46',['SetupDockspace',['../classimgui_manager.html#a1496a85b51414a2d6fdbfa6bd53414ea',1,'imguiManager']]], - ['setvelocity_47',['SetVelocity',['../classecs_1_1_physics_component.html#a5a4f3b4503ce9b199da87f5e11673501',1,'ecs::PhysicsComponent']]], - ['setvisible_48',['SetVisible',['../classecs_1_1_render_component.html#ae0beed54f3cfe42213e1767da1b36d46',1,'ecs::RenderComponent']]], - ['setwindowsize_49',['SetWindowSize',['../classimgui_manager.html#a7342adf62f12e139de6fbe6399ff7129',1,'imguiManager']]], - ['shadercomponent_50',['ShaderComponent',['../classecs_1_1_shader_component.html#a58198e14a710f43735b0e22d5f9d8296',1,'ecs::ShaderComponent']]], - ['shadertypetostring_51',['ShaderTypeToString',['../classecs_1_1_shader_component.html#a08335ddbedf7eecadcd0db95c4d45c63',1,'ecs::ShaderComponent']]], - ['should_5frun_52',['should_run',['../classfps__limiter.html#ad0ce9120462473ec9ee26df5f5fb13cf',1,'fps_limiter']]], - ['shutdown_53',['Shutdown',['../classimgui_manager.html#af6a2337e560cfd2fa52605f52e4e2d25',1,'imguiManager']]], - ['shutdown_54',['shutdown',['../classapplication__class.html#af2ef20892819f21303002a0f3005e73d',1,'application_class::shutdown()'],['../classd__3d__class.html#ac6f9c4ea768ab32707ddb7a095ca60b3',1,'d_3d_class::shutdown()'],['../classscene__manager.html#aa7f5a91b60edcbee862b5a2b173b8713',1,'scene_manager::shutdown()']]], - ['skybox_55',['Skybox',['../class_skybox.html#a77a92db4492ed94ed4bd101b05ffb1f4',1,'Skybox']]], - ['stringtoobjecttype_56',['StringToObjectType',['../classecs_1_1_identity_component.html#a9a92b2a27ec5399096a3ad196d2dec3f',1,'ecs::IdentityComponent']]], - ['stringtoshadertype_57',['StringToShaderType',['../classecs_1_1_shader_component.html#abd16c8adfd191f96594716b235780950',1,'ecs::ShaderComponent']]] -]; +version https://git-lfs.github.com/spec/v1 +oid sha256:ccc793e932ae9d65a8ccc4329b9ab31e8839a9abacb5f9d6c9a1db2af1dab0b9 +size 8407 diff --git a/doxygen_docs/html/search/mag.svg b/doxygen_docs/html/search/mag.svg index ffb6cf0..57e1f30 100644 --- a/doxygen_docs/html/search/mag.svg +++ b/doxygen_docs/html/search/mag.svg @@ -1,24 +1,3 @@ - - - - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:fa25ecffc91dcc7c1d14b34cc87bc6848514d5d7697f6f3c12191e8440515427 +size 804 diff --git a/doxygen_docs/html/search/mag_d.svg b/doxygen_docs/html/search/mag_d.svg index 4122773..fd0b638 100644 --- a/doxygen_docs/html/search/mag_d.svg +++ b/doxygen_docs/html/search/mag_d.svg @@ -1,24 +1,3 @@ - - - - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:c3df08a0a30b7488cfe470572168e82b250aecc1703311797e8f3a44c4da9823 +size 804 diff --git a/doxygen_docs/html/search/mag_sel.svg b/doxygen_docs/html/search/mag_sel.svg index 553dba8..068c440 100644 --- a/doxygen_docs/html/search/mag_sel.svg +++ b/doxygen_docs/html/search/mag_sel.svg @@ -1,31 +1,3 @@ - - - - - - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:a12627d70bff4b36542402ef7668fd0da94844d48a19a6c0a91d8e22eb20f5de +size 1019 diff --git a/doxygen_docs/html/search/mag_seld.svg b/doxygen_docs/html/search/mag_seld.svg index c906f84..059ad6e 100644 --- a/doxygen_docs/html/search/mag_seld.svg +++ b/doxygen_docs/html/search/mag_seld.svg @@ -1,31 +1,3 @@ - - - - - - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:2102d7424960ca705bce50ef2732ada44e512144939dae8cbfc18861ddfd5995 +size 1019 diff --git a/doxygen_docs/html/search/namespaces_0.js b/doxygen_docs/html/search/namespaces_0.js index 0568836..cd87ebd 100644 --- a/doxygen_docs/html/search/namespaces_0.js +++ b/doxygen_docs/html/search/namespaces_0.js @@ -1,4 +1,3 @@ -var searchData= -[ - ['ecs_0',['ecs',['../namespaceecs.html',1,'']]] -]; +version https://git-lfs.github.com/spec/v1 +oid sha256:192cf9d00402e08d8c14e618b3f6f9d668e2111923666f444ee56cbdd588b82c +size 71 diff --git a/doxygen_docs/html/search/search.css b/doxygen_docs/html/search/search.css index 19f76f9..98df90e 100644 --- a/doxygen_docs/html/search/search.css +++ b/doxygen_docs/html/search/search.css @@ -1,291 +1,3 @@ -/*---------------- Search Box positioning */ - -#main-menu > li:last-child { - /* This
  • object is the parent of the search bar */ - display: flex; - justify-content: center; - align-items: center; - height: 36px; - margin-right: 1em; -} - -/*---------------- Search box styling */ - -.SRPage * { - font-weight: normal; - line-height: normal; -} - -dark-mode-toggle { - margin-left: 5px; - display: flex; - float: right; -} - -#MSearchBox { - display: inline-block; - white-space : nowrap; - background: var(--search-background-color); - border-radius: 0.65em; - box-shadow: var(--search-box-shadow); - z-index: 102; -} - -#MSearchBox .left { - display: inline-block; - vertical-align: middle; - height: 1.4em; -} - -#MSearchSelect { - display: inline-block; - vertical-align: middle; - width: 20px; - height: 19px; - background-image: var(--search-magnification-select-image); - margin: 0 0 0 0.3em; - padding: 0; -} - -#MSearchSelectExt { - display: inline-block; - vertical-align: middle; - width: 10px; - height: 19px; - background-image: var(--search-magnification-image); - margin: 0 0 0 0.5em; - padding: 0; -} - - -#MSearchField { - display: inline-block; - vertical-align: middle; - width: 7.5em; - height: 19px; - margin: 0 0.15em; - padding: 0; - line-height: 1em; - border:none; - color: var(--search-foreground-color); - outline: none; - font-family: var(--font-family-search); - -webkit-border-radius: 0px; - border-radius: 0px; - background: none; -} - -@media(hover: none) { - /* to avoid zooming on iOS */ - #MSearchField { - font-size: 16px; - } -} - -#MSearchBox .right { - display: inline-block; - vertical-align: middle; - width: 1.4em; - height: 1.4em; -} - -#MSearchClose { - display: none; - font-size: inherit; - background : none; - border: none; - margin: 0; - padding: 0; - outline: none; - -} - -#MSearchCloseImg { - padding: 0.3em; - margin: 0; -} - -.MSearchBoxActive #MSearchField { - color: var(--search-active-color); -} - - - -/*---------------- Search filter selection */ - -#MSearchSelectWindow { - display: none; - position: absolute; - left: 0; top: 0; - border: 1px solid var(--search-filter-border-color); - background-color: var(--search-filter-background-color); - z-index: 10001; - padding-top: 4px; - padding-bottom: 4px; - -moz-border-radius: 4px; - -webkit-border-top-left-radius: 4px; - -webkit-border-top-right-radius: 4px; - -webkit-border-bottom-left-radius: 4px; - -webkit-border-bottom-right-radius: 4px; - -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); -} - -.SelectItem { - font: 8pt var(--font-family-search); - padding-left: 2px; - padding-right: 12px; - border: 0px; -} - -span.SelectionMark { - margin-right: 4px; - font-family: var(--font-family-monospace); - outline-style: none; - text-decoration: none; -} - -a.SelectItem { - display: block; - outline-style: none; - color: var(--search-filter-foreground-color); - text-decoration: none; - padding-left: 6px; - padding-right: 12px; -} - -a.SelectItem:focus, -a.SelectItem:active { - color: var(--search-filter-foreground-color); - outline-style: none; - text-decoration: none; -} - -a.SelectItem:hover { - color: var(--search-filter-highlight-text-color); - background-color: var(--search-filter-highlight-bg-color); - outline-style: none; - text-decoration: none; - cursor: pointer; - display: block; -} - -/*---------------- Search results window */ - -iframe#MSearchResults { - /*width: 60ex;*/ - height: 15em; -} - -#MSearchResultsWindow { - display: none; - position: absolute; - left: 0; top: 0; - border: 1px solid var(--search-results-border-color); - background-color: var(--search-results-background-color); - z-index:10000; - width: 300px; - height: 400px; - overflow: auto; -} - -/* ----------------------------------- */ - - -#SRIndex { - clear:both; -} - -.SREntry { - font-size: 10pt; - padding-left: 1ex; -} - -.SRPage .SREntry { - font-size: 8pt; - padding: 1px 5px; -} - -div.SRPage { - margin: 5px 2px; - background-color: var(--search-results-background-color); -} - -.SRChildren { - padding-left: 3ex; padding-bottom: .5em -} - -.SRPage .SRChildren { - display: none; -} - -.SRSymbol { - font-weight: bold; - color: var(--search-results-foreground-color); - font-family: var(--font-family-search); - text-decoration: none; - outline: none; -} - -a.SRScope { - display: block; - color: var(--search-results-foreground-color); - font-family: var(--font-family-search); - font-size: 8pt; - text-decoration: none; - outline: none; -} - -a.SRSymbol:focus, a.SRSymbol:active, -a.SRScope:focus, a.SRScope:active { - text-decoration: underline; -} - -span.SRScope { - padding-left: 4px; - font-family: var(--font-family-search); -} - -.SRPage .SRStatus { - padding: 2px 5px; - font-size: 8pt; - font-style: italic; - font-family: var(--font-family-search); -} - -.SRResult { - display: none; -} - -div.searchresults { - margin-left: 10px; - margin-right: 10px; -} - -/*---------------- External search page results */ - -.pages b { - color: white; - padding: 5px 5px 3px 5px; - background-image: var(--nav-gradient-active-image-parent); - background-repeat: repeat-x; - text-shadow: 0 1px 1px #000000; -} - -.pages { - line-height: 17px; - margin-left: 4px; - text-decoration: none; -} - -.hl { - font-weight: bold; -} - -#searchresults { - margin-bottom: 20px; -} - -.searchpages { - margin-top: 10px; -} - +version https://git-lfs.github.com/spec/v1 +oid sha256:98100edfded83b201ccee6535316a015b4c0b451fb59f92863d5edf776c38422 +size 5522 diff --git a/doxygen_docs/html/search/search.js b/doxygen_docs/html/search/search.js index 666af01..76ba4d6 100644 --- a/doxygen_docs/html/search/search.js +++ b/doxygen_docs/html/search/search.js @@ -1,694 +1,3 @@ -/* - @licstart The following is the entire license notice for the JavaScript code in this file. - - The MIT License (MIT) - - Copyright (C) 1997-2020 by Dimitri van Heesch - - Permission is hereby granted, free of charge, to any person obtaining a copy of this software - and associated documentation files (the "Software"), to deal in the Software without restriction, - including without limitation the rights to use, copy, modify, merge, publish, distribute, - sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all copies or - substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING - BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - @licend The above is the entire license notice for the JavaScript code in this file - */ -const SEARCH_COOKIE_NAME = ''+'search_grp'; - -const searchResults = new SearchResults(); - -/* A class handling everything associated with the search panel. - - Parameters: - name - The name of the global variable that will be - storing this instance. Is needed to be able to set timeouts. - resultPath - path to use for external files -*/ -function SearchBox(name, resultsPath, extension) { - if (!name || !resultsPath) { alert("Missing parameters to SearchBox."); } - if (!extension || extension == "") { extension = ".html"; } - - function getXPos(item) { - let x = 0; - if (item.offsetWidth) { - while (item && item!=document.body) { - x += item.offsetLeft; - item = item.offsetParent; - } - } - return x; - } - - function getYPos(item) { - let y = 0; - if (item.offsetWidth) { - while (item && item!=document.body) { - y += item.offsetTop; - item = item.offsetParent; - } - } - return y; - } - - // ---------- Instance variables - this.name = name; - this.resultsPath = resultsPath; - this.keyTimeout = 0; - this.keyTimeoutLength = 500; - this.closeSelectionTimeout = 300; - this.lastSearchValue = ""; - this.lastResultsPage = ""; - this.hideTimeout = 0; - this.searchIndex = 0; - this.searchActive = false; - this.extension = extension; - - // ----------- DOM Elements - - this.DOMSearchField = () => document.getElementById("MSearchField"); - this.DOMSearchSelect = () => document.getElementById("MSearchSelect"); - this.DOMSearchSelectWindow = () => document.getElementById("MSearchSelectWindow"); - this.DOMPopupSearchResults = () => document.getElementById("MSearchResults"); - this.DOMPopupSearchResultsWindow = () => document.getElementById("MSearchResultsWindow"); - this.DOMSearchClose = () => document.getElementById("MSearchClose"); - this.DOMSearchBox = () => document.getElementById("MSearchBox"); - - // ------------ Event Handlers - - // Called when focus is added or removed from the search field. - this.OnSearchFieldFocus = function(isActive) { - this.Activate(isActive); - } - - this.OnSearchSelectShow = function() { - const searchSelectWindow = this.DOMSearchSelectWindow(); - const searchField = this.DOMSearchSelect(); - - const left = getXPos(searchField); - const top = getYPos(searchField) + searchField.offsetHeight; - - // show search selection popup - searchSelectWindow.style.display='block'; - searchSelectWindow.style.left = left + 'px'; - searchSelectWindow.style.top = top + 'px'; - - // stop selection hide timer - if (this.hideTimeout) { - clearTimeout(this.hideTimeout); - this.hideTimeout=0; - } - return false; // to avoid "image drag" default event - } - - this.OnSearchSelectHide = function() { - this.hideTimeout = setTimeout(this.CloseSelectionWindow.bind(this), - this.closeSelectionTimeout); - } - - // Called when the content of the search field is changed. - this.OnSearchFieldChange = function(evt) { - if (this.keyTimeout) { // kill running timer - clearTimeout(this.keyTimeout); - this.keyTimeout = 0; - } - - const e = evt ? evt : window.event; // for IE - if (e.keyCode==40 || e.keyCode==13) { - if (e.shiftKey==1) { - this.OnSearchSelectShow(); - const win=this.DOMSearchSelectWindow(); - for (let i=0;i do a search - this.Search(); - } - } - - this.OnSearchSelectKey = function(evt) { - const e = (evt) ? evt : window.event; // for IE - if (e.keyCode==40 && this.searchIndex0) { // Up - this.searchIndex--; - this.OnSelectItem(this.searchIndex); - } else if (e.keyCode==13 || e.keyCode==27) { - e.stopPropagation(); - this.OnSelectItem(this.searchIndex); - this.CloseSelectionWindow(); - this.DOMSearchField().focus(); - } - return false; - } - - // --------- Actions - - // Closes the results window. - this.CloseResultsWindow = function() { - this.DOMPopupSearchResultsWindow().style.display = 'none'; - this.DOMSearchClose().style.display = 'none'; - this.Activate(false); - } - - this.CloseSelectionWindow = function() { - this.DOMSearchSelectWindow().style.display = 'none'; - } - - // Performs a search. - this.Search = function() { - this.keyTimeout = 0; - - // strip leading whitespace - const searchValue = this.DOMSearchField().value.replace(/^ +/, ""); - - const code = searchValue.toLowerCase().charCodeAt(0); - let idxChar = searchValue.substr(0, 1).toLowerCase(); - if ( 0xD800 <= code && code <= 0xDBFF && searchValue > 1) { // surrogate pair - idxChar = searchValue.substr(0, 2); - } - - let jsFile; - let idx = indexSectionsWithContent[this.searchIndex].indexOf(idxChar); - if (idx!=-1) { - const hexCode=idx.toString(16); - jsFile = this.resultsPath + indexSectionNames[this.searchIndex] + '_' + hexCode + '.js'; - } - - const loadJS = function(url, impl, loc) { - const scriptTag = document.createElement('script'); - scriptTag.src = url; - scriptTag.onload = impl; - scriptTag.onreadystatechange = impl; - loc.appendChild(scriptTag); - } - - const domPopupSearchResultsWindow = this.DOMPopupSearchResultsWindow(); - const domSearchBox = this.DOMSearchBox(); - const domPopupSearchResults = this.DOMPopupSearchResults(); - const domSearchClose = this.DOMSearchClose(); - const resultsPath = this.resultsPath; - - const handleResults = function() { - document.getElementById("Loading").style.display="none"; - if (typeof searchData !== 'undefined') { - createResults(resultsPath); - document.getElementById("NoMatches").style.display="none"; - } - - if (idx!=-1) { - searchResults.Search(searchValue); - } else { // no file with search results => force empty search results - searchResults.Search('===='); - } - - if (domPopupSearchResultsWindow.style.display!='block') { - domSearchClose.style.display = 'inline-block'; - let left = getXPos(domSearchBox) + 150; - let top = getYPos(domSearchBox) + 20; - domPopupSearchResultsWindow.style.display = 'block'; - left -= domPopupSearchResults.offsetWidth; - const maxWidth = document.body.clientWidth; - const maxHeight = document.body.clientHeight; - let width = 300; - if (left<10) left=10; - if (width+left+8>maxWidth) width=maxWidth-left-8; - let height = 400; - if (height+top+8>maxHeight) height=maxHeight-top-8; - domPopupSearchResultsWindow.style.top = top + 'px'; - domPopupSearchResultsWindow.style.left = left + 'px'; - domPopupSearchResultsWindow.style.width = width + 'px'; - domPopupSearchResultsWindow.style.height = height + 'px'; - } - } - - if (jsFile) { - loadJS(jsFile, handleResults, this.DOMPopupSearchResultsWindow()); - } else { - handleResults(); - } - - this.lastSearchValue = searchValue; - } - - // -------- Activation Functions - - // Activates or deactivates the search panel, resetting things to - // their default values if necessary. - this.Activate = function(isActive) { - if (isActive || // open it - this.DOMPopupSearchResultsWindow().style.display == 'block' - ) { - this.DOMSearchBox().className = 'MSearchBoxActive'; - this.searchActive = true; - } else if (!isActive) { // directly remove the panel - this.DOMSearchBox().className = 'MSearchBoxInactive'; - this.searchActive = false; - this.lastSearchValue = '' - this.lastResultsPage = ''; - this.DOMSearchField().value = ''; - } - } -} - -// ----------------------------------------------------------------------- - -// The class that handles everything on the search results page. -function SearchResults() { - - function convertToId(search) { - let result = ''; - for (let i=0;i. - this.lastMatchCount = 0; - this.lastKey = 0; - this.repeatOn = false; - - // Toggles the visibility of the passed element ID. - this.FindChildElement = function(id) { - const parentElement = document.getElementById(id); - let element = parentElement.firstChild; - - while (element && element!=parentElement) { - if (element.nodeName.toLowerCase() == 'div' && element.className == 'SRChildren') { - return element; - } - - if (element.nodeName.toLowerCase() == 'div' && element.hasChildNodes()) { - element = element.firstChild; - } else if (element.nextSibling) { - element = element.nextSibling; - } else { - do { - element = element.parentNode; - } - while (element && element!=parentElement && !element.nextSibling); - - if (element && element!=parentElement) { - element = element.nextSibling; - } - } - } - } - - this.Toggle = function(id) { - const element = this.FindChildElement(id); - if (element) { - if (element.style.display == 'block') { - element.style.display = 'none'; - } else { - element.style.display = 'block'; - } - } - } - - // Searches for the passed string. If there is no parameter, - // it takes it from the URL query. - // - // Always returns true, since other documents may try to call it - // and that may or may not be possible. - this.Search = function(search) { - if (!search) { // get search word from URL - search = window.location.search; - search = search.substring(1); // Remove the leading '?' - search = unescape(search); - } - - search = search.replace(/^ +/, ""); // strip leading spaces - search = search.replace(/ +$/, ""); // strip trailing spaces - search = search.toLowerCase(); - search = convertToId(search); - - const resultRows = document.getElementsByTagName("div"); - let matches = 0; - - let i = 0; - while (i < resultRows.length) { - const row = resultRows.item(i); - if (row.className == "SRResult") { - let rowMatchName = row.id.toLowerCase(); - rowMatchName = rowMatchName.replace(/^sr\d*_/, ''); // strip 'sr123_' - - if (search.length<=rowMatchName.length && - rowMatchName.substr(0, search.length)==search) { - row.style.display = 'block'; - matches++; - } else { - row.style.display = 'none'; - } - } - i++; - } - document.getElementById("Searching").style.display='none'; - if (matches == 0) { // no results - document.getElementById("NoMatches").style.display='block'; - } else { // at least one result - document.getElementById("NoMatches").style.display='none'; - } - this.lastMatchCount = matches; - return true; - } - - // return the first item with index index or higher that is visible - this.NavNext = function(index) { - let focusItem; - for (;;) { - const focusName = 'Item'+index; - focusItem = document.getElementById(focusName); - if (focusItem && focusItem.parentNode.parentNode.style.display=='block') { - break; - } else if (!focusItem) { // last element - break; - } - focusItem=null; - index++; - } - return focusItem; - } - - this.NavPrev = function(index) { - let focusItem; - for (;;) { - const focusName = 'Item'+index; - focusItem = document.getElementById(focusName); - if (focusItem && focusItem.parentNode.parentNode.style.display=='block') { - break; - } else if (!focusItem) { // last element - break; - } - focusItem=null; - index--; - } - return focusItem; - } - - this.ProcessKeys = function(e) { - if (e.type == "keydown") { - this.repeatOn = false; - this.lastKey = e.keyCode; - } else if (e.type == "keypress") { - if (!this.repeatOn) { - if (this.lastKey) this.repeatOn = true; - return false; // ignore first keypress after keydown - } - } else if (e.type == "keyup") { - this.lastKey = 0; - this.repeatOn = false; - } - return this.lastKey!=0; - } - - this.Nav = function(evt,itemIndex) { - const e = (evt) ? evt : window.event; // for IE - if (e.keyCode==13) return true; - if (!this.ProcessKeys(e)) return false; - - if (this.lastKey==38) { // Up - const newIndex = itemIndex-1; - let focusItem = this.NavPrev(newIndex); - if (focusItem) { - let child = this.FindChildElement(focusItem.parentNode.parentNode.id); - if (child && child.style.display == 'block') { // children visible - let n=0; - let tmpElem; - for (;;) { // search for last child - tmpElem = document.getElementById('Item'+newIndex+'_c'+n); - if (tmpElem) { - focusItem = tmpElem; - } else { // found it! - break; - } - n++; - } - } - } - if (focusItem) { - focusItem.focus(); - } else { // return focus to search field - document.getElementById("MSearchField").focus(); - } - } else if (this.lastKey==40) { // Down - const newIndex = itemIndex+1; - let focusItem; - const item = document.getElementById('Item'+itemIndex); - const elem = this.FindChildElement(item.parentNode.parentNode.id); - if (elem && elem.style.display == 'block') { // children visible - focusItem = document.getElementById('Item'+itemIndex+'_c0'); - } - if (!focusItem) focusItem = this.NavNext(newIndex); - if (focusItem) focusItem.focus(); - } else if (this.lastKey==39) { // Right - const item = document.getElementById('Item'+itemIndex); - const elem = this.FindChildElement(item.parentNode.parentNode.id); - if (elem) elem.style.display = 'block'; - } else if (this.lastKey==37) { // Left - const item = document.getElementById('Item'+itemIndex); - const elem = this.FindChildElement(item.parentNode.parentNode.id); - if (elem) elem.style.display = 'none'; - } else if (this.lastKey==27) { // Escape - e.stopPropagation(); - searchBox.CloseResultsWindow(); - document.getElementById("MSearchField").focus(); - } else if (this.lastKey==13) { // Enter - return true; - } - return false; - } - - this.NavChild = function(evt,itemIndex,childIndex) { - const e = (evt) ? evt : window.event; // for IE - if (e.keyCode==13) return true; - if (!this.ProcessKeys(e)) return false; - - if (this.lastKey==38) { // Up - if (childIndex>0) { - const newIndex = childIndex-1; - document.getElementById('Item'+itemIndex+'_c'+newIndex).focus(); - } else { // already at first child, jump to parent - document.getElementById('Item'+itemIndex).focus(); - } - } else if (this.lastKey==40) { // Down - const newIndex = childIndex+1; - let elem = document.getElementById('Item'+itemIndex+'_c'+newIndex); - if (!elem) { // last child, jump to parent next parent - elem = this.NavNext(itemIndex+1); - } - if (elem) { - elem.focus(); - } - } else if (this.lastKey==27) { // Escape - e.stopPropagation(); - searchBox.CloseResultsWindow(); - document.getElementById("MSearchField").focus(); - } else if (this.lastKey==13) { // Enter - return true; - } - return false; - } -} - -function createResults(resultsPath) { - - function setKeyActions(elem,action) { - elem.setAttribute('onkeydown',action); - elem.setAttribute('onkeypress',action); - elem.setAttribute('onkeyup',action); - } - - function setClassAttr(elem,attr) { - elem.setAttribute('class',attr); - elem.setAttribute('className',attr); - } - - const results = document.getElementById("SRResults"); - results.innerHTML = ''; - searchData.forEach((elem,index) => { - const id = elem[0]; - const srResult = document.createElement('div'); - srResult.setAttribute('id','SR_'+id); - setClassAttr(srResult,'SRResult'); - const srEntry = document.createElement('div'); - setClassAttr(srEntry,'SREntry'); - const srLink = document.createElement('a'); - srLink.setAttribute('id','Item'+index); - setKeyActions(srLink,'return searchResults.Nav(event,'+index+')'); - setClassAttr(srLink,'SRSymbol'); - srLink.innerHTML = elem[1][0]; - srEntry.appendChild(srLink); - if (elem[1].length==2) { // single result - srLink.setAttribute('href',resultsPath+elem[1][1][0]); - srLink.setAttribute('onclick','searchBox.CloseResultsWindow()'); - if (elem[1][1][1]) { - srLink.setAttribute('target','_parent'); - } else { - srLink.setAttribute('target','_blank'); - } - const srScope = document.createElement('span'); - setClassAttr(srScope,'SRScope'); - srScope.innerHTML = elem[1][1][2]; - srEntry.appendChild(srScope); - } else { // multiple results - srLink.setAttribute('href','javascript:searchResults.Toggle("SR_'+id+'")'); - const srChildren = document.createElement('div'); - setClassAttr(srChildren,'SRChildren'); - for (let c=0; c - - - - - - -Khaotic Engine Reborn: enginecustom/src/inc/system/ecs/components/shader_component.h Source File - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    shader_component.h
    -
    -
    -
    1#pragma once
    -
    2#include "../component.h"
    -
    3
    -
    4namespace ecs {
    -
    5
    -
    -
    10enum class ShaderType
    -
    11{
    -
    12 CEL_SHADING,
    -
    13 LIGHTING,
    -
    14 NORMAL_MAPPING,
    -
    15 SPECULAR_MAPPING,
    -
    16 REFLECTION,
    -
    17 REFRACTION,
    -
    18 TEXTURE,
    -
    19 SKYBOX,
    -
    20 SUNLIGHT,
    -
    21 ALPHA_MAPPING
    -
    22};
    -
    -
    23
    -
    -
    24class ShaderComponent : public Component {
    -
    25public:
    -
    26
    -
    31 ShaderComponent() : m_activeShader(ShaderType::LIGHTING) {}
    -
    32 ~ShaderComponent() = default;
    -
    33
    -
    34 void Initialize() override {}
    -
    35 void Update(float deltaTime) override {}
    -
    36
    -
    41 ShaderType GetActiveShader() const { return m_activeShader; }
    -
    47 void SetActiveShader(ShaderType shader) { m_activeShader = shader; }
    -
    48
    -
    -
    55 static ShaderType StringToShaderType(const std::string& str) {
    -
    56 if (str == "ALPHA_MAPPING") return ShaderType::ALPHA_MAPPING;
    -
    57 if (str == "CEL_SHADING") return ShaderType::CEL_SHADING;
    -
    58 if (str == "NORMAL_MAPPING") return ShaderType::NORMAL_MAPPING;
    -
    59 if (str == "SPECULAR_MAPPING") return ShaderType::SPECULAR_MAPPING;
    -
    60 if (str == "TEXTURE") return ShaderType::TEXTURE;
    -
    61 if (str == "LIGHTING") return ShaderType::LIGHTING;
    -
    62 if (str == "SUNLIGHT") return ShaderType::SUNLIGHT;
    -
    63 if (str == "SKYBOX") return ShaderType::SKYBOX;
    -
    64 if (str == "REFLECTION") return ShaderType::REFLECTION;
    -
    65 if (str == "REFRACTION") return ShaderType::REFRACTION;
    -
    66 return ShaderType::TEXTURE;
    -
    67 }
    -
    -
    68
    -
    -
    75 static std::string ShaderTypeToString(ShaderType type) {
    -
    76 switch (type) {
    -
    77 case ShaderType::ALPHA_MAPPING: return "ALPHA_MAPPING";
    -
    78 case ShaderType::CEL_SHADING: return "CEL_SHADING";
    -
    79 case ShaderType::NORMAL_MAPPING: return "NORMAL_MAPPING";
    -
    80 case ShaderType::SPECULAR_MAPPING: return "SPECULAR_MAPPING";
    -
    81 case ShaderType::TEXTURE: return "TEXTURE";
    -
    82 case ShaderType::LIGHTING: return "LIGHTING";
    -
    83 case ShaderType::SUNLIGHT: return "SUNLIGHT";
    -
    84 case ShaderType::SKYBOX: return "SKYBOX";
    -
    85 case ShaderType::REFLECTION: return "REFLECTION";
    -
    86 case ShaderType::REFRACTION: return "REFRACTION";
    -
    87 default: return "TEXTURE";
    -
    88 }
    -
    89 }
    -
    -
    90
    -
    91private:
    -
    92 ShaderType m_activeShader;
    -
    93};
    -
    -
    94
    -
    95} // namespace ecs
    - - -
    static std::string ShaderTypeToString(ShaderType type)
    -
    void Update(float deltaTime) override
    -
    void SetActiveShader(ShaderType shader)
    - -
    void Initialize() override
    -
    ShaderType GetActiveShader() const
    -
    static ShaderType StringToShaderType(const std::string &str)
    -
    Definition component.h:9
    - -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:772b4eebf019cbb0950acb2d50782ec89431c2e46610ef1b2a70fb487a897301 +size 22710 diff --git a/doxygen_docs/html/shader__manager__class_8cpp_source.html b/doxygen_docs/html/shader__manager__class_8cpp_source.html index 1e71967..c898c5d 100644 --- a/doxygen_docs/html/shader__manager__class_8cpp_source.html +++ b/doxygen_docs/html/shader__manager__class_8cpp_source.html @@ -1,648 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/src/shader/shader_manager_class.cpp Source File - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    shader_manager_class.cpp
    -
    -
    -
    1#include "shader_manager_class.h"
    -
    2
    -
    3shader_manager_class::shader_manager_class()
    -
    4{
    -
    5 texture_shader_ = 0;
    -
    6 normal_map_shader_ = 0;
    -
    7 multitexture_shader_ = 0;
    -
    8 translate_shader_ = 0;
    -
    9 alpha_map_shader_ = 0;
    -
    10 spec_map_shader_ = 0;
    -
    11 transparent_shader_ = 0;
    -
    12 light_shader_ = 0;
    -
    13 light_map_shader_ = 0;
    -
    14 refraction_shader_ = 0;
    -
    15 water_shader_ = 0;
    -
    16 cel_shading_shader_ = 0;
    -
    17 sunlight_shader_ = 0;
    -
    18 skybox_shader_ = 0;
    -
    19 refraction_shader_ = 0;
    -
    20 depth_shader_ = 0;
    -
    21}
    -
    22
    -
    23shader_manager_class::shader_manager_class(const shader_manager_class& other)
    -
    24{
    -
    25}
    -
    26
    -
    27shader_manager_class::~shader_manager_class()
    -
    28{
    -
    29}
    -
    30
    -
    31bool shader_manager_class::initialize(ID3D11Device* device, HWND hwnd)
    -
    32{
    -
    33 Logger::Get().Log("Initializing shader_manager_class", __FILE__, __LINE__, Logger::LogLevel::Initialize);
    -
    34
    -
    35 bool result;
    -
    36
    -
    37 // Create and initialize the texture shader object.
    -
    38 texture_shader_ = new texture_shader_class;
    -
    39 result = texture_shader_->initialize(device, hwnd);
    -
    40 if (!result)
    -
    41 {
    -
    42 Logger::Get().Log("Error initializing texture_shader_class", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    43 return false;
    -
    44 }
    -
    45
    -
    46 // Create and initialize the normal map shader object.
    -
    47 normal_map_shader_ = new normal_map_shader_class;
    -
    48 result = normal_map_shader_->initialize(device, hwnd);
    -
    49 if (!result)
    -
    50 {
    -
    51 Logger::Get().Log("Error initializing normal_map_shader_class", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    52 return false;
    -
    53 }
    -
    54
    -
    55 // Create and initialize the multitexture shader object.
    -
    56 multitexture_shader_ = new multi_texture_shader_class;
    -
    57 result = multitexture_shader_->initialize(device, hwnd);
    -
    58 if (!result)
    -
    59 {
    -
    60 Logger::Get().Log("Error initializing multi_texture_shader_class", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    61 return false;
    -
    62 }
    -
    63
    -
    64 // Create and initialize the translate shader object.
    -
    65 translate_shader_ = new translate_shader_class;
    -
    66 result = translate_shader_->initialize(device, hwnd);
    -
    67 if (!result)
    -
    68 {
    -
    69 Logger::Get().Log("Error initializing translate_shader_class", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    70 return false;
    -
    71 }
    -
    72
    -
    73 // Create and initialize the alpha map shader object.
    -
    74 alpha_map_shader_ = new alpha_map_shader_class;
    -
    75 result = alpha_map_shader_->initialize(device, hwnd);
    -
    76 if (!result)
    -
    77 {
    -
    78 Logger::Get().Log("Error initializing alpha_map_shader_class", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    79 return false;
    -
    80 }
    -
    81
    -
    82 // Create and initialize the specular map shader object.
    -
    83 spec_map_shader_ = new spec_map_shader_class;
    -
    84 result = spec_map_shader_->initialize(device, hwnd);
    -
    85 if (!result)
    -
    86 {
    -
    87 Logger::Get().Log("Error initializing spec_map_shader_class", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    88 return false;
    -
    89 }
    -
    90
    -
    91 // Create and initialize the transparent shader object.
    -
    92 transparent_shader_ = new transparent_shader_class;
    -
    93 result = transparent_shader_->initialize(device, hwnd);
    -
    94 if (!result)
    -
    95 {
    -
    96 Logger::Get().Log("Error initializing transparent_shader_class", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    97 return false;
    -
    98 }
    -
    99
    -
    100 // Create and initialize the light shader object.
    -
    101 light_shader_ = new light_shader_class;
    -
    102 result = light_shader_->initialize(device, hwnd);
    -
    103 if (!result)
    -
    104 {
    -
    105 Logger::Get().Log("Error initializing light_shader_class", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    106 return false;
    -
    107 }
    -
    108
    -
    109 // Create and initialize the light map shader object.
    -
    110 light_map_shader_ = new light_map_shader_class;
    -
    111 result = light_map_shader_->initialize(device, hwnd);
    -
    112 if (!result)
    -
    113 {
    -
    114 Logger::Get().Log("Error initializing light_map_shader_class", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    115 return false;
    -
    116 }
    -
    117
    -
    118 // Create and initialize the refraction shader object.
    -
    119 refraction_shader_ = new refraction_shader_class;
    -
    120 result = refraction_shader_->initialize(device, hwnd);
    -
    121 if (!result)
    -
    122 {
    -
    123 return false;
    -
    124 }
    -
    125
    -
    126 // Create and initialize the water shader object.
    -
    127 water_shader_ = new water_shader_class;
    -
    128 result = water_shader_->initialize(device, hwnd);
    -
    129 if (!result)
    -
    130 {
    -
    131 return false;
    -
    132 }
    -
    133
    -
    134 cel_shading_shader_ = new celshade_class;
    -
    135 result = cel_shading_shader_->initialize(device, hwnd);
    -
    136 if (!result)
    -
    137 {
    -
    138 return false;
    -
    139 }
    -
    140
    -
    141 sunlight_shader_ = new sunlight_shader_class;
    -
    142 result = sunlight_shader_->initialize(device, hwnd);
    -
    143 if (!result)
    -
    144 {
    -
    145 return false;
    -
    146 }
    -
    147
    -
    148 skybox_shader_ = new skybox_shader_class;
    -
    149 result = skybox_shader_->Initialize(device, hwnd);
    -
    150 if (!result)
    -
    151 {
    -
    152 Logger::Get().Log("Error initializing skybox_shader_class", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    153 return false;
    -
    154 }
    -
    155
    -
    156 depth_shader_ = new depth_shader_class;
    -
    157 result = depth_shader_->initialize(device, hwnd);
    -
    158 if (!result)
    -
    159 {
    -
    160 Logger::Get().Log("Error initializing depth_shader_class", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    161 return false;
    -
    162 }
    -
    163
    -
    164 Logger::Get().Log("shader_manager_class initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
    -
    165
    -
    166 return true;
    -
    167}
    -
    168
    -
    169void shader_manager_class::shutdown()
    -
    170{
    -
    171 Logger::Get().Log("Shutting down shader_manager_class", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
    -
    172
    -
    173 // Release the normal map shader object.
    -
    174 if (normal_map_shader_)
    -
    175 {
    -
    176 normal_map_shader_->shutdown();
    -
    177 delete normal_map_shader_;
    -
    178 normal_map_shader_ = 0;
    -
    179 }
    -
    180
    -
    181 // Release the texture shader object.
    -
    182 if (texture_shader_)
    -
    183 {
    -
    184 texture_shader_->shutdown();
    -
    185 delete texture_shader_;
    -
    186 texture_shader_ = 0;
    -
    187 }
    -
    188
    -
    189 // Release the multitexture shader object.
    -
    190 if (multitexture_shader_)
    -
    191 {
    -
    192 multitexture_shader_->shutdown();
    -
    193 delete multitexture_shader_;
    -
    194 multitexture_shader_ = 0;
    -
    195 }
    -
    196
    -
    197 // Release the translate shader object.
    -
    198 if (translate_shader_)
    -
    199 {
    -
    200 translate_shader_->shutdown();
    -
    201 delete translate_shader_;
    -
    202 translate_shader_ = 0;
    -
    203 }
    -
    204
    -
    205 // Release the alpha map shader object.
    -
    206 if (alpha_map_shader_)
    -
    207 {
    -
    208 alpha_map_shader_->shutdown();
    -
    209 delete alpha_map_shader_;
    -
    210 alpha_map_shader_ = 0;
    -
    211 }
    -
    212
    -
    213 // Release the specular map shader object.
    -
    214 if (spec_map_shader_)
    -
    215 {
    -
    216 spec_map_shader_->shutdown();
    -
    217 delete spec_map_shader_;
    -
    218 spec_map_shader_ = 0;
    -
    219 }
    -
    220
    -
    221 // Release the transparent shader object.
    -
    222 if (transparent_shader_)
    -
    223 {
    -
    224 transparent_shader_->shutdown();
    -
    225 delete transparent_shader_;
    -
    226 transparent_shader_ = 0;
    -
    227 }
    -
    228
    -
    229 // Release the light shader object.
    -
    230 if (light_shader_)
    -
    231 {
    -
    232 light_shader_->shutdown();
    -
    233 delete light_shader_;
    -
    234 light_shader_ = 0;
    -
    235 }
    -
    236
    -
    237 // Release the light map shader object.
    -
    238 if (light_map_shader_)
    -
    239 {
    -
    240 light_map_shader_->shutdown();
    -
    241 delete light_map_shader_;
    -
    242 light_map_shader_ = 0;
    -
    243 }
    -
    244
    -
    245 // Release the refraction shader object.
    -
    246 if (refraction_shader_)
    -
    247 {
    -
    248 refraction_shader_->shutdown();
    -
    249 delete refraction_shader_;
    -
    250 refraction_shader_ = 0;
    -
    251 }
    -
    252
    -
    253 // Release the water shader object.
    -
    254 if (water_shader_)
    -
    255 {
    -
    256 water_shader_->shutdown();
    -
    257 delete water_shader_;
    -
    258 water_shader_ = 0;
    -
    259 }
    -
    260
    -
    261 // Release the cel shading shader object.
    -
    262 if (cel_shading_shader_)
    -
    263 {
    -
    264 cel_shading_shader_->shutdown();
    -
    265 delete cel_shading_shader_;
    -
    266 cel_shading_shader_ = 0;
    -
    267 }
    -
    268
    -
    269 if (sunlight_shader_)
    -
    270 {
    -
    271 sunlight_shader_->shutdown();
    -
    272 delete sunlight_shader_;
    -
    273 sunlight_shader_ = 0;
    -
    274 }
    -
    275
    -
    276 if (skybox_shader_)
    -
    277 {
    -
    278 skybox_shader_->Shutdown();
    -
    279 delete skybox_shader_;
    -
    280 skybox_shader_ = 0;
    -
    281 }
    -
    282
    -
    283 if (depth_shader_)
    -
    284 {
    -
    285 depth_shader_->shutdown();
    -
    286 delete depth_shader_;
    -
    287 depth_shader_ = 0;
    -
    288 }
    -
    289
    -
    290 Logger::Get().Log("shader_manager_class shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
    -
    291}
    -
    292
    -
    293bool shader_manager_class::render_texture_shader(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix,
    -
    294 ID3D11ShaderResourceView* texture)
    -
    295{
    -
    296 bool result;
    -
    297
    -
    298 result = texture_shader_->render(deviceContext, indexCount, worldMatrix, viewMatrix, projectionMatrix, texture);
    -
    299 if (!result)
    -
    300 {
    -
    301 Logger::Get().Log("Error rendering texture_shader_class", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    302 return false;
    -
    303 }
    -
    304
    -
    305 return true;
    -
    306}
    -
    307
    -
    308bool shader_manager_class::render_normal_map_shader(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix,
    -
    309 ID3D11ShaderResourceView* colorTexture, ID3D11ShaderResourceView* normalTexture, XMFLOAT3 lightDirection, XMFLOAT4 diffuseColor)
    -
    310{
    -
    311 bool result;
    -
    312
    -
    313 result = normal_map_shader_->render(deviceContext, indexCount, worldMatrix, viewMatrix, projectionMatrix, colorTexture, normalTexture, lightDirection, diffuseColor);
    -
    314 if (!result)
    -
    315 {
    -
    316 Logger::Get().Log("Error rendering normal_map_shader_class", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    317 return false;
    -
    318 }
    -
    319
    -
    320 return true;
    -
    321}
    -
    322
    -
    323bool shader_manager_class::render_multitexture_shader(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix,
    -
    324 ID3D11ShaderResourceView* texture1, ID3D11ShaderResourceView* texture2)
    -
    325{
    -
    326 bool result;
    -
    327
    -
    328 result = multitexture_shader_->render(deviceContext, indexCount, worldMatrix, viewMatrix, projectionMatrix, texture1, texture2);
    -
    329 if (!result)
    -
    330 {
    -
    331 Logger::Get().Log("Error rendering multi_texture_shader_class", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    332 return false;
    -
    333 }
    -
    334
    -
    335 return true;
    -
    336}
    -
    337
    -
    338bool shader_manager_class::render_translate_shader(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix,
    -
    339 ID3D11ShaderResourceView* texture1, float valeur)
    -
    340{
    -
    341 bool result;
    -
    342
    -
    343 result = translate_shader_->render(deviceContext, indexCount, worldMatrix, viewMatrix, projectionMatrix, texture1, valeur);
    -
    344 if (!result)
    -
    345 {
    -
    346 Logger::Get().Log("Error rendering translate_shader_class", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    347 return false;
    -
    348 }
    -
    349
    -
    350 return true;
    -
    351}
    -
    352
    -
    353bool shader_manager_class::render_alpha_map_shader(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix,
    -
    354 ID3D11ShaderResourceView* texture1, ID3D11ShaderResourceView* texture2, ID3D11ShaderResourceView* texture3)
    -
    355{
    -
    356 bool result;
    -
    357
    -
    358 result = alpha_map_shader_->render(deviceContext, indexCount, worldMatrix, viewMatrix, projectionMatrix, texture1, texture2, texture3);
    -
    359 if (!result)
    -
    360 {
    -
    361 Logger::Get().Log("Error rendering alpha_map_shader_class", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    362 return false;
    -
    363 }
    -
    364
    -
    365 return true;
    -
    366}
    -
    367
    -
    368bool shader_manager_class::render_spec_map_shader(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix,
    -
    369 ID3D11ShaderResourceView* texture1, ID3D11ShaderResourceView* texture2, ID3D11ShaderResourceView* texture3,
    -
    370 XMFLOAT3 lightDirection, XMFLOAT4 diffuseColor, XMFLOAT3 cameraPosition, XMFLOAT4 specularColor, float specularPower)
    -
    371{
    -
    372 bool result;
    -
    373
    -
    374 result = spec_map_shader_->render(deviceContext, indexCount, worldMatrix, viewMatrix, projectionMatrix, texture1, texture2, texture3, lightDirection,
    -
    375 diffuseColor, cameraPosition, specularColor, specularPower);
    -
    376 if (!result)
    -
    377 {
    -
    378 Logger::Get().Log("Error rendering spec_map_shader_class", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    379 return false;
    -
    380 }
    -
    381
    -
    382 return true;
    -
    383}
    -
    384
    -
    385bool shader_manager_class::render_transparent_shader(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix,
    -
    386 ID3D11ShaderResourceView* texture1, float blendAmount)
    -
    387{
    -
    388 bool result;
    -
    389
    -
    390 result = transparent_shader_->render(deviceContext, indexCount, worldMatrix, viewMatrix, projectionMatrix, texture1, blendAmount);
    -
    391 if (!result)
    -
    392 {
    -
    393 Logger::Get().Log("Error rendering transparent_shader_class", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    394 return false;
    -
    395 }
    -
    396
    -
    397 return true;
    -
    398}
    -
    399
    -
    400bool shader_manager_class::renderlight_shader(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix,
    -
    401 ID3D11ShaderResourceView* texture, XMFLOAT4 diffuseColor[], XMFLOAT4 lightPosition[], XMFLOAT4 ambientColor[])
    -
    402{
    -
    403 bool result;
    -
    404
    -
    405 result = light_shader_->render(deviceContext, indexCount, worldMatrix, viewMatrix, projectionMatrix, texture, diffuseColor, lightPosition, ambientColor);
    -
    406 if (!result)
    -
    407 {
    -
    408 return false;
    -
    409 }
    -
    410
    -
    411 return true;
    -
    412}
    -
    413
    -
    414bool shader_manager_class::renderlight_map_shader(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix,
    -
    415 XMMATRIX projectionMatrix, ID3D11ShaderResourceView* texture1, ID3D11ShaderResourceView* texture2)
    -
    416{
    -
    417 bool result;
    -
    418
    -
    419 result = light_map_shader_->render(deviceContext, indexCount, worldMatrix, viewMatrix, projectionMatrix, texture1, texture2);
    -
    420 if (!result)
    -
    421 {
    -
    422 return false;
    -
    423 }
    -
    424
    -
    425 return true;
    -
    426}
    -
    427
    -
    428bool shader_manager_class::render_refraction_shader(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix,
    -
    429 ID3D11ShaderResourceView* texture, XMFLOAT3 lightDirection, XMFLOAT4 ambientColor[], XMFLOAT4 diffuseColor[], XMFLOAT4 lightPosition[], XMFLOAT4 clipPlane)
    -
    430{
    -
    431 bool result;
    -
    432
    -
    433 result = refraction_shader_->render(deviceContext, indexCount, worldMatrix, viewMatrix, projectionMatrix, texture, lightDirection, ambientColor, diffuseColor, lightPosition, clipPlane);
    -
    434 if (!result)
    -
    435 {
    -
    436 return false;
    -
    437 }
    -
    438
    -
    439 return true;
    -
    440}
    -
    441
    -
    442bool shader_manager_class::render_water_shader(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix,
    -
    443 XMMATRIX reflectionMatrix, ID3D11ShaderResourceView* reflectionTexture, ID3D11ShaderResourceView* refractionTexture,
    -
    444 ID3D11ShaderResourceView* normalTexture, float waterTranslation, float reflectRefractScale)
    -
    445{
    -
    446 bool result;
    -
    447
    -
    448 result = water_shader_->render(deviceContext, indexCount, worldMatrix, viewMatrix, projectionMatrix, reflectionMatrix, reflectionTexture,
    -
    449 refractionTexture, normalTexture, waterTranslation, reflectRefractScale);
    -
    450 if (!result)
    -
    451 {
    -
    452 return false;
    -
    453 }
    -
    454
    -
    455 return true;
    -
    456}
    -
    457
    -
    458bool shader_manager_class::render_cel_shading_shader(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix,
    -
    459 ID3D11ShaderResourceView* texture, XMFLOAT4 diffuseColor, XMFLOAT4 ambientColor, XMFLOAT3 sunDirection, float sunIntensity)
    -
    460{
    -
    461 bool result;
    -
    462
    -
    463 result = cel_shading_shader_->render(deviceContext, indexCount, worldMatrix, viewMatrix, projectionMatrix, texture, diffuseColor, ambientColor, sunDirection, sunIntensity);
    -
    464 if (!result)
    -
    465 {
    -
    466 return false;
    -
    467 }
    -
    468
    -
    469 return true;
    -
    470}
    -
    471
    -
    472bool shader_manager_class::render_sunlight_shader(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix,
    -
    473 ID3D11ShaderResourceView* texture, XMFLOAT4 diffuseColor, XMFLOAT4 ambientColor, XMFLOAT3 sunDirection, float sunIntensity)
    -
    474{
    -
    475 bool result;
    -
    476
    -
    477 result = sunlight_shader_->render(deviceContext, indexCount, worldMatrix, viewMatrix, projectionMatrix, texture, diffuseColor, ambientColor, sunDirection, sunIntensity);
    -
    478 if (!result)
    -
    479 {
    -
    480 return false;
    -
    481 }
    -
    482
    -
    483 return true;
    -
    484}
    -
    485
    -
    486bool shader_manager_class::render_skybox_shader(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix,
    -
    487 ID3D11ShaderResourceView* texture, XMFLOAT4 diffuseColor, XMFLOAT4 ambientColor, XMFLOAT3 sunDirection, float sunIntensity)
    -
    488{
    -
    489 bool result;
    -
    490
    -
    491 result = skybox_shader_->Render(deviceContext, indexCount, worldMatrix, viewMatrix, projectionMatrix, texture, diffuseColor, ambientColor, sunDirection, sunIntensity);
    -
    492 if (!result)
    -
    493 {
    -
    494 return false;
    -
    495 }
    -
    496
    -
    497 return true;
    -
    498}
    -
    499
    -
    500bool shader_manager_class::render_depth_shader(
    -
    501 ID3D11DeviceContext* context,
    -
    502 int indexCount,
    -
    503 XMMATRIX worldMatrix,
    -
    504 XMMATRIX viewMatrix,
    -
    505 XMMATRIX projectionMatrix,
    -
    506 ID3D11ShaderResourceView* texture
    -
    507)
    -
    508{
    -
    509 bool result;
    -
    510
    -
    511 result = depth_shader_->render(context, indexCount, worldMatrix, viewMatrix, projectionMatrix, texture);
    -
    512 if (!result)
    -
    513 {
    -
    514 return false;
    -
    515 }
    -
    516
    -
    517 return true;
    -
    518}
    -
    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
    - - - - - - - - - - - - - - - - -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:c82458b7959be2bdb280fc0f83e3e5659a5f5cd94cf23cb0d8393871fe6e1da5 +size 87899 diff --git a/doxygen_docs/html/shader__manager__class_8h_source.html b/doxygen_docs/html/shader__manager__class_8h_source.html index eb45d72..5b989db 100644 --- a/doxygen_docs/html/shader__manager__class_8h_source.html +++ b/doxygen_docs/html/shader__manager__class_8h_source.html @@ -1,208 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/inc/shader/shader_manager_class.h Source File - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    shader_manager_class.h
    -
    -
    -
    1#ifndef _SHADERMANAGERCLASS_H_
    -
    2#define _SHADERMANAGERCLASS_H_
    -
    3
    -
    4// Inclure les en-têtes nécessaires
    -
    5#include <d3d11.h>
    -
    6#include <DirectXMath.h>
    -
    7#include <vector>
    -
    8#include "texture_shader_class.h"
    -
    9#include "normal_map_shader_class.h"
    -
    10#include "multi_texture_shader_class.h"
    -
    11#include "translate_shader_class.h"
    -
    12#include "alpha_map_shader_class.h"
    -
    13#include "spec_map_shader_class.h"
    -
    14#include "transparent_shader_class.h"
    -
    15#include "light_shader_class.h"
    -
    16#include "light_map_shader_class.h"
    -
    17#include "refraction_shader_class.h"
    -
    18#include "water_shader_class.h"
    -
    19#include "celshade_class.h"
    -
    20#include "depth_shader_class.h"
    -
    21#include "skybox_shader_class.h"
    -
    22#include "sunlight_shader_class.h"
    -
    23#include "depth_shader_class.h"
    -
    24
    -
    25using namespace DirectX;
    -
    26
    -
    - -
    28{
    -
    29public:
    - - - -
    33
    -
    34 bool initialize(ID3D11Device*, HWND);
    -
    35 void shutdown();
    -
    36
    -
    37 bool render_texture_shader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*);
    -
    38 bool render_normal_map_shader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, XMFLOAT3, XMFLOAT4);
    -
    39 bool render_multitexture_shader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*);
    -
    40 bool render_translate_shader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, float);
    -
    41 bool render_alpha_map_shader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*);
    -
    42 bool render_spec_map_shader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, XMFLOAT3, XMFLOAT4, XMFLOAT3, XMFLOAT4, float);
    -
    43 bool render_transparent_shader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, float);
    -
    44 bool renderlight_shader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT4[], XMFLOAT4[], XMFLOAT4[]);
    -
    45 bool renderlight_map_shader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*);
    -
    46 bool render_refraction_shader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT3, XMFLOAT4[], XMFLOAT4[], XMFLOAT4[], XMFLOAT4);
    -
    47 bool render_water_shader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, float, float);
    -
    48 bool render_cel_shading_shader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT4, XMFLOAT4, XMFLOAT3, float);
    -
    49 bool render_sunlight_shader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT4, XMFLOAT4, XMFLOAT3, float);
    -
    50 bool render_skybox_shader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT4, XMFLOAT4, XMFLOAT3, float);
    -
    51 bool render_depth_shader(
    -
    52 ID3D11DeviceContext* context,
    -
    53 int indexCount,
    -
    54 XMMATRIX worldMatrix,
    -
    55 XMMATRIX viewMatrix,
    -
    56 XMMATRIX projectionMatrix,
    -
    57 ID3D11ShaderResourceView* texture
    -
    58 );
    -
    59
    -
    60private:
    -
    61 texture_shader_class* texture_shader_;
    -
    62 normal_map_shader_class* normal_map_shader_;
    -
    63 multi_texture_shader_class* multitexture_shader_;
    -
    64 translate_shader_class* translate_shader_;
    -
    65 alpha_map_shader_class* alpha_map_shader_;
    -
    66 spec_map_shader_class* spec_map_shader_;
    -
    67 transparent_shader_class* transparent_shader_;
    -
    68 light_shader_class* light_shader_;
    -
    69 light_map_shader_class* light_map_shader_;
    -
    70 refraction_shader_class* refraction_shader_;
    -
    71 water_shader_class* water_shader_;
    -
    72 celshade_class* cel_shading_shader_;
    -
    73 sunlight_shader_class* sunlight_shader_;
    -
    74 skybox_shader_class* skybox_shader_;
    -
    75 depth_shader_class* depth_shader_;
    -
    76};
    -
    -
    77
    -
    78#endif
    - - - - - - - - - - - - - - - - -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:b19b7c763cf9c2b35af1bace226ded37efa3ddd2362a298ee1a67efb881c5b3e +size 24361 diff --git a/doxygen_docs/html/shadow__map_8cpp_source.html b/doxygen_docs/html/shadow__map_8cpp_source.html index e8344a2..40ac8a1 100644 --- a/doxygen_docs/html/shadow__map_8cpp_source.html +++ b/doxygen_docs/html/shadow__map_8cpp_source.html @@ -1,174 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/src/system/shadow_map.cpp Source File - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    shadow_map.cpp
    -
    -
    -
    1#include "shadow_map.h"
    -
    2
    -
    3shadow_map::shadow_map()
    -
    4 : depth_texture_(nullptr), depth_stencil_view_(nullptr), shader_resource_view_(nullptr), width_(0), height_(0) {}
    -
    5
    -
    6shadow_map::~shadow_map() {
    -
    7 shutdown();
    -
    8}
    -
    9
    -
    10bool shadow_map::initialize(ID3D11Device* device, int width, int height) {
    -
    11 width_ = width;
    -
    12 height_ = height;
    -
    13
    -
    14 D3D11_TEXTURE2D_DESC texDesc = {};
    -
    15 texDesc.Width = width;
    -
    16 texDesc.Height = height;
    -
    17 texDesc.MipLevels = 1;
    -
    18 texDesc.ArraySize = 1;
    -
    19 texDesc.Format = DXGI_FORMAT_R24G8_TYPELESS;
    -
    20 texDesc.SampleDesc.Count = 1;
    -
    21 texDesc.Usage = D3D11_USAGE_DEFAULT;
    -
    22 texDesc.BindFlags = D3D11_BIND_DEPTH_STENCIL | D3D11_BIND_SHADER_RESOURCE;
    -
    23
    -
    24 if (FAILED(device->CreateTexture2D(&texDesc, nullptr, &depth_texture_)))
    -
    25 return false;
    -
    26
    -
    27 D3D11_DEPTH_STENCIL_VIEW_DESC dsvDesc = {};
    -
    28 dsvDesc.Format = DXGI_FORMAT_D24_UNORM_S8_UINT;
    -
    29 dsvDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D;
    -
    30 dsvDesc.Texture2D.MipSlice = 0;
    -
    31
    -
    32 if (FAILED(device->CreateDepthStencilView(depth_texture_, &dsvDesc, &depth_stencil_view_)))
    -
    33 return false;
    -
    34
    -
    35 D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc = {};
    -
    36 srvDesc.Format = DXGI_FORMAT_R24_UNORM_X8_TYPELESS;
    -
    37 srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
    -
    38 srvDesc.Texture2D.MipLevels = 1;
    -
    39
    -
    40 if (FAILED(device->CreateShaderResourceView(depth_texture_, &srvDesc, &shader_resource_view_)))
    -
    41 return false;
    -
    42
    -
    43 return true;
    -
    44}
    -
    45
    -
    46void shadow_map::shutdown() {
    -
    47 if (shader_resource_view_) { shader_resource_view_->Release(); shader_resource_view_ = nullptr; }
    -
    48 if (depth_stencil_view_) { depth_stencil_view_->Release(); depth_stencil_view_ = nullptr; }
    -
    49 if (depth_texture_) { depth_texture_->Release(); depth_texture_ = nullptr; }
    -
    50}
    -
    51
    -
    52void shadow_map::set_render_target(ID3D11DeviceContext* context) {
    -
    53 context->OMSetRenderTargets(0, nullptr, depth_stencil_view_);
    -
    54}
    -
    55
    -
    56void shadow_map::clear_render_target(ID3D11DeviceContext* context, float depth) {
    -
    57 context->ClearDepthStencilView(depth_stencil_view_, D3D11_CLEAR_DEPTH, depth, 0);
    -
    58}
    -
    59
    -
    60ID3D11ShaderResourceView* shadow_map::get_shader_resource_view() {
    -
    61 return shader_resource_view_;
    -
    62}
    -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:83b93fada8654e4ab42d718a0c66a9dc7925c6e2a6aeb063958245f2ca7b201c +size 13410 diff --git a/doxygen_docs/html/shadow__map_8h_source.html b/doxygen_docs/html/shadow__map_8h_source.html index 8093bee..fd7718a 100644 --- a/doxygen_docs/html/shadow__map_8h_source.html +++ b/doxygen_docs/html/shadow__map_8h_source.html @@ -1,140 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/inc/system/shadow_map.h Source File - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    shadow_map.h
    -
    -
    -
    1#pragma once
    -
    2#include <d3d11.h>
    -
    3#include <directxmath.h>
    -
    4
    -
    -
    5class shadow_map {
    -
    6public:
    - - -
    9
    -
    10 bool initialize(ID3D11Device* device, int width, int height);
    -
    11 void shutdown();
    -
    12
    -
    13 void set_render_target(ID3D11DeviceContext* context);
    -
    14 void clear_render_target(ID3D11DeviceContext* context, float depth = 1.0f);
    -
    15
    -
    16
    -
    17 ID3D11ShaderResourceView* get_shader_resource_view();
    -
    18
    -
    19
    -
    20private:
    -
    21 ID3D11Texture2D* depth_texture_;
    -
    22 ID3D11DepthStencilView* depth_stencil_view_;
    -
    23 ID3D11ShaderResourceView* shader_resource_view_;
    -
    24 int width_, height_;
    -
    25};
    -
    - -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:50705efbdabb2ee4af80b0e726861683b806acd3939b0d32e38c69f08ca553cb +size 8510 diff --git a/doxygen_docs/html/skybox__shader__class_8cpp_source.html b/doxygen_docs/html/skybox__shader__class_8cpp_source.html index 1c76aa2..bdab298 100644 --- a/doxygen_docs/html/skybox__shader__class_8cpp_source.html +++ b/doxygen_docs/html/skybox__shader__class_8cpp_source.html @@ -1,576 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/src/shader/skybox_shader_class.cpp Source File - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    skybox_shader_class.cpp
    -
    -
    -
    1
    -
    2// Filename: lightshaderclass.cpp
    -
    4#include "skybox_shader_class.h"
    -
    5
    -
    6
    -
    7skybox_shader_class::skybox_shader_class()
    -
    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}
    -
    19
    -
    20
    -
    21skybox_shader_class::skybox_shader_class(const skybox_shader_class& other)
    -
    22{
    -
    23}
    -
    24
    -
    25
    -
    26skybox_shader_class::~skybox_shader_class()
    -
    27{
    -
    28}
    -
    29
    -
    30
    -
    31bool skybox_shader_class::Initialize(ID3D11Device* device, HWND hwnd)
    -
    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}
    -
    67
    -
    68
    -
    69void skybox_shader_class::Shutdown()
    -
    70{
    -
    71 // Shutdown the vertex and pixel shaders as well as the related objects.
    -
    72 ShutdownShader();
    -
    73
    -
    74 return;
    -
    75}
    -
    76
    -
    77bool skybox_shader_class::Render(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix,
    -
    78 ID3D11ShaderResourceView* texture, XMFLOAT4 diffuseColor, XMFLOAT4 ambientColor, XMFLOAT3 sunDirection, float sunIntensity)
    -
    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}
    -
    96
    -
    97
    -
    98bool skybox_shader_class::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR* vsFilename, WCHAR* psFilename)
    -
    99{
    -
    100 Logger::Get().Log("Initializing shader", __FILE__, __LINE__, Logger::LogLevel::Initialize);
    -
    101
    -
    102 HRESULT result;
    -
    103 ID3D10Blob* errorMessage;
    -
    104 ID3D10Blob* vertexShaderBuffer;
    -
    105 ID3D10Blob* pixelShaderBuffer;
    -
    106 D3D11_INPUT_ELEMENT_DESC polygonLayout[3];
    -
    107 unsigned int numElements;
    -
    108 D3D11_SAMPLER_DESC samplerDesc;
    -
    109 D3D11_BUFFER_DESC matrixBufferDesc;
    -
    110 D3D11_BUFFER_DESC sunlightBufferDesc;
    -
    111
    -
    112 // Initialize the pointers this function will use to null.
    -
    113 errorMessage = 0;
    -
    114 vertexShaderBuffer = 0;
    -
    115 pixelShaderBuffer = 0;
    -
    116
    -
    117 // Compile the vertex shader code.
    -
    118 result = D3DCompileFromFile(vsFilename, NULL, NULL, "SkyboxVertexShader", "vs_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0, &vertexShaderBuffer, &errorMessage);
    -
    119 if (FAILED(result))
    -
    120 {
    -
    121 if (errorMessage)
    -
    122 {
    -
    123 OutputShaderErrorMessage(errorMessage, hwnd, vsFilename);
    -
    124 }
    -
    125 else
    -
    126 {
    -
    127 Logger::Get().Log("Failed to compile shader", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    128 }
    -
    129 return false;
    -
    130 }
    -
    131
    -
    132 // Compile the pixel shader code.
    -
    133 result = D3DCompileFromFile(psFilename, NULL, NULL, "SkyboxPixelShader", "ps_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0, &pixelShaderBuffer, &errorMessage);
    -
    134 if (FAILED(result))
    -
    135 {
    -
    136 if (errorMessage)
    -
    137 {
    -
    138 OutputShaderErrorMessage(errorMessage, hwnd, psFilename);
    -
    139 }
    -
    140 else
    -
    141 {
    -
    142 Logger::Get().Log("Failed to compile shader", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    143 }
    -
    144 return false;
    -
    145 }
    -
    146
    -
    147 // Create the vertex shader from the buffer.
    -
    148 result = device->CreateVertexShader(vertexShaderBuffer->GetBufferPointer(), vertexShaderBuffer->GetBufferSize(), NULL, &m_vertexShader);
    -
    149 if (FAILED(result))
    -
    150 {
    -
    151 Logger::Get().Log("Failed to create vertex shader", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    152 return false;
    -
    153 }
    -
    154
    -
    155 // Create the pixel shader from the buffer.
    -
    156 result = device->CreatePixelShader(pixelShaderBuffer->GetBufferPointer(), pixelShaderBuffer->GetBufferSize(), NULL, &m_pixelShader);
    -
    157 if (FAILED(result))
    -
    158 {
    -
    159 Logger::Get().Log("Failed to create pixel shader", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    160 return false;
    -
    161 }
    -
    162
    -
    163 // Create the vertex input layout description.
    -
    164 polygonLayout[0].SemanticName = "POSITION";
    -
    165 polygonLayout[0].SemanticIndex = 0;
    -
    166 polygonLayout[0].Format = DXGI_FORMAT_R32G32B32_FLOAT;
    -
    167 polygonLayout[0].InputSlot = 0;
    -
    168 polygonLayout[0].AlignedByteOffset = 0;
    -
    169 polygonLayout[0].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
    -
    170 polygonLayout[0].InstanceDataStepRate = 0;
    -
    171
    -
    172 polygonLayout[1].SemanticName = "TEXCOORD";
    -
    173 polygonLayout[1].SemanticIndex = 0;
    -
    174 polygonLayout[1].Format = DXGI_FORMAT_R32G32_FLOAT;
    -
    175 polygonLayout[1].InputSlot = 0;
    -
    176 polygonLayout[1].AlignedByteOffset = D3D11_APPEND_ALIGNED_ELEMENT;
    -
    177 polygonLayout[1].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
    -
    178 polygonLayout[1].InstanceDataStepRate = 0;
    -
    179
    -
    180 polygonLayout[2].SemanticName = "NORMAL";
    -
    181 polygonLayout[2].SemanticIndex = 0;
    -
    182 polygonLayout[2].Format = DXGI_FORMAT_R32G32B32_FLOAT;
    -
    183 polygonLayout[2].InputSlot = 0;
    -
    184 polygonLayout[2].AlignedByteOffset = D3D11_APPEND_ALIGNED_ELEMENT;
    -
    185 polygonLayout[2].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
    -
    186 polygonLayout[2].InstanceDataStepRate = 0;
    -
    187
    -
    188 // Get a count of the elements in the layout.
    -
    189 numElements = sizeof(polygonLayout) / sizeof(polygonLayout[0]);
    -
    190
    -
    191 // Create the vertex input layout.
    -
    192 result = device->CreateInputLayout(polygonLayout, numElements, vertexShaderBuffer->GetBufferPointer(), vertexShaderBuffer->GetBufferSize(), &m_layout);
    -
    193 if (FAILED(result))
    -
    194 {
    -
    195 Logger::Get().Log("Failed to create input layout", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    196 return false;
    -
    197 }
    -
    198
    -
    199 // Release the vertex shader buffer and pixel shader buffer since they are no longer needed.
    -
    200 vertexShaderBuffer->Release();
    -
    201 vertexShaderBuffer = 0;
    -
    202
    -
    203 pixelShaderBuffer->Release();
    -
    204 pixelShaderBuffer = 0;
    -
    205
    -
    206 // Create a texture sampler state description.
    -
    207 samplerDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR;
    -
    208 samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP;
    -
    209 samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP;
    -
    210 samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_WRAP;
    -
    211 samplerDesc.MipLODBias = 0.0f;
    -
    212 samplerDesc.MaxAnisotropy = 1;
    -
    213 samplerDesc.ComparisonFunc = D3D11_COMPARISON_ALWAYS;
    -
    214 samplerDesc.BorderColor[0] = 0;
    -
    215 samplerDesc.BorderColor[1] = 0;
    -
    216 samplerDesc.BorderColor[2] = 0;
    -
    217 samplerDesc.BorderColor[3] = 0;
    -
    218 samplerDesc.MinLOD = 0;
    -
    219 samplerDesc.MaxLOD = D3D11_FLOAT32_MAX;
    -
    220
    -
    221 // Create the texture sampler state.
    -
    222 result = device->CreateSamplerState(&samplerDesc, &m_sampleState);
    -
    223 if (FAILED(result))
    -
    224 {
    -
    225 Logger::Get().Log("Failed to create sampler state", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    226 return false;
    -
    227 }
    -
    228
    -
    229 // Setup the description of the dynamic matrix constant buffer that is in the vertex shader.
    -
    230 matrixBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
    -
    231 matrixBufferDesc.ByteWidth = sizeof(MatrixBufferType);
    -
    232 matrixBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
    -
    233 matrixBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
    -
    234 matrixBufferDesc.MiscFlags = 0;
    -
    235 matrixBufferDesc.StructureByteStride = 0;
    -
    236
    -
    237 // Create the constant buffer pointer so we can access the vertex shader constant buffer from within this class.
    -
    238 result = device->CreateBuffer(&matrixBufferDesc, NULL, &m_matrixBuffer);
    -
    239 if (FAILED(result))
    -
    240 {
    -
    241 Logger::Get().Log("Failed to create matrix buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    242 return false;
    -
    243 }
    -
    244
    -
    245 // Setup the description of the dynamic sunlight constant buffer that is in the pixel shader.
    -
    246 sunlightBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
    -
    247 sunlightBufferDesc.ByteWidth = sizeof(SkyboxBufferType);
    -
    248 sunlightBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
    -
    249 sunlightBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
    -
    250 sunlightBufferDesc.MiscFlags = 0;
    -
    251 sunlightBufferDesc.StructureByteStride = 0;
    -
    252
    -
    253 // Create the constant buffer pointer so we can access the pixel shader constant buffer from within this class.
    -
    254 result = device->CreateBuffer(&sunlightBufferDesc, NULL, &m_sunlightBuffer);
    -
    255 if (FAILED(result))
    -
    256 {
    -
    257 Logger::Get().Log("Failed to create sunlight buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    258 return false;
    -
    259 }
    -
    260
    -
    261 Logger::Get().Log("Shader initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
    -
    262
    -
    263 return true;
    -
    264}
    -
    265
    -
    266
    -
    267
    -
    268
    -
    269void skybox_shader_class::ShutdownShader()
    -
    270{
    -
    271 Logger::Get().Log("Shutting down SunLightShaderClass", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
    -
    272
    -
    273 // Release the light constant buffers.
    -
    274 if (m_sunlightColorBuffer)
    -
    275 {
    -
    276 m_sunlightColorBuffer->Release();
    -
    277 m_sunlightColorBuffer = 0;
    -
    278 }
    -
    279
    -
    280 if (m_sunlightPositionBuffer)
    -
    281 {
    -
    282 m_sunlightPositionBuffer->Release();
    -
    283 m_sunlightPositionBuffer = 0;
    -
    284 }
    -
    285
    -
    286 // Release the light constant buffer.
    -
    287 if (m_sunlightBuffer)
    -
    288 {
    -
    289 m_sunlightBuffer->Release();
    -
    290 m_sunlightBuffer = 0;
    -
    291 }
    -
    292
    -
    293 // Release the camera constant buffer.
    -
    294 if (m_cameraBuffer)
    -
    295 {
    -
    296 m_cameraBuffer->Release();
    -
    297 m_cameraBuffer = 0;
    -
    298 }
    -
    299
    -
    300 // Release the matrix constant buffer.
    -
    301 if (m_matrixBuffer)
    -
    302 {
    -
    303 m_matrixBuffer->Release();
    -
    304 m_matrixBuffer = 0;
    -
    305 }
    -
    306
    -
    307 // Release the sampler state.
    -
    308 if (m_sampleState)
    -
    309 {
    -
    310 m_sampleState->Release();
    -
    311 m_sampleState = 0;
    -
    312 }
    -
    313
    -
    314 // Release the layout.
    -
    315 if (m_layout)
    -
    316 {
    -
    317 m_layout->Release();
    -
    318 m_layout = 0;
    -
    319 }
    -
    320
    -
    321 // Release the pixel shader.
    -
    322 if (m_pixelShader)
    -
    323 {
    -
    324 m_pixelShader->Release();
    -
    325 m_pixelShader = 0;
    -
    326 }
    -
    327
    -
    328 // Release the vertex shader.
    -
    329 if (m_vertexShader)
    -
    330 {
    -
    331 m_vertexShader->Release();
    -
    332 m_vertexShader = 0;
    -
    333 }
    -
    334
    -
    335 Logger::Get().Log("SunLightShaderClass shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
    -
    336
    -
    337 return;
    -
    338}
    -
    339
    -
    340
    -
    341void skybox_shader_class::OutputShaderErrorMessage(ID3D10Blob* errorMessage, HWND hwnd, WCHAR* shaderFilename)
    -
    342{
    -
    343 char* compileErrors;
    -
    344 unsigned __int64 bufferSize, i;
    -
    345 ofstream fout;
    -
    346
    -
    347
    -
    348 // Get a pointer to the error message text buffer.
    -
    349 compileErrors = (char*)(errorMessage->GetBufferPointer());
    -
    350
    -
    351 // Get the length of the message.
    -
    352 bufferSize = errorMessage->GetBufferSize();
    -
    353
    -
    354 // Open a file to write the error message to.
    -
    355 fout.open("shader-error.txt");
    -
    356
    -
    357 // Write out the error message.
    -
    358 for (i = 0; i < bufferSize; i++)
    -
    359 {
    -
    360 fout << compileErrors[i];
    -
    361 }
    -
    362
    -
    363 // Close the file.
    -
    364 fout.close();
    -
    365
    -
    366 // Release the error message.
    -
    367 errorMessage->Release();
    -
    368 errorMessage = 0;
    -
    369
    -
    370 // Pop a message up on the screen to notify the user to check the text file for compile errors.
    -
    371 MessageBox(hwnd, L"Error compiling shader. Check shader-error.txt for message.", shaderFilename, MB_OK);
    -
    372
    -
    373 return;
    -
    374}
    -
    375
    -
    376
    -
    377bool skybox_shader_class::SetShaderParameters(ID3D11DeviceContext* deviceContext, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix, ID3D11ShaderResourceView* texture, XMFLOAT4 ambientColor, XMFLOAT4 diffuseColor, XMFLOAT3 lightDirection, float sunIntensity)
    -
    378{
    -
    379 HRESULT result;
    -
    380 D3D11_MAPPED_SUBRESOURCE mappedResource;
    -
    381 MatrixBufferType* dataPtr;
    -
    382 CameraBufferType* dataPtr2;
    -
    383 SkyboxBufferType* dataPtr3;
    -
    384 unsigned int bufferNumber;
    -
    385
    -
    386 // Transpose the matrices to prepare them for the shader.
    -
    387 worldMatrix = XMMatrixTranspose(worldMatrix);
    -
    388 viewMatrix = XMMatrixTranspose(viewMatrix);
    -
    389 projectionMatrix = XMMatrixTranspose(projectionMatrix);
    -
    390
    -
    391 // Lock the constant buffer so it can be written to.
    -
    392 result = deviceContext->Map(m_matrixBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
    -
    393 if (FAILED(result))
    -
    394 {
    -
    395 return false;
    -
    396 }
    -
    397
    -
    398 // Get a pointer to the data in the constant buffer.
    -
    399 dataPtr = (MatrixBufferType*)mappedResource.pData;
    -
    400
    -
    401 // Copy the matrices into the constant buffer.
    -
    402 dataPtr->world = worldMatrix;
    -
    403 dataPtr->view = viewMatrix;
    -
    404 dataPtr->projection = projectionMatrix;
    -
    405
    -
    406 // Unlock the constant buffer.
    -
    407 deviceContext->Unmap(m_matrixBuffer, 0);
    -
    408
    -
    409 // Set the position of the constant buffer in the vertex shader.
    -
    410 bufferNumber = 0;
    -
    411
    -
    412 // Finally set the constant buffer in the vertex shader with the updated values.
    -
    413 deviceContext->VSSetConstantBuffers(bufferNumber, 1, &m_matrixBuffer);
    -
    414
    -
    415 // Lock the sunlight constant buffer so it can be written to.
    -
    416 result = deviceContext->Map(m_sunlightBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
    -
    417 if (FAILED(result))
    -
    418 {
    -
    419 return false;
    -
    420 }
    -
    421
    -
    422 // Get a pointer to the data in the constant buffer.
    -
    423 dataPtr3 = (SkyboxBufferType*)mappedResource.pData;
    -
    424
    -
    425 // Copy the lighting variables into the constant buffer.
    -
    426 dataPtr3->ambientColor = ambientColor;
    -
    427 dataPtr3->diffuseColor = diffuseColor;
    -
    428 dataPtr3->sunDirection = lightDirection;
    -
    429 dataPtr3->intensity = sunIntensity;
    -
    430
    -
    431 // Unlock the constant buffer.
    -
    432 deviceContext->Unmap(m_sunlightBuffer, 0);
    -
    433
    -
    434 // Set the position of the sunlight constant buffer in the pixel shader.
    -
    435 bufferNumber = 0;
    -
    436
    -
    437 // Finally set the sunlight constant buffer in the pixel shader with the updated values.
    -
    438 deviceContext->PSSetConstantBuffers(bufferNumber, 1, &m_sunlightBuffer);
    -
    439
    -
    440 // Set shader texture resource in the pixel shader.
    -
    441 deviceContext->PSSetShaderResources(0, 1, &texture);
    -
    442
    -
    443 return true;
    -
    444}
    -
    445
    -
    446void skybox_shader_class::RenderShader(ID3D11DeviceContext* deviceContext, int indexCount)
    -
    447{
    -
    448 // Set the vertex input layout.
    -
    449 deviceContext->IASetInputLayout(m_layout);
    -
    450
    -
    451 // Set the vertex and pixel shaders that will be used to render this triangle.
    -
    452 deviceContext->VSSetShader(m_vertexShader, NULL, 0);
    -
    453 deviceContext->PSSetShader(m_pixelShader, NULL, 0);
    -
    454
    -
    455 // Set the sampler state in the pixel shader.
    -
    456 deviceContext->PSSetSamplers(0, 1, &m_sampleState);
    -
    457
    -
    458 // Render the triangle.
    -
    459 deviceContext->DrawIndexed(indexCount, 0, 0);
    -
    460
    -
    461 return;
    -
    462}
    -
    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
    - -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:b29dc45d9523018e1665a8404d427386b6a44f472c0ce9d3fa2d6602184babca +size 72024 diff --git a/doxygen_docs/html/skybox__shader__class_8h_source.html b/doxygen_docs/html/skybox__shader__class_8h_source.html index ded4c6c..c658506 100644 --- a/doxygen_docs/html/skybox__shader__class_8h_source.html +++ b/doxygen_docs/html/skybox__shader__class_8h_source.html @@ -1,183 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/inc/shader/skybox_shader_class.h Source File - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    skybox_shader_class.h
    -
    -
    -
    1#pragma once
    -
    2
    -
    3#include "Logger.h"
    -
    4#include <d3d11.h>
    -
    5#include <d3dcompiler.h>
    -
    6#include <directxmath.h>
    -
    7#include <fstream>
    -
    8using namespace DirectX;
    -
    9using namespace std;
    -
    10
    -
    - -
    12{
    -
    13
    -
    14 private :
    -
    15 struct MatrixBufferType
    -
    16 {
    -
    17 XMMATRIX world;
    -
    18 XMMATRIX view;
    -
    19 XMMATRIX projection;
    -
    20 };
    -
    21
    -
    22 struct CameraBufferType
    -
    23 {
    -
    24 XMFLOAT3 cameraPosition;
    -
    25 float padding;
    -
    26 };
    -
    27
    -
    28 struct SkyboxBufferType
    -
    29 {
    -
    30 XMFLOAT4 diffuseColor;
    -
    31 XMFLOAT4 ambientColor;
    -
    32 XMFLOAT3 sunDirection;
    -
    33 float intensity;
    -
    34 };
    -
    35
    -
    36 struct SkyboxColorBufferType
    -
    37 {
    -
    38 XMFLOAT4 sunColor;
    -
    39 };
    -
    40
    -
    41public :
    - - - -
    45
    -
    46 bool Initialize(ID3D11Device*, HWND);
    -
    47 void Shutdown();
    -
    48 bool Render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT4, XMFLOAT4, XMFLOAT3,float);
    -
    49
    -
    50private:
    -
    51 bool InitializeShader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
    -
    52 void ShutdownShader();
    -
    53 void OutputShaderErrorMessage(ID3D10Blob*, HWND, WCHAR*);
    -
    54
    -
    55 bool SetShaderParameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT4, XMFLOAT4, XMFLOAT3, float);
    -
    56 void RenderShader(ID3D11DeviceContext*, int);
    -
    57
    -
    58private:
    -
    59 ID3D11VertexShader* m_vertexShader;
    -
    60 ID3D11PixelShader* m_pixelShader;
    -
    61 ID3D11InputLayout* m_layout;
    -
    62 ID3D11SamplerState* m_sampleState;
    -
    63 ID3D11Buffer* m_matrixBuffer;
    -
    64 ID3D11Buffer* m_cameraBuffer;
    -
    65 ID3D11Buffer* m_sunlightBuffer;
    -
    66 ID3D11Buffer* m_sunlightColorBuffer;
    -
    67 ID3D11Buffer* m_sunlightPositionBuffer;
    -
    68};
    -
    - -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:81d51a6119120e9c720c640bdf34e5fd24f054977c8f2c93187c304bcf7cd998 +size 14268 diff --git a/doxygen_docs/html/spec__map__shader__class_8cpp_source.html b/doxygen_docs/html/spec__map__shader__class_8cpp_source.html index 6d2956a..53914a9 100644 --- a/doxygen_docs/html/spec__map__shader__class_8cpp_source.html +++ b/doxygen_docs/html/spec__map__shader__class_8cpp_source.html @@ -1,605 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/src/shader/spec_map_shader_class.cpp Source File - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    spec_map_shader_class.cpp
    -
    -
    -
    1#include "spec_map_shader_class.h"
    -
    2
    -
    3
    -
    4spec_map_shader_class::spec_map_shader_class()
    -
    5{
    -
    6 vertex_shader_ = 0;
    -
    7 pixel_shader_ = 0;
    -
    8 layout_ = 0;
    -
    9 matrix_buffer_ = 0;
    -
    10 sample_state_ = 0;
    -
    11 light_buffer_ = 0;
    -
    12 camera_buffer_ = 0;
    -
    13}
    -
    14
    -
    15
    -
    16spec_map_shader_class::spec_map_shader_class(const spec_map_shader_class& other)
    -
    17{
    -
    18}
    -
    19
    -
    20
    -
    21spec_map_shader_class::~spec_map_shader_class()
    -
    22{
    -
    23}
    -
    24
    -
    25
    -
    26bool spec_map_shader_class::initialize(ID3D11Device* device, HWND hwnd)
    -
    27{
    -
    28 bool result;
    -
    29 wchar_t vsFilename[128];
    -
    30 wchar_t psFilename[128];
    -
    31 int error;
    -
    32
    -
    33 // Set the filename of the vertex shader.
    -
    34 error = wcscpy_s(vsFilename, 128, L"src/hlsl/specmap.vs");
    -
    35 if (error != 0)
    -
    36 {
    -
    37 return false;
    -
    38 }
    -
    39
    -
    40 // Set the filename of the pixel shader.
    -
    41 error = wcscpy_s(psFilename, 128, L"src/hlsl/specmap.ps");
    -
    42 if (error != 0)
    -
    43 {
    -
    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 return false;
    -
    52 }
    -
    53
    -
    54 return true;
    -
    55}
    -
    56
    -
    57
    -
    58void spec_map_shader_class::shutdown()
    -
    59{
    -
    60 // shutdown the vertex and pixel shaders as well as the related objects.
    -
    61 shutdown_shader();
    -
    62
    -
    63 return;
    -
    64}
    -
    65
    -
    66bool spec_map_shader_class::render(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix,
    -
    67 ID3D11ShaderResourceView* texture1, ID3D11ShaderResourceView* texture2, ID3D11ShaderResourceView* texture3,
    -
    68 XMFLOAT3 lightDirection, XMFLOAT4 diffuseColor, XMFLOAT3 cameraPosition, XMFLOAT4 specularColor, float specularPower)
    -
    69{
    -
    70 bool result;
    -
    71
    -
    72
    -
    73 // Set the shader parameters that it will use for rendering.
    -
    74 result = set_shader_parameters(deviceContext, worldMatrix, viewMatrix, projectionMatrix, texture1, texture2, texture3, lightDirection, diffuseColor,
    -
    75 cameraPosition, specularColor, specularPower);
    -
    76 if (!result)
    -
    77 {
    -
    78 return false;
    -
    79 }
    -
    80
    -
    81 // Now render the prepared buffers with the shader.
    -
    82 render_shader(deviceContext, indexCount);
    -
    83
    -
    84 return true;
    -
    85}
    -
    86
    -
    87
    -
    88bool spec_map_shader_class::initialize_shader(ID3D11Device* device, HWND hwnd, WCHAR* vsFilename, WCHAR* psFilename)
    -
    89{
    -
    90 HRESULT result;
    -
    91 ID3D10Blob* errorMessage;
    -
    92 ID3D10Blob* vertexShaderBuffer;
    -
    93 ID3D10Blob* pixelShaderBuffer;
    -
    94 D3D11_INPUT_ELEMENT_DESC polygonLayout[5];
    -
    95 unsigned int numElements;
    -
    96 D3D11_BUFFER_DESC matrixBufferDesc;
    -
    97 D3D11_SAMPLER_DESC samplerDesc;
    -
    98 D3D11_BUFFER_DESC lightBufferDesc;
    -
    99 D3D11_BUFFER_DESC cameraBufferDesc;
    -
    100
    -
    101
    -
    102 // initialize the pointers this function will use to null.
    -
    103 errorMessage = 0;
    -
    104 vertexShaderBuffer = 0;
    -
    105 pixelShaderBuffer = 0;
    -
    106
    -
    107 // Compile the vertex shader code.
    -
    108 result = D3DCompileFromFile(vsFilename, NULL, NULL, "SpecMapVertexShader", "vs_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0,
    -
    109 &vertexShaderBuffer, &errorMessage);
    -
    110 if (FAILED(result))
    -
    111 {
    -
    112 // If the shader failed to compile it should have writen something to the error message.
    -
    113 if (errorMessage)
    -
    114 {
    -
    115 output_shader_error_message(errorMessage, hwnd, vsFilename);
    -
    116 }
    -
    117 // If there was nothing in the error message then it simply could not find the shader file itself.
    -
    118 else
    -
    119 {
    -
    120 MessageBox(hwnd, vsFilename, L"Missing Shader File", MB_OK);
    -
    121 }
    -
    122
    -
    123 return false;
    -
    124 }
    -
    125
    -
    126 // Compile the pixel shader code.
    -
    127 result = D3DCompileFromFile(psFilename, NULL, NULL, "SpecMapPixelShader", "ps_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0,
    -
    128 &pixelShaderBuffer, &errorMessage);
    -
    129 if (FAILED(result))
    -
    130 {
    -
    131 // If the shader failed to compile it should have writen something to the error message.
    -
    132 if (errorMessage)
    -
    133 {
    -
    134 output_shader_error_message(errorMessage, hwnd, psFilename);
    -
    135 }
    -
    136 // If there was nothing in the error message then it simply could not find the file itself.
    -
    137 else
    -
    138 {
    -
    139 MessageBox(hwnd, psFilename, L"Missing Shader File", MB_OK);
    -
    140 }
    -
    141
    -
    142 return false;
    -
    143 }
    -
    144
    -
    145 // Create the vertex shader from the buffer.
    -
    146 result = device->CreateVertexShader(vertexShaderBuffer->GetBufferPointer(), vertexShaderBuffer->GetBufferSize(), NULL, &vertex_shader_);
    -
    147 if (FAILED(result))
    -
    148 {
    -
    149 return false;
    -
    150 }
    -
    151
    -
    152 // Create the pixel shader from the buffer.
    -
    153 result = device->CreatePixelShader(pixelShaderBuffer->GetBufferPointer(), pixelShaderBuffer->GetBufferSize(), NULL, &pixel_shader_);
    -
    154 if (FAILED(result))
    -
    155 {
    -
    156 return false;
    -
    157 }
    -
    158
    -
    159 // Create the vertex input layout description.
    -
    160 polygonLayout[0].SemanticName = "POSITION";
    -
    161 polygonLayout[0].SemanticIndex = 0;
    -
    162 polygonLayout[0].Format = DXGI_FORMAT_R32G32B32_FLOAT;
    -
    163 polygonLayout[0].InputSlot = 0;
    -
    164 polygonLayout[0].AlignedByteOffset = 0;
    -
    165 polygonLayout[0].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
    -
    166 polygonLayout[0].InstanceDataStepRate = 0;
    -
    167
    -
    168 polygonLayout[1].SemanticName = "TEXCOORD";
    -
    169 polygonLayout[1].SemanticIndex = 0;
    -
    170 polygonLayout[1].Format = DXGI_FORMAT_R32G32_FLOAT;
    -
    171 polygonLayout[1].InputSlot = 0;
    -
    172 polygonLayout[1].AlignedByteOffset = D3D11_APPEND_ALIGNED_ELEMENT;
    -
    173 polygonLayout[1].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
    -
    174 polygonLayout[1].InstanceDataStepRate = 0;
    -
    175
    -
    176 polygonLayout[2].SemanticName = "NORMAL";
    -
    177 polygonLayout[2].SemanticIndex = 0;
    -
    178 polygonLayout[2].Format = DXGI_FORMAT_R32G32B32_FLOAT;
    -
    179 polygonLayout[2].InputSlot = 0;
    -
    180 polygonLayout[2].AlignedByteOffset = D3D11_APPEND_ALIGNED_ELEMENT;
    -
    181 polygonLayout[2].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
    -
    182 polygonLayout[2].InstanceDataStepRate = 0;
    -
    183
    -
    184 polygonLayout[3].SemanticName = "TANGENT";
    -
    185 polygonLayout[3].SemanticIndex = 0;
    -
    186 polygonLayout[3].Format = DXGI_FORMAT_R32G32B32_FLOAT;
    -
    187 polygonLayout[3].InputSlot = 0;
    -
    188 polygonLayout[3].AlignedByteOffset = D3D11_APPEND_ALIGNED_ELEMENT;
    -
    189 polygonLayout[3].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
    -
    190 polygonLayout[3].InstanceDataStepRate = 0;
    -
    191
    -
    192 polygonLayout[4].SemanticName = "BINORMAL";
    -
    193 polygonLayout[4].SemanticIndex = 0;
    -
    194 polygonLayout[4].Format = DXGI_FORMAT_R32G32B32_FLOAT;
    -
    195 polygonLayout[4].InputSlot = 0;
    -
    196 polygonLayout[4].AlignedByteOffset = D3D11_APPEND_ALIGNED_ELEMENT;
    -
    197 polygonLayout[4].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
    -
    198 polygonLayout[4].InstanceDataStepRate = 0;
    -
    199
    -
    200 // Get a count of the elements in the layout.
    -
    201 numElements = sizeof(polygonLayout) / sizeof(polygonLayout[0]);
    -
    202
    -
    203 // Create the vertex input layout.
    -
    204 result = device->CreateInputLayout(polygonLayout, numElements, vertexShaderBuffer->GetBufferPointer(),
    -
    205 vertexShaderBuffer->GetBufferSize(), &layout_);
    -
    206 if (FAILED(result))
    -
    207 {
    -
    208 return false;
    -
    209 }
    -
    210
    -
    211 // Release the vertex shader buffer and pixel shader buffer since they are no longer needed.
    -
    212 vertexShaderBuffer->Release();
    -
    213 vertexShaderBuffer = 0;
    -
    214
    -
    215 pixelShaderBuffer->Release();
    -
    216 pixelShaderBuffer = 0;
    -
    217
    -
    218 // Setup the description of the dynamic matrix constant buffer that is in the vertex shader.
    -
    219 matrixBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
    -
    220 matrixBufferDesc.ByteWidth = sizeof(matrix_buffer_type);
    -
    221 matrixBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
    -
    222 matrixBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
    -
    223 matrixBufferDesc.MiscFlags = 0;
    -
    224 matrixBufferDesc.StructureByteStride = 0;
    -
    225
    -
    226 // Create the constant buffer pointer so we can access the vertex shader constant buffer from within this class.
    -
    227 result = device->CreateBuffer(&matrixBufferDesc, NULL, &matrix_buffer_);
    -
    228 if (FAILED(result))
    -
    229 {
    -
    230 return false;
    -
    231 }
    -
    232
    -
    233 // Create a texture sampler state description.
    -
    234 samplerDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR;
    -
    235 samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP;
    -
    236 samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP;
    -
    237 samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_WRAP;
    -
    238 samplerDesc.MipLODBias = 0.0f;
    -
    239 samplerDesc.MaxAnisotropy = 1;
    -
    240 samplerDesc.ComparisonFunc = D3D11_COMPARISON_ALWAYS;
    -
    241 samplerDesc.BorderColor[0] = 0;
    -
    242 samplerDesc.BorderColor[1] = 0;
    -
    243 samplerDesc.BorderColor[2] = 0;
    -
    244 samplerDesc.BorderColor[3] = 0;
    -
    245 samplerDesc.MinLOD = 0;
    -
    246 samplerDesc.MaxLOD = D3D11_FLOAT32_MAX;
    -
    247
    -
    248 // Create the texture sampler state.
    -
    249 result = device->CreateSamplerState(&samplerDesc, &sample_state_);
    -
    250 if (FAILED(result))
    -
    251 {
    -
    252 return false;
    -
    253 }
    -
    254
    -
    255 // Setup the description of the light dynamic constant buffer that is in the pixel shader.
    -
    256 lightBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
    -
    257 lightBufferDesc.ByteWidth = sizeof(light_buffer_type);
    -
    258 lightBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
    -
    259 lightBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
    -
    260 lightBufferDesc.MiscFlags = 0;
    -
    261 lightBufferDesc.StructureByteStride = 0;
    -
    262
    -
    263 // Create the constant buffer pointer so we can access the vertex shader constant buffer from within this class.
    -
    264 result = device->CreateBuffer(&lightBufferDesc, NULL, &light_buffer_);
    -
    265 if (FAILED(result))
    -
    266 {
    -
    267 return false;
    -
    268 }
    -
    269
    -
    270 // Setup the description of the camera dynamic constant buffer that is in the vertex shader.
    -
    271 cameraBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
    -
    272 cameraBufferDesc.ByteWidth = sizeof(camera_buffer_type);
    -
    273 cameraBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
    -
    274 cameraBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
    -
    275 cameraBufferDesc.MiscFlags = 0;
    -
    276 cameraBufferDesc.StructureByteStride = 0;
    -
    277
    -
    278 // Create the camera constant buffer pointer so we can access the vertex shader constant buffer from within this class.
    -
    279 result = device->CreateBuffer(&cameraBufferDesc, NULL, &camera_buffer_);
    -
    280 if (FAILED(result))
    -
    281 {
    -
    282 return false;
    -
    283 }
    -
    284
    -
    285 return true;
    -
    286}
    -
    287
    -
    288
    -
    289void spec_map_shader_class::shutdown_shader()
    -
    290{
    -
    291 // Release the camera constant buffer.
    -
    292 if (camera_buffer_)
    -
    293 {
    -
    294 camera_buffer_->Release();
    -
    295 camera_buffer_ = 0;
    -
    296 }
    -
    297
    -
    298 // Release the light constant buffer.
    -
    299 if (light_buffer_)
    -
    300 {
    -
    301 light_buffer_->Release();
    -
    302 light_buffer_ = 0;
    -
    303 }
    -
    304
    -
    305 // Release the sampler state.
    -
    306 if (sample_state_)
    -
    307 {
    -
    308 sample_state_->Release();
    -
    309 sample_state_ = 0;
    -
    310 }
    -
    311
    -
    312 // Release the matrix constant buffer.
    -
    313 if (matrix_buffer_)
    -
    314 {
    -
    315 matrix_buffer_->Release();
    -
    316 matrix_buffer_ = 0;
    -
    317 }
    -
    318
    -
    319 // Release the layout.
    -
    320 if (layout_)
    -
    321 {
    -
    322 layout_->Release();
    -
    323 layout_ = 0;
    -
    324 }
    -
    325
    -
    326 // Release the pixel shader.
    -
    327 if (pixel_shader_)
    -
    328 {
    -
    329 pixel_shader_->Release();
    -
    330 pixel_shader_ = 0;
    -
    331 }
    -
    332
    -
    333 // Release the vertex shader.
    -
    334 if (vertex_shader_)
    -
    335 {
    -
    336 vertex_shader_->Release();
    -
    337 vertex_shader_ = 0;
    -
    338 }
    -
    339
    -
    340 return;
    -
    341}
    -
    342
    -
    343
    -
    344void spec_map_shader_class::output_shader_error_message(ID3D10Blob* errorMessage, HWND hwnd, WCHAR* shaderFilename)
    -
    345{
    -
    346 char* compileErrors;
    -
    347 unsigned long long bufferSize, i;
    -
    348 ofstream fout;
    -
    349
    -
    350
    -
    351 // Get a pointer to the error message text buffer.
    -
    352 compileErrors = (char*)(errorMessage->GetBufferPointer());
    -
    353
    -
    354 // Get the length of the message.
    -
    355 bufferSize = errorMessage->GetBufferSize();
    -
    356
    -
    357 // Open a file to write the error message to.
    -
    358 fout.open("shader-error.txt");
    -
    359
    -
    360 // Write out the error message.
    -
    361 for (i = 0; i < bufferSize; i++)
    -
    362 {
    -
    363 fout << compileErrors[i];
    -
    364 }
    -
    365
    -
    366 // Close the file.
    -
    367 fout.close();
    -
    368
    -
    369 // Release the error message.
    -
    370 errorMessage->Release();
    -
    371 errorMessage = 0;
    -
    372
    -
    373 // Pop a message up on the screen to notify the user to check the text file for compile errors.
    -
    374 MessageBox(hwnd, L"Error compiling shader. Check shader-error.txt for message.", shaderFilename, MB_OK);
    -
    375
    -
    376 return;
    -
    377}
    -
    378
    -
    379bool spec_map_shader_class::set_shader_parameters(ID3D11DeviceContext* deviceContext, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix,
    -
    380 ID3D11ShaderResourceView* texture1, ID3D11ShaderResourceView* texture2, ID3D11ShaderResourceView* texture3,
    -
    381 XMFLOAT3 lightDirection, XMFLOAT4 diffuseColor, XMFLOAT3 cameraPosition, XMFLOAT4 specularColor, float specularPower)
    -
    382{
    -
    383 HRESULT result;
    -
    384 D3D11_MAPPED_SUBRESOURCE mappedResource;
    -
    385 matrix_buffer_type* dataPtr;
    -
    386 unsigned int bufferNumber;
    -
    387 light_buffer_type* dataPtr2;
    -
    388 camera_buffer_type* dataPtr3;
    -
    389
    -
    390
    -
    391 // Transpose the matrices to prepare them for the shader.
    -
    392 worldMatrix = XMMatrixTranspose(worldMatrix);
    -
    393 viewMatrix = XMMatrixTranspose(viewMatrix);
    -
    394 projectionMatrix = XMMatrixTranspose(projectionMatrix);
    -
    395
    -
    396 // Lock the constant buffer so it can be written to.
    -
    397 result = deviceContext->Map(matrix_buffer_, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
    -
    398 if (FAILED(result))
    -
    399 {
    -
    400 return false;
    -
    401 }
    -
    402
    -
    403 // Get a pointer to the data in the constant buffer.
    -
    404 dataPtr = (matrix_buffer_type*)mappedResource.pData;
    -
    405
    -
    406 // Copy the matrices into the constant buffer.
    -
    407 dataPtr->world = worldMatrix;
    -
    408 dataPtr->view = viewMatrix;
    -
    409 dataPtr->projection = projectionMatrix;
    -
    410
    -
    411 // Unlock the constant buffer.
    -
    412 deviceContext->Unmap(matrix_buffer_, 0);
    -
    413
    -
    414 // Set the position of the constant buffer in the vertex shader.
    -
    415 bufferNumber = 0;
    -
    416
    -
    417 // Finally set the constant buffer in the vertex shader with the updated values.
    -
    418 deviceContext->VSSetConstantBuffers(bufferNumber, 1, &matrix_buffer_);
    -
    419
    -
    420 // Set shader texture resources in the pixel shader.
    -
    421 deviceContext->PSSetShaderResources(0, 1, &texture1);
    -
    422 deviceContext->PSSetShaderResources(1, 1, &texture2);
    -
    423 deviceContext->PSSetShaderResources(2, 1, &texture3);
    -
    424
    -
    425 // Lock the light constant buffer so it can be written to.
    -
    426 result = deviceContext->Map(light_buffer_, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
    -
    427 if (FAILED(result))
    -
    428 {
    -
    429 return false;
    -
    430 }
    -
    431
    -
    432 // Get a pointer to the data in the constant buffer.
    -
    433 dataPtr2 = (light_buffer_type*)mappedResource.pData;
    -
    434
    -
    435 // Copy the lighting variables into the constant buffer.
    -
    436 dataPtr2->diffuse_color = diffuseColor;
    -
    437 dataPtr2->light_direction = lightDirection;
    -
    438 dataPtr2->specular_color = specularColor;
    -
    439 dataPtr2->specular_power = specularPower;
    -
    440
    -
    441 // Unlock the constant buffer.
    -
    442 deviceContext->Unmap(light_buffer_, 0);
    -
    443
    -
    444 // Set the position of the light constant buffer in the pixel shader.
    -
    445 bufferNumber = 0;
    -
    446
    -
    447 // Finally set the light constant buffer in the pixel shader with the updated values.
    -
    448 deviceContext->PSSetConstantBuffers(bufferNumber, 1, &light_buffer_);
    -
    449
    -
    450 // Lock the camera constant buffer so it can be written to.
    -
    451 result = deviceContext->Map(camera_buffer_, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
    -
    452 if (FAILED(result))
    -
    453 {
    -
    454 return false;
    -
    455 }
    -
    456
    -
    457 // Get a pointer to the data in the constant buffer.
    -
    458 dataPtr3 = (camera_buffer_type*)mappedResource.pData;
    -
    459
    -
    460 // Copy the camera position into the constant buffer.
    -
    461 dataPtr3->camera_position = cameraPosition;
    -
    462
    -
    463 // Unlock the camera constant buffer.
    -
    464 deviceContext->Unmap(camera_buffer_, 0);
    -
    465
    -
    466 // Set the position of the camera constant buffer in the vertex shader as the second buffer.
    -
    467 bufferNumber = 1;
    -
    468
    -
    469 // Now set the camera constant buffer in the vertex shader with the updated values.
    -
    470 deviceContext->VSSetConstantBuffers(bufferNumber, 1, &camera_buffer_);
    -
    471
    -
    472 return true;
    -
    473}
    -
    474
    -
    475
    -
    476void spec_map_shader_class::render_shader(ID3D11DeviceContext* deviceContext, int indexCount)
    -
    477{
    -
    478 // Set the vertex input layout.
    -
    479 deviceContext->IASetInputLayout(layout_);
    -
    480
    -
    481 // Set the vertex and pixel shaders that will be used to render this model.
    -
    482 deviceContext->VSSetShader(vertex_shader_, NULL, 0);
    -
    483 deviceContext->PSSetShader(pixel_shader_, NULL, 0);
    -
    484
    -
    485 // Set the sampler state in the pixel shader.
    -
    486 deviceContext->PSSetSamplers(0, 1, &sample_state_);
    -
    487
    -
    488 // render the model.
    -
    489 deviceContext->DrawIndexed(indexCount, 0, 0);
    -
    490
    -
    491 return;
    -
    492}
    - -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:34295ead95fadce7ec97fdee05e80b735ece04e56dde08d65a6cce2bd531cfce +size 71687 diff --git a/doxygen_docs/html/spec__map__shader__class_8h_source.html b/doxygen_docs/html/spec__map__shader__class_8h_source.html index 7a14211..7dbd4b6 100644 --- a/doxygen_docs/html/spec__map__shader__class_8h_source.html +++ b/doxygen_docs/html/spec__map__shader__class_8h_source.html @@ -1,183 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/inc/shader/spec_map_shader_class.h Source File - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    spec_map_shader_class.h
    -
    -
    -
    1#ifndef _SPECMAPSHADERCLASS_H_
    -
    2#define _SPECMAPSHADERCLASS_H_
    -
    3
    -
    4
    -
    6// INCLUDES //
    -
    8#include <d3d11.h>
    -
    9#include <d3dcompiler.h>
    -
    10#include <directxmath.h>
    -
    11#include <fstream>
    -
    12using namespace DirectX;
    -
    13using namespace std;
    -
    14
    -
    15
    -
    17// Class name: spec_map_shader_class
    -
    - -
    20{
    -
    21private:
    -
    22 struct matrix_buffer_type
    -
    23 {
    -
    24 XMMATRIX world;
    -
    25 XMMATRIX view;
    -
    26 XMMATRIX projection;
    -
    27 };
    -
    28
    -
    29 struct light_buffer_type
    -
    30 {
    -
    31 XMFLOAT4 diffuse_color;
    -
    32 XMFLOAT4 specular_color;
    -
    33 float specular_power;
    -
    34 XMFLOAT3 light_direction;
    -
    35 };
    -
    36
    -
    37 struct camera_buffer_type
    -
    38 {
    -
    39 XMFLOAT3 camera_position;
    -
    40 float padding;
    -
    41 };
    -
    42
    -
    43public:
    - - - -
    47
    -
    48 bool initialize(ID3D11Device*, HWND);
    -
    49 void shutdown();
    -
    50 bool render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*,
    -
    51 XMFLOAT3, XMFLOAT4, XMFLOAT3, XMFLOAT4, float);
    -
    52
    -
    53private:
    -
    54 bool initialize_shader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
    -
    55 void shutdown_shader();
    -
    56 void output_shader_error_message(ID3D10Blob*, HWND, WCHAR*);
    -
    57
    -
    58 bool set_shader_parameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*,
    -
    59 XMFLOAT3, XMFLOAT4, XMFLOAT3, XMFLOAT4, float);
    -
    60 void render_shader(ID3D11DeviceContext*, int);
    -
    61
    -
    62private:
    -
    63 ID3D11VertexShader* vertex_shader_;
    -
    64 ID3D11PixelShader* pixel_shader_;
    -
    65 ID3D11InputLayout* layout_;
    -
    66 ID3D11Buffer* matrix_buffer_;
    -
    67 ID3D11SamplerState* sample_state_;
    -
    68 ID3D11Buffer* light_buffer_;
    -
    69 ID3D11Buffer* camera_buffer_;
    -
    70};
    -
    -
    71
    -
    72#endif
    - -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:b9917bcb8ca89ff403497d897974a03b729889d6637baa41b5cbfbd4f8b60adc +size 14514 diff --git a/doxygen_docs/html/splitbar.png b/doxygen_docs/html/splitbar.png index fe895f2..3148d9c 100644 Binary files a/doxygen_docs/html/splitbar.png and b/doxygen_docs/html/splitbar.png differ diff --git a/doxygen_docs/html/splitbard.png b/doxygen_docs/html/splitbard.png index 8367416..0709d0c 100644 Binary files a/doxygen_docs/html/splitbard.png and b/doxygen_docs/html/splitbard.png differ diff --git a/doxygen_docs/html/sprite__class_8cpp_source.html b/doxygen_docs/html/sprite__class_8cpp_source.html index 461c740..f412a69 100644 --- a/doxygen_docs/html/sprite__class_8cpp_source.html +++ b/doxygen_docs/html/sprite__class_8cpp_source.html @@ -1,536 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/src/system/sprite_class.cpp Source File - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    sprite_class.cpp
    -
    -
    -
    1#include "sprite_class.h"
    -
    2
    -
    3
    -
    4sprite_class::sprite_class()
    -
    5{
    -
    6 m_vertexBuffer = 0;
    -
    7 m_indexBuffer = 0;
    -
    8 m_Textures = 0;
    -
    9}
    -
    10
    -
    11
    -
    12sprite_class::sprite_class(const sprite_class& other)
    -
    13{
    -
    14}
    -
    15
    -
    16
    -
    17sprite_class::~sprite_class()
    -
    18{
    -
    19}
    -
    20
    -
    21bool sprite_class::Initialize(ID3D11Device* device, ID3D11DeviceContext* deviceContext, int screenWidth, int screenHeight, char* spriteFilename, int renderX, int renderY)
    -
    22{
    -
    23 bool result;
    -
    24
    -
    25
    -
    26 // Store the screen size.
    -
    27 m_screenWidth = screenWidth;
    -
    28 m_screenHeight = screenHeight;
    -
    29
    -
    30 // Store where the sprite should be rendered to.
    -
    31 m_renderX = renderX;
    -
    32 m_renderY = renderY;
    -
    33
    -
    34 // Initialize the frame time for this sprite object.
    -
    35 m_frameTime = 0;
    -
    36
    -
    37 // Initialize the vertex and index buffer that hold the geometry for the sprite bitmap.
    -
    38 result = InitializeBuffers(device);
    -
    39 if (!result)
    -
    40 {
    -
    41 return false;
    -
    42 }
    -
    43
    -
    44 // Load the textures for this sprite.
    -
    45 result = LoadTextures(device, deviceContext, spriteFilename);
    -
    46 if (!result)
    -
    47 {
    -
    48 return false;
    -
    49 }
    -
    50
    -
    51 return true;
    -
    52}
    -
    53
    -
    54
    -
    55void sprite_class::Shutdown()
    -
    56{
    -
    57 // Release the textures used for this sprite.
    -
    58 ReleaseTextures();
    -
    59
    -
    60 // Release the vertex and index buffers.
    -
    61 ShutdownBuffers();
    -
    62
    -
    63 return;
    -
    64}
    -
    65
    -
    66
    -
    67bool sprite_class::Render(ID3D11DeviceContext* deviceContext)
    -
    68{
    -
    69 bool result;
    -
    70
    -
    71
    -
    72 // Update the buffers if the position of the sprite has changed from its original position.
    -
    73 result = UpdateBuffers(deviceContext);
    -
    74 if (!result)
    -
    75 {
    -
    76 return false;
    -
    77 }
    -
    78
    -
    79 // Put the vertex and index buffers on the graphics pipeline to prepare them for drawing.
    -
    80 RenderBuffers(deviceContext);
    -
    81
    -
    82 return true;
    -
    83}
    -
    84
    -
    85void sprite_class::Update(float frameTime)
    -
    86{
    -
    87 // Increment the frame time each frame.
    -
    88 m_frameTime += frameTime;
    -
    89
    -
    90 // Check if the frame time has reached the cycle time.
    -
    91 if (m_frameTime >= m_cycleTime)
    -
    92 {
    -
    93 // If it has then reset the frame time and cycle to the next sprite in the texture array.
    -
    94 m_frameTime -= m_cycleTime;
    -
    95
    -
    96 m_currentTexture++;
    -
    97
    -
    98 // If we are at the last sprite texture then go back to the beginning of the texture array to the first texture again.
    -
    99 if (m_currentTexture == m_textureCount)
    -
    100 {
    -
    101 m_currentTexture = 0;
    -
    102 }
    -
    103 }
    -
    104
    -
    105 return;
    -
    106}
    -
    107
    -
    108
    -
    109int sprite_class::GetIndexCount()
    -
    110{
    -
    111 return m_indexCount;
    -
    112}
    -
    113
    -
    114ID3D11ShaderResourceView* sprite_class::GetTexture()
    -
    115{
    -
    116 return m_Textures[m_currentTexture].GetTexture();
    -
    117}
    -
    118
    -
    119
    -
    120bool sprite_class::InitializeBuffers(ID3D11Device* device)
    -
    121{
    -
    122 VertexType* vertices;
    -
    123 unsigned long* indices;
    -
    124 D3D11_BUFFER_DESC vertexBufferDesc, indexBufferDesc;
    -
    125 D3D11_SUBRESOURCE_DATA vertexData, indexData;
    -
    126 HRESULT result;
    -
    127 int i;
    -
    128
    -
    129
    -
    130 // Initialize the previous rendering position to negative one.
    -
    131 m_prevPosX = -1;
    -
    132 m_prevPosY = -1;
    -
    133
    -
    134 // Set the number of vertices in the vertex array.
    -
    135 m_vertexCount = 6;
    -
    136
    -
    137 // Set the number of indices in the index array.
    -
    138 m_indexCount = m_vertexCount;
    -
    139
    -
    140 // Create the vertex array.
    -
    141 vertices = new VertexType[m_vertexCount];
    -
    142
    -
    143 // Create the index array.
    -
    144 indices = new unsigned long[m_indexCount];
    -
    145
    -
    146 // Initialize vertex array to zeros at first.
    -
    147 memset(vertices, 0, (sizeof(VertexType) * m_vertexCount));
    -
    148
    -
    149 // Load the index array with data.
    -
    150 for (i = 0; i < m_indexCount; i++)
    -
    151 {
    -
    152 indices[i] = i;
    -
    153 }
    -
    154
    -
    155 // Set up the description of the dynamic vertex buffer.
    -
    156 vertexBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
    -
    157 vertexBufferDesc.ByteWidth = sizeof(VertexType) * m_vertexCount;
    -
    158 vertexBufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
    -
    159 vertexBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
    -
    160 vertexBufferDesc.MiscFlags = 0;
    -
    161 vertexBufferDesc.StructureByteStride = 0;
    -
    162
    -
    163 // Give the subresource structure a pointer to the vertex data.
    -
    164 vertexData.pSysMem = vertices;
    -
    165 vertexData.SysMemPitch = 0;
    -
    166 vertexData.SysMemSlicePitch = 0;
    -
    167
    -
    168 // Now finally create the vertex buffer.
    -
    169 result = device->CreateBuffer(&vertexBufferDesc, &vertexData, &m_vertexBuffer);
    -
    170 if (FAILED(result))
    -
    171 {
    -
    172 return false;
    -
    173 }
    -
    174
    -
    175 // Set up the description of the index buffer.
    -
    176 indexBufferDesc.Usage = D3D11_USAGE_DEFAULT;
    -
    177 indexBufferDesc.ByteWidth = sizeof(unsigned long) * m_indexCount;
    -
    178 indexBufferDesc.BindFlags = D3D11_BIND_INDEX_BUFFER;
    -
    179 indexBufferDesc.CPUAccessFlags = 0;
    -
    180 indexBufferDesc.MiscFlags = 0;
    -
    181 indexBufferDesc.StructureByteStride = 0;
    -
    182
    -
    183 // Give the subresource structure a pointer to the index data.
    -
    184 indexData.pSysMem = indices;
    -
    185 indexData.SysMemPitch = 0;
    -
    186 indexData.SysMemSlicePitch = 0;
    -
    187
    -
    188 // Create the index buffer.
    -
    189 result = device->CreateBuffer(&indexBufferDesc, &indexData, &m_indexBuffer);
    -
    190 if (FAILED(result))
    -
    191 {
    -
    192 return false;
    -
    193 }
    -
    194
    -
    195 // Release the arrays now that the vertex and index buffers have been created and loaded.
    -
    196 delete[] vertices;
    -
    197 vertices = 0;
    -
    198
    -
    199 delete[] indices;
    -
    200 indices = 0;
    -
    201
    -
    202 return true;
    -
    203}
    -
    204
    -
    205
    -
    206void sprite_class::ShutdownBuffers()
    -
    207{
    -
    208 // Release the index buffer.
    -
    209 if (m_indexBuffer)
    -
    210 {
    -
    211 m_indexBuffer->Release();
    -
    212 m_indexBuffer = 0;
    -
    213 }
    -
    214
    -
    215 // Release the vertex buffer.
    -
    216 if (m_vertexBuffer)
    -
    217 {
    -
    218 m_vertexBuffer->Release();
    -
    219 m_vertexBuffer = 0;
    -
    220 }
    -
    221
    -
    222 return;
    -
    223}
    -
    224
    -
    225
    -
    226bool sprite_class::UpdateBuffers(ID3D11DeviceContext* deviceContent)
    -
    227{
    -
    228 float left, right, top, bottom;
    -
    229 VertexType* vertices;
    -
    230 D3D11_MAPPED_SUBRESOURCE mappedResource;
    -
    231 VertexType* dataPtr;
    -
    232 HRESULT result;
    -
    233
    -
    234
    -
    235 // If the position we are rendering this bitmap to hasn't changed then don't update the vertex buffer.
    -
    236 if ((m_prevPosX == m_renderX) && (m_prevPosY == m_renderY))
    -
    237 {
    -
    238 return true;
    -
    239 }
    -
    240
    -
    241 // If the rendering location has changed then store the new position and update the vertex buffer.
    -
    242 m_prevPosX = m_renderX;
    -
    243 m_prevPosY = m_renderY;
    -
    244
    -
    245 // Create the vertex array.
    -
    246 vertices = new VertexType[m_vertexCount];
    -
    247
    -
    248 // Calculate the screen coordinates of the left side of the bitmap.
    -
    249 left = (float)((m_screenWidth / 2) * -1) + (float)m_renderX;
    -
    250
    -
    251 // Calculate the screen coordinates of the right side of the bitmap.
    -
    252 right = left + (float)m_bitmapWidth;
    -
    253
    -
    254 // Calculate the screen coordinates of the top of the bitmap.
    -
    255 top = (float)(m_screenHeight / 2) - (float)m_renderY;
    -
    256
    -
    257 // Calculate the screen coordinates of the bottom of the bitmap.
    -
    258 bottom = top - (float)m_bitmapHeight;
    -
    259
    -
    260 // Load the vertex array with data.
    -
    261 // First triangle.
    -
    262 vertices[0].position = XMFLOAT3(left, top, 0.0f); // Top left.
    -
    263 vertices[0].texture = XMFLOAT2(0.0f, 0.0f);
    -
    264
    -
    265 vertices[1].position = XMFLOAT3(right, bottom, 0.0f); // Bottom right.
    -
    266 vertices[1].texture = XMFLOAT2(1.0f, 1.0f);
    -
    267
    -
    268 vertices[2].position = XMFLOAT3(left, bottom, 0.0f); // Bottom left.
    -
    269 vertices[2].texture = XMFLOAT2(0.0f, 1.0f);
    -
    270
    -
    271 // Second triangle.
    -
    272 vertices[3].position = XMFLOAT3(left, top, 0.0f); // Top left.
    -
    273 vertices[3].texture = XMFLOAT2(0.0f, 0.0f);
    -
    274
    -
    275 vertices[4].position = XMFLOAT3(right, top, 0.0f); // Top right.
    -
    276 vertices[4].texture = XMFLOAT2(1.0f, 0.0f);
    -
    277
    -
    278 vertices[5].position = XMFLOAT3(right, bottom, 0.0f); // Bottom right.
    -
    279 vertices[5].texture = XMFLOAT2(1.0f, 1.0f);
    -
    280
    -
    281 // Lock the vertex buffer.
    -
    282 result = deviceContent->Map(m_vertexBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
    -
    283 if (FAILED(result))
    -
    284 {
    -
    285 return false;
    -
    286 }
    -
    287
    -
    288 // Get a pointer to the data in the constant buffer.
    -
    289 dataPtr = (VertexType*)mappedResource.pData;
    -
    290
    -
    291 // Copy the data into the vertex buffer.
    -
    292 memcpy(dataPtr, (void*)vertices, (sizeof(VertexType) * m_vertexCount));
    -
    293
    -
    294 // Unlock the vertex buffer.
    -
    295 deviceContent->Unmap(m_vertexBuffer, 0);
    -
    296
    -
    297 // Release the pointer reference.
    -
    298 dataPtr = 0;
    -
    299
    -
    300 // Release the vertex array as it is no longer needed.
    -
    301 delete[] vertices;
    -
    302 vertices = 0;
    -
    303
    -
    304 return true;
    -
    305}
    -
    306
    -
    307
    -
    308void sprite_class::RenderBuffers(ID3D11DeviceContext* deviceContext)
    -
    309{
    -
    310 unsigned int stride;
    -
    311 unsigned int offset;
    -
    312
    -
    313
    -
    314 // Set vertex buffer stride and offset.
    -
    315 stride = sizeof(VertexType);
    -
    316 offset = 0;
    -
    317
    -
    318 // Set the vertex buffer to active in the input assembler so it can be rendered.
    -
    319 deviceContext->IASetVertexBuffers(0, 1, &m_vertexBuffer, &stride, &offset);
    -
    320
    -
    321 // Set the index buffer to active in the input assembler so it can be rendered.
    -
    322 deviceContext->IASetIndexBuffer(m_indexBuffer, DXGI_FORMAT_R32_UINT, 0);
    -
    323
    -
    324 // Set the type of primitive that should be rendered from this vertex buffer, in this case triangles.
    -
    325 deviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
    -
    326
    -
    327 return;
    -
    328}
    -
    329
    -
    330bool sprite_class::LoadTextures(ID3D11Device* device, ID3D11DeviceContext* deviceContext, char* filename)
    -
    331{
    -
    332 std::string textureFilename(256, '0');
    -
    333 std::ifstream fin;
    -
    334 int i, j;
    -
    335 char input;
    -
    336 bool result;
    -
    337
    -
    338
    -
    339 // Open the sprite info data file.
    -
    340 fin.open(filename);
    -
    341 if (fin.fail())
    -
    342 {
    -
    343 return false;
    -
    344 }
    -
    345
    -
    346 // Read in the number of textures.
    -
    347 fin >> m_textureCount;
    -
    348
    -
    349 // Create and initialize the texture array with the texture count from the file.
    -
    350 m_Textures = new texture_class[m_textureCount];
    -
    351
    -
    352 // Read to start of next line.
    -
    353 fin.get(input);
    -
    354
    -
    355 // Read in each texture file name.
    -
    356 for (i = 0; i < m_textureCount; i++)
    -
    357 {
    -
    358 j = 0;
    -
    359 fin.get(input);
    -
    360 while (input != '\n')
    -
    361 {
    -
    362 textureFilename[j] = input;
    -
    363 j++;
    -
    364 fin.get(input);
    -
    365 }
    -
    366 textureFilename[j] = '\0';
    -
    367
    -
    368 // Once you have the filename then load the texture in the texture array.
    -
    369 result = m_Textures[i].Initialize(device, deviceContext, textureFilename);
    -
    370 if (!result)
    -
    371 {
    -
    372 return false;
    -
    373 }
    -
    374 }
    -
    375
    -
    376 // Read in the cycle time.
    -
    377 fin >> m_cycleTime;
    -
    378
    -
    379 // Convert the integer milliseconds to float representation.
    -
    380 m_cycleTime = m_cycleTime * 0.001f;
    -
    381
    -
    382 // Close the file.
    -
    383 fin.close();
    -
    384
    -
    385 // Get the dimensions of the first texture and use that as the dimensions of the 2D sprite images.
    -
    386 m_bitmapWidth = m_Textures[0].GetWidth();
    -
    387 m_bitmapHeight = m_Textures[0].GetHeight();
    -
    388
    -
    389 // Set the starting texture in the cycle to be the first one in the list.
    -
    390 m_currentTexture = 0;
    -
    391
    -
    392 return true;
    -
    393}
    -
    394
    -
    395void sprite_class::ReleaseTextures()
    -
    396{
    -
    397 int i;
    -
    398
    -
    399
    -
    400 // Release the texture objects.
    -
    401 if (m_Textures)
    -
    402 {
    -
    403 for (i = 0; i < m_textureCount; i++)
    -
    404 {
    -
    405 m_Textures[i].Shutdown();
    -
    406 }
    -
    407
    -
    408 delete[] m_Textures;
    -
    409 m_Textures = 0;
    -
    410 }
    -
    411
    -
    412 return;
    -
    413}
    -
    414
    -
    415
    -
    416void sprite_class::SetRenderLocation(int x, int y)
    -
    417{
    -
    418 m_renderX = x;
    -
    419 m_renderY = y;
    -
    420 return;
    -
    421}
    - - - -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:0f0a6a6becea33222aa00662eff1d347102a162fdd58681f2397d5a4fb604023 +size 60318 diff --git a/doxygen_docs/html/sprite__class_8h_source.html b/doxygen_docs/html/sprite__class_8h_source.html index 727dbb3..f00b793 100644 --- a/doxygen_docs/html/sprite__class_8h_source.html +++ b/doxygen_docs/html/sprite__class_8h_source.html @@ -1,173 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/inc/system/sprite_class.h Source File - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    sprite_class.h
    -
    -
    -
    1#ifndef _SPRITECLASS_H_
    -
    2#define _SPRITECLASS_H_
    -
    3
    -
    4
    -
    6// INCLUDES //
    -
    8#include <directxmath.h>
    -
    9#include <fstream>
    -
    10using namespace DirectX;
    -
    11
    -
    12
    -
    14// MY CLASS INCLUDES //
    -
    16#include "texture_class.h"
    -
    17
    -
    18
    -
    20// Class name: sprite_class
    -
    - -
    23{
    -
    24private:
    -
    25 struct VertexType
    -
    26 {
    -
    27 XMFLOAT3 position;
    -
    28 XMFLOAT2 texture;
    -
    29 };
    -
    30
    -
    31public:
    - - - -
    35
    -
    36 bool Initialize(ID3D11Device*, ID3D11DeviceContext*, int, int, char*, int, int);
    -
    37 void Shutdown();
    -
    38 bool Render(ID3D11DeviceContext*);
    -
    39 void Update(float);
    -
    40
    -
    41 int GetIndexCount();
    -
    42 ID3D11ShaderResourceView* GetTexture();
    -
    43
    -
    44 void SetRenderLocation(int, int);
    -
    45
    -
    46private:
    -
    47 bool InitializeBuffers(ID3D11Device*);
    -
    48 void ShutdownBuffers();
    -
    49 bool UpdateBuffers(ID3D11DeviceContext*);
    -
    50 void RenderBuffers(ID3D11DeviceContext*);
    -
    51
    -
    52 bool LoadTextures(ID3D11Device*, ID3D11DeviceContext*, char*);
    -
    53 void ReleaseTextures();
    -
    54
    -
    55private:
    -
    56 ID3D11Buffer* m_vertexBuffer, * m_indexBuffer;
    -
    57 int m_vertexCount, m_indexCount, m_screenWidth, m_screenHeight, m_bitmapWidth, m_bitmapHeight, m_renderX, m_renderY, m_prevPosX, m_prevPosY;
    -
    58 texture_class* m_Textures;
    -
    59 float m_frameTime, m_cycleTime;
    -
    60 int m_currentTexture, m_textureCount;
    -
    61};
    -
    -
    62
    -
    63#endif
    - - -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:10e02e80b862e1a3a9fa44717eeb3da044e975ecc52acebd11de5cdb1ed311da +size 13429 diff --git a/doxygen_docs/html/stats_8cpp_source.html b/doxygen_docs/html/stats_8cpp_source.html index 27bb5ab..d3f6926 100644 --- a/doxygen_docs/html/stats_8cpp_source.html +++ b/doxygen_docs/html/stats_8cpp_source.html @@ -1,401 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/src/system/stats.cpp Source File - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    stats.cpp
    -
    -
    -
    1#include "stats.h"
    -
    2#include "application_class.h"
    -
    3
    -
    4stats::stats() : fps_(nullptr), drawcalls_(0)
    -
    5{
    -
    6 total_triangle_count_ = std::make_shared<int>(0);
    -
    7 total_vertex_count_ = std::make_shared<int>(0);
    -
    8}
    -
    9
    -
    10stats::~stats()
    -
    11{
    -
    12 fps_ = nullptr;
    -
    13}
    -
    14
    -
    15bool stats::initialize(application_class* app)
    -
    16{
    -
    17 if (!app) {
    -
    18 Logger::Get().Log("Application pointer is null", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    19 return false;
    -
    20 }
    -
    21
    -
    22 drawcalls_ = 0;
    -
    23 app_ = app;
    -
    24
    -
    25 fps_ = app_->get_fps();
    -
    26
    -
    27 if (!fps_) {
    -
    28 Logger::Get().Log("FPS object is null", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    29 return false;
    -
    30 }
    -
    31
    -
    32 Logger::Get().Log("Stats initialized successfully", __FILE__, __LINE__, Logger::LogLevel::Initialize);
    -
    33
    -
    34 return true;
    -
    35}
    -
    36
    -
    37void stats::update_geometric_stats()
    -
    38{
    -
    39 // Utiliser le système ECS pour accéder aux entités avec des composants de rendu
    -
    40 if (app_ && app_->get_entity_manager())
    -
    41 {
    -
    42 *total_vertex_count_ = get_total_vertex_count();
    -
    43 *total_triangle_count_ = get_total_triangle_count();
    -
    44
    -
    45 update_visible_count();
    -
    46
    -
    47 Logger::Get().Log("Statistics updated: " + std::to_string(*total_vertex_count_) + " vertices, " + std::to_string(*total_triangle_count_) + " triangles", __FILE__, __LINE__, Logger::LogLevel::Debug);
    -
    48 }
    -
    49}
    -
    50
    -
    51void stats::update_visible_count()
    -
    52{
    -
    53 visible_triangle_count_ = get_visible_triangle_count();
    -
    54}
    -
    55
    -
    56void stats::update_display_stats()
    -
    57{
    -
    58
    -
    59 current_fps_ = fps_->GetFps();
    -
    60 min_fps_ = fps_->GetMinFps();
    -
    61 max_fps_ = fps_->GetMaxFps();
    -
    62 drawcalls_ = get_draw_calls();
    -
    63 current_frame_time_ = fps_->GetFrameTime();
    -
    64}
    -
    65
    -
    66int stats::get_total_vertex_count() const
    -
    67{
    -
    68 int totalVertices = 0;
    -
    69
    -
    70 // Utiliser le système ECS pour accéder aux entités avec des composants de rendu
    -
    71 if (app_ && app_->get_entity_manager())
    -
    72 {
    - -
    74
    -
    75 for (const auto& entity : entities)
    -
    76 {
    -
    77 auto renderComponent = entity->GetComponent<ecs::RenderComponent>();
    -
    78 if (renderComponent && renderComponent->GetModel())
    -
    79 {
    -
    80 totalVertices += renderComponent->GetModel()->GetVertexCount();
    -
    81 }
    -
    82 }
    -
    83 }
    -
    84
    -
    85 // Ajouter également les éventuels objets restants de l'ancien système
    -
    86 for (const auto& obj : object_vec_)
    -
    87 {
    -
    88 if (obj && obj->get_model())
    -
    89 {
    -
    90 totalVertices += obj->get_model()->GetVertexCount();
    -
    91 }
    -
    92 }
    -
    93
    -
    94 for (const auto& cube : cubes_vec_)
    -
    95 {
    -
    96 if (cube && cube->get_model())
    -
    97 {
    -
    98 totalVertices += cube->get_model()->GetVertexCount();
    -
    99 }
    -
    100 }
    -
    101
    -
    102 for (const auto& chunk : terrain_chunk_vec_)
    -
    103 {
    -
    104 if (chunk && chunk->get_model())
    -
    105 {
    -
    106 totalVertices += chunk->get_model()->GetVertexCount();
    -
    107 }
    -
    108 }
    -
    109
    -
    110 return totalVertices;
    -
    111}
    -
    112
    -
    113int stats::get_total_triangle_count() const
    -
    114{
    -
    115 int totalTriangles = 0;
    -
    116
    -
    117 // Utiliser le système ECS pour accéder aux entités avec des composants de rendu
    -
    118 if (app_ && app_->get_entity_manager())
    -
    119 {
    - -
    121
    -
    122 for (const auto& entity : entities)
    -
    123 {
    -
    124 auto renderComponent = entity->GetComponent<ecs::RenderComponent>();
    -
    125 if (renderComponent && renderComponent->GetModel())
    -
    126 {
    -
    127 // Dans une topologie de liste de triangles, chaque triangle utilise 3 indices
    -
    128 totalTriangles += renderComponent->GetModel()->GetIndexCount() / 3;
    -
    129 }
    -
    130 }
    -
    131 }
    -
    132
    -
    133 // Ajouter également les éventuels objets restants de l'ancien système
    -
    134 for (const auto& obj : object_vec_)
    -
    135 {
    -
    136 if (obj && obj->get_model())
    -
    137 {
    -
    138 totalTriangles += obj->get_model()->GetIndexCount() / 3;
    -
    139 }
    -
    140 }
    -
    141
    -
    142 for (const auto& cube : cubes_vec_)
    -
    143 {
    -
    144 if (cube && cube->get_model())
    -
    145 {
    -
    146 totalTriangles += cube->get_model()->GetIndexCount() / 3;
    -
    147 }
    -
    148 }
    -
    149
    -
    150 for (const auto& chunk : terrain_chunk_vec_)
    -
    151 {
    -
    152 if (chunk && chunk->get_model())
    -
    153 {
    -
    154 totalTriangles += chunk->get_model()->GetIndexCount() / 3;
    -
    155 }
    -
    156 }
    -
    157
    -
    158 return totalTriangles;
    -
    159}
    -
    160
    -
    161int stats::get_visible_triangle_count() const
    -
    162{
    -
    163 int visibleTriangles = 0;
    -
    164
    -
    165 // Utiliser le système ECS pour accéder aux entités avec des composants de rendu
    -
    166 if (app_ && app_->get_entity_manager())
    -
    167 {
    - -
    169
    -
    170 for (const auto& entity : entities)
    -
    171 {
    -
    172 auto renderComponent = entity->GetComponent<ecs::RenderComponent>();
    -
    173 if (renderComponent && renderComponent->GetModel() && renderComponent->IsVisible())
    -
    174 {
    -
    175 // Dans une topologie de liste de triangles, chaque triangle utilise 3 indices
    -
    176 visibleTriangles += renderComponent->GetModel()->GetIndexCount() / 3;
    -
    177 }
    -
    178 }
    -
    179 }
    -
    180
    -
    181 // Ajouter également les éventuels objets restants de l'ancien système
    -
    182 for (const auto& obj : object_vec_)
    -
    183 {
    -
    184 if (obj && obj->get_model() && obj->IsVisible())
    -
    185 {
    -
    186 visibleTriangles += obj->get_model()->GetIndexCount() / 3;
    -
    187 }
    -
    188 }
    -
    189
    -
    190 for (const auto& cube : cubes_vec_)
    -
    191 {
    -
    192 if (cube && cube->get_model() && cube->IsVisible())
    -
    193 {
    -
    194 visibleTriangles += cube->get_model()->GetIndexCount() / 3;
    -
    195 }
    -
    196 }
    -
    197
    -
    198 for (const auto& chunk : terrain_chunk_vec_)
    -
    199 {
    -
    200 if (chunk && chunk->get_model() && chunk->IsVisible())
    -
    201 {
    -
    202 visibleTriangles += chunk->get_model()->GetIndexCount() / 3;
    -
    203 }
    -
    204 }
    -
    205
    -
    206 return visibleTriangles;
    -
    207}
    -
    208
    -
    209std::string stats::get_cpu_name()
    -
    210{
    -
    211 char CPUBrandString[0x40] = {0};
    -
    212 int CPUInfo[4] = {-1};
    -
    213
    -
    214 // Fonction CPUID pour récupérer le nom du CPU
    -
    215 __cpuid(CPUInfo, 0x80000000);
    -
    216 unsigned int nExIds = CPUInfo[0];
    -
    217
    -
    218 for (unsigned int i = 0x80000000; i <= nExIds; ++i)
    -
    219 {
    -
    220 __cpuid(CPUInfo, i);
    -
    221
    -
    222 if (i == 0x80000002)
    -
    223 memcpy(CPUBrandString, CPUInfo, sizeof(CPUInfo));
    -
    224 else if (i == 0x80000003)
    -
    225 memcpy(CPUBrandString + 16, CPUInfo, sizeof(CPUInfo));
    -
    226 else if (i == 0x80000004)
    -
    227 memcpy(CPUBrandString + 32, CPUInfo, sizeof(CPUInfo));
    -
    228 }
    -
    229
    -
    230 std::string result = CPUBrandString;
    -
    231
    -
    232 // Nettoyer les caractères non-ASCII ou problématiques
    -
    233 result.erase(std::remove_if(result.begin(), result.end(),
    -
    234 [](unsigned char c) { return c < 32 || c > 126; }),
    -
    235 result.end());
    -
    236
    -
    237 // Supprimer les espaces multiples consécutifs
    -
    238 std::string::iterator new_end = std::unique(result.begin(), result.end(),
    -
    239 [](char a, char b) { return a == ' ' && b == ' '; });
    -
    240 result.erase(new_end, result.end());
    -
    241
    -
    242 // Supprimer les espaces au début et à la fin
    -
    243 result.erase(0, result.find_first_not_of(' '));
    -
    244 result.erase(result.find_last_not_of(' ') + 1);
    -
    245
    -
    246 return result;
    -
    247}
    -
    248
    -
    249std::string stats::get_gpu_driver_version(ID3D11Device* device)
    -
    250{
    -
    251 IDXGIDevice* dxgiDevice = nullptr;
    -
    252 IDXGIAdapter* adapter = nullptr;
    -
    253 std::string driverVersion = "Inconnu";
    -
    254
    -
    255 if (SUCCEEDED(device->QueryInterface(__uuidof(IDXGIDevice), (void**)&dxgiDevice)))
    -
    256 {
    -
    257 if (SUCCEEDED(dxgiDevice->GetAdapter(&adapter)))
    -
    258 {
    -
    259 DXGI_ADAPTER_DESC desc;
    -
    260 if (SUCCEEDED(adapter->GetDesc(&desc)))
    -
    261 {
    -
    262 // Conversion correcte de WCHAR (UTF-16) vers UTF-8
    -
    263 int size_needed = WideCharToMultiByte(CP_UTF8, 0, desc.Description, -1, nullptr, 0, nullptr, nullptr);
    -
    264 std::string deviceName;
    -
    265 if (size_needed > 0) {
    -
    266 std::vector<char> buffer(size_needed);
    -
    267 WideCharToMultiByte(CP_UTF8, 0, desc.Description, -1, buffer.data(), size_needed, nullptr, nullptr);
    -
    268 deviceName = buffer.data();
    -
    269 }
    -
    270
    -
    271 char driverVersionStr[256];
    -
    272 sprintf_s(driverVersionStr, "%s (ID: %04X:%04X)", deviceName.c_str(), desc.VendorId, desc.DeviceId);
    -
    273
    -
    274 driverVersion = driverVersionStr;
    -
    275 }
    -
    276 adapter->Release();
    -
    277 }
    -
    278 dxgiDevice->Release();
    -
    279 }
    -
    280
    -
    281 return driverVersion;
    -
    282}
    -
    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
    - -
    fps_class * get_fps() const
    -
    ecs::EntityManager * get_entity_manager() const
    -
    std::vector< std::shared_ptr< Entity > > GetEntitiesWithComponent()
    - -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:872c2031a59d00a9daf42fd4f79eaf2408406fd772e43ee693fb35e7f4444e32 +size 48927 diff --git a/doxygen_docs/html/stats_8h_source.html b/doxygen_docs/html/stats_8h_source.html index 3a0bc1f..fc24970 100644 --- a/doxygen_docs/html/stats_8h_source.html +++ b/doxygen_docs/html/stats_8h_source.html @@ -1,181 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/inc/system/stats.h Source File - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    stats.h
    -
    -
    -
    1#pragma once
    -
    2#include <thread>
    -
    3#include <vector>
    -
    4
    -
    5#include "fps_class.h"
    -
    6#include "object.h"
    -
    7#include <intrin.h> // Pour __cpuid
    -
    8#include <dxgi.h> // Pour DXGI
    -
    9#include <mutex>
    -
    10#pragma comment(lib, "dxgi.lib")
    -
    11
    -
    -
    12class stats
    -
    13{
    -
    14public:
    -
    15
    -
    16 stats();
    -
    17 ~stats();
    -
    18
    -
    19 bool initialize(application_class* app);
    -
    20 void update_geometric_stats();
    -
    21 void update_visible_count();
    -
    22 void update_display_stats();
    -
    23
    -
    24 int get_total_vertex_count() const;
    -
    25 int get_total_triangle_count() const;
    -
    26 int get_visible_triangle_count() const;
    -
    27
    -
    28 int get_current_fps() const { return current_fps_; };
    -
    29 int get_min_fps() const { return min_fps_; };
    -
    30 int get_max_fps() const { return max_fps_; };
    -
    31 float get_frame_time() const { return current_frame_time_;};
    -
    32 int get_draw_calls() const { return drawcalls_; };
    -
    33
    -
    34 void increment_draw_call_count() { drawcalls_++; };
    -
    35 void reset_draw_call_count() { drawcalls_ = 0; };
    -
    36
    -
    37 std::string get_cpu_name();
    -
    38 std::string get_gpu_driver_version(ID3D11Device* device);
    -
    39
    -
    40 std::shared_ptr<int>& get_vertex_count_ptr() { return total_vertex_count_; }
    -
    41 std::shared_ptr<int>& get_triangle_count_ptr() { return total_triangle_count_; }
    -
    42
    -
    43
    -
    44private:
    -
    45 std::thread update_display_thread_;
    -
    46
    -
    47 fps_class* fps_;
    -
    48 int drawcalls_;
    - -
    50
    -
    51 std::vector<object*> object_vec_;
    -
    52 std::vector<object*> cubes_vec_;
    -
    53 std::vector<object*> terrain_chunk_vec_;
    -
    54
    -
    55 std::shared_ptr<int> total_vertex_count_;
    -
    56 std::shared_ptr<int> total_triangle_count_;
    -
    57
    -
    58 int visible_triangle_count_ = 0;
    -
    59 int current_fps_ = 0;
    -
    60 int min_fps_ = 0;
    -
    61 int max_fps_ = 0;
    -
    62 float current_frame_time_ = 0.0f;
    -
    63
    -
    64};
    -
    - - -
    Definition stats.h:13
    -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:6a62451a88534f66a7509970cbbe303ef6b5c39c330da9921297bc9f15032616 +size 14958 diff --git a/doxygen_docs/html/struct_logger_1_1_log_entry-members.html b/doxygen_docs/html/struct_logger_1_1_log_entry-members.html index 4017162..945f399 100644 --- a/doxygen_docs/html/struct_logger_1_1_log_entry-members.html +++ b/doxygen_docs/html/struct_logger_1_1_log_entry-members.html @@ -1,116 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    Logger::LogEntry Member List
    -
    -
    - -

    This is the complete list of members for Logger::LogEntry, including all inherited members.

    - - - -
    level (defined in Logger::LogEntry)Logger::LogEntry
    message (defined in Logger::LogEntry)Logger::LogEntry
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:8aa2c288cd8a0e578cf51bf536d6603ac02d7e2ed0d364abb3e46f4c5fef4cab +size 4951 diff --git a/doxygen_docs/html/struct_logger_1_1_log_entry.html b/doxygen_docs/html/struct_logger_1_1_log_entry.html index db97081..36a04ed 100644 --- a/doxygen_docs/html/struct_logger_1_1_log_entry.html +++ b/doxygen_docs/html/struct_logger_1_1_log_entry.html @@ -1,165 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Logger::LogEntry Struct Reference - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    - -
    Logger::LogEntry Struct Reference
    -
    -
    - -

    #include <Logger.h>

    - - - - - - -

    -Public Attributes

    std::string message
     
    LogLevel level
     
    -

    Detailed Description

    -

    Struct representing a log entry. Contains the log message and its associated log level.

    - -

    Definition at line 65 of file Logger.h.

    -

    Member Data Documentation

    - -

    ◆ level

    - -
    -
    - - - - -
    LogLevel Logger::LogEntry::level
    -
    - -

    Definition at line 68 of file Logger.h.

    - -
    -
    - -

    ◆ message

    - -
    -
    - - - - -
    std::string Logger::LogEntry::message
    -
    - -

    Definition at line 67 of file Logger.h.

    - -
    -
    -
    The documentation for this struct was generated from the following file:
      -
    • enginecustom/src/inc/system/Logger.h
    • -
    -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:d343dea8d82b9775bb0e472f5cdc831e9dcf3098cc1eaee7b22c067dbe1684b3 +size 7600 diff --git a/doxygen_docs/html/struct_logger_1_1_log_level_info-members.html b/doxygen_docs/html/struct_logger_1_1_log_level_info-members.html index 858c845..27ebab1 100644 --- a/doxygen_docs/html/struct_logger_1_1_log_level_info-members.html +++ b/doxygen_docs/html/struct_logger_1_1_log_level_info-members.html @@ -1,117 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    Logger::LogLevelInfo Member List
    -
    -
    - -

    This is the complete list of members for Logger::LogLevelInfo, including all inherited members.

    - - - - -
    color (defined in Logger::LogLevelInfo)Logger::LogLevelInfo
    name (defined in Logger::LogLevelInfo)Logger::LogLevelInfo
    value (defined in Logger::LogLevelInfo)Logger::LogLevelInfo
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:00d33a7286dd61185d85f4b4e2d2a8a9c9737ef8fdb8511f9736d4762d6a19b3 +size 5306 diff --git a/doxygen_docs/html/struct_logger_1_1_log_level_info.html b/doxygen_docs/html/struct_logger_1_1_log_level_info.html index 8bf8f56..c5c29db 100644 --- a/doxygen_docs/html/struct_logger_1_1_log_level_info.html +++ b/doxygen_docs/html/struct_logger_1_1_log_level_info.html @@ -1,183 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Logger::LogLevelInfo Struct Reference - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    - -
    Logger::LogLevelInfo Struct Reference
    -
    -
    - -

    #include <Logger.h>

    - - - - - - - - -

    -Public Attributes

    const char * name
     
    int value
     
    ImVec4 color
     
    -

    Detailed Description

    -

    Struct containing information about a log level. This includes the name of the log level, its value, and its color for display.

    - -

    Definition at line 75 of file Logger.h.

    -

    Member Data Documentation

    - -

    ◆ color

    - -
    -
    - - - - -
    ImVec4 Logger::LogLevelInfo::color
    -
    - -

    Definition at line 79 of file Logger.h.

    - -
    -
    - -

    ◆ name

    - -
    -
    - - - - -
    const char* Logger::LogLevelInfo::name
    -
    - -

    Definition at line 77 of file Logger.h.

    - -
    -
    - -

    ◆ value

    - -
    -
    - - - - -
    int Logger::LogLevelInfo::value
    -
    - -

    Definition at line 78 of file Logger.h.

    - -
    -
    -
    The documentation for this struct was generated from the following file:
      -
    • enginecustom/src/inc/system/Logger.h
    • -
    -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:3bb18e445c61c83fe92777dc2dc53dd56db0ed33c94b1078d756de399c4e7997 +size 8506 diff --git a/doxygen_docs/html/struct_texture_container-members.html b/doxygen_docs/html/struct_texture_container-members.html index b86a42b..20a2da9 100644 --- a/doxygen_docs/html/struct_texture_container-members.html +++ b/doxygen_docs/html/struct_texture_container-members.html @@ -1,128 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    TextureContainer Member List
    -
    -
    - -

    This is the complete list of members for TextureContainer, including all inherited members.

    - - - - - - - - - - - - - - - -
    alpha (defined in TextureContainer)TextureContainer
    alphaPaths (defined in TextureContainer)TextureContainer
    AssignTexture(TextureContainer &textContainer, ID3D11ShaderResourceView *texture, const std::wstring paths, int index) (defined in TextureContainer)TextureContainerinline
    diffuse (defined in TextureContainer)TextureContainer
    diffusePaths (defined in TextureContainer)TextureContainer
    Get(TextureType type) const (defined in TextureContainer)TextureContainerinline
    GetPaths(TextureType type) const (defined in TextureContainer)TextureContainerinline
    GetTexture(TextureType type, int index) const (defined in TextureContainer)TextureContainerinline
    GetTexturePath(TextureType type, int index) const (defined in TextureContainer)TextureContainerinline
    normal (defined in TextureContainer)TextureContainer
    normalPaths (defined in TextureContainer)TextureContainer
    ReleaseAll() (defined in TextureContainer)TextureContainerinline
    specular (defined in TextureContainer)TextureContainer
    specularPaths (defined in TextureContainer)TextureContainer
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:832a737c232b22ceb2dfc1735185c878e4705db4e187f4a5b0423af6eafd2df4 +size 8778 diff --git a/doxygen_docs/html/struct_texture_container.html b/doxygen_docs/html/struct_texture_container.html index 5c74048..5588a85 100644 --- a/doxygen_docs/html/struct_texture_container.html +++ b/doxygen_docs/html/struct_texture_container.html @@ -1,538 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: TextureContainer Struct Reference - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    - -
    TextureContainer Struct Reference
    -
    -
    - - - - - - - - - - - - - - -

    -Public Member Functions

    std::vector< ID3D11ShaderResourceView * > & Get (TextureType type) const
     
    std::vector< std::wstring > GetPaths (TextureType type) const
     
    ID3D11ShaderResourceView * GetTexture (TextureType type, int index) const
     
    std::wstring GetTexturePath (TextureType type, int index) const
     
    void ReleaseAll ()
     
    void AssignTexture (TextureContainer &textContainer, ID3D11ShaderResourceView *texture, const std::wstring paths, int index)
     
    - - - - - - - - - - - - - - - - - -

    -Public Attributes

    std::vector< ID3D11ShaderResourceView * > diffuse
     
    std::vector< ID3D11ShaderResourceView * > normal
     
    std::vector< ID3D11ShaderResourceView * > specular
     
    std::vector< ID3D11ShaderResourceView * > alpha
     
    std::vector< std::wstring > diffusePaths
     
    std::vector< std::wstring > normalPaths
     
    std::vector< std::wstring > specularPaths
     
    std::vector< std::wstring > alphaPaths
     
    -

    Detailed Description

    -
    -

    Definition at line 33 of file model_class.h.

    -

    Member Function Documentation

    - -

    ◆ AssignTexture()

    - -
    -
    - - - - - -
    - - - - - - - - - - - - - - - - - - - - - -
    void TextureContainer::AssignTexture (TextureContainer & textContainer,
    ID3D11ShaderResourceView * texture,
    const std::wstring paths,
    int index )
    -
    -inline
    -
    - -

    Definition at line 105 of file model_class.h.

    -
    106 {
    -
    107 switch (index)
    -
    108 {
    -
    109 case 0:
    -
    110 textContainer.diffuse.push_back(texture);
    -
    111 textContainer.diffusePaths.push_back(paths);
    -
    112 break;
    -
    113 case 1:
    -
    114 textContainer.normal.push_back(texture);
    -
    115 textContainer.normalPaths.push_back(paths);
    -
    116 break;
    -
    117 case 2:
    -
    118 textContainer.specular.push_back(texture);
    -
    119 textContainer.specularPaths.push_back(paths);
    -
    120 break;
    -
    121 case 3:
    -
    122 textContainer.alpha.push_back(texture);
    -
    123 textContainer.alphaPaths.push_back(paths);
    -
    124 break;
    -
    125 default:
    -
    126 textContainer.diffuse.push_back(texture);
    -
    127 textContainer.diffusePaths.push_back(paths);
    -
    128 break;
    -
    129 }
    -
    130 }
    -
    -
    -
    - -

    ◆ Get()

    - -
    -
    - - - - - -
    - - - - - - - -
    std::vector< ID3D11ShaderResourceView * > & TextureContainer::Get (TextureType type) const
    -
    -inline
    -
    - -

    Definition at line 50 of file model_class.h.

    -
    50 {
    -
    51 switch (type) {
    -
    52 case TextureType::Diffuse: return const_cast<std::vector<ID3D11ShaderResourceView*>&>(diffuse);
    -
    53 case TextureType::Normal: return const_cast<std::vector<ID3D11ShaderResourceView*>&>(normal);
    -
    54 case TextureType::Specular: return const_cast<std::vector<ID3D11ShaderResourceView*>&>(specular);
    -
    55 case TextureType::Alpha: return const_cast<std::vector<ID3D11ShaderResourceView*>&>(alpha);
    -
    56 default: return const_cast<std::vector<ID3D11ShaderResourceView*>&>(diffuse);
    -
    57 }
    -
    58 }
    -
    -
    -
    - -

    ◆ GetPaths()

    - -
    -
    - - - - - -
    - - - - - - - -
    std::vector< std::wstring > TextureContainer::GetPaths (TextureType type) const
    -
    -inline
    -
    - -

    Definition at line 61 of file model_class.h.

    -
    61 {
    -
    62 switch (type)
    -
    63 {
    -
    64 case TextureType::Diffuse: return std::vector<std::wstring>(diffusePaths);
    -
    65 case TextureType::Normal: return std::vector<std::wstring>(normalPaths);
    -
    66 case TextureType::Specular: return std::vector<std::wstring>(specularPaths);
    -
    67 case TextureType::Alpha: return std::vector<std::wstring>(alphaPaths);
    -
    68 default: return std::vector<std::wstring>(diffusePaths);
    -
    69 }
    -
    70 }
    -
    -
    -
    - -

    ◆ GetTexture()

    - -
    -
    - - - - - -
    - - - - - - - - - - - -
    ID3D11ShaderResourceView * TextureContainer::GetTexture (TextureType type,
    int index ) const
    -
    -inline
    -
    - -

    Definition at line 74 of file model_class.h.

    -
    74 {
    -
    75 auto& vec = Get(type);
    -
    76 if (index >= 0 && index < vec.size())
    -
    77 return vec[index];
    -
    78 return nullptr;
    -
    79 }
    -
    -
    -
    - -

    ◆ GetTexturePath()

    - -
    -
    - - - - - -
    - - - - - - - - - - - -
    std::wstring TextureContainer::GetTexturePath (TextureType type,
    int index ) const
    -
    -inline
    -
    - -

    Definition at line 82 of file model_class.h.

    -
    83 {
    -
    84 std::vector<std::wstring> path = GetPaths(type);
    -
    85 if (index >= 0 && index < path.size())
    -
    86 return path[index];
    -
    87 return L"";
    -
    88 }
    -
    -
    -
    - -

    ◆ ReleaseAll()

    - -
    -
    - - - - - -
    - - - - - - - -
    void TextureContainer::ReleaseAll ()
    -
    -inline
    -
    - -

    Definition at line 92 of file model_class.h.

    -
    92 {
    -
    93 ReleaseVector(diffuse);
    -
    94 ReleaseVector(normal);
    -
    95 ReleaseVector(specular);
    -
    96 ReleaseVector(alpha);
    -
    97
    -
    98 ReleaseVector(diffusePaths);
    -
    99 ReleaseVector(normalPaths);
    -
    100 ReleaseVector(specularPaths);
    -
    101 ReleaseVector(alphaPaths);
    -
    102 }
    -
    -
    -
    -

    Member Data Documentation

    - -

    ◆ alpha

    - -
    -
    - - - - -
    std::vector<ID3D11ShaderResourceView*> TextureContainer::alpha
    -
    - -

    Definition at line 40 of file model_class.h.

    - -
    -
    - -

    ◆ alphaPaths

    - -
    -
    - - - - -
    std::vector<std::wstring> TextureContainer::alphaPaths
    -
    - -

    Definition at line 46 of file model_class.h.

    - -
    -
    - -

    ◆ diffuse

    - -
    -
    - - - - -
    std::vector<ID3D11ShaderResourceView*> TextureContainer::diffuse
    -
    - -

    Definition at line 37 of file model_class.h.

    - -
    -
    - -

    ◆ diffusePaths

    - -
    -
    - - - - -
    std::vector<std::wstring> TextureContainer::diffusePaths
    -
    - -

    Definition at line 43 of file model_class.h.

    - -
    -
    - -

    ◆ normal

    - -
    -
    - - - - -
    std::vector<ID3D11ShaderResourceView*> TextureContainer::normal
    -
    - -

    Definition at line 38 of file model_class.h.

    - -
    -
    - -

    ◆ normalPaths

    - -
    -
    - - - - -
    std::vector<std::wstring> TextureContainer::normalPaths
    -
    - -

    Definition at line 44 of file model_class.h.

    - -
    -
    - -

    ◆ specular

    - -
    -
    - - - - -
    std::vector<ID3D11ShaderResourceView*> TextureContainer::specular
    -
    - -

    Definition at line 39 of file model_class.h.

    - -
    -
    - -

    ◆ specularPaths

    - -
    -
    - - - - -
    std::vector<std::wstring> TextureContainer::specularPaths
    -
    - -

    Definition at line 45 of file model_class.h.

    - -
    -
    -
    The documentation for this struct was generated from the following file: -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:35d8a8e7ff8231a5f9ef310a2e2a85d794a07bc20a634ed9677b71e1a76df30a +size 32662 diff --git a/doxygen_docs/html/structinput-members.html b/doxygen_docs/html/structinput-members.html index 7299312..b18d8a8 100644 --- a/doxygen_docs/html/structinput-members.html +++ b/doxygen_docs/html/structinput-members.html @@ -1,118 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    input Member List
    -
    -
    - -

    This is the complete list of members for input, including all inherited members.

    - - - - - -
    key_down (defined in input)input
    key_left (defined in input)input
    key_right (defined in input)input
    key_up (defined in input)input
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:d2186d17ebdc184847d50db782e8e101316acff3f933f502194bc44a24317a3c +size 5261 diff --git a/doxygen_docs/html/structinput.html b/doxygen_docs/html/structinput.html index 51f0183..cb98c7d 100644 --- a/doxygen_docs/html/structinput.html +++ b/doxygen_docs/html/structinput.html @@ -1,198 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: input Struct Reference - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    - -
    input Struct Reference
    -
    -
    - - - - - - - - - - -

    -Public Attributes

    bool key_left = false
     
    bool key_right = false
     
    bool key_up = false
     
    bool key_down = false
     
    -

    Detailed Description

    -
    -

    Definition at line 67 of file application_class.h.

    -

    Member Data Documentation

    - -

    ◆ key_down

    - -
    -
    - - - - -
    bool input::key_down = false
    -
    - -

    Definition at line 72 of file application_class.h.

    - -
    -
    - -

    ◆ key_left

    - -
    -
    - - - - -
    bool input::key_left = false
    -
    - -

    Definition at line 69 of file application_class.h.

    - -
    -
    - -

    ◆ key_right

    - -
    -
    - - - - -
    bool input::key_right = false
    -
    - -

    Definition at line 70 of file application_class.h.

    - -
    -
    - -

    ◆ key_up

    - -
    -
    - - - - -
    bool input::key_up = false
    -
    - -

    Definition at line 71 of file application_class.h.

    - -
    -
    -
    The documentation for this struct was generated from the following file: -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:25ebac52cee57b61248a50e47fd6b9398df05693fd1b7607734fa3f1971025d5 +size 9310 diff --git a/doxygen_docs/html/structmodel__class_1_1_face-members.html b/doxygen_docs/html/structmodel__class_1_1_face-members.html index fe08b5c..b63480c 100644 --- a/doxygen_docs/html/structmodel__class_1_1_face-members.html +++ b/doxygen_docs/html/structmodel__class_1_1_face-members.html @@ -1,123 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    model_class::Face Member List
    -
    -
    - -

    This is the complete list of members for model_class::Face, including all inherited members.

    - - - - - - - - - - -
    n1 (defined in model_class::Face)model_class::Face
    n2 (defined in model_class::Face)model_class::Face
    n3 (defined in model_class::Face)model_class::Face
    t1 (defined in model_class::Face)model_class::Face
    t2 (defined in model_class::Face)model_class::Face
    t3 (defined in model_class::Face)model_class::Face
    v1 (defined in model_class::Face)model_class::Face
    v2 (defined in model_class::Face)model_class::Face
    v3 (defined in model_class::Face)model_class::Face
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:77bd610eb15d56bee0bab3c309d86161668df4a27b69e1c42ca123776771cde7 +size 6941 diff --git a/doxygen_docs/html/structmodel__class_1_1_face.html b/doxygen_docs/html/structmodel__class_1_1_face.html index cac033e..80b64f1 100644 --- a/doxygen_docs/html/structmodel__class_1_1_face.html +++ b/doxygen_docs/html/structmodel__class_1_1_face.html @@ -1,288 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: model_class::Face Struct Reference - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    - -
    model_class::Face Struct Reference
    -
    -
    - - - - - - - - - - - - - - - - - - - - -

    -Public Attributes

    int v1
     
    int v2
     
    int v3
     
    int t1
     
    int t2
     
    int t3
     
    int n1
     
    int n2
     
    int n3
     
    -

    Detailed Description

    -
    -

    Definition at line 196 of file model_class.h.

    -

    Member Data Documentation

    - -

    ◆ n1

    - -
    -
    - - - - -
    int model_class::Face::n1
    -
    - -

    Definition at line 199 of file model_class.h.

    - -
    -
    - -

    ◆ n2

    - -
    -
    - - - - -
    int model_class::Face::n2
    -
    - -

    Definition at line 199 of file model_class.h.

    - -
    -
    - -

    ◆ n3

    - -
    -
    - - - - -
    int model_class::Face::n3
    -
    - -

    Definition at line 199 of file model_class.h.

    - -
    -
    - -

    ◆ t1

    - -
    -
    - - - - -
    int model_class::Face::t1
    -
    - -

    Definition at line 198 of file model_class.h.

    - -
    -
    - -

    ◆ t2

    - -
    -
    - - - - -
    int model_class::Face::t2
    -
    - -

    Definition at line 198 of file model_class.h.

    - -
    -
    - -

    ◆ t3

    - -
    -
    - - - - -
    int model_class::Face::t3
    -
    - -

    Definition at line 198 of file model_class.h.

    - -
    -
    - -

    ◆ v1

    - -
    -
    - - - - -
    int model_class::Face::v1
    -
    - -

    Definition at line 197 of file model_class.h.

    - -
    -
    - -

    ◆ v2

    - -
    -
    - - - - -
    int model_class::Face::v2
    -
    - -

    Definition at line 197 of file model_class.h.

    - -
    -
    - -

    ◆ v3

    - -
    -
    - - - - -
    int model_class::Face::v3
    -
    - -

    Definition at line 197 of file model_class.h.

    - -
    -
    -
    The documentation for this struct was generated from the following file: -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:5f55b470989f53ea3f5449dcdf201d43c56f08f441031bdd894fc3077dce820a +size 14280 diff --git a/doxygen_docs/html/structmodel__class_1_1_model_type-members.html b/doxygen_docs/html/structmodel__class_1_1_model_type-members.html index ebd77dd..683e614 100644 --- a/doxygen_docs/html/structmodel__class_1_1_model_type-members.html +++ b/doxygen_docs/html/structmodel__class_1_1_model_type-members.html @@ -1,128 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    model_class::ModelType Member List
    -
    - -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:181a997257ca444f82e387370c038bafc87d280468f552aae0e8479b0d9c054e +size 8690 diff --git a/doxygen_docs/html/structmodel__class_1_1_model_type.html b/doxygen_docs/html/structmodel__class_1_1_model_type.html index 81b5950..1ee6974 100644 --- a/doxygen_docs/html/structmodel__class_1_1_model_type.html +++ b/doxygen_docs/html/structmodel__class_1_1_model_type.html @@ -1,378 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: model_class::ModelType Struct Reference - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    - -
    model_class::ModelType Struct Reference
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

    -Public Attributes

    float x
     
    float y
     
    float z
     
    float tu
     
    float tv
     
    float nx
     
    float ny
     
    float nz
     
    float tx
     
    float ty
     
    float tz
     
    float bx
     
    float by
     
    float bz
     
    -

    Detailed Description

    -
    -

    Definition at line 163 of file model_class.h.

    -

    Member Data Documentation

    - -

    ◆ bx

    - -
    -
    - - - - -
    float model_class::ModelType::bx
    -
    - -

    Definition at line 169 of file model_class.h.

    - -
    -
    - -

    ◆ by

    - -
    -
    - - - - -
    float model_class::ModelType::by
    -
    - -

    Definition at line 169 of file model_class.h.

    - -
    -
    - -

    ◆ bz

    - -
    -
    - - - - -
    float model_class::ModelType::bz
    -
    - -

    Definition at line 169 of file model_class.h.

    - -
    -
    - -

    ◆ nx

    - -
    -
    - - - - -
    float model_class::ModelType::nx
    -
    - -

    Definition at line 167 of file model_class.h.

    - -
    -
    - -

    ◆ ny

    - -
    -
    - - - - -
    float model_class::ModelType::ny
    -
    - -

    Definition at line 167 of file model_class.h.

    - -
    -
    - -

    ◆ nz

    - -
    -
    - - - - -
    float model_class::ModelType::nz
    -
    - -

    Definition at line 167 of file model_class.h.

    - -
    -
    - -

    ◆ tu

    - -
    -
    - - - - -
    float model_class::ModelType::tu
    -
    - -

    Definition at line 166 of file model_class.h.

    - -
    -
    - -

    ◆ tv

    - -
    -
    - - - - -
    float model_class::ModelType::tv
    -
    - -

    Definition at line 166 of file model_class.h.

    - -
    -
    - -

    ◆ tx

    - -
    -
    - - - - -
    float model_class::ModelType::tx
    -
    - -

    Definition at line 168 of file model_class.h.

    - -
    -
    - -

    ◆ ty

    - -
    -
    - - - - -
    float model_class::ModelType::ty
    -
    - -

    Definition at line 168 of file model_class.h.

    - -
    -
    - -

    ◆ tz

    - -
    -
    - - - - -
    float model_class::ModelType::tz
    -
    - -

    Definition at line 168 of file model_class.h.

    - -
    -
    - -

    ◆ x

    - -
    -
    - - - - -
    float model_class::ModelType::x
    -
    - -

    Definition at line 165 of file model_class.h.

    - -
    -
    - -

    ◆ y

    - -
    -
    - - - - -
    float model_class::ModelType::y
    -
    - -

    Definition at line 165 of file model_class.h.

    - -
    -
    - -

    ◆ z

    - -
    -
    - - - - -
    float model_class::ModelType::z
    -
    - -

    Definition at line 165 of file model_class.h.

    - -
    -
    -
    The documentation for this struct was generated from the following file: -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:6f06d3a652786972b31c41f5b044a0589a5bd6ac4468d1532e0860672186086f +size 19435 diff --git a/doxygen_docs/html/structmodel__class_1_1_normal-members.html b/doxygen_docs/html/structmodel__class_1_1_normal-members.html index f99afc6..ee9abfe 100644 --- a/doxygen_docs/html/structmodel__class_1_1_normal-members.html +++ b/doxygen_docs/html/structmodel__class_1_1_normal-members.html @@ -1,117 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    model_class::Normal Member List
    -
    -
    - -

    This is the complete list of members for model_class::Normal, including all inherited members.

    - - - - -
    nx (defined in model_class::Normal)model_class::Normal
    ny (defined in model_class::Normal)model_class::Normal
    nz (defined in model_class::Normal)model_class::Normal
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:0c3b21d8d203dc29821b01546be2eed6f865cb17d0699d6d9d4a7ba1664ed055 +size 5266 diff --git a/doxygen_docs/html/structmodel__class_1_1_normal.html b/doxygen_docs/html/structmodel__class_1_1_normal.html index 4874731..392e552 100644 --- a/doxygen_docs/html/structmodel__class_1_1_normal.html +++ b/doxygen_docs/html/structmodel__class_1_1_normal.html @@ -1,180 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: model_class::Normal Struct Reference - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    - -
    model_class::Normal Struct Reference
    -
    -
    - - - - - - - - -

    -Public Attributes

    float nx
     
    float ny
     
    float nz
     
    -

    Detailed Description

    -
    -

    Definition at line 180 of file model_class.h.

    -

    Member Data Documentation

    - -

    ◆ nx

    - -
    -
    - - - - -
    float model_class::Normal::nx
    -
    - -

    Definition at line 181 of file model_class.h.

    - -
    -
    - -

    ◆ ny

    - -
    -
    - - - - -
    float model_class::Normal::ny
    -
    - -

    Definition at line 181 of file model_class.h.

    - -
    -
    - -

    ◆ nz

    - -
    -
    - - - - -
    float model_class::Normal::nz
    -
    - -

    Definition at line 181 of file model_class.h.

    - -
    -
    -
    The documentation for this struct was generated from the following file: -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:84db1106fd0481a55bf98aa4fe571a1333bcc4f9b706097cfeb8b33a9e44fe2f +size 8304 diff --git a/doxygen_docs/html/structmodel__class_1_1_temp_vertex_type-members.html b/doxygen_docs/html/structmodel__class_1_1_temp_vertex_type-members.html index 2617122..c22bb0e 100644 --- a/doxygen_docs/html/structmodel__class_1_1_temp_vertex_type-members.html +++ b/doxygen_docs/html/structmodel__class_1_1_temp_vertex_type-members.html @@ -1,122 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    model_class::TempVertexType Member List
    -
    - -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:14733c1c0fd27b973beb05deaaa73301f1edd60113f75ba884e3bffc7f3a2c83 +size 7049 diff --git a/doxygen_docs/html/structmodel__class_1_1_temp_vertex_type.html b/doxygen_docs/html/structmodel__class_1_1_temp_vertex_type.html index e4aff1c..65ba8a9 100644 --- a/doxygen_docs/html/structmodel__class_1_1_temp_vertex_type.html +++ b/doxygen_docs/html/structmodel__class_1_1_temp_vertex_type.html @@ -1,270 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: model_class::TempVertexType Struct Reference - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    - -
    model_class::TempVertexType Struct Reference
    -
    -
    - - - - - - - - - - - - - - - - - - -

    -Public Attributes

    float x
     
    float y
     
    float z
     
    float tu
     
    float tv
     
    float nx
     
    float ny
     
    float nz
     
    -

    Detailed Description

    -
    -

    Definition at line 184 of file model_class.h.

    -

    Member Data Documentation

    - -

    ◆ nx

    - -
    -
    - - - - -
    float model_class::TempVertexType::nx
    -
    - -

    Definition at line 188 of file model_class.h.

    - -
    -
    - -

    ◆ ny

    - -
    -
    - - - - -
    float model_class::TempVertexType::ny
    -
    - -

    Definition at line 188 of file model_class.h.

    - -
    -
    - -

    ◆ nz

    - -
    -
    - - - - -
    float model_class::TempVertexType::nz
    -
    - -

    Definition at line 188 of file model_class.h.

    - -
    -
    - -

    ◆ tu

    - -
    -
    - - - - -
    float model_class::TempVertexType::tu
    -
    - -

    Definition at line 187 of file model_class.h.

    - -
    -
    - -

    ◆ tv

    - -
    -
    - - - - -
    float model_class::TempVertexType::tv
    -
    - -

    Definition at line 187 of file model_class.h.

    - -
    -
    - -

    ◆ x

    - -
    -
    - - - - -
    float model_class::TempVertexType::x
    -
    - -

    Definition at line 186 of file model_class.h.

    - -
    -
    - -

    ◆ y

    - -
    -
    - - - - -
    float model_class::TempVertexType::y
    -
    - -

    Definition at line 186 of file model_class.h.

    - -
    -
    - -

    ◆ z

    - -
    -
    - - - - -
    float model_class::TempVertexType::z
    -
    - -

    Definition at line 186 of file model_class.h.

    - -
    -
    -
    The documentation for this struct was generated from the following file: -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:49ac4b1aa596edc799880b37f1c26bd19cf3cb578ba00ba912a98f23c4a0bff7 +size 13448 diff --git a/doxygen_docs/html/structmodel__class_1_1_texture-members.html b/doxygen_docs/html/structmodel__class_1_1_texture-members.html index a693db2..b89e919 100644 --- a/doxygen_docs/html/structmodel__class_1_1_texture-members.html +++ b/doxygen_docs/html/structmodel__class_1_1_texture-members.html @@ -1,116 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    model_class::Texture Member List
    -
    -
    - -

    This is the complete list of members for model_class::Texture, including all inherited members.

    - - - -
    u (defined in model_class::Texture)model_class::Texture
    v (defined in model_class::Texture)model_class::Texture
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:cbfee8164930319bbec0be0ca496e3cb7eabbdfe2c30887fbce3a034f5506d19 +size 4983 diff --git a/doxygen_docs/html/structmodel__class_1_1_texture.html b/doxygen_docs/html/structmodel__class_1_1_texture.html index b266e8b..db7497e 100644 --- a/doxygen_docs/html/structmodel__class_1_1_texture.html +++ b/doxygen_docs/html/structmodel__class_1_1_texture.html @@ -1,162 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: model_class::Texture Struct Reference - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    - -
    model_class::Texture Struct Reference
    -
    -
    - - - - - - -

    -Public Attributes

    float u
     
    float v
     
    -

    Detailed Description

    -
    -

    Definition at line 176 of file model_class.h.

    -

    Member Data Documentation

    - -

    ◆ u

    - -
    -
    - - - - -
    float model_class::Texture::u
    -
    - -

    Definition at line 177 of file model_class.h.

    - -
    -
    - -

    ◆ v

    - -
    -
    - - - - -
    float model_class::Texture::v
    -
    - -

    Definition at line 177 of file model_class.h.

    - -
    -
    -
    The documentation for this struct was generated from the following file: -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:ab0f475c8b5663233f92ff63808ee5cedd7995844d2cf05eb3ce36e27d683097 +size 7299 diff --git a/doxygen_docs/html/structmodel__class_1_1_vector_type-members.html b/doxygen_docs/html/structmodel__class_1_1_vector_type-members.html index 4a87932..73b5c9c 100644 --- a/doxygen_docs/html/structmodel__class_1_1_vector_type-members.html +++ b/doxygen_docs/html/structmodel__class_1_1_vector_type-members.html @@ -1,117 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    model_class::VectorType Member List
    -
    -
    - -

    This is the complete list of members for model_class::VectorType, including all inherited members.

    - - - - -
    x (defined in model_class::VectorType)model_class::VectorType
    y (defined in model_class::VectorType)model_class::VectorType
    z (defined in model_class::VectorType)model_class::VectorType
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:3817280e3d2572a25f825cd30612d32050270f092fa840bd8ed295608efb9ea2 +size 5335 diff --git a/doxygen_docs/html/structmodel__class_1_1_vector_type.html b/doxygen_docs/html/structmodel__class_1_1_vector_type.html index c6b97f9..eea5246 100644 --- a/doxygen_docs/html/structmodel__class_1_1_vector_type.html +++ b/doxygen_docs/html/structmodel__class_1_1_vector_type.html @@ -1,180 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: model_class::VectorType Struct Reference - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    - -
    model_class::VectorType Struct Reference
    -
    -
    - - - - - - - - -

    -Public Attributes

    float x
     
    float y
     
    float z
     
    -

    Detailed Description

    -
    -

    Definition at line 191 of file model_class.h.

    -

    Member Data Documentation

    - -

    ◆ x

    - -
    -
    - - - - -
    float model_class::VectorType::x
    -
    - -

    Definition at line 193 of file model_class.h.

    - -
    -
    - -

    ◆ y

    - -
    -
    - - - - -
    float model_class::VectorType::y
    -
    - -

    Definition at line 193 of file model_class.h.

    - -
    -
    - -

    ◆ z

    - -
    -
    - - - - -
    float model_class::VectorType::z
    -
    - -

    Definition at line 193 of file model_class.h.

    - -
    -
    -
    The documentation for this struct was generated from the following file: -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:8d6064fa89a36b9d9635b3b68af9b771950f11621a04c9dd1cd7d623b337e68d +size 8334 diff --git a/doxygen_docs/html/structmodel__class_1_1_vertex-members.html b/doxygen_docs/html/structmodel__class_1_1_vertex-members.html index 9a4b8d8..000a288 100644 --- a/doxygen_docs/html/structmodel__class_1_1_vertex-members.html +++ b/doxygen_docs/html/structmodel__class_1_1_vertex-members.html @@ -1,117 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    model_class::Vertex Member List
    -
    -
    - -

    This is the complete list of members for model_class::Vertex, including all inherited members.

    - - - - -
    x (defined in model_class::Vertex)model_class::Vertex
    y (defined in model_class::Vertex)model_class::Vertex
    z (defined in model_class::Vertex)model_class::Vertex
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:b9ef07c0f7057b631e98ccdc93af86b0e6c38430f8aa80f352c55a7bad41a8bc +size 5263 diff --git a/doxygen_docs/html/structmodel__class_1_1_vertex.html b/doxygen_docs/html/structmodel__class_1_1_vertex.html index a489b58..c2dca7c 100644 --- a/doxygen_docs/html/structmodel__class_1_1_vertex.html +++ b/doxygen_docs/html/structmodel__class_1_1_vertex.html @@ -1,180 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: model_class::Vertex Struct Reference - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    - -
    model_class::Vertex Struct Reference
    -
    -
    - - - - - - - - -

    -Public Attributes

    float x
     
    float y
     
    float z
     
    -

    Detailed Description

    -
    -

    Definition at line 172 of file model_class.h.

    -

    Member Data Documentation

    - -

    ◆ x

    - -
    -
    - - - - -
    float model_class::Vertex::x
    -
    - -

    Definition at line 173 of file model_class.h.

    - -
    -
    - -

    ◆ y

    - -
    -
    - - - - -
    float model_class::Vertex::y
    -
    - -

    Definition at line 173 of file model_class.h.

    - -
    -
    - -

    ◆ z

    - -
    -
    - - - - -
    float model_class::Vertex::z
    -
    - -

    Definition at line 173 of file model_class.h.

    - -
    -
    -
    The documentation for this struct was generated from the following file: -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:0005f6d44472692144ae589ecb2730fa72f48b9029c65b4b713b5c6af8e4c426 +size 8295 diff --git a/doxygen_docs/html/structmodel__class_1_1_vertex_type-members.html b/doxygen_docs/html/structmodel__class_1_1_vertex_type-members.html index 94979ce..4adb750 100644 --- a/doxygen_docs/html/structmodel__class_1_1_vertex_type-members.html +++ b/doxygen_docs/html/structmodel__class_1_1_vertex_type-members.html @@ -1,119 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    model_class::VertexType Member List
    -
    -
    - -

    This is the complete list of members for model_class::VertexType, including all inherited members.

    - - - - - - -
    binormal (defined in model_class::VertexType)model_class::VertexType
    normal (defined in model_class::VertexType)model_class::VertexType
    position (defined in model_class::VertexType)model_class::VertexType
    tangent (defined in model_class::VertexType)model_class::VertexType
    texture (defined in model_class::VertexType)model_class::VertexType
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:22b964c56045de751346875e80cc98b807ce16e739fc3ddae2657059085469ef +size 5985 diff --git a/doxygen_docs/html/structmodel__class_1_1_vertex_type.html b/doxygen_docs/html/structmodel__class_1_1_vertex_type.html index f771681..0e32558 100644 --- a/doxygen_docs/html/structmodel__class_1_1_vertex_type.html +++ b/doxygen_docs/html/structmodel__class_1_1_vertex_type.html @@ -1,216 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: model_class::VertexType Struct Reference - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    - -
    model_class::VertexType Struct Reference
    -
    -
    - - - - - - - - - - - - -

    -Public Attributes

    XMFLOAT3 position
     
    XMFLOAT2 texture
     
    XMFLOAT3 normal
     
    XMFLOAT3 tangent
     
    XMFLOAT3 binormal
     
    -

    Detailed Description

    -
    -

    Definition at line 154 of file model_class.h.

    -

    Member Data Documentation

    - -

    ◆ binormal

    - -
    -
    - - - - -
    XMFLOAT3 model_class::VertexType::binormal
    -
    - -

    Definition at line 160 of file model_class.h.

    - -
    -
    - -

    ◆ normal

    - -
    -
    - - - - -
    XMFLOAT3 model_class::VertexType::normal
    -
    - -

    Definition at line 158 of file model_class.h.

    - -
    -
    - -

    ◆ position

    - -
    -
    - - - - -
    XMFLOAT3 model_class::VertexType::position
    -
    - -

    Definition at line 156 of file model_class.h.

    - -
    -
    - -

    ◆ tangent

    - -
    -
    - - - - -
    XMFLOAT3 model_class::VertexType::tangent
    -
    - -

    Definition at line 159 of file model_class.h.

    - -
    -
    - -

    ◆ texture

    - -
    -
    - - - - -
    XMFLOAT2 model_class::VertexType::texture
    -
    - -

    Definition at line 157 of file model_class.h.

    - -
    -
    -
    The documentation for this struct was generated from the following file: -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:c352bb11a28bc166b2edf382ed1efc9780c9d9729b61e962180107d3e8348144 +size 10473 diff --git a/doxygen_docs/html/structwidget__entry-members.html b/doxygen_docs/html/structwidget__entry-members.html index c65b7b3..8d2835e 100644 --- a/doxygen_docs/html/structwidget__entry-members.html +++ b/doxygen_docs/html/structwidget__entry-members.html @@ -1,116 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: Member List - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    widget_entry Member List
    -
    -
    - -

    This is the complete list of members for widget_entry, including all inherited members.

    - - - -
    func (defined in widget_entry)widget_entry
    show (defined in widget_entry)widget_entry
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:7cc3ec5b207eab191dd316dff13a8c0923e9e189f6b43f8e38c9df8e6c73ffc5 +size 4875 diff --git a/doxygen_docs/html/structwidget__entry.html b/doxygen_docs/html/structwidget__entry.html index 07881ae..5a2da8e 100644 --- a/doxygen_docs/html/structwidget__entry.html +++ b/doxygen_docs/html/structwidget__entry.html @@ -1,165 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: widget_entry Struct Reference - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    - -
    widget_entry Struct Reference
    -
    -
    - -

    #include <imguiManager.h>

    - - - - - - -

    -Public Attributes

    bool * show
     
    std::function< void()> func
     
    -

    Detailed Description

    -

    Struct to hold widget entries for ImGui. This struct contains a pointer to a boolean that determines if the widget should be shown, and a function that will be called when the widget is rendered.

    - -

    Definition at line 27 of file imguiManager.h.

    -

    Member Data Documentation

    - -

    ◆ func

    - -
    -
    - - - - -
    std::function<void()> widget_entry::func
    -
    - -

    Definition at line 30 of file imguiManager.h.

    - -
    -
    - -

    ◆ show

    - -
    -
    - - - - -
    bool* widget_entry::show
    -
    - -

    Definition at line 29 of file imguiManager.h.

    - -
    -
    -
    The documentation for this struct was generated from the following file: -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:750828a1def16af0a1290fa599f52dbe64dc6b37884e67cfbaf634447836a3f7 +size 7538 diff --git a/doxygen_docs/html/sunlight__shader__class_8cpp_source.html b/doxygen_docs/html/sunlight__shader__class_8cpp_source.html index 663d088..131098a 100644 --- a/doxygen_docs/html/sunlight__shader__class_8cpp_source.html +++ b/doxygen_docs/html/sunlight__shader__class_8cpp_source.html @@ -1,576 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/src/shader/sunlight_shader_class.cpp Source File - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    sunlight_shader_class.cpp
    -
    -
    -
    1
    -
    2// Filename: lightshaderclass.cpp
    -
    4#include "sunlight_shader_class.h"
    -
    5
    -
    6
    -
    7sunlight_shader_class::sunlight_shader_class()
    -
    8{
    -
    9 vertex_shader_ = 0;
    -
    10 pixel_shader_ = 0;
    -
    11 layout_ = 0;
    -
    12 sample_state_ = 0;
    -
    13 matrix_buffer_ = 0;
    -
    14 camera_buffer_ = 0;
    -
    15 sunlight_buffer_ = 0;
    -
    16 sunlight_color_buffer_ = 0;
    -
    17 sunlight_position_buffer_ = 0;
    -
    18}
    -
    19
    -
    20
    -
    21sunlight_shader_class::sunlight_shader_class(const sunlight_shader_class& other)
    -
    22{
    -
    23}
    -
    24
    -
    25
    -
    26sunlight_shader_class::~sunlight_shader_class()
    -
    27{
    -
    28}
    -
    29
    -
    30
    -
    31bool sunlight_shader_class::initialize(ID3D11Device* device, HWND hwnd)
    -
    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/sunlight.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/sunlight.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 = initialize_shader(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("SunLightShaderClass initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
    -
    64
    -
    65 return true;
    -
    66}
    -
    67
    -
    68
    -
    69void sunlight_shader_class::shutdown()
    -
    70{
    -
    71 // shutdown the vertex and pixel shaders as well as the related objects.
    -
    72 shutdown_shader();
    -
    73
    -
    74 return;
    -
    75}
    -
    76
    -
    77bool sunlight_shader_class::render(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix,
    -
    78 ID3D11ShaderResourceView* texture, XMFLOAT4 diffuseColor, XMFLOAT4 ambientColor, XMFLOAT3 sunDirection, float sunIntensity)
    -
    79{
    -
    80 bool result;
    -
    81
    -
    82
    -
    83 // Set the shader parameters that it will use for rendering.
    -
    84 result = set_shader_parameters(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 render_shader(deviceContext, indexCount);
    -
    93
    -
    94 return true;
    -
    95}
    -
    96
    -
    97
    -
    98bool sunlight_shader_class::initialize_shader(ID3D11Device* device, HWND hwnd, WCHAR* vsFilename, WCHAR* psFilename)
    -
    99{
    -
    100 Logger::Get().Log("Initializing shader", __FILE__, __LINE__, Logger::LogLevel::Initialize);
    -
    101
    -
    102 HRESULT result;
    -
    103 ID3D10Blob* errorMessage;
    -
    104 ID3D10Blob* vertexShaderBuffer;
    -
    105 ID3D10Blob* pixelShaderBuffer;
    -
    106 D3D11_INPUT_ELEMENT_DESC polygonLayout[3];
    -
    107 unsigned int numElements;
    -
    108 D3D11_SAMPLER_DESC samplerDesc;
    -
    109 D3D11_BUFFER_DESC matrixBufferDesc;
    -
    110 D3D11_BUFFER_DESC sunlightBufferDesc;
    -
    111
    -
    112 // initialize the pointers this function will use to null.
    -
    113 errorMessage = 0;
    -
    114 vertexShaderBuffer = 0;
    -
    115 pixelShaderBuffer = 0;
    -
    116
    -
    117 // Compile the vertex shader code.
    -
    118 result = D3DCompileFromFile(vsFilename, NULL, NULL, "SunLightVertexShader", "vs_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0, &vertexShaderBuffer, &errorMessage);
    -
    119 if (FAILED(result))
    -
    120 {
    -
    121 if (errorMessage)
    -
    122 {
    -
    123 output_shader_error_message(errorMessage, hwnd, vsFilename);
    -
    124 }
    -
    125 else
    -
    126 {
    -
    127 Logger::Get().Log("Failed to compile shader", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    128 }
    -
    129 return false;
    -
    130 }
    -
    131
    -
    132 // Compile the pixel shader code.
    -
    133 result = D3DCompileFromFile(psFilename, NULL, NULL, "SunLightPixelShader", "ps_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0, &pixelShaderBuffer, &errorMessage);
    -
    134 if (FAILED(result))
    -
    135 {
    -
    136 if (errorMessage)
    -
    137 {
    -
    138 output_shader_error_message(errorMessage, hwnd, psFilename);
    -
    139 }
    -
    140 else
    -
    141 {
    -
    142 Logger::Get().Log("Failed to compile shader", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    143 }
    -
    144 return false;
    -
    145 }
    -
    146
    -
    147 // Create the vertex shader from the buffer.
    -
    148 result = device->CreateVertexShader(vertexShaderBuffer->GetBufferPointer(), vertexShaderBuffer->GetBufferSize(), NULL, &vertex_shader_);
    -
    149 if (FAILED(result))
    -
    150 {
    -
    151 Logger::Get().Log("Failed to create vertex shader", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    152 return false;
    -
    153 }
    -
    154
    -
    155 // Create the pixel shader from the buffer.
    -
    156 result = device->CreatePixelShader(pixelShaderBuffer->GetBufferPointer(), pixelShaderBuffer->GetBufferSize(), NULL, &pixel_shader_);
    -
    157 if (FAILED(result))
    -
    158 {
    -
    159 Logger::Get().Log("Failed to create pixel shader", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    160 return false;
    -
    161 }
    -
    162
    -
    163 // Create the vertex input layout description.
    -
    164 polygonLayout[0].SemanticName = "POSITION";
    -
    165 polygonLayout[0].SemanticIndex = 0;
    -
    166 polygonLayout[0].Format = DXGI_FORMAT_R32G32B32_FLOAT;
    -
    167 polygonLayout[0].InputSlot = 0;
    -
    168 polygonLayout[0].AlignedByteOffset = 0;
    -
    169 polygonLayout[0].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
    -
    170 polygonLayout[0].InstanceDataStepRate = 0;
    -
    171
    -
    172 polygonLayout[1].SemanticName = "TEXCOORD";
    -
    173 polygonLayout[1].SemanticIndex = 0;
    -
    174 polygonLayout[1].Format = DXGI_FORMAT_R32G32_FLOAT;
    -
    175 polygonLayout[1].InputSlot = 0;
    -
    176 polygonLayout[1].AlignedByteOffset = D3D11_APPEND_ALIGNED_ELEMENT;
    -
    177 polygonLayout[1].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
    -
    178 polygonLayout[1].InstanceDataStepRate = 0;
    -
    179
    -
    180 polygonLayout[2].SemanticName = "NORMAL";
    -
    181 polygonLayout[2].SemanticIndex = 0;
    -
    182 polygonLayout[2].Format = DXGI_FORMAT_R32G32B32_FLOAT;
    -
    183 polygonLayout[2].InputSlot = 0;
    -
    184 polygonLayout[2].AlignedByteOffset = D3D11_APPEND_ALIGNED_ELEMENT;
    -
    185 polygonLayout[2].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
    -
    186 polygonLayout[2].InstanceDataStepRate = 0;
    -
    187
    -
    188 // Get a count of the elements in the layout.
    -
    189 numElements = sizeof(polygonLayout) / sizeof(polygonLayout[0]);
    -
    190
    -
    191 // Create the vertex input layout.
    -
    192 result = device->CreateInputLayout(polygonLayout, numElements, vertexShaderBuffer->GetBufferPointer(), vertexShaderBuffer->GetBufferSize(), &layout_);
    -
    193 if (FAILED(result))
    -
    194 {
    -
    195 Logger::Get().Log("Failed to create input layout", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    196 return false;
    -
    197 }
    -
    198
    -
    199 // Release the vertex shader buffer and pixel shader buffer since they are no longer needed.
    -
    200 vertexShaderBuffer->Release();
    -
    201 vertexShaderBuffer = 0;
    -
    202
    -
    203 pixelShaderBuffer->Release();
    -
    204 pixelShaderBuffer = 0;
    -
    205
    -
    206 // Create a texture sampler state description.
    -
    207 samplerDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR;
    -
    208 samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP;
    -
    209 samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP;
    -
    210 samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_WRAP;
    -
    211 samplerDesc.MipLODBias = 0.0f;
    -
    212 samplerDesc.MaxAnisotropy = 1;
    -
    213 samplerDesc.ComparisonFunc = D3D11_COMPARISON_ALWAYS;
    -
    214 samplerDesc.BorderColor[0] = 0;
    -
    215 samplerDesc.BorderColor[1] = 0;
    -
    216 samplerDesc.BorderColor[2] = 0;
    -
    217 samplerDesc.BorderColor[3] = 0;
    -
    218 samplerDesc.MinLOD = 0;
    -
    219 samplerDesc.MaxLOD = D3D11_FLOAT32_MAX;
    -
    220
    -
    221 // Create the texture sampler state.
    -
    222 result = device->CreateSamplerState(&samplerDesc, &sample_state_);
    -
    223 if (FAILED(result))
    -
    224 {
    -
    225 Logger::Get().Log("Failed to create sampler state", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    226 return false;
    -
    227 }
    -
    228
    -
    229 // Setup the description of the dynamic matrix constant buffer that is in the vertex shader.
    -
    230 matrixBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
    -
    231 matrixBufferDesc.ByteWidth = sizeof(matrix_buffer_type);
    -
    232 matrixBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
    -
    233 matrixBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
    -
    234 matrixBufferDesc.MiscFlags = 0;
    -
    235 matrixBufferDesc.StructureByteStride = 0;
    -
    236
    -
    237 // Create the constant buffer pointer so we can access the vertex shader constant buffer from within this class.
    -
    238 result = device->CreateBuffer(&matrixBufferDesc, NULL, &matrix_buffer_);
    -
    239 if (FAILED(result))
    -
    240 {
    -
    241 Logger::Get().Log("Failed to create matrix buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    242 return false;
    -
    243 }
    -
    244
    -
    245 // Setup the description of the dynamic sunlight constant buffer that is in the pixel shader.
    -
    246 sunlightBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
    -
    247 sunlightBufferDesc.ByteWidth = sizeof(sun_light_buffer_type);
    -
    248 sunlightBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
    -
    249 sunlightBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
    -
    250 sunlightBufferDesc.MiscFlags = 0;
    -
    251 sunlightBufferDesc.StructureByteStride = 0;
    -
    252
    -
    253 // Create the constant buffer pointer so we can access the pixel shader constant buffer from within this class.
    -
    254 result = device->CreateBuffer(&sunlightBufferDesc, NULL, &sunlight_buffer_);
    -
    255 if (FAILED(result))
    -
    256 {
    -
    257 Logger::Get().Log("Failed to create sunlight buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    258 return false;
    -
    259 }
    -
    260
    -
    261 Logger::Get().Log("Shader initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
    -
    262
    -
    263 return true;
    -
    264}
    -
    265
    -
    266
    -
    267
    -
    268
    -
    269void sunlight_shader_class::shutdown_shader()
    -
    270{
    -
    271 Logger::Get().Log("Shutting down SunLightShaderClass", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
    -
    272
    -
    273 // Release the light constant buffers.
    -
    274 if (sunlight_color_buffer_)
    -
    275 {
    -
    276 sunlight_color_buffer_->Release();
    -
    277 sunlight_color_buffer_ = 0;
    -
    278 }
    -
    279
    -
    280 if (sunlight_position_buffer_)
    -
    281 {
    -
    282 sunlight_position_buffer_->Release();
    -
    283 sunlight_position_buffer_ = 0;
    -
    284 }
    -
    285
    -
    286 // Release the light constant buffer.
    -
    287 if (sunlight_buffer_)
    -
    288 {
    -
    289 sunlight_buffer_->Release();
    -
    290 sunlight_buffer_ = 0;
    -
    291 }
    -
    292
    -
    293 // Release the camera constant buffer.
    -
    294 if (camera_buffer_)
    -
    295 {
    -
    296 camera_buffer_->Release();
    -
    297 camera_buffer_ = 0;
    -
    298 }
    -
    299
    -
    300 // Release the matrix constant buffer.
    -
    301 if (matrix_buffer_)
    -
    302 {
    -
    303 matrix_buffer_->Release();
    -
    304 matrix_buffer_ = 0;
    -
    305 }
    -
    306
    -
    307 // Release the sampler state.
    -
    308 if (sample_state_)
    -
    309 {
    -
    310 sample_state_->Release();
    -
    311 sample_state_ = 0;
    -
    312 }
    -
    313
    -
    314 // Release the layout.
    -
    315 if (layout_)
    -
    316 {
    -
    317 layout_->Release();
    -
    318 layout_ = 0;
    -
    319 }
    -
    320
    -
    321 // Release the pixel shader.
    -
    322 if (pixel_shader_)
    -
    323 {
    -
    324 pixel_shader_->Release();
    -
    325 pixel_shader_ = 0;
    -
    326 }
    -
    327
    -
    328 // Release the vertex shader.
    -
    329 if (vertex_shader_)
    -
    330 {
    -
    331 vertex_shader_->Release();
    -
    332 vertex_shader_ = 0;
    -
    333 }
    -
    334
    -
    335 Logger::Get().Log("SunLightShaderClass shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
    -
    336
    -
    337 return;
    -
    338}
    -
    339
    -
    340
    -
    341void sunlight_shader_class::output_shader_error_message(ID3D10Blob* errorMessage, HWND hwnd, WCHAR* shaderFilename)
    -
    342{
    -
    343 char* compileErrors;
    -
    344 unsigned __int64 bufferSize, i;
    -
    345 ofstream fout;
    -
    346
    -
    347
    -
    348 // Get a pointer to the error message text buffer.
    -
    349 compileErrors = (char*)(errorMessage->GetBufferPointer());
    -
    350
    -
    351 // Get the length of the message.
    -
    352 bufferSize = errorMessage->GetBufferSize();
    -
    353
    -
    354 // Open a file to write the error message to.
    -
    355 fout.open("shader-error.txt");
    -
    356
    -
    357 // Write out the error message.
    -
    358 for (i = 0; i < bufferSize; i++)
    -
    359 {
    -
    360 fout << compileErrors[i];
    -
    361 }
    -
    362
    -
    363 // Close the file.
    -
    364 fout.close();
    -
    365
    -
    366 // Release the error message.
    -
    367 errorMessage->Release();
    -
    368 errorMessage = 0;
    -
    369
    -
    370 // Pop a message up on the screen to notify the user to check the text file for compile errors.
    -
    371 MessageBox(hwnd, L"Error compiling shader. Check shader-error.txt for message.", shaderFilename, MB_OK);
    -
    372
    -
    373 return;
    -
    374}
    -
    375
    -
    376
    -
    377bool sunlight_shader_class::set_shader_parameters(ID3D11DeviceContext* deviceContext, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix, ID3D11ShaderResourceView* texture, XMFLOAT4 ambientColor, XMFLOAT4 diffuseColor, XMFLOAT3 lightDirection, float sunIntensity)
    -
    378{
    -
    379 HRESULT result;
    -
    380 D3D11_MAPPED_SUBRESOURCE mappedResource;
    -
    381 matrix_buffer_type* dataPtr;
    -
    382 camera_buffer_type* dataPtr2;
    -
    383 sun_light_buffer_type* dataPtr3;
    -
    384 unsigned int bufferNumber;
    -
    385
    -
    386 // Transpose the matrices to prepare them for the shader.
    -
    387 worldMatrix = XMMatrixTranspose(worldMatrix);
    -
    388 viewMatrix = XMMatrixTranspose(viewMatrix);
    -
    389 projectionMatrix = XMMatrixTranspose(projectionMatrix);
    -
    390
    -
    391 // Lock the constant buffer so it can be written to.
    -
    392 result = deviceContext->Map(matrix_buffer_, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
    -
    393 if (FAILED(result))
    -
    394 {
    -
    395 return false;
    -
    396 }
    -
    397
    -
    398 // Get a pointer to the data in the constant buffer.
    -
    399 dataPtr = (matrix_buffer_type*)mappedResource.pData;
    -
    400
    -
    401 // Copy the matrices into the constant buffer.
    -
    402 dataPtr->world = worldMatrix;
    -
    403 dataPtr->view = viewMatrix;
    -
    404 dataPtr->projection = projectionMatrix;
    -
    405
    -
    406 // Unlock the constant buffer.
    -
    407 deviceContext->Unmap(matrix_buffer_, 0);
    -
    408
    -
    409 // Set the position of the constant buffer in the vertex shader.
    -
    410 bufferNumber = 0;
    -
    411
    -
    412 // Finally set the constant buffer in the vertex shader with the updated values.
    -
    413 deviceContext->VSSetConstantBuffers(bufferNumber, 1, &matrix_buffer_);
    -
    414
    -
    415 // Lock the sunlight constant buffer so it can be written to.
    -
    416 result = deviceContext->Map(sunlight_buffer_, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
    -
    417 if (FAILED(result))
    -
    418 {
    -
    419 return false;
    -
    420 }
    -
    421
    -
    422 // Get a pointer to the data in the constant buffer.
    -
    423 dataPtr3 = (sun_light_buffer_type*)mappedResource.pData;
    -
    424
    -
    425 // Copy the lighting variables into the constant buffer.
    -
    426 dataPtr3->ambient_color = ambientColor;
    -
    427 dataPtr3->diffuse_color = diffuseColor;
    -
    428 dataPtr3->sun_direction = lightDirection;
    -
    429 dataPtr3->intensity = sunIntensity;
    -
    430
    -
    431 // Unlock the constant buffer.
    -
    432 deviceContext->Unmap(sunlight_buffer_, 0);
    -
    433
    -
    434 // Set the position of the sunlight constant buffer in the pixel shader.
    -
    435 bufferNumber = 0;
    -
    436
    -
    437 // Finally set the sunlight constant buffer in the pixel shader with the updated values.
    -
    438 deviceContext->PSSetConstantBuffers(bufferNumber, 1, &sunlight_buffer_);
    -
    439
    -
    440 // Set shader texture resource in the pixel shader.
    -
    441 deviceContext->PSSetShaderResources(0, 1, &texture);
    -
    442
    -
    443 return true;
    -
    444}
    -
    445
    -
    446void sunlight_shader_class::render_shader(ID3D11DeviceContext* deviceContext, int indexCount)
    -
    447{
    -
    448 // Set the vertex input layout.
    -
    449 deviceContext->IASetInputLayout(layout_);
    -
    450
    -
    451 // Set the vertex and pixel shaders that will be used to render this triangle.
    -
    452 deviceContext->VSSetShader(vertex_shader_, NULL, 0);
    -
    453 deviceContext->PSSetShader(pixel_shader_, NULL, 0);
    -
    454
    -
    455 // Set the sampler state in the pixel shader.
    -
    456 deviceContext->PSSetSamplers(0, 1, &sample_state_);
    -
    457
    -
    458 // render the triangle.
    -
    459 deviceContext->DrawIndexed(indexCount, 0, 0);
    -
    460
    -
    461 return;
    -
    462}
    -
    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
    - -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:4924616acc99ec4d6dab19e05af8dc99a60252923d19a4b3a293d82239b02782 +size 72131 diff --git a/doxygen_docs/html/sunlight__shader__class_8h_source.html b/doxygen_docs/html/sunlight__shader__class_8h_source.html index 6acc8d7..ce1f110 100644 --- a/doxygen_docs/html/sunlight__shader__class_8h_source.html +++ b/doxygen_docs/html/sunlight__shader__class_8h_source.html @@ -1,183 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/inc/shader/sunlight_shader_class.h Source File - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    sunlight_shader_class.h
    -
    -
    -
    1#pragma once
    -
    2
    -
    3#include "Logger.h"
    -
    4#include <d3d11.h>
    -
    5#include <d3dcompiler.h>
    -
    6#include <directxmath.h>
    -
    7#include <fstream>
    -
    8using namespace DirectX;
    -
    9using namespace std;
    -
    10
    -
    - -
    12{
    -
    13
    -
    14private :
    -
    15 struct matrix_buffer_type
    -
    16 {
    -
    17 XMMATRIX world;
    -
    18 XMMATRIX view;
    -
    19 XMMATRIX projection;
    -
    20 };
    -
    21
    -
    22 struct camera_buffer_type
    -
    23 {
    -
    24 XMFLOAT3 camera_position;
    -
    25 float padding;
    -
    26 };
    -
    27
    -
    28 struct sun_light_buffer_type
    -
    29 {
    -
    30 XMFLOAT4 diffuse_color;
    -
    31 XMFLOAT4 ambient_color;
    -
    32 XMFLOAT3 sun_direction;
    -
    33 float intensity;
    -
    34 };
    -
    35
    -
    36 struct sun_light_color_buffer_type
    -
    37 {
    -
    38 XMFLOAT4 sun_color;
    -
    39 };
    -
    40
    -
    41public :
    - - - -
    45
    -
    46 bool initialize(ID3D11Device*, HWND);
    -
    47 void shutdown();
    -
    48 bool render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT4, XMFLOAT4, XMFLOAT3,float);
    -
    49
    -
    50private:
    -
    51 bool initialize_shader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
    -
    52 void shutdown_shader();
    -
    53 void output_shader_error_message(ID3D10Blob*, HWND, WCHAR*);
    -
    54
    -
    55 bool set_shader_parameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT4, XMFLOAT4, XMFLOAT3, float);
    -
    56 void render_shader(ID3D11DeviceContext*, int);
    -
    57
    -
    58private:
    -
    59 ID3D11VertexShader* vertex_shader_;
    -
    60 ID3D11PixelShader* pixel_shader_;
    -
    61 ID3D11InputLayout* layout_;
    -
    62 ID3D11SamplerState* sample_state_;
    -
    63 ID3D11Buffer* matrix_buffer_;
    -
    64 ID3D11Buffer* camera_buffer_;
    -
    65 ID3D11Buffer* sunlight_buffer_;
    -
    66 ID3D11Buffer* sunlight_color_buffer_;
    -
    67 ID3D11Buffer* sunlight_position_buffer_;
    -
    68};
    -
    - -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:1fa976d828e5bee87a2d63cddc90d6feb0da51c4d94b6cf4c603c61c8e71ffce +size 14327 diff --git a/doxygen_docs/html/sync_off.png b/doxygen_docs/html/sync_off.png index 3b443fc..9fc7d81 100644 Binary files a/doxygen_docs/html/sync_off.png and b/doxygen_docs/html/sync_off.png differ diff --git a/doxygen_docs/html/sync_on.png b/doxygen_docs/html/sync_on.png index e08320f..c93c8e2 100644 Binary files a/doxygen_docs/html/sync_on.png and b/doxygen_docs/html/sync_on.png differ diff --git a/doxygen_docs/html/system__class_8cpp_source.html b/doxygen_docs/html/system__class_8cpp_source.html index a409c21..a2adc8b 100644 --- a/doxygen_docs/html/system__class_8cpp_source.html +++ b/doxygen_docs/html/system__class_8cpp_source.html @@ -1,564 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/src/system/system_class.cpp Source File - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    system_class.cpp
    -
    -
    -
    1#include "system_class.h"
    -
    2#include <iostream>
    -
    3#include <shellapi.h> // Include for DragAcceptFiles and DragQueryFile
    -
    4#include <windows.h>
    -
    5extern IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
    -
    6
    -
    7system_class::system_class()
    -
    8{
    -
    9 input_ = 0;
    -
    10 application_ = 0;
    -
    11 imgui_manager_ = 0;
    -
    12 application_name_ = 0;
    -
    13 hinstance_ = 0;
    -
    14 hwnd_ = 0;
    -
    15 initial_window_width_ = 0;
    -
    16 initial_window_height_ = 0;
    -
    17 is_direct_3d_initialized_ = false;
    -
    18
    -
    19}
    -
    20
    -
    21system_class::~system_class()
    -
    22{
    -
    23}
    -
    24
    -
    25bool system_class::initialize()
    -
    26{
    -
    27 int screenHeight, screenWidth = 0;
    -
    28 bool result;
    -
    29
    -
    30 Logger::Get().Log("Initializing system class", __FILE__, __LINE__, Logger::LogLevel::Initialize);
    -
    31
    -
    32 try
    -
    33 {
    -
    34 // initialize the windows api.
    -
    35 initialize_windows(screenWidth, screenHeight);
    -
    36
    -
    37 // Create and initialize the input object. This object will be used to handle reading the keyboard input from the user.
    -
    38 input_ = std::make_shared<input_class>();
    -
    39
    -
    40 result = input_->Initialize(hinstance_, hwnd_, screenWidth, screenHeight);
    -
    41 if (!result)
    -
    42 {
    -
    43 Logger::Get().Log("Failed to initialize input class", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    44 return false;
    -
    45 }
    -
    46
    -
    47 // Create and initialize the application class object. This object will handle rendering all the graphics for this application.
    -
    48 application_ = std::make_shared<application_class>();
    -
    49
    -
    50 result = application_->initialize(screenWidth, screenHeight, hwnd_, false);
    -
    51 if (!result)
    -
    52 {
    -
    53 return false;
    -
    54 }
    -
    55
    -
    56 is_direct_3d_initialized_ = true;
    -
    57
    -
    58 // If we received a WM_SIZE message before Direct3D was initialized, resize the swap chain now
    -
    59 if (initial_window_width_ > 0 && initial_window_height_ > 0)
    -
    60 {
    -
    61 application_->get_direct_3d()->resize_swap_chain(initial_window_width_, initial_window_height_);
    -
    62 }
    -
    63
    -
    64 // initialize imgui
    -
    65 if(DEBUG_MODE)
    -
    66 {
    -
    67 imgui_manager_ = std::make_shared<imguiManager>();
    -
    68 imgui_manager_->SetApp(application_);
    -
    69 result = imgui_manager_->Initialize(hwnd_, application_->get_direct_3d()->get_device(), application_->get_direct_3d()->get_device_context());
    -
    70 if (!result)
    -
    71 {
    -
    72 return false;
    -
    73 }
    -
    74 }
    -
    75
    -
    76 }
    -
    77 catch (const std::exception& e)
    -
    78 {
    -
    79 Logger::Get().Log(std::string("Exception caught during initialization: ") + e.what(), __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    80 return false;
    -
    81 }
    -
    82
    -
    83 Logger::Get().Log("System class initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
    -
    84
    -
    85 return true;
    -
    86}
    -
    87
    -
    88void system_class::shutdown()
    -
    89{
    -
    90 Logger::Get().Log("Shutting down system class", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
    -
    91
    -
    92 std::lock_guard<std::mutex> guard(render_mutex_);
    -
    93
    -
    94 // shutdown the window.
    -
    95 shutdown_windows();
    -
    96
    -
    97 Logger::Get().Log("System class shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
    -
    98
    -
    99}
    -
    100
    -
    101void system_class::run()
    -
    102{
    -
    103 MSG msg;
    -
    104 bool done, result;
    -
    105
    -
    106 Logger::Get().Log("Running the system", __FILE__, __LINE__);
    -
    107
    -
    108 // initialize the message structure.
    -
    109 ZeroMemory(&msg, sizeof(MSG));
    -
    110
    -
    111 // Loop until there is a quit message from the window or the user.
    -
    112 done = false;
    -
    113
    -
    114 while (!done)
    -
    115 {
    -
    116 // Handle the windows messages.
    -
    117 if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
    -
    118 {
    -
    119 if(msg.message == WM_QUIT)
    -
    120 {
    -
    121 done = true;
    -
    122 }
    -
    123 else
    -
    124 {
    -
    125 TranslateMessage(&msg);
    -
    126 DispatchMessage(&msg);
    -
    127 }
    -
    128 }
    -
    129
    -
    130 // If windows signals to end the application then exit out.
    -
    131 if (application_ != nullptr && application_->get_should_quit())
    -
    132 {
    -
    133 Logger::Get().Log("Received quit signal from application", __FILE__, __LINE__);
    -
    134 done = true;
    -
    135 }
    -
    136 else
    -
    137 {
    -
    138 // Otherwise do the frame processing.
    -
    139 result = frame();
    -
    140 if (!result)
    -
    141 {
    -
    142 Logger::Get().Log("Failed to process frame", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    143 done = true;
    -
    144 }
    -
    145 }
    -
    146
    -
    147 }
    -
    148
    -
    149 return;
    -
    150}
    -
    151
    -
    152bool system_class::frame()
    -
    153{
    -
    154 // Clear the buffers to begin the scene.
    -
    155 application_->get_direct_3d()->begin_scene(0.0f, 0.0f, 0.0f, 1.0f);
    -
    156
    -
    157 std::lock_guard<std::mutex> guard(render_mutex_);
    -
    158 bool result;
    -
    159
    -
    160 result = input_->Frame();
    -
    161 if (!result)
    -
    162 {
    -
    163 Logger::Get().Log("Failed to process input frame", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    164 return false;
    -
    165 }
    -
    166
    -
    167 // Do the frame processing for the application class object.
    -
    168 result = application_->frame(input_.get());
    -
    169 if (!result)
    -
    170 {
    -
    171 Logger::Get().Log("Failed to process application frame", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    172 return false;
    -
    173 }
    -
    174
    -
    175 if(!input_->IsKeyDown(222))
    -
    176 {
    -
    177 //log the key press
    -
    178 is_debug_key_pressed_ = false;
    -
    179 }
    -
    180 else if (input_->IsKeyDown(222) && !is_debug_key_pressed_)
    -
    181 {
    -
    182 // Log the key release state
    -
    183 is_debug_key_pressed_ = true;
    -
    184 DEBUG_MODE = !DEBUG_MODE;
    -
    185 }
    -
    186
    -
    187 if (DEBUG_MODE)
    -
    188 {
    -
    189 // render ImGui
    -
    190 result = imgui_manager_->ImGuiWidgetRenderer();
    -
    191 if (!result)
    -
    192 {
    -
    193 Logger::Get().Log("Failed to render ImGui widgets", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    194 return false;
    -
    195 }
    -
    196 }
    -
    197
    -
    198 application_->get_direct_3d()->end_scene();
    -
    199
    -
    200 return true;
    -
    201}
    -
    202
    -
    203LRESULT CALLBACK system_class::message_handler(HWND hwnd, UINT umsg, WPARAM wparam, LPARAM lparam)
    -
    204{
    -
    205
    -
    206 if (ImGui_ImplWin32_WndProcHandler(hwnd, umsg, wparam, lparam))
    -
    207 {
    -
    208 return true;
    -
    209 }
    -
    210
    -
    211 switch (umsg)
    -
    212 {
    -
    213 // Check if a key has been pressed on the keyboard.
    -
    214 case WM_KEYDOWN:
    -
    215 {
    -
    216 // If a key is pressed send it to the input object so it can record that state.
    -
    217 input_->KeyDown((unsigned int)wparam);
    -
    218 return 0;
    -
    219 }
    -
    220
    -
    221 // Check if a key has been released on the keyboard.
    -
    222 case WM_KEYUP:
    -
    223 {
    -
    224 // If a key is released then send it to the input object so it can unset the state for that key.
    -
    225 input_->KeyUp((unsigned int)wparam);
    -
    226 return 0;
    -
    227 }
    -
    228 case WM_SIZE:
    -
    229 {
    -
    230 int newWidth = LOWORD(lparam);
    -
    231 int newHeight = HIWORD(lparam);
    -
    232
    -
    233 // If Direct3D is initialized, update the swap chain. Otherwise, store the window dimensions
    -
    234 if (is_direct_3d_initialized_ && application_ && application_->get_direct_3d())
    -
    235 {
    -
    236 application_->set_screen_width(newWidth);
    -
    237 application_->set_screen_height(newHeight);
    -
    238 application_->get_direct_3d()->resize_swap_chain(newWidth, newHeight);
    -
    239 }
    -
    240 else
    -
    241 {
    -
    242 initial_window_width_ = newWidth;
    -
    243 initial_window_height_ = newHeight;
    -
    244 }
    -
    245 return 0;
    -
    246 }
    -
    247 case WM_ENTERSIZEMOVE:
    -
    248 {
    -
    249 is_resizing_ = true;
    -
    250 break;
    -
    251 }
    -
    252 case WM_EXITSIZEMOVE:
    -
    253 {
    -
    254 is_resizing_ = false;
    -
    255 break;
    -
    256 }
    -
    257 case WM_DROPFILES:
    -
    258 {
    -
    259 HDROP hDrop = reinterpret_cast<HDROP>(wparam);
    -
    260 UINT numFiles = DragQueryFile(hDrop, 0xFFFFFFFF, nullptr, 0);
    -
    261
    -
    262 if (numFiles > 0) {
    -
    263 for (UINT i = 0; i < numFiles; ++i) {
    -
    264 WCHAR filePath[MAX_PATH];
    -
    265 DragQueryFile(hDrop, i, filePath, MAX_PATH);
    -
    266
    -
    267 // Get the file extension
    -
    268 std::wstring fileName = filePath;
    -
    269 std::wstring extension = fileName.substr(fileName.find_last_of(L".") + 1);
    -
    270
    -
    271 // Check if the file has a valid extension
    -
    272 if (extension == L"txt" || extension == L"kobj") {
    -
    273 // Handle dropped files with valid extensions
    -
    274 std::wcout << L"File dropped: " << filePath << std::endl;
    -
    275 application_->add_kobject(fileName);
    -
    276 }
    -
    277 else {
    -
    278 // Handle files with invalid extensions (optional)
    -
    279 std::wcout << L"Ignored file: " << filePath << std::endl;
    -
    280 }
    -
    281 }
    -
    282 }
    -
    283
    -
    284 DragFinish(hDrop);
    -
    285 return 0;
    -
    286 }
    -
    287 case WM_CLOSE:
    -
    288 {
    -
    289 Logger::Get().Log("WM_CLOSE message received", __FILE__, __LINE__);
    -
    290 application_->set_should_quit(true);
    -
    291 return 0;
    -
    292 }
    -
    293 // Any other messages send to the default message handler as our application won't make use of them.
    -
    294 default:
    -
    295 {
    -
    296 return DefWindowProc(hwnd, umsg, wparam, lparam);
    -
    297 }
    -
    298
    -
    299 }
    -
    300
    -
    301 return 0;
    -
    302}
    -
    303
    -
    304void system_class::initialize_windows(int& screenWidth, int& screenHeight)
    -
    305{
    -
    306 WNDCLASSEX wc;
    -
    307 DEVMODE dmScreenSettings;
    -
    308 int posX, posY;
    -
    309
    -
    310 Logger::Get().Log("Initializing windows", __FILE__, __LINE__, Logger::LogLevel::Initialize);
    -
    311 // Get an external pointer to this object.
    -
    312 application_handle = this;
    -
    313
    -
    314 // Get the instance of this application.
    -
    315 hinstance_ = GetModuleHandle(NULL);
    -
    316
    -
    317 // Give the application a name.
    -
    318 application_name_ = L"Khaotic Engine";
    -
    319
    -
    320 // Setup the windows class with default settings.
    -
    321 wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
    -
    322 wc.lpfnWndProc = wnd_proc;
    -
    323 wc.cbClsExtra = 0;
    -
    324 wc.cbWndExtra = 0;
    -
    325 wc.hInstance = hinstance_;
    -
    326 wc.hIcon = LoadIcon(hinstance_,MAKEINTRESOURCE(IDI_ICON1));
    -
    327 wc.hIconSm = LoadIcon(hinstance_, MAKEINTRESOURCE(IDI_ICON1));
    -
    328 wc.hCursor = LoadCursor(NULL, IDC_ARROW);
    -
    329 wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
    -
    330 wc.lpszMenuName = NULL;
    -
    331 wc.lpszClassName = application_name_;
    -
    332 wc.cbSize = sizeof(WNDCLASSEX);
    -
    333
    -
    334 // Register the window class.
    -
    335 RegisterClassEx(&wc);
    -
    336
    -
    337 // Determine the resolution of the clients desktop screen.
    -
    338 screenWidth = GetSystemMetrics(SM_CXSCREEN);
    -
    339 screenHeight = GetSystemMetrics(SM_CYSCREEN);
    -
    340
    -
    341 // Setup the screen settings depending on whether it is running in full screen or in windowed mode.
    -
    342 if (full_screen)
    -
    343 {
    -
    344 // If full screen set the screen to maximum size of the users desktop and 32bit.
    -
    345 memset(&dmScreenSettings, 0, sizeof(dmScreenSettings));
    -
    346 dmScreenSettings.dmSize = sizeof(dmScreenSettings);
    -
    347 dmScreenSettings.dmPelsWidth = (unsigned long)screenWidth;
    -
    348 dmScreenSettings.dmPelsHeight = (unsigned long)screenHeight;
    -
    349 dmScreenSettings.dmBitsPerPel = 32;
    -
    350 dmScreenSettings.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
    -
    351
    -
    352 // Change the display settings to full screen.
    -
    353 ChangeDisplaySettings(&dmScreenSettings, CDS_FULLSCREEN);
    -
    354
    -
    355 // Set the position of the window to the top left corner.
    -
    356 posX = posY = 0;
    -
    357 }
    -
    358 else
    -
    359 {
    -
    360 // If windowed then set it to 1600x900 resolution.
    -
    361 screenWidth = 1600;
    -
    362 screenHeight = 900;
    -
    363
    -
    364 // Place the window in the middle of the screen.
    -
    365 posX = (GetSystemMetrics(SM_CXSCREEN) - screenWidth) / 2;
    -
    366 posY = (GetSystemMetrics(SM_CYSCREEN) - screenHeight) / 2;
    -
    367 }
    -
    368
    -
    369 // Create the window with the screen settings and get the handle to it.
    -
    370 hwnd_ = CreateWindowEx(WS_EX_APPWINDOW, application_name_, application_name_,
    -
    371 WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX,
    -
    372 posX, posY, screenWidth, screenHeight, NULL, NULL, hinstance_, NULL);
    -
    373
    -
    374 // Bring the window up on the screen and set it as main focus.
    -
    375 ShowWindow(hwnd_, SW_SHOW);
    -
    376 SetForegroundWindow(hwnd_);
    -
    377 SetFocus(hwnd_);
    -
    378
    -
    379 // Hide the mouse cursor.
    -
    380 ShowCursor(true);
    -
    381
    -
    382 //drag and drop
    -
    383 DragAcceptFiles(hwnd_, TRUE);
    -
    384
    -
    385 return;
    -
    386}
    -
    387
    -
    388void system_class::shutdown_windows()
    -
    389{
    -
    390 Logger::Get().Log("Shutting down the windows", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
    -
    391 // Show the mouse cursor.
    -
    392 ShowCursor(true);
    -
    393
    -
    394 // Fix the display settings if leaving full screen mode.
    -
    395 if (full_screen)
    -
    396 {
    -
    397 ChangeDisplaySettings(NULL, 0);
    -
    398 }
    -
    399
    -
    400 // Remove the window.
    -
    401 DestroyWindow(hwnd_);
    -
    402 hwnd_ = NULL;
    -
    403
    -
    404 // Remove the application instance.
    -
    405 UnregisterClass(application_name_, hinstance_);
    -
    406 hinstance_ = NULL;
    -
    407
    -
    408 // Release the pointer to this class.
    -
    409 application_handle = NULL;
    -
    410
    -
    411 return;
    -
    412}
    -
    413
    -
    414LRESULT CALLBACK wnd_proc(HWND hwnd, UINT umessage, WPARAM wparam, LPARAM lparam)
    -
    415{
    -
    416 switch (umessage)
    -
    417 {
    -
    418 // Check if the window is being destroyed.
    -
    419 case WM_DESTROY:
    -
    420 {
    -
    421 PostQuitMessage(0);
    -
    422 return 0;
    -
    423 }
    -
    424
    -
    425 // Check if the window is being closed.
    -
    426 case WM_CLOSE:
    -
    427 {
    -
    428 PostQuitMessage(0);
    -
    429 return 0;
    -
    430 }
    -
    431
    -
    432 case WM_DROPFILES:
    -
    433 {
    -
    434 application_handle->message_handler(hwnd, umessage, wparam, lparam);
    -
    435 return(0);
    -
    436 }
    -
    437
    -
    438 // All other messages pass to the message handler in the system class.
    -
    439 default:
    -
    440 {
    -
    441 return application_handle->message_handler(hwnd, umessage, wparam, lparam);
    -
    442 }
    -
    443 }
    -
    444}
    -
    445
    -
    446void system_class::send_path(wchar_t* path, std::filesystem::path w_folder)
    -
    447{
    -
    448 application_->set_path(path);
    -
    449 application_->set_w_folder(w_folder);
    -
    450}
    -
    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
    -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:1a030360bc4dbf3a6f65d8ed3e63bfbbfdf54036513c90e44cfb985eeac03d86 +size 69325 diff --git a/doxygen_docs/html/system__class_8h_source.html b/doxygen_docs/html/system__class_8h_source.html index ca6f675..208e72f 100644 --- a/doxygen_docs/html/system__class_8h_source.html +++ b/doxygen_docs/html/system__class_8h_source.html @@ -1,196 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/inc/system/system_class.h Source File - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    system_class.h
    -
    -
    -
    1#ifndef _SYSTEMCLASS_H_
    -
    2#define _SYSTEMCLASS_H_
    -
    3
    -
    4#define WIN32_LEAN_AND_MEAN
    -
    5
    -
    6static bool DEBUG_MODE = true;
    -
    7
    -
    8#include "Logger.h"
    -
    9
    -
    10#include "input_class.h"
    -
    11#include "application_class.h"
    -
    12#include "imguiManager.h"
    -
    13#include <mutex>
    -
    14#include <filesystem>
    -
    15#include <commdlg.h>
    -
    16
    -
    17#include "../resources.h"
    -
    18#include <chrono>
    -
    19
    -
    - -
    21{
    -
    22public:
    - - - -
    26
    -
    27 bool initialize();
    -
    28 void shutdown();
    -
    29 void run();
    -
    30
    -
    31 LRESULT CALLBACK message_handler(HWND, UINT, WPARAM, LPARAM);
    -
    32
    -
    33 void send_path(wchar_t* path, std::filesystem::path w_folder);
    -
    34
    -
    35 std::shared_ptr<application_class> get_application_class() const { return application_; }
    -
    36 void set_application_class(std::shared_ptr<application_class> application) { application_ = std::move(application); }
    -
    37
    -
    38 std::shared_ptr<input_class> get_input_class() const { return input_; }
    -
    39 void set_input(std::shared_ptr<input_class> input) { input_ = std::move(input); }
    -
    40
    -
    41 HWND get_hwnd() const { return hwnd_; }
    -
    42
    -
    43 void set_d_3D_mock(d_3d_class* mock) {application_->set_direct_3d(mock);}
    -
    44
    -
    45
    -
    46protected:
    -
    47 bool frame();
    -
    48 void initialize_windows(int&, int&);
    -
    49 void shutdown_windows();
    -
    50
    -
    51private:
    -
    52 LPCWSTR application_name_;
    -
    53 HINSTANCE hinstance_;
    -
    54 HWND hwnd_;
    -
    55
    -
    56 std::shared_ptr<input_class> input_;
    -
    57 std::shared_ptr<application_class> application_;
    -
    58 std::shared_ptr<imguiManager> imgui_manager_;
    -
    59
    -
    60 int initial_window_width_;
    -
    61 int initial_window_height_;
    -
    62 bool is_direct_3d_initialized_;
    -
    63 bool is_resizing_ = false;
    -
    64 bool is_debug_key_pressed_ = false;
    -
    65
    -
    66 std::mutex render_mutex_;
    -
    67
    -
    68};
    -
    -
    69
    -
    70
    -
    72// FUNCTION PROTOTYPES //
    -
    74static LRESULT CALLBACK wnd_proc(HWND, UINT, WPARAM, LPARAM);
    -
    75
    -
    76
    -
    78// GLOBALS //
    -
    80static system_class* application_handle = 0;
    -
    81
    -
    82
    -
    83#endif
    - - - -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:16b6cd5641b2252805b69a4e52db2b7ab5777b627dbd62bc08f35e4dffa36c90 +size 16757 diff --git a/doxygen_docs/html/tab_a.png b/doxygen_docs/html/tab_a.png index 3b725c4..2997353 100644 Binary files a/doxygen_docs/html/tab_a.png and b/doxygen_docs/html/tab_a.png differ diff --git a/doxygen_docs/html/tab_ad.png b/doxygen_docs/html/tab_ad.png index e34850a..6826810 100644 Binary files a/doxygen_docs/html/tab_ad.png and b/doxygen_docs/html/tab_ad.png differ diff --git a/doxygen_docs/html/tab_b.png b/doxygen_docs/html/tab_b.png index e2b4a86..97ef1fb 100644 Binary files a/doxygen_docs/html/tab_b.png and b/doxygen_docs/html/tab_b.png differ diff --git a/doxygen_docs/html/tab_bd.png b/doxygen_docs/html/tab_bd.png index 91c2524..d5325a0 100644 Binary files a/doxygen_docs/html/tab_bd.png and b/doxygen_docs/html/tab_bd.png differ diff --git a/doxygen_docs/html/tab_h.png b/doxygen_docs/html/tab_h.png index fd5cb70..62f8271 100644 Binary files a/doxygen_docs/html/tab_h.png and b/doxygen_docs/html/tab_h.png differ diff --git a/doxygen_docs/html/tab_hd.png b/doxygen_docs/html/tab_hd.png index 2489273..524059b 100644 Binary files a/doxygen_docs/html/tab_hd.png and b/doxygen_docs/html/tab_hd.png differ diff --git a/doxygen_docs/html/tab_s.png b/doxygen_docs/html/tab_s.png index ab478c9..e7f5766 100644 Binary files a/doxygen_docs/html/tab_s.png and b/doxygen_docs/html/tab_s.png differ diff --git a/doxygen_docs/html/tab_sd.png b/doxygen_docs/html/tab_sd.png index 757a565..44b1fb3 100644 Binary files a/doxygen_docs/html/tab_sd.png and b/doxygen_docs/html/tab_sd.png differ diff --git a/doxygen_docs/html/tabs.css b/doxygen_docs/html/tabs.css index 7fa4268..85fab81 100644 --- a/doxygen_docs/html/tabs.css +++ b/doxygen_docs/html/tabs.css @@ -1 +1,3 @@ -.sm{position:relative;z-index:9999}.sm,.sm ul,.sm li{display:block;list-style:none;margin:0;padding:0;line-height:normal;direction:ltr;text-align:left;-webkit-tap-highlight-color:rgba(0,0,0,0)}.sm-rtl,.sm-rtl ul,.sm-rtl li{direction:rtl;text-align:right}.sm>li>h1,.sm>li>h2,.sm>li>h3,.sm>li>h4,.sm>li>h5,.sm>li>h6{margin:0;padding:0}.sm ul{display:none}.sm li,.sm a{position:relative}.sm a{display:block}.sm a.disabled{cursor:not-allowed}.sm:after{content:"\00a0";display:block;height:0;font:0/0 serif;clear:both;visibility:hidden;overflow:hidden}.sm,.sm *,.sm *:before,.sm *:after{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}.main-menu-btn{position:relative;display:inline-block;width:36px;height:36px;text-indent:36px;margin-left:8px;white-space:nowrap;overflow:hidden;cursor:pointer;-webkit-tap-highlight-color:rgba(0,0,0,0)}.main-menu-btn-icon,.main-menu-btn-icon:before,.main-menu-btn-icon:after{position:absolute;top:50%;left:2px;height:2px;width:24px;background:var(--nav-menu-button-color);-webkit-transition:all .25s;transition:all .25s}.main-menu-btn-icon:before{content:'';top:-7px;left:0}.main-menu-btn-icon:after{content:'';top:7px;left:0}#main-menu-state:checked ~ .main-menu-btn .main-menu-btn-icon{height:0}#main-menu-state:checked ~ .main-menu-btn .main-menu-btn-icon:before{top:0;-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}#main-menu-state:checked ~ .main-menu-btn .main-menu-btn-icon:after{top:0;-webkit-transform:rotate(45deg);transform:rotate(45deg)}#main-menu-state{position:absolute;width:1px;height:1px;margin:-1px;border:0;padding:0;overflow:hidden;clip:rect(1px,1px,1px,1px)}#main-menu-state:not(:checked) ~ #main-menu{display:none}#main-menu-state:checked ~ #main-menu{display:block}@media(min-width:768px){.main-menu-btn{position:absolute;top:-99999px}#main-menu-state:not(:checked) ~ #main-menu{display:block}}.sm-dox{background-image:var(--nav-gradient-image)}.sm-dox a,.sm-dox a:focus,.sm-dox a:hover,.sm-dox a:active{padding:0 12px;padding-right:43px;font-family:var(--font-family-nav);font-size:13px;font-weight:bold;line-height:36px;text-decoration:none;text-shadow:var(--nav-text-normal-shadow);color:var(--nav-text-normal-color);outline:0}.sm-dox a:hover{background-image:var(--nav-gradient-active-image);background-repeat:repeat-x;color:var(--nav-text-hover-color);text-shadow:var(--nav-text-hover-shadow)}.sm-dox a.current{color:#d23600}.sm-dox a.disabled{color:#bbb}.sm-dox a span.sub-arrow{position:absolute;top:50%;margin-top:-14px;left:auto;right:3px;width:28px;height:28px;overflow:hidden;font:bold 12px/28px monospace !important;text-align:center;text-shadow:none;background:var(--nav-menu-toggle-color);-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px}.sm-dox a span.sub-arrow:before{display:block;content:'+'}.sm-dox a.highlighted span.sub-arrow:before{display:block;content:'-'}.sm-dox>li:first-child>a,.sm-dox>li:first-child>:not(ul) a{-moz-border-radius:5px 5px 0 0;-webkit-border-radius:5px;border-radius:5px 5px 0 0}.sm-dox>li:last-child>a,.sm-dox>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul{-moz-border-radius:0 0 5px 5px;-webkit-border-radius:0;border-radius:0 0 5px 5px}.sm-dox>li:last-child>a.highlighted,.sm-dox>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a.highlighted{-moz-border-radius:0;-webkit-border-radius:0;border-radius:0}.sm-dox ul{background:var(--nav-menu-background-color)}.sm-dox ul a,.sm-dox ul a:focus,.sm-dox ul a:hover,.sm-dox ul a:active{font-size:12px;border-left:8px solid transparent;line-height:36px;text-shadow:none;background-color:var(--nav-menu-background-color);background-image:none}.sm-dox ul a:hover{background-image:var(--nav-gradient-active-image);background-repeat:repeat-x;color:var(--nav-text-hover-color);text-shadow:0 1px 1px black}.sm-dox ul ul a,.sm-dox ul ul a:hover,.sm-dox ul ul a:focus,.sm-dox ul ul a:active{border-left:16px solid transparent}.sm-dox ul ul ul a,.sm-dox ul ul ul a:hover,.sm-dox ul ul ul a:focus,.sm-dox ul ul ul a:active{border-left:24px solid transparent}.sm-dox ul ul ul ul a,.sm-dox ul ul ul ul a:hover,.sm-dox ul ul ul ul a:focus,.sm-dox ul ul ul ul a:active{border-left:32px solid transparent}.sm-dox ul ul ul ul ul a,.sm-dox ul ul ul ul ul a:hover,.sm-dox ul ul ul ul ul a:focus,.sm-dox ul ul ul ul ul a:active{border-left:40px solid transparent}@media(min-width:768px){.sm-dox ul{position:absolute;width:12em}.sm-dox li{float:left}.sm-dox.sm-rtl li{float:right}.sm-dox ul li,.sm-dox.sm-rtl ul li,.sm-dox.sm-vertical li{float:none}.sm-dox a{white-space:nowrap}.sm-dox ul a,.sm-dox.sm-vertical a{white-space:normal}.sm-dox .sm-nowrap>li>a,.sm-dox .sm-nowrap>li>:not(ul) a{white-space:nowrap}.sm-dox{padding:0 10px;background-image:var(--nav-gradient-image);line-height:36px}.sm-dox a span.sub-arrow{top:50%;margin-top:-2px;right:12px;width:0;height:0;border-width:4px;border-style:solid dashed dashed dashed;border-color:var(--nav-text-normal-color) transparent transparent transparent;background:transparent;-moz-border-radius:0;-webkit-border-radius:0;border-radius:0}.sm-dox a,.sm-dox a:focus,.sm-dox a:active,.sm-dox a:hover,.sm-dox a.highlighted{padding:0 12px;background-image:var(--nav-separator-image);background-repeat:no-repeat;background-position:right;-moz-border-radius:0 !important;-webkit-border-radius:0;border-radius:0 !important}.sm-dox a:hover{background-image:var(--nav-gradient-active-image);background-repeat:repeat-x;color:var(--nav-text-hover-color);text-shadow:var(--nav-text-hover-shadow)}.sm-dox a:hover span.sub-arrow{border-color:var(--nav-text-hover-color) transparent transparent transparent}.sm-dox a.has-submenu{padding-right:24px}.sm-dox li{border-top:0}.sm-dox>li>ul:before,.sm-dox>li>ul:after{content:'';position:absolute;top:-18px;left:30px;width:0;height:0;overflow:hidden;border-width:9px;border-style:dashed dashed solid dashed;border-color:transparent transparent #bbb transparent}.sm-dox>li>ul:after{top:-16px;left:31px;border-width:8px;border-color:transparent transparent var(--nav-menu-background-color) transparent}.sm-dox ul{border:1px solid #bbb;padding:5px 0;background:var(--nav-menu-background-color);-moz-border-radius:5px !important;-webkit-border-radius:5px;border-radius:5px !important;-moz-box-shadow:0 5px 9px rgba(0,0,0,0.2);-webkit-box-shadow:0 5px 9px rgba(0,0,0,0.2);box-shadow:0 5px 9px rgba(0,0,0,0.2)}.sm-dox ul a span.sub-arrow{right:8px;top:50%;margin-top:-5px;border-width:5px;border-color:transparent transparent transparent var(--nav-menu-foreground-color);border-style:dashed dashed dashed solid}.sm-dox ul a,.sm-dox ul a:hover,.sm-dox ul a:focus,.sm-dox ul a:active,.sm-dox ul a.highlighted{color:var(--nav-menu-foreground-color);background-image:none;border:0 !important}.sm-dox ul a:hover{background-image:var(--nav-gradient-active-image);background-repeat:repeat-x;color:var(--nav-text-hover-color);text-shadow:var(--nav-text-hover-shadow)}.sm-dox ul a:hover span.sub-arrow{border-color:transparent transparent transparent var(--nav-text-hover-color)}.sm-dox span.scroll-up,.sm-dox span.scroll-down{position:absolute;display:none;visibility:hidden;overflow:hidden;background:var(--nav-menu-background-color);height:36px}.sm-dox span.scroll-up:hover,.sm-dox span.scroll-down:hover{background:#eee}.sm-dox span.scroll-up:hover span.scroll-up-arrow,.sm-dox span.scroll-up:hover span.scroll-down-arrow{border-color:transparent transparent #d23600 transparent}.sm-dox span.scroll-down:hover span.scroll-down-arrow{border-color:#d23600 transparent transparent transparent}.sm-dox span.scroll-up-arrow,.sm-dox span.scroll-down-arrow{position:absolute;top:0;left:50%;margin-left:-6px;width:0;height:0;overflow:hidden;border-width:6px;border-style:dashed dashed solid dashed;border-color:transparent transparent var(--nav-menu-foreground-color) transparent}.sm-dox span.scroll-down-arrow{top:8px;border-style:solid dashed dashed dashed;border-color:var(--nav-menu-foreground-color) transparent transparent transparent}.sm-dox.sm-rtl a.has-submenu{padding-right:12px;padding-left:24px}.sm-dox.sm-rtl a span.sub-arrow{right:auto;left:12px}.sm-dox.sm-rtl.sm-vertical a.has-submenu{padding:10px 20px}.sm-dox.sm-rtl.sm-vertical a span.sub-arrow{right:auto;left:8px;border-style:dashed solid dashed dashed;border-color:transparent #555 transparent transparent}.sm-dox.sm-rtl>li>ul:before{left:auto;right:30px}.sm-dox.sm-rtl>li>ul:after{left:auto;right:31px}.sm-dox.sm-rtl ul a.has-submenu{padding:10px 20px !important}.sm-dox.sm-rtl ul a span.sub-arrow{right:auto;left:8px;border-style:dashed solid dashed dashed;border-color:transparent #555 transparent transparent}.sm-dox.sm-vertical{padding:10px 0;-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px}.sm-dox.sm-vertical a{padding:10px 20px}.sm-dox.sm-vertical a:hover,.sm-dox.sm-vertical a:focus,.sm-dox.sm-vertical a:active,.sm-dox.sm-vertical a.highlighted{background:#fff}.sm-dox.sm-vertical a.disabled{background-image:var(--nav-gradient-image)}.sm-dox.sm-vertical a span.sub-arrow{right:8px;top:50%;margin-top:-5px;border-width:5px;border-style:dashed dashed dashed solid;border-color:transparent transparent transparent #555}.sm-dox.sm-vertical>li>ul:before,.sm-dox.sm-vertical>li>ul:after{display:none}.sm-dox.sm-vertical ul a{padding:10px 20px}.sm-dox.sm-vertical ul a:hover,.sm-dox.sm-vertical ul a:focus,.sm-dox.sm-vertical ul a:active,.sm-dox.sm-vertical ul a.highlighted{background:#eee}.sm-dox.sm-vertical ul a.disabled{background:var(--nav-menu-background-color)}} +version https://git-lfs.github.com/spec/v1 +oid sha256:fe9327a6a2bade5defff53ea20b2b13d50e99041f5ec12078400a77a90550f12 +size 10995 diff --git a/doxygen_docs/html/text__class_8cpp_source.html b/doxygen_docs/html/text__class_8cpp_source.html index b9f66fd..b0775bd 100644 --- a/doxygen_docs/html/text__class_8cpp_source.html +++ b/doxygen_docs/html/text__class_8cpp_source.html @@ -1,364 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/src/system/text_class.cpp Source File - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    text_class.cpp
    -
    -
    -
    1#include "text_class.h"
    -
    2
    -
    3
    -
    4text_class::text_class()
    -
    5{
    -
    6 m_vertexBuffer = 0;
    -
    7 m_indexBuffer = 0;
    -
    8}
    -
    9
    -
    10
    -
    11text_class::text_class(const text_class& other)
    -
    12{
    -
    13}
    -
    14
    -
    15
    -
    16text_class::~text_class()
    -
    17{
    -
    18}
    -
    19
    -
    20bool text_class::Initialize(ID3D11Device* device, ID3D11DeviceContext* deviceContext, int screenWidth, int screenHeight, int maxLength, font_class* Font, char* text,
    -
    21 int positionX, int positionY, float red, float green, float blue)
    -
    22{
    -
    23 bool result;
    -
    24
    -
    25
    -
    26 // Store the screen width and height.
    -
    27 m_screenWidth = screenWidth;
    -
    28 m_screenHeight = screenHeight;
    -
    29
    -
    30 // Store the maximum length of the sentence.
    -
    31 m_maxLength = maxLength;
    -
    32
    -
    33 // Initalize the sentence.
    -
    34 result = InitializeBuffers(device, deviceContext, Font, text, positionX, positionY, red, green, blue);
    -
    35 if (!result)
    -
    36 {
    -
    37 return false;
    -
    38 }
    -
    39
    -
    40 return true;
    -
    41}
    -
    42
    -
    43void text_class::Shutdown()
    -
    44{
    -
    45 // Release the vertex and index buffers.
    -
    46 ShutdownBuffers();
    -
    47
    -
    48 return;
    -
    49}
    -
    50
    -
    51void text_class::Render(ID3D11DeviceContext* deviceContext)
    -
    52{
    -
    53 // Put the vertex and index buffers on the graphics pipeline to prepare them for drawing.
    -
    54 RenderBuffers(deviceContext);
    -
    55
    -
    56 return;
    -
    57}
    -
    58
    -
    59int text_class::GetIndexCount()
    -
    60{
    -
    61 return m_indexCount;
    -
    62}
    -
    63
    -
    64bool text_class::InitializeBuffers(ID3D11Device* device, ID3D11DeviceContext* deviceContext, font_class* Font, char* text, int positionX, int positionY, float red, float green, float blue)
    -
    65{
    -
    66 VertexType* vertices;
    -
    67 unsigned long* indices;
    -
    68 D3D11_BUFFER_DESC vertexBufferDesc, indexBufferDesc;
    -
    69 D3D11_SUBRESOURCE_DATA vertexData, indexData;
    -
    70 HRESULT result;
    -
    71 int i;
    -
    72
    -
    73 // Set the vertex and index count.
    -
    74 m_vertexCount = 6 * m_maxLength;
    -
    75 m_indexCount = m_vertexCount;
    -
    76
    -
    77 // Create the vertex array.
    -
    78 vertices = new VertexType[m_vertexCount];
    -
    79
    -
    80 // Create the index array.
    -
    81 indices = new unsigned long[m_indexCount];
    -
    82
    -
    83 // Initialize vertex array to zeros at first.
    -
    84 memset(vertices, 0, (sizeof(VertexType) * m_vertexCount));
    -
    85
    -
    86 // Initialize the index array.
    -
    87 for (i = 0; i < m_indexCount; i++)
    -
    88 {
    -
    89 indices[i] = i;
    -
    90 }
    -
    91
    -
    92 // Set up the description of the dynamic vertex buffer.
    -
    93 vertexBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
    -
    94 vertexBufferDesc.ByteWidth = sizeof(VertexType) * m_vertexCount;
    -
    95 vertexBufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
    -
    96 vertexBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
    -
    97 vertexBufferDesc.MiscFlags = 0;
    -
    98 vertexBufferDesc.StructureByteStride = 0;
    -
    99
    -
    100 // Give the subresource structure a pointer to the vertex data.
    -
    101 vertexData.pSysMem = vertices;
    -
    102 vertexData.SysMemPitch = 0;
    -
    103 vertexData.SysMemSlicePitch = 0;
    -
    104
    -
    105 // Create the vertex buffer.
    -
    106 result = device->CreateBuffer(&vertexBufferDesc, &vertexData, &m_vertexBuffer);
    -
    107 if (FAILED(result))
    -
    108 {
    -
    109 return false;
    -
    110 }
    -
    111
    -
    112 // Set up the description of the static index buffer.
    -
    113 indexBufferDesc.Usage = D3D11_USAGE_DEFAULT;
    -
    114 indexBufferDesc.ByteWidth = sizeof(unsigned long) * m_indexCount;
    -
    115 indexBufferDesc.BindFlags = D3D11_BIND_INDEX_BUFFER;
    -
    116 indexBufferDesc.CPUAccessFlags = 0;
    -
    117 indexBufferDesc.MiscFlags = 0;
    -
    118 indexBufferDesc.StructureByteStride = 0;
    -
    119
    -
    120 // Give the subresource structure a pointer to the index data.
    -
    121 indexData.pSysMem = indices;
    -
    122 indexData.SysMemPitch = 0;
    -
    123 indexData.SysMemSlicePitch = 0;
    -
    124
    -
    125 // Create the index buffer.
    -
    126 result = device->CreateBuffer(&indexBufferDesc, &indexData, &m_indexBuffer);
    -
    127 if (FAILED(result))
    -
    128 {
    -
    129 return false;
    -
    130 }
    -
    131
    -
    132 // Release the vertex array as it is no longer needed.
    -
    133 delete[] vertices;
    -
    134 vertices = 0;
    -
    135
    -
    136 // Release the index array as it is no longer needed.
    -
    137 delete[] indices;
    -
    138 indices = 0;
    -
    139
    -
    140 // Now add the text data to the sentence buffers.
    -
    141 result = UpdateText(deviceContext, Font, text, positionX, positionY, red, green, blue);
    -
    142 if (!result)
    -
    143 {
    -
    144 return false;
    -
    145 }
    -
    146
    -
    147 return true;
    -
    148}
    -
    149
    -
    150void text_class::ShutdownBuffers()
    -
    151{
    -
    152 // Release the index buffer.
    -
    153 if (m_indexBuffer)
    -
    154 {
    -
    155 m_indexBuffer->Release();
    -
    156 m_indexBuffer = 0;
    -
    157 }
    -
    158
    -
    159 // Release the vertex buffer.
    -
    160 if (m_vertexBuffer)
    -
    161 {
    -
    162 m_vertexBuffer->Release();
    -
    163 m_vertexBuffer = 0;
    -
    164 }
    -
    165
    -
    166 return;
    -
    167}
    -
    168
    -
    169bool text_class::UpdateText(ID3D11DeviceContext* deviceContext, font_class* Font, char* text, int positionX, int positionY, float red, float green, float blue)
    -
    170{
    -
    171 int numLetters;
    -
    172 VertexType* vertices;
    -
    173 float drawX, drawY;
    -
    174 HRESULT result;
    -
    175 D3D11_MAPPED_SUBRESOURCE mappedResource;
    -
    176 VertexType* verticesPtr;
    -
    177
    -
    178 // Store the color of the sentence.
    -
    179 m_pixelColor = XMFLOAT4(red, green, blue, 1.0f);
    -
    180
    -
    181 // Get the number of letters in the sentence.
    -
    182 numLetters = (int)strlen(text);
    -
    183
    -
    184 // Check for possible buffer overflow.
    -
    185 if (numLetters > m_maxLength)
    -
    186 {
    -
    187 return false;
    -
    188 }
    -
    189
    -
    190 // Create the vertex array.
    -
    191 vertices = new VertexType[m_vertexCount];
    -
    192
    -
    193 // Initialize vertex array to zeros at first.
    -
    194 memset(vertices, 0, (sizeof(VertexType) * m_vertexCount));
    -
    195
    -
    196 // Calculate the X and Y pixel position on the screen to start drawing to.
    -
    197 drawX = (float)(((m_screenWidth / 2) * -1) + positionX);
    -
    198 drawY = (float)((m_screenHeight / 2) - positionY);
    -
    199
    -
    200 // Use the font class to build the vertex array from the sentence text and sentence draw location.
    -
    201 Font->BuildVertexArray((void*)vertices, text, drawX, drawY);
    -
    202
    -
    203 // Lock the vertex buffer so it can be written to.
    -
    204 result = deviceContext->Map(m_vertexBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
    -
    205 if (FAILED(result))
    -
    206 {
    -
    207 return false;
    -
    208 }
    -
    209
    -
    210 // Get a pointer to the data in the vertex buffer.
    -
    211 verticesPtr = (VertexType*)mappedResource.pData;
    -
    212
    -
    213 // Copy the data into the vertex buffer.
    -
    214 memcpy(verticesPtr, (void*)vertices, (sizeof(VertexType) * m_vertexCount));
    -
    215
    -
    216 // Unlock the vertex buffer.
    -
    217 deviceContext->Unmap(m_vertexBuffer, 0);
    -
    218
    -
    219 // Release the vertex array as it is no longer needed.
    -
    220 delete[] vertices;
    -
    221 vertices = 0;
    -
    222
    -
    223 return true;
    -
    224}
    -
    225
    -
    226void text_class::RenderBuffers(ID3D11DeviceContext* deviceContext)
    -
    227{
    -
    228 unsigned int stride, offset;
    -
    229
    -
    230
    -
    231 // Set vertex buffer stride and offset.
    -
    232 stride = sizeof(VertexType);
    -
    233 offset = 0;
    -
    234
    -
    235 // Set the vertex buffer to active in the input assembler so it can be rendered.
    -
    236 deviceContext->IASetVertexBuffers(0, 1, &m_vertexBuffer, &stride, &offset);
    -
    237
    -
    238 // Set the index buffer to active in the input assembler so it can be rendered.
    -
    239 deviceContext->IASetIndexBuffer(m_indexBuffer, DXGI_FORMAT_R32_UINT, 0);
    -
    240
    -
    241 // Set the type of primitive that should be rendered from this vertex buffer, in this case triangles.
    -
    242 deviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
    -
    243
    -
    244 return;
    -
    245}
    -
    246
    -
    247XMFLOAT4 text_class::GetPixelColor()
    -
    248{
    -
    249 return m_pixelColor;
    -
    250}
    - - -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:93c5c52588a5ad39c1ddf0a09c050b41663575504fcc06e2fa73b0e38424439b +size 38848 diff --git a/doxygen_docs/html/text__class_8h_source.html b/doxygen_docs/html/text__class_8h_source.html index 69075d6..570d4f5 100644 --- a/doxygen_docs/html/text__class_8h_source.html +++ b/doxygen_docs/html/text__class_8h_source.html @@ -1,158 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/inc/system/text_class.h Source File - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    text_class.h
    -
    -
    -
    1#ifndef _TEXTCLASS_H_
    -
    2#define _TEXTCLASS_H_
    -
    3
    -
    4
    -
    6// MY CLASS INCLUDES //
    -
    8#include "font_class.h"
    -
    10// Class name: text_class
    -
    - -
    13{
    -
    14private:
    -
    15 struct VertexType
    -
    16 {
    -
    17 XMFLOAT3 position;
    -
    18 XMFLOAT2 texture;
    -
    19 };
    -
    20
    -
    21public:
    -
    22 text_class();
    -
    23 text_class(const text_class&);
    - -
    25
    -
    26 bool Initialize(ID3D11Device*, ID3D11DeviceContext*, int, int, int, font_class*, char*, int, int, float, float, float);
    -
    27 void Shutdown();
    -
    28 void Render(ID3D11DeviceContext*);
    -
    29
    -
    30 int GetIndexCount();
    -
    31
    -
    32 bool UpdateText(ID3D11DeviceContext*, font_class*, char*, int, int, float, float, float);
    -
    33 XMFLOAT4 GetPixelColor();
    -
    34
    -
    35private:
    -
    36 bool InitializeBuffers(ID3D11Device*, ID3D11DeviceContext*, font_class*, char*, int, int, float, float, float);
    -
    37 void ShutdownBuffers();
    -
    38 void RenderBuffers(ID3D11DeviceContext*);
    -
    39
    -
    40private:
    -
    41 ID3D11Buffer* m_vertexBuffer, * m_indexBuffer;
    -
    42 int m_screenWidth, m_screenHeight, m_maxLength, m_vertexCount, m_indexCount;
    -
    43 XMFLOAT4 m_pixelColor;
    -
    44};
    -
    -
    45
    -
    46#endif
    - - -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:0b07efb51713b4c7edc2fb3d9211681f02237a0c77c52feb80ba1f9de9b85ab3 +size 11939 diff --git a/doxygen_docs/html/texture__class_8cpp_source.html b/doxygen_docs/html/texture__class_8cpp_source.html index af0e017..b486ef7 100644 --- a/doxygen_docs/html/texture__class_8cpp_source.html +++ b/doxygen_docs/html/texture__class_8cpp_source.html @@ -1,357 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/src/system/texture_class.cpp Source File - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    texture_class.cpp
    -
    -
    -
    1#include "texture_class.h"
    -
    2
    -
    3texture_class::texture_class()
    -
    4{
    -
    5 m_targaData = 0;
    -
    6 m_texture = 0;
    -
    7 m_textureView = 0;
    -
    8}
    -
    9
    -
    10
    -
    11texture_class::texture_class(const texture_class& other)
    -
    12{
    -
    13}
    -
    14
    -
    15
    -
    16texture_class::~texture_class()
    -
    17{
    -
    18}
    -
    19
    -
    20bool texture_class::Initialize(ID3D11Device * device, ID3D11DeviceContext * deviceContext, std::string filename)
    -
    21{
    -
    22 Logger::Get().Log(("Iinitializing texture: %s", filename), __FILE__, __LINE__, Logger::LogLevel::Initialize);
    -
    23
    -
    24 bool result;
    -
    25 D3D11_TEXTURE2D_DESC textureDesc;
    -
    26 HRESULT hResult;
    -
    27 unsigned int rowPitch;
    -
    28 D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
    -
    29 // Load the targa image data into memory.
    -
    30 result = LoadTarga(filename);
    -
    31 if (!result)
    -
    32 {
    -
    33 Logger::Get().Log("Failed to load targa data", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    34 return false;
    -
    35 }
    -
    36 // Setup the description of the texture.
    -
    37 textureDesc.Height = m_height;
    -
    38 textureDesc.Width = m_width;
    -
    39 textureDesc.MipLevels = 0;
    -
    40 textureDesc.ArraySize = 1;
    -
    41 textureDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
    -
    42 textureDesc.SampleDesc.Count = 1;
    -
    43 textureDesc.SampleDesc.Quality = 0;
    -
    44 textureDesc.Usage = D3D11_USAGE_DEFAULT;
    -
    45 textureDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET;
    -
    46 textureDesc.CPUAccessFlags = 0;
    -
    47 textureDesc.MiscFlags = D3D11_RESOURCE_MISC_GENERATE_MIPS;
    -
    48
    -
    49 // Create the empty texture.
    -
    50 hResult = device->CreateTexture2D(&textureDesc, NULL, &m_texture);
    -
    51 if (FAILED(hResult))
    -
    52 {
    -
    53 Logger::Get().Log("Failed to create texture", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    54 return false;
    -
    55 }
    -
    56
    -
    57 // Set the row pitch of the targa image data.
    -
    58 rowPitch = (m_width * 4) * sizeof(unsigned char);
    -
    59 // Copy the targa image data into the texture.
    -
    60 deviceContext->UpdateSubresource(m_texture, 0, NULL, m_targaData, rowPitch, 0);
    -
    61 // Setup the shader resource view description.
    -
    62 srvDesc.Format = textureDesc.Format;
    -
    63 srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
    -
    64 srvDesc.Texture2D.MostDetailedMip = 0;
    -
    65 srvDesc.Texture2D.MipLevels = -1;
    -
    66
    -
    67 // Create the shader resource view for the texture.
    -
    68 hResult = device->CreateShaderResourceView(m_texture, &srvDesc, &m_textureView);
    -
    69 if (FAILED(hResult))
    -
    70 {
    -
    71 Logger::Get().Log("Failed to create shader resource view", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    72 return false;
    -
    73 }
    -
    74
    -
    75 // Generate mipmaps for this texture.
    -
    76 deviceContext->GenerateMips(m_textureView);
    -
    77
    -
    78 // Release the targa image data now that the image data has been loaded into the texture.
    -
    79 delete[] m_targaData;
    -
    80 m_targaData = 0;
    -
    81
    -
    82 Logger::Get().Log("Texture initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
    -
    83
    -
    84 return true;
    -
    85}
    -
    86
    -
    87void texture_class::Shutdown()
    -
    88{
    -
    89
    -
    90 Logger::Get().Log("Shutting down texture", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
    -
    91 // Release the texture view resource.
    -
    92 if (m_textureView)
    -
    93 {
    -
    94 m_textureView->Release();
    -
    95 m_textureView = 0;
    -
    96 }
    -
    97
    -
    98 // Release the texture.
    -
    99 if (m_texture)
    -
    100 {
    -
    101 m_texture->Release();
    -
    102 m_texture = 0;
    -
    103 }
    -
    104
    -
    105 // Release the targa data.
    -
    106 if (m_targaData)
    -
    107 {
    -
    108 delete[] m_targaData;
    -
    109 m_targaData = 0;
    -
    110 }
    -
    111
    -
    112 Logger::Get().Log("Texture shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
    -
    113
    -
    114 return;
    -
    115}
    -
    116
    -
    117ID3D11ShaderResourceView* texture_class::GetTexture()
    -
    118{
    -
    119 return m_textureView;
    -
    120}
    -
    121
    -
    122bool texture_class::LoadTarga(std::string filename)
    -
    123{
    -
    124
    -
    125 Logger::Get().Log(("Loading targa file: %s", filename), __FILE__, __LINE__);
    -
    126 int error, bpp, imageSize, index, i, j, k;
    -
    127 FILE* filePtr;
    -
    128 unsigned int count;
    -
    129 TargaHeader targaFileHeader;
    -
    130 unsigned char* targaImage;
    -
    131
    -
    132
    -
    133 // Open the targa file for reading in binary.
    -
    134 error = fopen_s(&filePtr, filename.c_str(), "rb");
    -
    135 if (error != 0)
    -
    136 {
    -
    137 Logger::Get().Log("Failed to open targa file. Working directory: " + std::filesystem::current_path().string(), __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    138 return false;
    -
    139 }
    -
    140
    -
    141 // Read in the file header.
    -
    142 count = (unsigned int)fread(&targaFileHeader, sizeof(TargaHeader), 1, filePtr);
    -
    143 if (count != 1)
    -
    144 {
    -
    145 Logger::Get().Log("Failed to read targa file header", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    146 return false;
    -
    147 }
    -
    148
    -
    149 // Get the important information from the header.
    -
    150 m_height = (int)targaFileHeader.height;
    -
    151 m_width = (int)targaFileHeader.width;
    -
    152 bpp = (int)targaFileHeader.bpp;
    -
    153
    -
    154 // Check that it is 32 bit and not 24 bit.
    -
    155 if (bpp != 32 && bpp != 24)
    -
    156 {
    -
    157 Logger::Get().Log("Targa file is not 32 or 24 bit", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    158 return false;
    -
    159 }
    -
    160
    -
    161 // Calculate the size of the 32 bit image data.
    -
    162 imageSize = m_width * m_height * (bpp / 8);
    -
    163
    -
    164 // Allocate memory for the targa image data.
    -
    165 targaImage = new unsigned char[imageSize];
    -
    166
    -
    167 // Read in the targa image data.
    -
    168 count = (unsigned int)fread(targaImage, 1, imageSize, filePtr);
    -
    169 if (count != imageSize)
    -
    170 {
    -
    171 Logger::Get().Log("Failed to read targa image data", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    172 return false;
    -
    173 }
    -
    174
    -
    175 // Close the file.
    -
    176 error = fclose(filePtr);
    -
    177 if (error != 0)
    -
    178 {
    -
    179 Logger::Get().Log("Failed to close targa file", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    180 return false;
    -
    181 }
    -
    182
    -
    183 // Allocate memory for the targa destination data.
    -
    184 m_targaData = new unsigned char[imageSize];
    -
    185
    -
    186 // Initialize the index into the targa destination data array.
    -
    187 index = 0;
    -
    188
    -
    189 // Initialize the index into the targa image data.
    -
    190 k = (m_width * m_height * (bpp / 8)) - (m_width * (bpp / 8));
    -
    191
    -
    192 // Now copy the targa image data into the targa destination array in the correct order since the targa format is stored upside down and also is not in RGBA order.
    -
    193 for (j = 0; j < m_height; j++)
    -
    194 {
    -
    195 for (i = 0; i < m_width; i++)
    -
    196 {
    -
    197 if (index + 3 < imageSize) // Ajout de la vérification ici
    -
    198 {
    -
    199 m_targaData[index + 0] = targaImage[k + 2]; // Red.
    -
    200 m_targaData[index + 1] = targaImage[k + 1]; // Green.
    -
    201 m_targaData[index + 2] = targaImage[k + 0]; // Blue
    -
    202 if (bpp == 32)
    -
    203 {
    -
    204 m_targaData[index + 3] = targaImage[k + 3]; // Alpha
    -
    205 }
    -
    206 }
    -
    207 else
    -
    208 {
    -
    209 Logger::Get().Log("Index out of bounds", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    210 return false;
    -
    211 }
    -
    212
    -
    213 // Increment the indexes into the targa data.
    -
    214 k += (bpp / 8);
    -
    215 index += (bpp / 8);
    -
    216 }
    -
    217
    -
    218 // Set the targa image data index back to the preceding row at the beginning of the column since its reading it in upside down.
    -
    219 k -= (m_width * (bpp / 8) * 2);
    -
    220 }
    -
    221
    -
    222
    -
    223 // Release the targa image data now that it was copied into the destination array.
    -
    224 delete[] targaImage;
    -
    225 targaImage = 0;
    -
    226
    -
    227 Logger::Get().Log(("targa file %s loaded", filename), __FILE__, __LINE__);
    -
    228
    -
    229 return true;
    -
    230}
    -
    231
    -
    232
    -
    233int texture_class::GetWidth()
    -
    234{
    -
    235 return m_width;
    -
    236}
    -
    237
    -
    238
    -
    239int texture_class::GetHeight()
    -
    240{
    -
    241 return m_height;
    -
    242}
    -
    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
    - -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:84cd98e4a18cc4cb371c7a2da455260de2741a17168bb3cf3b13a84ba690c955 +size 41686 diff --git a/doxygen_docs/html/texture__class_8h_source.html b/doxygen_docs/html/texture__class_8h_source.html index 1a0d460..9516c0e 100644 --- a/doxygen_docs/html/texture__class_8h_source.html +++ b/doxygen_docs/html/texture__class_8h_source.html @@ -1,163 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/inc/system/texture_class.h Source File - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    texture_class.h
    -
    -
    -
    1#ifndef _TEXTURECLASS_H_
    -
    2#define _TEXTURECLASS_H_
    -
    3
    -
    4
    -
    6// INCLUDES //
    -
    8#include "Logger.h"
    -
    9#include <d3d11.h>
    -
    10#include <stdio.h>
    -
    11
    -
    12
    -
    14// Class name: texture_class
    -
    - -
    17{
    -
    18private:
    -
    19 struct TargaHeader
    -
    20 {
    -
    21 unsigned char data1[12];
    -
    22 unsigned short width;
    -
    23 unsigned short height;
    -
    24 unsigned char bpp;
    -
    25 unsigned char data2;
    -
    26 };
    -
    27
    -
    28public:
    - - - -
    32
    -
    33 bool Initialize(ID3D11Device*, ID3D11DeviceContext*, std::string);
    -
    34 void Shutdown();
    -
    35
    -
    36 ID3D11ShaderResourceView* GetTexture();
    -
    37
    -
    38 int GetWidth();
    -
    39 int GetHeight();
    -
    40
    -
    41private:
    -
    42 bool LoadTarga(std::string);
    -
    43
    -
    44private:
    -
    45 unsigned char* m_targaData;
    -
    46 ID3D11Texture2D* m_texture;
    -
    47 ID3D11ShaderResourceView* m_textureView;
    -
    48 int m_width, m_height;
    -
    49
    -
    50};
    -
    -
    51
    -
    52#endif
    - -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:2b314d0dfcf4cdf4a15f2f1c21086c7fab5eee2d2feb6d3af57164aa6b3e3c1b +size 11619 diff --git a/doxygen_docs/html/texture__shader__class_8cpp_source.html b/doxygen_docs/html/texture__shader__class_8cpp_source.html index 7e9a9c1..3df218a 100644 --- a/doxygen_docs/html/texture__shader__class_8cpp_source.html +++ b/doxygen_docs/html/texture__shader__class_8cpp_source.html @@ -1,493 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/src/shader/texture_shader_class.cpp Source File - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    texture_shader_class.cpp
    -
    -
    -
    1#include "texture_shader_class.h"
    -
    2
    -
    3
    -
    4texture_shader_class::texture_shader_class()
    -
    5{
    -
    6 vertex_shader_ = 0;
    -
    7 pixel_shader_ = 0;
    -
    8 layout_ = 0;
    -
    9 matrix_buffer_ = 0;
    -
    10 sample_state_ = 0;
    -
    11}
    -
    12
    -
    13
    -
    14texture_shader_class::texture_shader_class(const texture_shader_class& other)
    -
    15{
    -
    16}
    -
    17
    -
    18
    -
    19texture_shader_class::~texture_shader_class()
    -
    20{
    -
    21}
    -
    22
    -
    23
    -
    24bool texture_shader_class::initialize(ID3D11Device* device, HWND hwnd)
    -
    25{
    -
    26 Logger::Get().Log("Initializing texture shader", __FILE__, __LINE__, Logger::LogLevel::Initialize);
    -
    27
    -
    28 bool result;
    -
    29 wchar_t vsFilename[128];
    -
    30 wchar_t psFilename[128];
    -
    31 int error;
    -
    32 // Set the filename of the vertex shader.
    -
    33 error = wcscpy_s(vsFilename, 128, L"src/hlsl/texture.vs");
    -
    34 if (error != 0)
    -
    35 {
    -
    36 Logger::Get().Log("Error copying stirng", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    37 return false;
    -
    38 }
    -
    39
    -
    40 // Set the filename of the pixel shader.
    -
    41 error = wcscpy_s(psFilename, 128, L"src/hlsl/texture.ps");
    -
    42 if (error != 0)
    -
    43 {
    -
    44 Logger::Get().Log("Error copying stirng", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    45 return false;
    -
    46 }
    -
    47
    -
    48 // initialize the vertex and pixel shaders.
    -
    49 result = initialize_shader(device, hwnd, vsFilename, psFilename);
    -
    50 if (!result)
    -
    51 {
    -
    52 Logger::Get().Log("Error initializing shader", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    53 return false;
    -
    54 }
    -
    55
    -
    56 Logger::Get().Log("Texture shader initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
    -
    57
    -
    58 return true;
    -
    59}
    -
    60
    -
    61void texture_shader_class::shutdown()
    -
    62{
    -
    63 // shutdown the vertex and pixel shaders as well as the related objects.
    -
    64 shutdown_shader();
    -
    65
    -
    66 return;
    -
    67}
    -
    68
    -
    69bool texture_shader_class::render(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix,
    -
    70 XMMATRIX projectionMatrix, ID3D11ShaderResourceView* texture)
    -
    71{
    -
    72 bool result;
    -
    73
    -
    74
    -
    75 // Set the shader parameters that it will use for rendering.
    -
    76 result = set_shader_parameters(deviceContext, worldMatrix, viewMatrix, projectionMatrix, texture);
    -
    77 if (!result)
    -
    78 {
    -
    79 Logger::Get().Log("Error setting shader parameters", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    80 return false;
    -
    81 }
    -
    82
    -
    83 // Now render the prepared buffers with the shader.
    -
    84 render_shader(deviceContext, indexCount);
    -
    85
    -
    86 return true;
    -
    87}
    -
    88
    -
    89bool texture_shader_class::initialize_shader(ID3D11Device* device, HWND hwnd, WCHAR* vsFilename, WCHAR* psFilename)
    -
    90{
    -
    91 Logger::Get().Log("Initializing shader", __FILE__, __LINE__, Logger::LogLevel::Initialize);
    -
    92
    -
    93 HRESULT result;
    -
    94 ID3D10Blob* errorMessage;
    -
    95 ID3D10Blob* vertexShaderBuffer;
    -
    96 ID3D10Blob* pixelShaderBuffer;
    -
    97 D3D11_INPUT_ELEMENT_DESC polygonLayout[2];
    -
    98 unsigned int numElements;
    -
    99 D3D11_BUFFER_DESC matrixBufferDesc;
    -
    100 D3D11_SAMPLER_DESC samplerDesc;
    -
    101
    -
    102
    -
    103 // initialize the pointers this function will use to null.
    -
    104 errorMessage = 0;
    -
    105 vertexShaderBuffer = 0;
    -
    106 pixelShaderBuffer = 0;
    -
    107 // Compile the vertex shader code.
    -
    108 result = D3DCompileFromFile(vsFilename, NULL, NULL, "TextureVertexShader", "vs_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0,
    -
    109 &vertexShaderBuffer, &errorMessage);
    -
    110 if (FAILED(result))
    -
    111 {
    -
    112 // If the shader failed to compile it should have writen something to the error message.
    -
    113 if (errorMessage)
    -
    114 {
    -
    115 output_shader_error_message(errorMessage, hwnd, vsFilename);
    -
    116 }
    -
    117 // If there was nothing in the error message then it simply could not find the shader file itself.
    -
    118 else
    -
    119 {
    -
    120 Logger::Get().Log("Error compiling shader", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    121 }
    -
    122
    -
    123 return false;
    -
    124 }
    -
    125
    -
    126 // Compile the pixel shader code.
    -
    127 result = D3DCompileFromFile(psFilename, NULL, NULL, "TexturePixelShader", "ps_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0,
    -
    128 &pixelShaderBuffer, &errorMessage);
    -
    129 if (FAILED(result))
    -
    130 {
    -
    131 // If the shader failed to compile it should have writen something to the error message.
    -
    132 if (errorMessage)
    -
    133 {
    -
    134 output_shader_error_message(errorMessage, hwnd, psFilename);
    -
    135 }
    -
    136 // If there was nothing in the error message then it simply could not find the file itself.
    -
    137 else
    -
    138 {
    -
    139 Logger::Get().Log("Error compiling shader", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    140 }
    -
    141
    -
    142 return false;
    -
    143 }
    -
    144
    -
    145 // Create the vertex shader from the buffer.
    -
    146 result = device->CreateVertexShader(vertexShaderBuffer->GetBufferPointer(), vertexShaderBuffer->GetBufferSize(), NULL, &vertex_shader_);
    -
    147 if (FAILED(result))
    -
    148 {
    -
    149 Logger::Get().Log("Error creating vertex shader", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    150 return false;
    -
    151 }
    -
    152
    -
    153 // Create the pixel shader from the buffer.
    -
    154 result = device->CreatePixelShader(pixelShaderBuffer->GetBufferPointer(), pixelShaderBuffer->GetBufferSize(), NULL, &pixel_shader_);
    -
    155 if (FAILED(result))
    -
    156 {
    -
    157 Logger::Get().Log("Error creating pixel shader", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    158 return false;
    -
    159 }
    -
    160 // Create the vertex input layout description.
    -
    161 // This setup needs to match the VertexType stucture in the ModelClass and in the shader.
    -
    162 polygonLayout[0].SemanticName = "POSITION";
    -
    163 polygonLayout[0].SemanticIndex = 0;
    -
    164 polygonLayout[0].Format = DXGI_FORMAT_R32G32B32_FLOAT;
    -
    165 polygonLayout[0].InputSlot = 0;
    -
    166 polygonLayout[0].AlignedByteOffset = 0;
    -
    167 polygonLayout[0].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
    -
    168 polygonLayout[0].InstanceDataStepRate = 0;
    -
    169
    -
    170 polygonLayout[1].SemanticName = "TEXCOORD";
    -
    171 polygonLayout[1].SemanticIndex = 0;
    -
    172 polygonLayout[1].Format = DXGI_FORMAT_R32G32_FLOAT;
    -
    173 polygonLayout[1].InputSlot = 0;
    -
    174 polygonLayout[1].AlignedByteOffset = D3D11_APPEND_ALIGNED_ELEMENT;
    -
    175 polygonLayout[1].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
    -
    176 polygonLayout[1].InstanceDataStepRate = 0;
    -
    177
    -
    178 // Get a count of the elements in the layout.
    -
    179 numElements = sizeof(polygonLayout) / sizeof(polygonLayout[0]);
    -
    180
    -
    181 // Create the vertex input layout.
    -
    182 result = device->CreateInputLayout(polygonLayout, numElements, vertexShaderBuffer->GetBufferPointer(),
    -
    183 vertexShaderBuffer->GetBufferSize(), &layout_);
    -
    184 if (FAILED(result))
    -
    185 {
    -
    186 Logger::Get().Log("Error creating input layout", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    187 return false;
    -
    188 }
    -
    189
    -
    190 // Release the vertex shader buffer and pixel shader buffer since they are no longer needed.
    -
    191 vertexShaderBuffer->Release();
    -
    192 vertexShaderBuffer = 0;
    -
    193
    -
    194 pixelShaderBuffer->Release();
    -
    195 pixelShaderBuffer = 0;
    -
    196
    -
    197 // Setup the description of the dynamic matrix constant buffer that is in the vertex shader.
    -
    198 matrixBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
    -
    199 matrixBufferDesc.ByteWidth = sizeof(matrix_buffer_type);
    -
    200 matrixBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
    -
    201 matrixBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
    -
    202 matrixBufferDesc.MiscFlags = 0;
    -
    203 matrixBufferDesc.StructureByteStride = 0;
    -
    204
    -
    205 // Create the constant buffer pointer so we can access the vertex shader constant buffer from within this class.
    -
    206 result = device->CreateBuffer(&matrixBufferDesc, NULL, &matrix_buffer_);
    -
    207 if (FAILED(result))
    -
    208 {
    -
    209 Logger::Get().Log("Error creating constant buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    210 return false;
    -
    211 }
    -
    212 // Create a texture sampler state description.
    -
    213 samplerDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR;
    -
    214 samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP;
    -
    215 samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP;
    -
    216 samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_WRAP;
    -
    217 samplerDesc.MipLODBias = 0.0f;
    -
    218 samplerDesc.MaxAnisotropy = 1;
    -
    219 samplerDesc.ComparisonFunc = D3D11_COMPARISON_ALWAYS;
    -
    220 samplerDesc.BorderColor[0] = 0;
    -
    221 samplerDesc.BorderColor[1] = 0;
    -
    222 samplerDesc.BorderColor[2] = 0;
    -
    223 samplerDesc.BorderColor[3] = 0;
    -
    224 samplerDesc.MinLOD = 0;
    -
    225 samplerDesc.MaxLOD = D3D11_FLOAT32_MAX;
    -
    226
    -
    227 // Create the texture sampler state.
    -
    228 result = device->CreateSamplerState(&samplerDesc, &sample_state_);
    -
    229 if (FAILED(result))
    -
    230 {
    -
    231 Logger::Get().Log("Error creating sampler state", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    232 return false;
    -
    233 }
    -
    234
    -
    235 Logger::Get().Log("Shader initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
    -
    236
    -
    237 return true;
    -
    238}
    -
    239
    -
    240void texture_shader_class::shutdown_shader()
    -
    241{
    -
    242 Logger::Get().Log("Shutting down shader", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
    -
    243
    -
    244 // Release the sampler state.
    -
    245 if (sample_state_)
    -
    246 {
    -
    247 sample_state_->Release();
    -
    248 sample_state_ = 0;
    -
    249 }
    -
    250
    -
    251 // Release the matrix constant buffer.
    -
    252 if (matrix_buffer_)
    -
    253 {
    -
    254 matrix_buffer_->Release();
    -
    255 matrix_buffer_ = 0;
    -
    256 }
    -
    257
    -
    258 // Release the layout.
    -
    259 if (layout_)
    -
    260 {
    -
    261 layout_->Release();
    -
    262 layout_ = 0;
    -
    263 }
    -
    264
    -
    265 // Release the pixel shader.
    -
    266 if (pixel_shader_)
    -
    267 {
    -
    268 pixel_shader_->Release();
    -
    269 pixel_shader_ = 0;
    -
    270 }
    -
    271
    -
    272 // Release the vertex shader.
    -
    273 if (vertex_shader_)
    -
    274 {
    -
    275 vertex_shader_->Release();
    -
    276 vertex_shader_ = 0;
    -
    277 }
    -
    278
    -
    279 Logger::Get().Log("Shader shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
    -
    280
    -
    281 return;
    -
    282}
    -
    283
    -
    284void texture_shader_class::output_shader_error_message(ID3D10Blob* errorMessage, HWND hwnd, WCHAR* shaderFilename)
    -
    285{
    -
    286 char* compileErrors;
    -
    287 unsigned long long bufferSize, i;
    -
    288 ofstream fout;
    -
    289
    -
    290
    -
    291 // Get a pointer to the error message text buffer.
    -
    292 compileErrors = (char*)(errorMessage->GetBufferPointer());
    -
    293
    -
    294 // Get the length of the message.
    -
    295 bufferSize = errorMessage->GetBufferSize();
    -
    296
    -
    297 // Open a file to write the error message to.
    -
    298 fout.open("shader-error.txt");
    -
    299
    -
    300 // Write out the error message.
    -
    301 for (i = 0; i < bufferSize; i++)
    -
    302 {
    -
    303 fout << compileErrors[i];
    -
    304 }
    -
    305
    -
    306 // Close the file.
    -
    307 fout.close();
    -
    308
    -
    309 // Release the error message.
    -
    310 errorMessage->Release();
    -
    311 errorMessage = 0;
    -
    312
    -
    313 // Pop a message up on the screen to notify the user to check the text file for compile errors.
    -
    314 MessageBox(hwnd, L"Error compiling shader. Check shader-error.txt for message.", shaderFilename, MB_OK);
    -
    315
    -
    316 return;
    -
    317}
    -
    318
    -
    319bool texture_shader_class::set_shader_parameters(ID3D11DeviceContext* deviceContext, XMMATRIX worldMatrix, XMMATRIX viewMatrix,
    -
    320 XMMATRIX projectionMatrix, ID3D11ShaderResourceView* texture)
    -
    321{
    -
    322 HRESULT result;
    -
    323 D3D11_MAPPED_SUBRESOURCE mappedResource;
    -
    324 matrix_buffer_type* dataPtr;
    -
    325 unsigned int bufferNumber;
    -
    326
    -
    327
    -
    328 // Transpose the matrices to prepare them for the shader.
    -
    329 worldMatrix = XMMatrixTranspose(worldMatrix);
    -
    330 viewMatrix = XMMatrixTranspose(viewMatrix);
    -
    331 projectionMatrix = XMMatrixTranspose(projectionMatrix);
    -
    332
    -
    333 // Lock the constant buffer so it can be written to.
    -
    334 result = deviceContext->Map(matrix_buffer_, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
    -
    335 if (FAILED(result))
    -
    336 {
    -
    337 Logger::Get().Log("Error mapping constant buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    338 return false;
    -
    339 }
    -
    340
    -
    341 // Get a pointer to the data in the constant buffer.
    -
    342 dataPtr = (matrix_buffer_type*)mappedResource.pData;
    -
    343
    -
    344 // Copy the matrices into the constant buffer.
    -
    345 dataPtr->world = worldMatrix;
    -
    346 dataPtr->view = viewMatrix;
    -
    347 dataPtr->projection = projectionMatrix;
    -
    348
    -
    349 // Unlock the constant buffer.
    -
    350 deviceContext->Unmap(matrix_buffer_, 0);
    -
    351
    -
    352 // Set the position of the constant buffer in the vertex shader.
    -
    353 bufferNumber = 0;
    -
    354
    -
    355 // Finanly set the constant buffer in the vertex shader with the updated values.
    -
    356 deviceContext->VSSetConstantBuffers(bufferNumber, 1, &matrix_buffer_);
    -
    357 // Set shader texture resource in the pixel shader.
    -
    358 deviceContext->PSSetShaderResources(0, 1, &texture);
    -
    359
    -
    360 return true;
    -
    361}
    -
    362
    -
    363void texture_shader_class::render_shader(ID3D11DeviceContext* deviceContext, int indexCount)
    -
    364{
    -
    365 // Set the vertex input layout.
    -
    366 deviceContext->IASetInputLayout(layout_);
    -
    367
    -
    368 // Set the vertex and pixel shaders that will be used to render this triangle.
    -
    369 deviceContext->VSSetShader(vertex_shader_, NULL, 0);
    -
    370 deviceContext->PSSetShader(pixel_shader_, NULL, 0);
    -
    371 // Set the sampler state in the pixel shader.
    -
    372 deviceContext->PSSetSamplers(0, 1, &sample_state_);
    -
    373
    -
    374 // render the triangle.
    -
    375 deviceContext->DrawIndexed(indexCount, 0, 0);
    -
    376
    -
    377 return;
    -
    378}
    -
    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
    - -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:efeee8418853d81be93587b71cfa7e0e9439d1460b9da6924282227571db413d +size 61345 diff --git a/doxygen_docs/html/texture__shader__class_8h_source.html b/doxygen_docs/html/texture__shader__class_8h_source.html index 4264417..6606250 100644 --- a/doxygen_docs/html/texture__shader__class_8h_source.html +++ b/doxygen_docs/html/texture__shader__class_8h_source.html @@ -1,167 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/inc/shader/texture_shader_class.h Source File - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    texture_shader_class.h
    -
    -
    -
    1#ifndef _TEXTURESHADERCLASS_H_
    -
    2#define _TEXTURESHADERCLASS_H_
    -
    3
    -
    4
    -
    6// INCLUDES //
    -
    8#include "Logger.h"
    -
    9#include <d3d11.h>
    -
    10#include <d3dcompiler.h>
    -
    11#include <directxmath.h>
    -
    12#include <fstream>
    -
    13using namespace DirectX;
    -
    14using namespace std;
    -
    15
    -
    16
    -
    18// Class name: texture_shader_class
    -
    - -
    21{
    -
    22private:
    -
    23 struct matrix_buffer_type
    -
    24 {
    -
    25 XMMATRIX world;
    -
    26 XMMATRIX view;
    -
    27 XMMATRIX projection;
    -
    28 };
    -
    29
    -
    30public:
    - - - -
    34
    -
    35 bool initialize(ID3D11Device*, HWND);
    -
    36 void shutdown();
    -
    37 bool render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*);
    -
    38
    -
    39private:
    -
    40 bool initialize_shader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
    -
    41 void shutdown_shader();
    -
    42 void output_shader_error_message(ID3D10Blob*, HWND, WCHAR*);
    -
    43
    -
    44 bool set_shader_parameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*);
    -
    45 void render_shader(ID3D11DeviceContext*, int);
    -
    46
    -
    47private:
    -
    48 ID3D11VertexShader* vertex_shader_;
    -
    49 ID3D11PixelShader* pixel_shader_;
    -
    50 ID3D11InputLayout* layout_;
    -
    51 ID3D11Buffer* matrix_buffer_;
    -
    52 ID3D11SamplerState* sample_state_;
    -
    53
    -
    54};
    -
    -
    55
    -
    56#endif
    - -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:14dd7fbd358a386941e059c2cd13e844e6bd2625dc7f73fba5484a7c89669c1b +size 12361 diff --git a/doxygen_docs/html/timer__class_8cpp_source.html b/doxygen_docs/html/timer__class_8cpp_source.html index ef411dc..034386a 100644 --- a/doxygen_docs/html/timer__class_8cpp_source.html +++ b/doxygen_docs/html/timer__class_8cpp_source.html @@ -1,183 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/src/system/timer_class.cpp Source File - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    timer_class.cpp
    -
    -
    -
    1#include "timer_class.h"
    -
    2
    -
    3
    -
    4timer_class::timer_class()
    -
    5{
    -
    6}
    -
    7
    -
    8
    -
    9timer_class::timer_class(const timer_class& other)
    -
    10{
    -
    11}
    -
    12
    -
    13
    -
    14timer_class::~timer_class()
    -
    15{
    -
    16}
    -
    17
    -
    18bool timer_class::Initialize()
    -
    19{
    -
    20 Logger::Get().Log("Initilazing timer class", __FILE__, __LINE__, Logger::LogLevel::Initialize);
    -
    21
    -
    22 INT64 frequency;
    -
    23
    -
    24
    -
    25 // Get the cycles per second speed for this system.
    -
    26 QueryPerformanceFrequency((LARGE_INTEGER*)&frequency);
    -
    27 if (frequency == 0)
    -
    28 {
    -
    29 Logger::Get().Log("QueryPerformanceFrequency failed", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    30 return false;
    -
    31 }
    -
    32
    -
    33 // Store it in floating point.
    -
    34 m_frequency = (float)frequency;
    -
    35
    -
    36 // Get the initial start time.
    -
    37 QueryPerformanceCounter((LARGE_INTEGER*)&m_startTime);
    -
    38
    -
    39 Logger::Get().Log("Timer class initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
    -
    40
    -
    41 return true;
    -
    42}
    -
    43
    -
    44void timer_class::Frame()
    -
    45{
    -
    46 INT64 currentTime;
    -
    47 INT64 elapsedTicks;
    -
    48
    -
    49
    -
    50 // Query the current time.
    -
    51 QueryPerformanceCounter((LARGE_INTEGER*)&currentTime);
    -
    52
    -
    53 // Calculate the difference in time since the last time we queried for the current time.
    -
    54 elapsedTicks = currentTime - m_startTime;
    -
    55
    -
    56 // Calculate the frame time.
    -
    57 m_frameTime = (float)elapsedTicks / m_frequency;
    -
    58
    -
    59 // Restart the timer.
    -
    60 m_startTime = currentTime;
    -
    61
    -
    62 return;
    -
    63}
    -
    64
    -
    65float timer_class::GetTime()
    -
    66{
    -
    67 return m_frameTime;
    -
    68}
    -
    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
    - -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:a6216d5c09cb1f7d769c0f5eacf2b314d2d8b321bf00c56a3f9accbd7c970e82 +size 14600 diff --git a/doxygen_docs/html/timer__class_8h_source.html b/doxygen_docs/html/timer__class_8h_source.html index 2efe4d8..1093187 100644 --- a/doxygen_docs/html/timer__class_8h_source.html +++ b/doxygen_docs/html/timer__class_8h_source.html @@ -1,145 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/inc/system/timer_class.h Source File - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    timer_class.h
    -
    -
    -
    1#ifndef _TIMERCLASS_H_
    -
    2#define _TIMERCLASS_H_
    -
    3
    -
    4
    -
    6// INCLUDES //
    -
    8#include "Logger.h"
    -
    9#include <windows.h>
    -
    10
    -
    11
    -
    13// Class name: timer_class
    -
    - -
    16{
    -
    17public:
    - - - -
    21
    -
    22 bool Initialize();
    -
    23 void Frame();
    -
    24
    -
    25 float GetTime();
    -
    26
    -
    27private:
    -
    28 float m_frequency;
    -
    29 INT64 m_startTime;
    -
    30 float m_frameTime;
    -
    31
    -
    32};
    -
    -
    33
    -
    34#endif
    - -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:31dc6e7eb2fce0dafcbcbbe2bedd2964b34689d50a610878caa6b9c8cf08f0d0 +size 8956 diff --git a/doxygen_docs/html/transform__component_8h_source.html b/doxygen_docs/html/transform__component_8h_source.html index ed9ee61..3248d5d 100644 --- a/doxygen_docs/html/transform__component_8h_source.html +++ b/doxygen_docs/html/transform__component_8h_source.html @@ -1,247 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/inc/system/ecs/components/transform_component.h Source File - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    transform_component.h
    -
    -
    -
    1#pragma once
    -
    2#include "../component.h"
    -
    3#include <DirectXMath.h>
    -
    4
    -
    5using namespace DirectX;
    -
    6
    -
    7namespace ecs {
    -
    8
    -
    - -
    10public:
    -
    11
    -
    - -
    17 m_ScaleMatrix = XMMatrixIdentity();
    -
    18 m_RotateMatrix = XMMatrixIdentity();
    -
    19 m_TranslateMatrix = XMMatrixIdentity();
    -
    20 m_WorldMatrix = XMMatrixIdentity();
    -
    21 }
    -
    -
    22
    -
    23 ~TransformComponent() = default;
    -
    24
    -
    -
    29 void SetPosition(XMVECTOR position) {
    -
    30 XMFLOAT4X4 matrix;
    -
    31 XMStoreFloat4x4(&matrix, m_TranslateMatrix);
    -
    32 matrix._41 = XMVectorGetX(position);
    -
    33 matrix._42 = XMVectorGetY(position);
    -
    34 matrix._43 = XMVectorGetZ(position);
    -
    35 m_TranslateMatrix = XMLoadFloat4x4(&matrix);
    - -
    37 }
    -
    -
    38
    -
    -
    43 void SetRotation(XMVECTOR rotation) {
    -
    44 m_RotateMatrix = XMMatrixRotationRollPitchYawFromVector(rotation);
    - -
    46 }
    -
    -
    47
    -
    -
    52 void SetScale(XMVECTOR scale) {
    -
    53 XMFLOAT4X4 matrix;
    -
    54 XMStoreFloat4x4(&matrix, m_ScaleMatrix);
    -
    55 matrix._11 = XMVectorGetX(scale);
    -
    56 matrix._22 = XMVectorGetY(scale);
    -
    57 matrix._33 = XMVectorGetZ(scale);
    -
    58 m_ScaleMatrix = XMLoadFloat4x4(&matrix);
    - -
    60 }
    -
    -
    61
    -
    -
    66 XMVECTOR GetPosition() const {
    -
    67 XMFLOAT4X4 matrix;
    -
    68 XMStoreFloat4x4(&matrix, m_TranslateMatrix);
    -
    69 return XMVectorSet(matrix._41, matrix._42, matrix._43, 0.0f);
    -
    70 }
    -
    -
    71
    -
    -
    76 XMVECTOR GetRotation() const {
    -
    77 XMFLOAT4X4 matrix;
    -
    78 XMStoreFloat4x4(&matrix, m_RotateMatrix);
    -
    79 float rotationX = atan2f(matrix._32, matrix._33);
    -
    80 float rotationY = atan2f(-matrix._31, sqrtf(matrix._32 * matrix._32 + matrix._33 * matrix._33));
    -
    81 float rotationZ = atan2f(matrix._21, matrix._11);
    -
    82 return XMVectorSet(rotationX, rotationY, rotationZ, 0.0f);
    -
    83 }
    -
    -
    84
    -
    -
    89 XMVECTOR GetScale() const {
    -
    90 XMFLOAT4X4 matrix;
    -
    91 XMStoreFloat4x4(&matrix, m_ScaleMatrix);
    -
    92
    -
    93 XMVECTOR row1 = XMLoadFloat3(reinterpret_cast<XMFLOAT3*>(&matrix._11));
    -
    94 XMVECTOR row2 = XMLoadFloat3(reinterpret_cast<XMFLOAT3*>(&matrix._21));
    -
    95 XMVECTOR row3 = XMLoadFloat3(reinterpret_cast<XMFLOAT3*>(&matrix._31));
    -
    96
    -
    97 XMVECTOR scale = XMVectorSet(
    -
    98 XMVectorGetX(XMVector3Length(row1)),
    -
    99 XMVectorGetX(XMVector3Length(row2)),
    -
    100 XMVectorGetX(XMVector3Length(row3)),
    -
    101 0.0f
    -
    102 );
    -
    103
    -
    104 return scale;
    -
    105 }
    -
    -
    106
    -
    - -
    112 m_WorldMatrix = m_ScaleMatrix * m_RotateMatrix * m_TranslateMatrix;
    -
    113 }
    -
    -
    114
    -
    119 XMMATRIX GetScaleMatrix() const { return m_ScaleMatrix; }
    -
    124 XMMATRIX GetRotateMatrix() const { return m_RotateMatrix; }
    -
    129 XMMATRIX GetTranslateMatrix() const { return m_TranslateMatrix; }
    -
    135 XMMATRIX GetWorldMatrix() const { return m_WorldMatrix; }
    -
    136
    -
    142 void SetScaleMatrix(XMMATRIX matrix) { m_ScaleMatrix = matrix; UpdateWorldMatrix(); }
    -
    148 void SetRotateMatrix(XMMATRIX matrix) { m_RotateMatrix = matrix; UpdateWorldMatrix(); }
    -
    154 void SetTranslateMatrix(XMMATRIX matrix) { m_TranslateMatrix = matrix; UpdateWorldMatrix(); }
    -
    155
    -
    156private:
    -
    157 XMMATRIX m_ScaleMatrix;
    -
    158 XMMATRIX m_RotateMatrix;
    -
    159 XMMATRIX m_TranslateMatrix;
    -
    160 XMMATRIX m_WorldMatrix;
    -
    161};
    -
    -
    162
    -
    163} // namespace ecs
    - - - - - -
    XMMATRIX GetTranslateMatrix() const
    - -
    void SetRotateMatrix(XMMATRIX matrix)
    - -
    void SetRotation(XMVECTOR rotation)
    -
    void SetScaleMatrix(XMMATRIX matrix)
    -
    void SetScale(XMVECTOR scale)
    - -
    void SetPosition(XMVECTOR position)
    -
    void SetTranslateMatrix(XMMATRIX matrix)
    - - -
    Definition component.h:9
    -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:fe3cc7f65ffa33b8dbcdb7a508a93bf703baa6cef4a4b5375f198f80882895ed +size 29995 diff --git a/doxygen_docs/html/translate__shader__class_8cpp_source.html b/doxygen_docs/html/translate__shader__class_8cpp_source.html index e64d2fc..aaa5469 100644 --- a/doxygen_docs/html/translate__shader__class_8cpp_source.html +++ b/doxygen_docs/html/translate__shader__class_8cpp_source.html @@ -1,553 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/src/shader/translate_shader_class.cpp Source File - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    translate_shader_class.cpp
    -
    -
    -
    1#include "translate_shader_class.h"
    -
    2
    -
    3
    -
    4translate_shader_class::translate_shader_class()
    -
    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}
    -
    13
    -
    14
    -
    15translate_shader_class::translate_shader_class(const translate_shader_class& other)
    -
    16{
    -
    17}
    -
    18
    -
    19
    -
    20translate_shader_class::~translate_shader_class()
    -
    21{
    -
    22}
    -
    23
    -
    24
    -
    25bool translate_shader_class::initialize(ID3D11Device* device, HWND hwnd)
    -
    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}
    -
    62
    -
    63
    -
    64void translate_shader_class::shutdown()
    -
    65{
    -
    66 // shutdown the vertex and pixel shaders as well as the related objects.
    -
    67 shutdown_shader();
    -
    68
    -
    69 return;
    -
    70}
    -
    71
    -
    72bool translate_shader_class::render(ID3D11DeviceContext * deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix,
    -
    73 XMMATRIX projectionMatrix, ID3D11ShaderResourceView * texture, float translation)
    -
    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}
    -
    91
    -
    92
    -
    93bool translate_shader_class::initialize_shader(ID3D11Device * device, HWND hwnd, WCHAR * vsFilename, WCHAR * psFilename)
    -
    94{
    -
    95 Logger::Get().Log("Initializing translate shader", __FILE__, __LINE__, Logger::LogLevel::Initialize);
    -
    96
    -
    97 HRESULT result;
    -
    98 ID3D10Blob* errorMessage;
    -
    99 ID3D10Blob* vertexShaderBuffer;
    -
    100 ID3D10Blob* pixelShaderBuffer;
    -
    101 D3D11_INPUT_ELEMENT_DESC polygonLayout[2];
    -
    102 unsigned int numElements;
    -
    103 D3D11_BUFFER_DESC matrixBufferDesc;
    -
    104 D3D11_SAMPLER_DESC samplerDesc;
    -
    105 D3D11_BUFFER_DESC translateBufferDesc;
    -
    106
    -
    107
    -
    108 // initialize the pointers this function will use to null.
    -
    109 errorMessage = 0;
    -
    110 vertexShaderBuffer = 0;
    -
    111 pixelShaderBuffer = 0;
    -
    112
    -
    113 // Compile the vertex shader code.
    -
    114 result = D3DCompileFromFile(vsFilename, NULL, NULL, "TranslateVertexShader", "vs_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0,
    -
    115 &vertexShaderBuffer, &errorMessage);
    -
    116 if (FAILED(result))
    -
    117 {
    -
    118 // If the shader failed to compile it should have writen something to the error message.
    -
    119 if (errorMessage)
    -
    120 {
    -
    121 output_shader_error_message(errorMessage, hwnd, vsFilename);
    -
    122 }
    -
    123 // If there was nothing in the error message then it simply could not find the shader file itself.
    -
    124 else
    -
    125 {
    -
    126 Logger::Get().Log("Failed to compile shader", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    127 }
    -
    128
    -
    129 return false;
    -
    130 }
    -
    131
    -
    132 // Compile the pixel shader code.
    -
    133 result = D3DCompileFromFile(psFilename, NULL, NULL, "TranslatePixelShader", "ps_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0,
    -
    134 &pixelShaderBuffer, &errorMessage);
    -
    135 if (FAILED(result))
    -
    136 {
    -
    137 // If the shader failed to compile it should have writen something to the error message.
    -
    138 if (errorMessage)
    -
    139 {
    -
    140 output_shader_error_message(errorMessage, hwnd, psFilename);
    -
    141 }
    -
    142 // If there was nothing in the error message then it simply could not find the file itself.
    -
    143 else
    -
    144 {
    -
    145 Logger::Get().Log("Failed to compile shader", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    146 }
    -
    147
    -
    148 return false;
    -
    149 }
    -
    150
    -
    151 // Create the vertex shader from the buffer.
    -
    152 result = device->CreateVertexShader(vertexShaderBuffer->GetBufferPointer(), vertexShaderBuffer->GetBufferSize(), NULL, &vertex_shader_);
    -
    153 if (FAILED(result))
    -
    154 {
    -
    155 Logger::Get().Log("Failed to create vertex shader", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    156 return false;
    -
    157 }
    -
    158
    -
    159 // Create the pixel shader from the buffer.
    -
    160 result = device->CreatePixelShader(pixelShaderBuffer->GetBufferPointer(), pixelShaderBuffer->GetBufferSize(), NULL, &pixel_shader_);
    -
    161 if (FAILED(result))
    -
    162 {
    -
    163 Logger::Get().Log("Failed to create pixel shader", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    164 return false;
    -
    165 }
    -
    166
    -
    167 // Create the vertex input layout description.
    -
    168 polygonLayout[0].SemanticName = "POSITION";
    -
    169 polygonLayout[0].SemanticIndex = 0;
    -
    170 polygonLayout[0].Format = DXGI_FORMAT_R32G32B32_FLOAT;
    -
    171 polygonLayout[0].InputSlot = 0;
    -
    172 polygonLayout[0].AlignedByteOffset = 0;
    -
    173 polygonLayout[0].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
    -
    174 polygonLayout[0].InstanceDataStepRate = 0;
    -
    175
    -
    176 polygonLayout[1].SemanticName = "TEXCOORD";
    -
    177 polygonLayout[1].SemanticIndex = 0;
    -
    178 polygonLayout[1].Format = DXGI_FORMAT_R32G32_FLOAT;
    -
    179 polygonLayout[1].InputSlot = 0;
    -
    180 polygonLayout[1].AlignedByteOffset = D3D11_APPEND_ALIGNED_ELEMENT;
    -
    181 polygonLayout[1].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
    -
    182 polygonLayout[1].InstanceDataStepRate = 0;
    -
    183
    -
    184 // Get a count of the elements in the layout.
    -
    185 numElements = sizeof(polygonLayout) / sizeof(polygonLayout[0]);
    -
    186
    -
    187 // Create the vertex input layout.
    -
    188 result = device->CreateInputLayout(polygonLayout, numElements, vertexShaderBuffer->GetBufferPointer(),
    -
    189 vertexShaderBuffer->GetBufferSize(), &layout_);
    -
    190 if (FAILED(result))
    -
    191 {
    -
    192 Logger::Get().Log("Failed to create input layout", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    193 return false;
    -
    194 }
    -
    195
    -
    196 // Release the vertex shader buffer and pixel shader buffer since they are no longer needed.
    -
    197 vertexShaderBuffer->Release();
    -
    198 vertexShaderBuffer = 0;
    -
    199
    -
    200 pixelShaderBuffer->Release();
    -
    201 pixelShaderBuffer = 0;
    -
    202
    -
    203 // Setup the description of the dynamic matrix constant buffer that is in the vertex shader.
    -
    204 matrixBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
    -
    205 matrixBufferDesc.ByteWidth = sizeof(matrix_buffer_type);
    -
    206 matrixBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
    -
    207 matrixBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
    -
    208 matrixBufferDesc.MiscFlags = 0;
    -
    209 matrixBufferDesc.StructureByteStride = 0;
    -
    210
    -
    211 // Create the constant buffer pointer so we can access the vertex shader constant buffer from within this class.
    -
    212 result = device->CreateBuffer(&matrixBufferDesc, NULL, &matrix_buffer_);
    -
    213 if (FAILED(result))
    -
    214 {
    -
    215 Logger::Get().Log("Failed to create matrix buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    216 return false;
    -
    217 }
    -
    218
    -
    219 // Create a texture sampler state description.
    -
    220 samplerDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR;
    -
    221 samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP;
    -
    222 samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP;
    -
    223 samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_WRAP;
    -
    224 samplerDesc.MipLODBias = 0.0f;
    -
    225 samplerDesc.MaxAnisotropy = 1;
    -
    226 samplerDesc.ComparisonFunc = D3D11_COMPARISON_ALWAYS;
    -
    227 samplerDesc.BorderColor[0] = 0;
    -
    228 samplerDesc.BorderColor[1] = 0;
    -
    229 samplerDesc.BorderColor[2] = 0;
    -
    230 samplerDesc.BorderColor[3] = 0;
    -
    231 samplerDesc.MinLOD = 0;
    -
    232 samplerDesc.MaxLOD = D3D11_FLOAT32_MAX;
    -
    233
    -
    234 // Create the texture sampler state.
    -
    235 result = device->CreateSamplerState(&samplerDesc, &sample_state_);
    -
    236 if (FAILED(result))
    -
    237 {
    -
    238 Logger::Get().Log("Failed to create sampler state", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    239 return false;
    -
    240 }
    -
    241
    -
    242 // Setup the description of the texture translation dynamic constant buffer that is in the pixel shader.
    -
    243 translateBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
    -
    244 translateBufferDesc.ByteWidth = sizeof(translate_buffer_type);
    -
    245 translateBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
    -
    246 translateBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
    -
    247 translateBufferDesc.MiscFlags = 0;
    -
    248 translateBufferDesc.StructureByteStride = 0;
    -
    249
    -
    250 // Create the constant buffer pointer so we can access the pixel shader constant buffer from within this class.
    -
    251 result = device->CreateBuffer(&translateBufferDesc, NULL, &translate_buffer_);
    -
    252 if (FAILED(result))
    -
    253 {
    -
    254 Logger::Get().Log("Failed to create translate buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    255 return false;
    -
    256 }
    -
    257
    -
    258 Logger::Get().Log("Translate shader initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
    -
    259
    -
    260 return true;
    -
    261}
    -
    262
    -
    263
    -
    264void translate_shader_class::shutdown_shader()
    -
    265{
    -
    266 Logger::Get().Log("Shutting down translate shader", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
    -
    267
    -
    268 // Release the texture translation constant buffer.
    -
    269 if (translate_buffer_)
    -
    270 {
    -
    271 translate_buffer_->Release();
    -
    272 translate_buffer_ = 0;
    -
    273 }
    -
    274
    -
    275 // Release the sampler state.
    -
    276 if (sample_state_)
    -
    277 {
    -
    278 sample_state_->Release();
    -
    279 sample_state_ = 0;
    -
    280 }
    -
    281
    -
    282 // Release the matrix constant buffer.
    -
    283 if (matrix_buffer_)
    -
    284 {
    -
    285 matrix_buffer_->Release();
    -
    286 matrix_buffer_ = 0;
    -
    287 }
    -
    288
    -
    289 // Release the layout.
    -
    290 if (layout_)
    -
    291 {
    -
    292 layout_->Release();
    -
    293 layout_ = 0;
    -
    294 }
    -
    295
    -
    296 // Release the pixel shader.
    -
    297 if (pixel_shader_)
    -
    298 {
    -
    299 pixel_shader_->Release();
    -
    300 pixel_shader_ = 0;
    -
    301 }
    -
    302
    -
    303 // Release the vertex shader.
    -
    304 if (vertex_shader_)
    -
    305 {
    -
    306 vertex_shader_->Release();
    -
    307 vertex_shader_ = 0;
    -
    308 }
    -
    309
    -
    310 Logger::Get().Log("Translate shader shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
    -
    311
    -
    312 return;
    -
    313}
    -
    314
    -
    315
    -
    316void translate_shader_class::output_shader_error_message(ID3D10Blob * errorMessage, HWND hwnd, WCHAR * shaderFilename)
    -
    317{
    -
    318 char* compileErrors;
    -
    319 unsigned long long bufferSize, i;
    -
    320 ofstream fout;
    -
    321
    -
    322
    -
    323 // Get a pointer to the error message text buffer.
    -
    324 compileErrors = (char*)(errorMessage->GetBufferPointer());
    -
    325
    -
    326 // Get the length of the message.
    -
    327 bufferSize = errorMessage->GetBufferSize();
    -
    328
    -
    329 // Open a file to write the error message to.
    -
    330 fout.open("shader-error.txt");
    -
    331
    -
    332 // Write out the error message.
    -
    333 for (i = 0; i < bufferSize; i++)
    -
    334 {
    -
    335 fout << compileErrors[i];
    -
    336 }
    -
    337
    -
    338 // Close the file.
    -
    339 fout.close();
    -
    340
    -
    341 // Release the error message.
    -
    342 errorMessage->Release();
    -
    343 errorMessage = 0;
    -
    344
    -
    345 // Pop a message up on the screen to notify the user to check the text file for compile errors.
    -
    346 MessageBox(hwnd, L"Error compiling shader. Check shader-error.txt for message.", shaderFilename, MB_OK);
    -
    347
    -
    348 return;
    -
    349}
    -
    350
    -
    351
    -
    352bool translate_shader_class::set_shader_parameters(ID3D11DeviceContext * deviceContext, XMMATRIX worldMatrix, XMMATRIX viewMatrix,
    -
    353 XMMATRIX projectionMatrix, ID3D11ShaderResourceView * texture, float translation)
    -
    354{
    -
    355 HRESULT result;
    -
    356 D3D11_MAPPED_SUBRESOURCE mappedResource;
    -
    357 matrix_buffer_type* dataPtr;
    -
    358 unsigned int bufferNumber;
    -
    359 translate_buffer_type* dataPtr2;
    -
    360
    -
    361
    -
    362 // Transpose the matrices to prepare them for the shader.
    -
    363 worldMatrix = XMMatrixTranspose(worldMatrix);
    -
    364 viewMatrix = XMMatrixTranspose(viewMatrix);
    -
    365 projectionMatrix = XMMatrixTranspose(projectionMatrix);
    -
    366
    -
    367 // Lock the constant buffer so it can be written to.
    -
    368 result = deviceContext->Map(matrix_buffer_, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
    -
    369 if (FAILED(result))
    -
    370 {
    -
    371 Logger::Get().Log("Failed to map matrix buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    372 return false;
    -
    373 }
    -
    374
    -
    375 // Get a pointer to the data in the constant buffer.
    -
    376 dataPtr = (matrix_buffer_type*)mappedResource.pData;
    -
    377
    -
    378 // Copy the matrices into the constant buffer.
    -
    379 dataPtr->world = worldMatrix;
    -
    380 dataPtr->view = viewMatrix;
    -
    381 dataPtr->projection = projectionMatrix;
    -
    382
    -
    383 // Unlock the constant buffer.
    -
    384 deviceContext->Unmap(matrix_buffer_, 0);
    -
    385
    -
    386 // Set the position of the constant buffer in the vertex shader.
    -
    387 bufferNumber = 0;
    -
    388
    -
    389 // Finally set the constant buffer in the vertex shader with the updated values.
    -
    390 deviceContext->VSSetConstantBuffers(bufferNumber, 1, &matrix_buffer_);
    -
    391
    -
    392 // Set shader texture resource in the pixel shader.
    -
    393 deviceContext->PSSetShaderResources(0, 1, &texture);
    -
    394
    -
    395 // Lock the texture translation constant buffer so it can be written to.
    -
    396 result = deviceContext->Map(translate_buffer_, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
    -
    397 if (FAILED(result))
    -
    398 {
    -
    399 Logger::Get().Log("Failed to map translate buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    400 return false;
    -
    401 }
    -
    402
    -
    403 // Get a pointer to the data in the texture translation constant buffer.
    -
    404 dataPtr2 = (translate_buffer_type*)mappedResource.pData;
    -
    405
    -
    406 // Copy the translation value into the texture translation constant buffer.
    -
    407 dataPtr2->translation = translation;
    -
    408
    -
    409 // Unlock the buffer.
    -
    410 deviceContext->Unmap(translate_buffer_, 0);
    -
    411
    -
    412 // Set the position of the texture translation constant buffer in the pixel shader.
    -
    413 bufferNumber = 0;
    -
    414
    -
    415 // Now set the texture translation constant buffer in the pixel shader with the updated values.
    -
    416 deviceContext->PSSetConstantBuffers(bufferNumber, 1, &translate_buffer_);
    -
    417
    -
    418 return true;
    -
    419}
    -
    420
    -
    421
    -
    422void translate_shader_class::render_shader(ID3D11DeviceContext * deviceContext, int indexCount)
    -
    423{
    -
    424 // Set the vertex input layout.
    -
    425 deviceContext->IASetInputLayout(layout_);
    -
    426
    -
    427 // Set the vertex and pixel shaders that will be used to render this triangle.
    -
    428 deviceContext->VSSetShader(vertex_shader_, NULL, 0);
    -
    429 deviceContext->PSSetShader(pixel_shader_, NULL, 0);
    -
    430
    -
    431 // Set the sampler state in the pixel shader.
    -
    432 deviceContext->PSSetSamplers(0, 1, &sample_state_);
    -
    433
    -
    434 // render the geometry.
    -
    435 deviceContext->DrawIndexed(indexCount, 0, 0);
    -
    436
    -
    437 return;
    -
    438}
    -
    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
    - -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:fabad81bc2ed3cc509029693ed71e164a2139cd2d7718aa448e6cc093e42b14f +size 69976 diff --git a/doxygen_docs/html/translate__shader__class_8h_source.html b/doxygen_docs/html/translate__shader__class_8h_source.html index 7b9950d..40d4d45 100644 --- a/doxygen_docs/html/translate__shader__class_8h_source.html +++ b/doxygen_docs/html/translate__shader__class_8h_source.html @@ -1,174 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/inc/shader/translate_shader_class.h Source File - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    translate_shader_class.h
    -
    -
    -
    1#ifndef _TRANSLATESHADERCLASS_H_
    -
    2#define _TRANSLATESHADERCLASS_H_
    -
    3
    -
    4
    -
    6// INCLUDES //
    -
    8#include "Logger.h"
    -
    9#include <d3d11.h>
    -
    10#include <d3dcompiler.h>
    -
    11#include <directxmath.h>
    -
    12#include <fstream>
    -
    13using namespace DirectX;
    -
    14using namespace std;
    -
    15
    -
    16
    -
    18// Class name: translate_shader_class
    -
    - -
    21{
    -
    22private:
    -
    23 struct matrix_buffer_type
    -
    24 {
    -
    25 XMMATRIX world;
    -
    26 XMMATRIX view;
    -
    27 XMMATRIX projection;
    -
    28 };
    -
    29
    -
    30 struct translate_buffer_type
    -
    31 {
    -
    32 float translation;
    -
    33 XMFLOAT3 padding;
    -
    34 };
    -
    35
    -
    36public:
    - - - -
    40
    -
    41 bool initialize(ID3D11Device*, HWND);
    -
    42 void shutdown();
    -
    43 bool render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, float);
    -
    44
    -
    45private:
    -
    46 bool initialize_shader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
    -
    47 void shutdown_shader();
    -
    48 void output_shader_error_message(ID3D10Blob*, HWND, WCHAR*);
    -
    49
    -
    50 bool set_shader_parameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, float);
    -
    51 void render_shader(ID3D11DeviceContext*, int);
    -
    52
    -
    53private:
    -
    54 ID3D11VertexShader* vertex_shader_;
    -
    55 ID3D11PixelShader* pixel_shader_;
    -
    56 ID3D11InputLayout* layout_;
    -
    57 ID3D11Buffer* matrix_buffer_;
    -
    58 ID3D11SamplerState* sample_state_;
    -
    59 ID3D11Buffer* translate_buffer_;
    -
    60
    -
    61};
    -
    -
    62
    -
    63#endif
    - -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:b4190b3d1547fc471d754c3467ad9e0ec6277884fb6601724d47ff5f5c83f06a +size 13319 diff --git a/doxygen_docs/html/transparent__shader__class_8cpp_source.html b/doxygen_docs/html/transparent__shader__class_8cpp_source.html index 36af32f..180034f 100644 --- a/doxygen_docs/html/transparent__shader__class_8cpp_source.html +++ b/doxygen_docs/html/transparent__shader__class_8cpp_source.html @@ -1,552 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/src/shader/transparent_shader_class.cpp Source File - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    transparent_shader_class.cpp
    -
    -
    -
    1#include "transparent_shader_class.h"
    -
    2
    -
    3
    -
    4transparent_shader_class::transparent_shader_class()
    -
    5{
    -
    6 vertex_shader_ = 0;
    -
    7 pixel_shader_ = 0;
    -
    8 layout_ = 0;
    -
    9 matrix_buffer_ = 0;
    -
    10 sample_state_ = 0;
    -
    11 transparent_buffer_ = 0;
    -
    12}
    -
    13
    -
    14
    -
    15transparent_shader_class::transparent_shader_class(const transparent_shader_class& other)
    -
    16{
    -
    17}
    -
    18
    -
    19
    -
    20transparent_shader_class::~transparent_shader_class()
    -
    21{
    -
    22}
    -
    23
    -
    24
    -
    25bool transparent_shader_class::initialize(ID3D11Device* device, HWND hwnd)
    -
    26{
    -
    27 Logger::Get().Log("Initializing transparent_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/transparent.vs");
    -
    36 if (error != 0)
    -
    37 {
    -
    38 Logger::Get().Log("Failed to copy vertex shader filename", __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/transparent.ps");
    -
    44 if (error != 0)
    -
    45 {
    -
    46 Logger::Get().Log("Failed to copy pixel shader filename", __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("transparent_shader_class initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
    -
    59
    -
    60 return true;
    -
    61}
    -
    62
    -
    63
    -
    64void transparent_shader_class::shutdown()
    -
    65{
    -
    66 // shutdown the vertex and pixel shaders as well as the related objects.
    -
    67 shutdown_shader();
    -
    68
    -
    69 return;
    -
    70}
    -
    71
    -
    72bool transparent_shader_class::render(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix,
    -
    73 XMMATRIX projectionMatrix, ID3D11ShaderResourceView* texture, float blend)
    -
    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, blend);
    -
    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}
    -
    91
    -
    92
    -
    93bool transparent_shader_class::initialize_shader(ID3D11Device* device, HWND hwnd, WCHAR* vsFilename, WCHAR* psFilename)
    -
    94{
    -
    95 Logger::Get().Log("Initializing transparent shader", __FILE__, __LINE__, Logger::LogLevel::Initialize);
    -
    96
    -
    97 HRESULT result;
    -
    98 ID3D10Blob* errorMessage;
    -
    99 ID3D10Blob* vertexShaderBuffer;
    -
    100 ID3D10Blob* pixelShaderBuffer;
    -
    101 D3D11_INPUT_ELEMENT_DESC polygonLayout[2];
    -
    102 unsigned int numElements;
    -
    103 D3D11_BUFFER_DESC matrixBufferDesc;
    -
    104 D3D11_SAMPLER_DESC samplerDesc;
    -
    105 D3D11_BUFFER_DESC transparentBufferDesc;
    -
    106
    -
    107
    -
    108 // initialize the pointers this function will use to null.
    -
    109 errorMessage = 0;
    -
    110 vertexShaderBuffer = 0;
    -
    111 pixelShaderBuffer = 0;
    -
    112
    -
    113 // Compile the vertex shader code.
    -
    114 result = D3DCompileFromFile(vsFilename, NULL, NULL, "TransparentVertexShader", "vs_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0,
    -
    115 &vertexShaderBuffer, &errorMessage);
    -
    116 if (FAILED(result))
    -
    117 {
    -
    118 // If the shader failed to compile it should have writen something to the error message.
    -
    119 if (errorMessage)
    -
    120 {
    -
    121 output_shader_error_message(errorMessage, hwnd, vsFilename);
    -
    122 }
    -
    123 // If there was nothing in the error message then it simply could not find the shader file itself.
    -
    124 else
    -
    125 {
    -
    126 Logger::Get().Log("Failed to compile vertex shader", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    127 }
    -
    128
    -
    129 return false;
    -
    130 }
    -
    131
    -
    132 // Compile the pixel shader code.
    -
    133 result = D3DCompileFromFile(psFilename, NULL, NULL, "TransparentPixelShader", "ps_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0,
    -
    134 &pixelShaderBuffer, &errorMessage);
    -
    135 if (FAILED(result))
    -
    136 {
    -
    137 // If the shader failed to compile it should have writen something to the error message.
    -
    138 if (errorMessage)
    -
    139 {
    -
    140 output_shader_error_message(errorMessage, hwnd, psFilename);
    -
    141 }
    -
    142 // If there was nothing in the error message then it simply could not find the file itself.
    -
    143 else
    -
    144 {
    -
    145 Logger::Get().Log("Failed to compile pixel shader", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    146 }
    -
    147
    -
    148 return false;
    -
    149 }
    -
    150
    -
    151 // Create the vertex shader from the buffer.
    -
    152 result = device->CreateVertexShader(vertexShaderBuffer->GetBufferPointer(), vertexShaderBuffer->GetBufferSize(), NULL, &vertex_shader_);
    -
    153 if (FAILED(result))
    -
    154 {
    -
    155 Logger::Get().Log("Failed to create vertex shader", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    156 return false;
    -
    157 }
    -
    158
    -
    159 // Create the pixel shader from the buffer.
    -
    160 result = device->CreatePixelShader(pixelShaderBuffer->GetBufferPointer(), pixelShaderBuffer->GetBufferSize(), NULL, &pixel_shader_);
    -
    161 if (FAILED(result))
    -
    162 {
    -
    163 Logger::Get().Log("Failed to create pixel shader", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    164 return false;
    -
    165 }
    -
    166
    -
    167 // Create the vertex input layout description.
    -
    168 polygonLayout[0].SemanticName = "POSITION";
    -
    169 polygonLayout[0].SemanticIndex = 0;
    -
    170 polygonLayout[0].Format = DXGI_FORMAT_R32G32B32_FLOAT;
    -
    171 polygonLayout[0].InputSlot = 0;
    -
    172 polygonLayout[0].AlignedByteOffset = 0;
    -
    173 polygonLayout[0].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
    -
    174 polygonLayout[0].InstanceDataStepRate = 0;
    -
    175
    -
    176 polygonLayout[1].SemanticName = "TEXCOORD";
    -
    177 polygonLayout[1].SemanticIndex = 0;
    -
    178 polygonLayout[1].Format = DXGI_FORMAT_R32G32_FLOAT;
    -
    179 polygonLayout[1].InputSlot = 0;
    -
    180 polygonLayout[1].AlignedByteOffset = D3D11_APPEND_ALIGNED_ELEMENT;
    -
    181 polygonLayout[1].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
    -
    182 polygonLayout[1].InstanceDataStepRate = 0;
    -
    183
    -
    184 // Get a count of the elements in the layout.
    -
    185 numElements = sizeof(polygonLayout) / sizeof(polygonLayout[0]);
    -
    186
    -
    187 // Create the vertex input layout.
    -
    188 result = device->CreateInputLayout(polygonLayout, numElements, vertexShaderBuffer->GetBufferPointer(),
    -
    189 vertexShaderBuffer->GetBufferSize(), &layout_);
    -
    190 if (FAILED(result))
    -
    191 {
    -
    192 Logger::Get().Log("Failed to create input layout", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    193 return false;
    -
    194 }
    -
    195
    -
    196 // Release the vertex shader buffer and pixel shader buffer since they are no longer needed.
    -
    197 vertexShaderBuffer->Release();
    -
    198 vertexShaderBuffer = 0;
    -
    199
    -
    200 pixelShaderBuffer->Release();
    -
    201 pixelShaderBuffer = 0;
    -
    202
    -
    203 // Setup the description of the dynamic matrix constant buffer that is in the vertex shader.
    -
    204 matrixBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
    -
    205 matrixBufferDesc.ByteWidth = sizeof(matrix_buffer_type);
    -
    206 matrixBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
    -
    207 matrixBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
    -
    208 matrixBufferDesc.MiscFlags = 0;
    -
    209 matrixBufferDesc.StructureByteStride = 0;
    -
    210
    -
    211 // Create the constant buffer pointer so we can access the vertex shader constant buffer from within this class.
    -
    212 result = device->CreateBuffer(&matrixBufferDesc, NULL, &matrix_buffer_);
    -
    213 if (FAILED(result))
    -
    214 {
    -
    215 Logger::Get().Log("Failed to create matrix buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    216 return false;
    -
    217 }
    -
    218
    -
    219 // Create a texture sampler state description.
    -
    220 samplerDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR;
    -
    221 samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP;
    -
    222 samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP;
    -
    223 samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_WRAP;
    -
    224 samplerDesc.MipLODBias = 0.0f;
    -
    225 samplerDesc.MaxAnisotropy = 1;
    -
    226 samplerDesc.ComparisonFunc = D3D11_COMPARISON_ALWAYS;
    -
    227 samplerDesc.BorderColor[0] = 0;
    -
    228 samplerDesc.BorderColor[1] = 0;
    -
    229 samplerDesc.BorderColor[2] = 0;
    -
    230 samplerDesc.BorderColor[3] = 0;
    -
    231 samplerDesc.MinLOD = 0;
    -
    232 samplerDesc.MaxLOD = D3D11_FLOAT32_MAX;
    -
    233
    -
    234 // Create the texture sampler state.
    -
    235 result = device->CreateSamplerState(&samplerDesc, &sample_state_);
    -
    236 if (FAILED(result))
    -
    237 {
    -
    238 Logger::Get().Log("Failed to create sampler state", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    239 return false;
    -
    240 }
    -
    241
    -
    242 // Setup the description of the transparent dynamic constant buffer that is in the pixel shader.
    -
    243 transparentBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
    -
    244 transparentBufferDesc.ByteWidth = sizeof(transparent_buffer_type);
    -
    245 transparentBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
    -
    246 transparentBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
    -
    247 transparentBufferDesc.MiscFlags = 0;
    -
    248 transparentBufferDesc.StructureByteStride = 0;
    -
    249
    -
    250 // Create the constant buffer pointer so we can access the pixel shader constant buffer from within this class.
    -
    251 result = device->CreateBuffer(&transparentBufferDesc, NULL, &transparent_buffer_);
    -
    252 if (FAILED(result))
    -
    253 {
    -
    254 Logger::Get().Log("Failed to create transparent buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    255 return false;
    -
    256 }
    -
    257
    -
    258 Logger::Get().Log("Transparent shader initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
    -
    259
    -
    260 return true;
    -
    261}
    -
    262
    -
    263
    -
    264void transparent_shader_class::shutdown_shader()
    -
    265{
    -
    266 Logger::Get().Log("Shutting down transparent shader", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
    -
    267
    -
    268 // Release the transparent constant buffer.
    -
    269 if (transparent_buffer_)
    -
    270 {
    -
    271 transparent_buffer_->Release();
    -
    272 transparent_buffer_ = 0;
    -
    273 }
    -
    274
    -
    275 // Release the sampler state.
    -
    276 if (sample_state_)
    -
    277 {
    -
    278 sample_state_->Release();
    -
    279 sample_state_ = 0;
    -
    280 }
    -
    281
    -
    282 // Release the matrix constant buffer.
    -
    283 if (matrix_buffer_)
    -
    284 {
    -
    285 matrix_buffer_->Release();
    -
    286 matrix_buffer_ = 0;
    -
    287 }
    -
    288
    -
    289 // Release the layout.
    -
    290 if (layout_)
    -
    291 {
    -
    292 layout_->Release();
    -
    293 layout_ = 0;
    -
    294 }
    -
    295
    -
    296 // Release the pixel shader.
    -
    297 if (pixel_shader_)
    -
    298 {
    -
    299 pixel_shader_->Release();
    -
    300 pixel_shader_ = 0;
    -
    301 }
    -
    302
    -
    303 // Release the vertex shader.
    -
    304 if (vertex_shader_)
    -
    305 {
    -
    306 vertex_shader_->Release();
    -
    307 vertex_shader_ = 0;
    -
    308 }
    -
    309
    -
    310 Logger::Get().Log("Transparent shader shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
    -
    311
    -
    312 return;
    -
    313}
    -
    314
    -
    315
    -
    316void transparent_shader_class::output_shader_error_message(ID3D10Blob* errorMessage, HWND hwnd, WCHAR* shaderFilename)
    -
    317{
    -
    318 char* compileErrors;
    -
    319 unsigned long long bufferSize, i;
    -
    320 ofstream fout;
    -
    321
    -
    322
    -
    323 // Get a pointer to the error message text buffer.
    -
    324 compileErrors = (char*)(errorMessage->GetBufferPointer());
    -
    325
    -
    326 // Get the length of the message.
    -
    327 bufferSize = errorMessage->GetBufferSize();
    -
    328
    -
    329 // Open a file to write the error message to.
    -
    330 fout.open("shader-error.txt");
    -
    331
    -
    332 // Write out the error message.
    -
    333 for (i = 0; i < bufferSize; i++)
    -
    334 {
    -
    335 fout << compileErrors[i];
    -
    336 }
    -
    337
    -
    338 // Close the file.
    -
    339 fout.close();
    -
    340
    -
    341 // Release the error message.
    -
    342 errorMessage->Release();
    -
    343 errorMessage = 0;
    -
    344
    -
    345 // Pop a message up on the screen to notify the user to check the text file for compile errors.
    -
    346 MessageBox(hwnd, L"Error compiling shader. Check shader-error.txt for message.", shaderFilename, MB_OK);
    -
    347
    -
    348 return;
    -
    349}
    -
    350
    -
    351bool transparent_shader_class::set_shader_parameters(ID3D11DeviceContext* deviceContext, XMMATRIX worldMatrix, XMMATRIX viewMatrix,
    -
    352 XMMATRIX projectionMatrix, ID3D11ShaderResourceView* texture, float blend)
    -
    353{
    -
    354 HRESULT result;
    -
    355 D3D11_MAPPED_SUBRESOURCE mappedResource;
    -
    356 matrix_buffer_type* dataPtr;
    -
    357 unsigned int bufferNumber;
    -
    358 transparent_buffer_type* dataPtr2;
    -
    359
    -
    360
    -
    361 // Transpose the matrices to prepare them for the shader.
    -
    362 worldMatrix = XMMatrixTranspose(worldMatrix);
    -
    363 viewMatrix = XMMatrixTranspose(viewMatrix);
    -
    364 projectionMatrix = XMMatrixTranspose(projectionMatrix);
    -
    365
    -
    366 // Lock the constant buffer so it can be written to.
    -
    367 result = deviceContext->Map(matrix_buffer_, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
    -
    368 if (FAILED(result))
    -
    369 {
    -
    370 Logger::Get().Log("Failed to map matrix buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    371 return false;
    -
    372 }
    -
    373
    -
    374 // Get a pointer to the data in the constant buffer.
    -
    375 dataPtr = (matrix_buffer_type*)mappedResource.pData;
    -
    376
    -
    377 // Copy the matrices into the constant buffer.
    -
    378 dataPtr->world = worldMatrix;
    -
    379 dataPtr->view = viewMatrix;
    -
    380 dataPtr->projection = projectionMatrix;
    -
    381
    -
    382 // Unlock the constant buffer.
    -
    383 deviceContext->Unmap(matrix_buffer_, 0);
    -
    384
    -
    385 // Set the position of the constant buffer in the vertex shader.
    -
    386 bufferNumber = 0;
    -
    387
    -
    388 // Finally set the constant buffer in the vertex shader with the updated values.
    -
    389 deviceContext->VSSetConstantBuffers(bufferNumber, 1, &matrix_buffer_);
    -
    390
    -
    391 // Set shader texture resource in the pixel shader.
    -
    392 deviceContext->PSSetShaderResources(0, 1, &texture);
    -
    393
    -
    394 // Lock the transparent constant buffer so it can be written to.
    -
    395 result = deviceContext->Map(transparent_buffer_, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
    -
    396 if (FAILED(result))
    -
    397 {
    -
    398 Logger::Get().Log("Failed to map transparent buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
    -
    399 return false;
    -
    400 }
    -
    401
    -
    402 // Get a pointer to the data in the transparent constant buffer.
    -
    403 dataPtr2 = (transparent_buffer_type*)mappedResource.pData;
    -
    404
    -
    405 // Copy the alpha blending value into the transparent constant buffer.
    -
    406 dataPtr2->blend_amount = blend;
    -
    407
    -
    408 // Unlock the buffer.
    -
    409 deviceContext->Unmap(transparent_buffer_, 0);
    -
    410
    -
    411 // Set the position of the transparent constant buffer in the pixel shader.
    -
    412 bufferNumber = 0;
    -
    413
    -
    414 // Now set the transparent constant buffer in the pixel shader with the updated values.
    -
    415 deviceContext->PSSetConstantBuffers(bufferNumber, 1, &transparent_buffer_);
    -
    416
    -
    417 return true;
    -
    418}
    -
    419
    -
    420
    -
    421void transparent_shader_class::render_shader(ID3D11DeviceContext* deviceContext, int indexCount)
    -
    422{
    -
    423 // Set the vertex input layout.
    -
    424 deviceContext->IASetInputLayout(layout_);
    -
    425
    -
    426 // Set the vertex and pixel shaders that will be used to render the geometry.
    -
    427 deviceContext->VSSetShader(vertex_shader_, NULL, 0);
    -
    428 deviceContext->PSSetShader(pixel_shader_, NULL, 0);
    -
    429
    -
    430 // Set the sampler state in the pixel shader.
    -
    431 deviceContext->PSSetSamplers(0, 1, &sample_state_);
    -
    432
    -
    433 // render the geometry.
    -
    434 deviceContext->DrawIndexed(indexCount, 0, 0);
    -
    435
    -
    436 return;
    -
    437}
    -
    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
    - -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:6cfe816c4ce967543798d082c78bb7cfb10eb8d7adab8df2f6dfc09f43620625 +size 69946 diff --git a/doxygen_docs/html/transparent__shader__class_8h_source.html b/doxygen_docs/html/transparent__shader__class_8h_source.html index f29c346..040deb0 100644 --- a/doxygen_docs/html/transparent__shader__class_8h_source.html +++ b/doxygen_docs/html/transparent__shader__class_8h_source.html @@ -1,174 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/inc/shader/transparent_shader_class.h Source File - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    transparent_shader_class.h
    -
    -
    -
    1#ifndef _TRANSPARENTSHADERCLASS_H_
    -
    2#define _TRANSPARENTSHADERCLASS_H_
    -
    3
    -
    4
    -
    6// INCLUDES //
    -
    8#include "Logger.h"
    -
    9#include <d3d11.h>
    -
    10#include <d3dcompiler.h>
    -
    11#include <directxmath.h>
    -
    12#include <fstream>
    -
    13using namespace DirectX;
    -
    14using namespace std;
    -
    15
    -
    16
    -
    18// Class name: transparent_shader_class
    -
    - -
    21{
    -
    22private:
    -
    23 struct matrix_buffer_type
    -
    24 {
    -
    25 XMMATRIX world;
    -
    26 XMMATRIX view;
    -
    27 XMMATRIX projection;
    -
    28 };
    -
    29
    -
    30 struct transparent_buffer_type
    -
    31 {
    -
    32 float blend_amount;
    -
    33 XMFLOAT3 padding;
    -
    34 };
    -
    35
    -
    36public:
    - - - -
    40
    -
    41 bool initialize(ID3D11Device*, HWND);
    -
    42 void shutdown();
    -
    43 bool render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, float);
    -
    44
    -
    45private:
    -
    46 bool initialize_shader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
    -
    47 void shutdown_shader();
    -
    48 void output_shader_error_message(ID3D10Blob*, HWND, WCHAR*);
    -
    49
    -
    50 bool set_shader_parameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, float);
    -
    51 void render_shader(ID3D11DeviceContext*, int);
    -
    52
    -
    53private:
    -
    54 ID3D11VertexShader* vertex_shader_;
    -
    55 ID3D11PixelShader* pixel_shader_;
    -
    56 ID3D11InputLayout* layout_;
    -
    57 ID3D11Buffer* matrix_buffer_;
    -
    58 ID3D11SamplerState* sample_state_;
    -
    59 ID3D11Buffer* transparent_buffer_;
    -
    60
    -
    61};
    -
    -
    62
    -
    63#endif
    - -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:546b46e40ccf3287d756735d04f3a522dd445b52b0b581b65576a5124fbe4d13 +size 13364 diff --git a/doxygen_docs/html/vulkan_8cpp_source.html b/doxygen_docs/html/vulkan_8cpp_source.html index 045744b..2a90e78 100644 --- a/doxygen_docs/html/vulkan_8cpp_source.html +++ b/doxygen_docs/html/vulkan_8cpp_source.html @@ -1,113 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/src/system/vulkan.cpp Source File - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    vulkan.cpp
    -
    -
    -
    1
    -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:5cf43830b77374b49866d64e5f51cec315b3df210c58c6289f376f011702c2c3 +size 4774 diff --git a/doxygen_docs/html/vulkan_8h_source.html b/doxygen_docs/html/vulkan_8h_source.html index 40954b1..1d69f2b 100644 --- a/doxygen_docs/html/vulkan_8h_source.html +++ b/doxygen_docs/html/vulkan_8h_source.html @@ -1,113 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/inc/system/vulkan.h Source File - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    vulkan.h
    -
    -
    -
    1
    -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:dc1efbda37572e239fdab66f79eeda3f6b4a17d282cac47257ff6377f31de9e9 +size 4766 diff --git a/doxygen_docs/html/water__shader__class_8cpp_source.html b/doxygen_docs/html/water__shader__class_8cpp_source.html index 7f4a452..71a8882 100644 --- a/doxygen_docs/html/water__shader__class_8cpp_source.html +++ b/doxygen_docs/html/water__shader__class_8cpp_source.html @@ -1,583 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/src/shader/water_shader_class.cpp Source File - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    water_shader_class.cpp
    -
    -
    -
    1#include "water_shader_class.h"
    -
    2
    -
    3
    -
    4water_shader_class::water_shader_class()
    -
    5{
    -
    6 vertex_shader_ = 0;
    -
    7 pixel_shader_ = 0;
    -
    8 layout_ = 0;
    -
    9 sample_state_ = 0;
    -
    10 matrix_buffer_ = 0;
    -
    11 reflection_buffer_ = 0;
    -
    12 water_buffer_ = 0;
    -
    13}
    -
    14
    -
    15
    -
    16water_shader_class::water_shader_class(const water_shader_class& other)
    -
    17{
    -
    18}
    -
    19
    -
    20
    -
    21water_shader_class::~water_shader_class()
    -
    22{
    -
    23}
    -
    24
    -
    25
    -
    26bool water_shader_class::initialize(ID3D11Device* device, HWND hwnd)
    -
    27{
    -
    28 bool result;
    -
    29 wchar_t vsFilename[128];
    -
    30 wchar_t psFilename[128];
    -
    31 int error;
    -
    32
    -
    33 // Set the filename of the vertex shader.
    -
    34 error = wcscpy_s(vsFilename, 128, L"src/hlsl/water.vs");
    -
    35 if (error != 0)
    -
    36 {
    -
    37 return false;
    -
    38 }
    -
    39
    -
    40 // Set the filename of the pixel shader.
    -
    41 error = wcscpy_s(psFilename, 128, L"src/hlsl/water.ps");
    -
    42 if (error != 0)
    -
    43 {
    -
    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 return false;
    -
    52 }
    -
    53
    -
    54 return true;
    -
    55}
    -
    56
    -
    57
    -
    58void water_shader_class::shutdown()
    -
    59{
    -
    60 // shutdown the vertex and pixel shaders as well as the related objects.
    -
    61 shutdown_shader();
    -
    62
    -
    63 return;
    -
    64}
    -
    65
    -
    66bool water_shader_class::render(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix,
    -
    67 XMMATRIX reflectionMatrix, ID3D11ShaderResourceView* reflectionTexture, ID3D11ShaderResourceView* refractionTexture,
    -
    68 ID3D11ShaderResourceView* normalTexture, float waterTranslation, float reflectRefractScale)
    -
    69{
    -
    70 bool result;
    -
    71
    -
    72
    -
    73 // Set the shader parameters that it will use for rendering.
    -
    74 result = set_shader_parameters(deviceContext, worldMatrix, viewMatrix, projectionMatrix, reflectionMatrix, reflectionTexture,
    -
    75 refractionTexture, normalTexture, waterTranslation, reflectRefractScale);
    -
    76 if (!result)
    -
    77 {
    -
    78 return false;
    -
    79 }
    -
    80
    -
    81 // Now render the prepared buffers with the shader.
    -
    82 render_shader(deviceContext, indexCount);
    -
    83
    -
    84 return true;
    -
    85}
    -
    86
    -
    87
    -
    88bool water_shader_class::initialize_shader(ID3D11Device* device, HWND hwnd, WCHAR* vsFilename, WCHAR* psFilename)
    -
    89{
    -
    90 HRESULT result;
    -
    91 ID3D10Blob* errorMessage;
    -
    92 ID3D10Blob* vertexShaderBuffer;
    -
    93 ID3D10Blob* pixelShaderBuffer;
    -
    94 D3D11_INPUT_ELEMENT_DESC polygonLayout[2];
    -
    95 unsigned int numElements;
    -
    96 D3D11_BUFFER_DESC matrixBufferDesc;
    -
    97 D3D11_SAMPLER_DESC samplerDesc;
    -
    98 D3D11_BUFFER_DESC reflectionBufferDesc;
    -
    99 D3D11_BUFFER_DESC waterBufferDesc;
    -
    100
    -
    101
    -
    102 // initialize the pointers this function will use to null.
    -
    103 errorMessage = 0;
    -
    104 vertexShaderBuffer = 0;
    -
    105 pixelShaderBuffer = 0;
    -
    106
    -
    107 // Compile the vertex shader code.
    -
    108 result = D3DCompileFromFile(vsFilename, NULL, NULL, "WaterVertexShader", "vs_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0,
    -
    109 &vertexShaderBuffer, &errorMessage);
    -
    110 if (FAILED(result))
    -
    111 {
    -
    112 // If the shader failed to compile it should have writen something to the error message.
    -
    113 if (errorMessage)
    -
    114 {
    -
    115 output_shader_error_message(errorMessage, hwnd, vsFilename);
    -
    116 }
    -
    117 // If there was nothing in the error message then it simply could not find the shader file itself.
    -
    118 else
    -
    119 {
    -
    120 MessageBox(hwnd, vsFilename, L"Missing Shader File", MB_OK);
    -
    121 }
    -
    122
    -
    123 return false;
    -
    124 }
    -
    125
    -
    126 // Compile the pixel shader code.
    -
    127 result = D3DCompileFromFile(psFilename, NULL, NULL, "WaterPixelShader", "ps_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0,
    -
    128 &pixelShaderBuffer, &errorMessage);
    -
    129 if (FAILED(result))
    -
    130 {
    -
    131 // If the shader failed to compile it should have writen something to the error message.
    -
    132 if (errorMessage)
    -
    133 {
    -
    134 output_shader_error_message(errorMessage, hwnd, psFilename);
    -
    135 }
    -
    136 // If there was nothing in the error message then it simply could not find the file itself.
    -
    137 else
    -
    138 {
    -
    139 MessageBox(hwnd, psFilename, L"Missing Shader File", MB_OK);
    -
    140 }
    -
    141
    -
    142 return false;
    -
    143 }
    -
    144
    -
    145 // Create the vertex shader from the buffer.
    -
    146 result = device->CreateVertexShader(vertexShaderBuffer->GetBufferPointer(), vertexShaderBuffer->GetBufferSize(), NULL, &vertex_shader_);
    -
    147 if (FAILED(result))
    -
    148 {
    -
    149 return false;
    -
    150 }
    -
    151
    -
    152 // Create the pixel shader from the buffer.
    -
    153 result = device->CreatePixelShader(pixelShaderBuffer->GetBufferPointer(), pixelShaderBuffer->GetBufferSize(), NULL, &pixel_shader_);
    -
    154 if (FAILED(result))
    -
    155 {
    -
    156 return false;
    -
    157 }
    -
    158
    -
    159 // Create the vertex input layout description.
    -
    160 polygonLayout[0].SemanticName = "POSITION";
    -
    161 polygonLayout[0].SemanticIndex = 0;
    -
    162 polygonLayout[0].Format = DXGI_FORMAT_R32G32B32_FLOAT;
    -
    163 polygonLayout[0].InputSlot = 0;
    -
    164 polygonLayout[0].AlignedByteOffset = 0;
    -
    165 polygonLayout[0].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
    -
    166 polygonLayout[0].InstanceDataStepRate = 0;
    -
    167
    -
    168 polygonLayout[1].SemanticName = "TEXCOORD";
    -
    169 polygonLayout[1].SemanticIndex = 0;
    -
    170 polygonLayout[1].Format = DXGI_FORMAT_R32G32_FLOAT;
    -
    171 polygonLayout[1].InputSlot = 0;
    -
    172 polygonLayout[1].AlignedByteOffset = D3D11_APPEND_ALIGNED_ELEMENT;
    -
    173 polygonLayout[1].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
    -
    174 polygonLayout[1].InstanceDataStepRate = 0;
    -
    175
    -
    176 // Get a count of the elements in the layout.
    -
    177 numElements = sizeof(polygonLayout) / sizeof(polygonLayout[0]);
    -
    178
    -
    179 // Create the vertex input layout.
    -
    180 result = device->CreateInputLayout(polygonLayout, numElements, vertexShaderBuffer->GetBufferPointer(),
    -
    181 vertexShaderBuffer->GetBufferSize(), &layout_);
    -
    182 if (FAILED(result))
    -
    183 {
    -
    184 return false;
    -
    185 }
    -
    186
    -
    187 // Release the vertex shader buffer and pixel shader buffer since they are no longer needed.
    -
    188 vertexShaderBuffer->Release();
    -
    189 vertexShaderBuffer = 0;
    -
    190
    -
    191 pixelShaderBuffer->Release();
    -
    192 pixelShaderBuffer = 0;
    -
    193
    -
    194 // Setup the description of the dynamic matrix constant buffer that is in the vertex shader.
    -
    195 matrixBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
    -
    196 matrixBufferDesc.ByteWidth = sizeof(matrix_buffer_type);
    -
    197 matrixBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
    -
    198 matrixBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
    -
    199 matrixBufferDesc.MiscFlags = 0;
    -
    200 matrixBufferDesc.StructureByteStride = 0;
    -
    201
    -
    202 // Create the constant buffer pointer so we can access the vertex shader constant buffer from within this class.
    -
    203 result = device->CreateBuffer(&matrixBufferDesc, NULL, &matrix_buffer_);
    -
    204 if (FAILED(result))
    -
    205 {
    -
    206 return false;
    -
    207 }
    -
    208
    -
    209 // Create a texture sampler state description.
    -
    210 samplerDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR;
    -
    211 samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP;
    -
    212 samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP;
    -
    213 samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_WRAP;
    -
    214 samplerDesc.MipLODBias = 0.0f;
    -
    215 samplerDesc.MaxAnisotropy = 1;
    -
    216 samplerDesc.ComparisonFunc = D3D11_COMPARISON_ALWAYS;
    -
    217 samplerDesc.BorderColor[0] = 0;
    -
    218 samplerDesc.BorderColor[1] = 0;
    -
    219 samplerDesc.BorderColor[2] = 0;
    -
    220 samplerDesc.BorderColor[3] = 0;
    -
    221 samplerDesc.MinLOD = 0;
    -
    222 samplerDesc.MaxLOD = D3D11_FLOAT32_MAX;
    -
    223
    -
    224 // Create the texture sampler state.
    -
    225 result = device->CreateSamplerState(&samplerDesc, &sample_state_);
    -
    226 if (FAILED(result))
    -
    227 {
    -
    228 return false;
    -
    229 }
    -
    230
    -
    231 // Setup the description of the reflection dynamic constant buffer that is in the vertex shader.
    -
    232 reflectionBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
    -
    233 reflectionBufferDesc.ByteWidth = sizeof(reflection_buffer_type);
    -
    234 reflectionBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
    -
    235 reflectionBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
    -
    236 reflectionBufferDesc.MiscFlags = 0;
    -
    237 reflectionBufferDesc.StructureByteStride = 0;
    -
    238
    -
    239 // Create the constant buffer pointer so we can access the vertex shader constant buffer from within this class.
    -
    240 result = device->CreateBuffer(&reflectionBufferDesc, NULL, &reflection_buffer_);
    -
    241 if (FAILED(result))
    -
    242 {
    -
    243 return false;
    -
    244 }
    -
    245
    -
    246 // Setup the description of the water dynamic constant buffer that is in the pixel shader.
    -
    247 waterBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
    -
    248 waterBufferDesc.ByteWidth = sizeof(water_buffer_type);
    -
    249 waterBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
    -
    250 waterBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
    -
    251 waterBufferDesc.MiscFlags = 0;
    -
    252 waterBufferDesc.StructureByteStride = 0;
    -
    253
    -
    254 // Create the constant buffer pointer so we can access the pixel shader constant buffer from within this class.
    -
    255 result = device->CreateBuffer(&waterBufferDesc, NULL, &water_buffer_);
    -
    256 if (FAILED(result))
    -
    257 {
    -
    258 return false;
    -
    259 }
    -
    260
    -
    261 return true;
    -
    262}
    -
    263
    -
    264
    -
    265void water_shader_class::shutdown_shader()
    -
    266{
    -
    267 // Release the water constant buffer.
    -
    268 if (water_buffer_)
    -
    269 {
    -
    270 water_buffer_->Release();
    -
    271 water_buffer_ = 0;
    -
    272 }
    -
    273
    -
    274 // Release the reflection constant buffer.
    -
    275 if (reflection_buffer_)
    -
    276 {
    -
    277 reflection_buffer_->Release();
    -
    278 reflection_buffer_ = 0;
    -
    279 }
    -
    280
    -
    281 // Release the sampler state.
    -
    282 if (sample_state_)
    -
    283 {
    -
    284 sample_state_->Release();
    -
    285 sample_state_ = 0;
    -
    286 }
    -
    287
    -
    288 // Release the matrix constant buffer.
    -
    289 if (matrix_buffer_)
    -
    290 {
    -
    291 matrix_buffer_->Release();
    -
    292 matrix_buffer_ = 0;
    -
    293 }
    -
    294
    -
    295 // Release the layout.
    -
    296 if (layout_)
    -
    297 {
    -
    298 layout_->Release();
    -
    299 layout_ = 0;
    -
    300 }
    -
    301
    -
    302 // Release the pixel shader.
    -
    303 if (pixel_shader_)
    -
    304 {
    -
    305 pixel_shader_->Release();
    -
    306 pixel_shader_ = 0;
    -
    307 }
    -
    308
    -
    309 // Release the vertex shader.
    -
    310 if (vertex_shader_)
    -
    311 {
    -
    312 vertex_shader_->Release();
    -
    313 vertex_shader_ = 0;
    -
    314 }
    -
    315
    -
    316 return;
    -
    317}
    -
    318
    -
    319
    -
    320void water_shader_class::output_shader_error_message(ID3D10Blob* errorMessage, HWND hwnd, WCHAR* shaderFilename)
    -
    321{
    -
    322 char* compileErrors;
    -
    323 unsigned long long bufferSize, i;
    -
    324 ofstream fout;
    -
    325
    -
    326
    -
    327 // Get a pointer to the error message text buffer.
    -
    328 compileErrors = (char*)(errorMessage->GetBufferPointer());
    -
    329
    -
    330 // Get the length of the message.
    -
    331 bufferSize = errorMessage->GetBufferSize();
    -
    332
    -
    333 // Open a file to write the error message to.
    -
    334 fout.open("shader-error.txt");
    -
    335
    -
    336 // Write out the error message.
    -
    337 for (i = 0; i < bufferSize; i++)
    -
    338 {
    -
    339 fout << compileErrors[i];
    -
    340 }
    -
    341
    -
    342 // Close the file.
    -
    343 fout.close();
    -
    344
    -
    345 // Release the error message.
    -
    346 errorMessage->Release();
    -
    347 errorMessage = 0;
    -
    348
    -
    349 // Pop a message up on the screen to notify the user to check the text file for compile errors.
    -
    350 MessageBox(hwnd, L"Error compiling shader. Check shader-error.txt for message.", shaderFilename, MB_OK);
    -
    351
    -
    352 return;
    -
    353}
    -
    354
    -
    355bool water_shader_class::set_shader_parameters(ID3D11DeviceContext* deviceContext, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix, XMMATRIX reflectionMatrix,
    -
    356 ID3D11ShaderResourceView* reflectionTexture, ID3D11ShaderResourceView* refractionTexture, ID3D11ShaderResourceView* normalTexture,
    -
    357 float waterTranslation, float reflectRefractScale)
    -
    358{
    -
    359 HRESULT result;
    -
    360 D3D11_MAPPED_SUBRESOURCE mappedResource;
    -
    361 matrix_buffer_type* dataPtr;
    -
    362 unsigned int bufferNumber;
    -
    363 reflection_buffer_type* dataPtr2;
    -
    364 water_buffer_type* dataPtr3;
    -
    365
    -
    366 // Transpose the matrices to prepare them for the shader.
    -
    367 worldMatrix = XMMatrixTranspose(worldMatrix);
    -
    368 viewMatrix = XMMatrixTranspose(viewMatrix);
    -
    369 projectionMatrix = XMMatrixTranspose(projectionMatrix);
    -
    370 reflectionMatrix = XMMatrixTranspose(reflectionMatrix);
    -
    371
    -
    372 // Lock the constant buffer so it can be written to.
    -
    373 result = deviceContext->Map(matrix_buffer_, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
    -
    374 if (FAILED(result))
    -
    375 {
    -
    376 return false;
    -
    377 }
    -
    378
    -
    379 // Get a pointer to the data in the constant buffer.
    -
    380 dataPtr = (matrix_buffer_type*)mappedResource.pData;
    -
    381
    -
    382 // Copy the matrices into the constant buffer.
    -
    383 dataPtr->world = worldMatrix;
    -
    384 dataPtr->view = viewMatrix;
    -
    385 dataPtr->projection = projectionMatrix;
    -
    386
    -
    387 // Unlock the constant buffer.
    -
    388 deviceContext->Unmap(matrix_buffer_, 0);
    -
    389
    -
    390 // Set the position of the constant buffer in the vertex shader.
    -
    391 bufferNumber = 0;
    -
    392
    -
    393 // Finanly set the constant buffer in the vertex shader with the updated values.
    -
    394 deviceContext->VSSetConstantBuffers(bufferNumber, 1, &matrix_buffer_);
    -
    395
    -
    396 // Lock the reflection constant buffer so it can be written to.
    -
    397 result = deviceContext->Map(reflection_buffer_, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
    -
    398 if (FAILED(result))
    -
    399 {
    -
    400 return false;
    -
    401 }
    -
    402
    -
    403 // Get a pointer to the data in the constant buffer.
    -
    404 dataPtr2 = (reflection_buffer_type*)mappedResource.pData;
    -
    405
    -
    406 // Copy the reflection matrix into the constant buffer.
    -
    407 dataPtr2->reflection = reflectionMatrix;
    -
    408
    -
    409 // Unlock the constant buffer.
    -
    410 deviceContext->Unmap(reflection_buffer_, 0);
    -
    411
    -
    412 // Set the position of the reflection constant buffer in the vertex shader.
    -
    413 bufferNumber = 1;
    -
    414
    -
    415 // Finally set the reflection constant buffer in the vertex shader with the updated values.
    -
    416 deviceContext->VSSetConstantBuffers(bufferNumber, 1, &reflection_buffer_);
    -
    417
    -
    418 // Set the reflection texture resource in the pixel shader.
    -
    419 deviceContext->PSSetShaderResources(0, 1, &reflectionTexture);
    -
    420
    -
    421 // Set the refraction texture resource in the pixel shader.
    -
    422 deviceContext->PSSetShaderResources(1, 1, &refractionTexture);
    -
    423
    -
    424 // Set the normal map texture resource in the pixel shader.
    -
    425 deviceContext->PSSetShaderResources(2, 1, &normalTexture);
    -
    426
    -
    427 // Lock the water constant buffer so it can be written to.
    -
    428 result = deviceContext->Map(water_buffer_, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
    -
    429 if (FAILED(result))
    -
    430 {
    -
    431 return false;
    -
    432 }
    -
    433
    -
    434 // Get a pointer to the data in the constant buffer.
    -
    435 dataPtr3 = (water_buffer_type*)mappedResource.pData;
    -
    436
    -
    437 // Copy the water data into the constant buffer.
    -
    438 dataPtr3->water_translation = waterTranslation;
    -
    439 dataPtr3->reflect_refract_scale = reflectRefractScale;
    -
    440 dataPtr3->padding = XMFLOAT2(0.0f, 0.0f);
    -
    441
    -
    442 // Unlock the constant buffer.
    -
    443 deviceContext->Unmap(water_buffer_, 0);
    -
    444
    -
    445 // Set the position of the water constant buffer in the pixel shader.
    -
    446 bufferNumber = 0;
    -
    447
    -
    448 // Finally set the water constant buffer in the pixel shader with the updated values.
    -
    449 deviceContext->PSSetConstantBuffers(bufferNumber, 1, &water_buffer_);
    -
    450
    -
    451 return true;
    -
    452}
    -
    453
    -
    454void water_shader_class::render_shader(ID3D11DeviceContext* deviceContext, int indexCount)
    -
    455{
    -
    456 // Set the vertex input layout.
    -
    457 deviceContext->IASetInputLayout(layout_);
    -
    458
    -
    459 // Set the vertex and pixel shaders that will be used to render this triangle.
    -
    460 deviceContext->VSSetShader(vertex_shader_, NULL, 0);
    -
    461 deviceContext->PSSetShader(pixel_shader_, NULL, 0);
    -
    462
    -
    463 // Set the sampler state in the pixel shader.
    -
    464 deviceContext->PSSetSamplers(0, 1, &sample_state_);
    -
    465
    -
    466 // render the geometry.
    -
    467 deviceContext->DrawIndexed(indexCount, 0, 0);
    -
    468
    -
    469 return;
    -
    470}
    - -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:67b3fa51c6a7c68c40b6bfa2c49530ef1736060a5c185160e78e13afefa362e4 +size 68717 diff --git a/doxygen_docs/html/water__shader__class_8h_source.html b/doxygen_docs/html/water__shader__class_8h_source.html index e8d4848..5f8db12 100644 --- a/doxygen_docs/html/water__shader__class_8h_source.html +++ b/doxygen_docs/html/water__shader__class_8h_source.html @@ -1,181 +1,3 @@ - - - - - - - -Khaotic Engine Reborn: enginecustom/src/inc/shader/water_shader_class.h Source File - - - - - - - - - - - - - - - -
    -
    - - - - - - -
    -
    Khaotic Engine Reborn -
    -
    -
    - - - - - - - - -
    -
    - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    Loading...
    -
    Searching...
    -
    No Matches
    -
    -
    -
    -
    - -
    -
    water_shader_class.h
    -
    -
    -
    1#ifndef _WATERSHADERCLASS_H_
    -
    2#define _WATERSHADERCLASS_H_
    -
    3
    -
    4
    -
    6// INCLUDES //
    -
    8#include <d3d11.h>
    -
    9#include <d3dcompiler.h>
    -
    10#include <directxmath.h>
    -
    11#include <fstream>
    -
    12using namespace DirectX;
    -
    13using namespace std;
    -
    14
    -
    15
    -
    17// Class name: water_shader_class
    -
    - -
    20{
    -
    21private:
    -
    22 struct matrix_buffer_type
    -
    23 {
    -
    24 XMMATRIX world;
    -
    25 XMMATRIX view;
    -
    26 XMMATRIX projection;
    -
    27 };
    -
    28
    -
    29 struct reflection_buffer_type
    -
    30 {
    -
    31 XMMATRIX reflection;
    -
    32 };
    -
    33
    -
    34 struct water_buffer_type
    -
    35 {
    -
    36 float water_translation;
    -
    37 float reflect_refract_scale;
    -
    38 XMFLOAT2 padding;
    -
    39 };
    -
    40
    -
    41public:
    - - - -
    45
    -
    46 bool initialize(ID3D11Device*, HWND);
    -
    47 void shutdown();
    -
    48 bool render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*,
    -
    49 ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, float, float);
    -
    50
    -
    51private:
    -
    52 bool initialize_shader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
    -
    53 void shutdown_shader();
    -
    54 void output_shader_error_message(ID3D10Blob*, HWND, WCHAR*);
    -
    55
    -
    56 bool set_shader_parameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*,
    -
    57 ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, float, float);
    -
    58 void render_shader(ID3D11DeviceContext*, int);
    -
    59
    -
    60private:
    -
    61 ID3D11VertexShader* vertex_shader_;
    -
    62 ID3D11PixelShader* pixel_shader_;
    -
    63 ID3D11InputLayout* layout_;
    -
    64 ID3D11Buffer* matrix_buffer_;
    -
    65 ID3D11SamplerState* sample_state_;
    -
    66 ID3D11Buffer* reflection_buffer_;
    -
    67 ID3D11Buffer* water_buffer_;
    -
    68};
    -
    -
    69
    -
    70#endif
    - -
    -
    - - - - +version https://git-lfs.github.com/spec/v1 +oid sha256:84725d1f59aef01fe6164bfeeb34b0056e0b6b9e8147491db6bd99babc923077 +size 14228