1#include "application_class.h"
3#include "depth_shader_class.h"
4#include "system_class.h"
14 mouse_strings_ =
nullptr;
15 font_shader_ =
nullptr;
18 fps_string_ =
nullptr;
19 shader_manager_ =
nullptr;
20 render_count_string_ =
nullptr;
21 model_list_ =
nullptr;
23 display_plane_ =
nullptr;
24 bath_model_ =
nullptr;
25 water_model_ =
nullptr;
27 refraction_texture_ =
nullptr;
28 reflection_texture_ =
nullptr;
29 scene_texture_ =
nullptr;
34 swap_chain_ =
nullptr;
35 ground_model_ =
nullptr;
36 wall_model_ =
nullptr;
38 base_view_matrix_ = XMMatrixIdentity();
39 render_texture_ =
nullptr;
44 water_translation_ = 0.0f;
45 true_light_position_ = XMFLOAT3(0.0f, 0.0f, 0.0f);
46 light_model_ =
nullptr;
48 tab_was_pressed_ =
false;
51application_class::~application_class()
54 culling_active_ =
false;
57 if (physics_thread_.joinable())
59 physics_thread_.join();
62 if (culling_thread_.joinable())
64 culling_thread_.join();
73 Logger::Get().
Log(
"Initializing application class", __FILE__, __LINE__, Logger::LogLevel::Initialize);
77 char mouseString1[32], mouseString2[32], mouseString3[32];
78 char modelFilename[128], renderString[32];
79 char bitmapFilename[128];
80 char spriteFilename[128];
86 entity_manager_ = std::make_unique<ecs::EntityManager>();
88 screen_width_ = screenWidth;
89 screen_height_ = screenHeight;
100 Logger::Get().
Log(
"Could not create the Direct3D object", __FILE__, __LINE__, Logger::LogLevel::Error);
104 result = direct_3d_->
initialize(screen_width_, screen_height_, vsync_enabled_, hwnd, full_screen, screen_depth, screen_near);
107 Logger::Get().
Log(
"Could not initialize Direct3D", __FILE__, __LINE__, Logger::LogLevel::Error);
115 Logger::Get().
Log(
"Could not create the camera object", __FILE__, __LINE__, Logger::LogLevel::Error);
122 Logger::Get().
Log(
"Could not create the sun camera object", __FILE__, __LINE__, Logger::LogLevel::Error);
137 active_camera_ = camera_;
142 result = font_shader_->initialize(direct_3d_->
get_device(), hwnd);
145 Logger::Get().
Log(
"Could not initialize the font shader object", __FILE__, __LINE__, Logger::LogLevel::Error);
155 Logger::Get().
Log(
"Could not initialize the font object", __FILE__, __LINE__, Logger::LogLevel::Error);
162 result = render_texture_->Initialize(direct_3d_->
get_device(), 256, 256, screen_depth, screen_near, 1);
165 Logger::Get().
Log(
"Could not initialize the render texture object", __FILE__, __LINE__, Logger::LogLevel::Error);
173 result = scene_texture_->Initialize(direct_3d_->
get_device(), 256, 256, screen_depth, screen_near, 1);
176 Logger::Get().
Log(
"Could not initialize the render texture object", __FILE__, __LINE__, Logger::LogLevel::Error);
183 result = display_plane_->Initialize(direct_3d_->
get_device(), 1.0f, 1.0f);
186 Logger::Get().
Log(
"Could not initialize the display plane object", __FILE__, __LINE__, Logger::LogLevel::Error);
193 strcpy_s(spriteFilename,
"sprite_data_01.txt");
198 result = sprite_->Initialize(direct_3d_->
get_device(), direct_3d_->
get_device_context(), screenWidth, screenHeight, spriteFilename, 50, 50);
201 Logger::Get().
Log(
"Could not initialize the sprite object", __FILE__, __LINE__, Logger::LogLevel::Error);
206 strcpy_s(mouseString1,
"Mouse X: 0");
207 strcpy_s(mouseString2,
"Mouse Y: 0");
208 strcpy_s(mouseString3,
"Mouse Button: No");
213 for (
int i = 0; i < 3; i++)
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);
219 Logger::Get().
Log(
"Could not initialize the mouse strings", __FILE__, __LINE__, Logger::LogLevel::Error);
225 strcpy_s(bitmapFilename,
"assets/Texture/stone01.tga");
230 result = bitmap_->initialize(direct_3d_->
get_device(), direct_3d_->
get_device_context(), screenWidth, screenHeight, bitmapFilename, 50, 50);
233 Logger::Get().
Log(
"Could not initialize the bitmap object", __FILE__, __LINE__, Logger::LogLevel::Error);
238 strcpy_s(modelFilename,
"assets/Model/TXT/cube.txt");
241 std::vector<std::wstring> textureFilenames = {
242 L
"assets/Texture/stone01.png"
247 for (
const auto& textureFilename : textureFilenames)
249 ID3D11ShaderResourceView* texture =
nullptr;
250 Hresult = DirectX::CreateWICTextureFromFile(direct_3d_->
get_device(), direct_3d_->
get_device_context(), textureFilename.c_str(),
nullptr, &texture);
253 Logger::Get().
Log(
"Failed to load texture: " + std::string(textureFilename.begin(), textureFilename.end()), __FILE__, __LINE__, Logger::LogLevel::Error);
256 CubeTextures.diffuse.push_back(texture);
266 Logger::Get().
Log(
"Could not initialize the model object", __FILE__, __LINE__, Logger::LogLevel::Error);
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);
282 lights_.resize(num_lights_);
285 lights_[0]->SetDiffuseColor(1.0f, 1.0f, 1.0f, 1.0f);
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);
293 lights_[1]->SetDiffuseColor(1.0f, 0.0f, 0.0f, 1.0f);
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);
301 lights_[2]->SetDiffuseColor(0.0f, 1.0f, 0.0f, 1.0f);
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);
309 lights_[3]->SetDiffuseColor(0.0f, 0.0f, 1.0f, 1.0f);
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);
321 sun_light_->SetDiffuseColor(1.0f, 1.0f, 1.0f, 1.0f);
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);
327 sun_camera_->
set_position(sun_light_->GetPosition().x, sun_light_->GetPosition().y, sun_light_->GetPosition().z);
334 result = shader_manager_->initialize(direct_3d_->
get_device(), hwnd);
337 Logger::Get().
Log(
"Could not initialize the shader manager object", __FILE__, __LINE__, Logger::LogLevel::Error);
342 strcpy_s(renderString,
"render Count: 0");
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);
350 Logger::Get().
Log(
"Could not initialize the render count string", __FILE__, __LINE__, Logger::LogLevel::Error);
356 model_list_->Initialize(25);
359 std::vector<std::wstring> bathTextures = {
360 L
"assets/Texture/marble01.png"
366 for (
const auto& textureFilename : bathTextures)
368 ID3D11ShaderResourceView* texture =
nullptr;
369 Hresult = DirectX::CreateWICTextureFromFile(direct_3d_->
get_device(), direct_3d_->
get_device_context(), textureFilename.c_str(),
nullptr, &texture);
372 Logger::Get().
Log(
"Failed to load texture: " + std::string(textureFilename.begin(), textureFilename.end()), __FILE__, __LINE__, Logger::LogLevel::Error);
375 BathTextures.diffuse.push_back(texture);
379 strcpy_s(modelFilename,
"assets/Model/TXT/bath.txt");
387 MessageBox(hwnd, L
"Could not initialize the bath model object.", L
"Error", MB_OK);
392 strcpy_s(modelFilename,
"assets/Model/TXT/water.txt");
394 std::vector<std::wstring> waterTextures = {
395 L
"assets/Texture/water01.png"
401 for (
const auto& textureFilename : waterTextures)
403 ID3D11ShaderResourceView* texture =
nullptr;
404 Hresult = DirectX::CreateWICTextureFromFile(direct_3d_->
get_device(), direct_3d_->
get_device_context(), textureFilename.c_str(),
nullptr, &texture);
407 Logger::Get().
Log(
"Failed to load texture: " + std::string(textureFilename.begin(), textureFilename.end()), __FILE__, __LINE__, Logger::LogLevel::Error);
410 WaterTextures.diffuse.push_back(texture);
419 MessageBox(hwnd, L
"Could not initialize the water model object.", L
"Error", MB_OK);
426 result = refraction_texture_->Initialize(direct_3d_->
get_device(), screenWidth, screenHeight, screen_depth, screen_near, 1);
429 MessageBox(hwnd, L
"Could not initialize the refraction render texture object.", L
"Error", MB_OK);
436 result = reflection_texture_->Initialize(direct_3d_->
get_device(), screenWidth, screenHeight, screen_depth, screen_near, 1);
439 MessageBox(hwnd, L
"Could not initialize the reflection render texture object.", L
"Error", MB_OK);
444 water_height_ = -9.25f;
447 water_translation_ = 100.0f;
452 result = timer_->Initialize();
455 Logger::Get().
Log(
"Could not initialize the timer object", __FILE__, __LINE__, Logger::LogLevel::Error);
469 strcpy_s(fpsString,
"Fps: 0");
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);
477 Logger::Get().
Log(
"Could not initialize the fps string", __FILE__, __LINE__, Logger::LogLevel::Error);
482 if (!shadow_map_->initialize(direct_3d_->
get_device(), 2048, 2048))
484 Logger::Get().
Log(
"Could not initialize the shadow map object", __FILE__, __LINE__, Logger::LogLevel::Error);
488 stats_ =
new stats();
489 if (!stats_->initialize(
this))
491 Logger::Get().
Log(
"Could not initialize the stats object", __FILE__, __LINE__, Logger::LogLevel::Error);
504 culling_active_ =
true;
505 culling_thread_ = std::thread(&application_class::culling_thread_function,
this);
508 catch (
const std::exception& e)
510 Logger::Get().
Log(std::string(
"Exception caught during initialization: ") + e.what(), __FILE__, __LINE__, Logger::LogLevel::Error);
513 Logger::Get().
Log(
"Application class initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
522 Logger::Get().
Log(
"Shutting down application class", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
527 Logger::Get().
Log(
"Releasing the shader manager object", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
529 shader_manager_->shutdown();
530 delete shader_manager_;
533 Logger::Get().
Log(
"Shader manager object released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
537 if (reflection_texture_)
539 reflection_texture_->Shutdown();
540 delete reflection_texture_;
541 reflection_texture_ = 0;
545 if (refraction_texture_)
547 refraction_texture_->Shutdown();
548 delete refraction_texture_;
549 refraction_texture_ = 0;
555 water_model_->Shutdown();
563 bath_model_->Shutdown();
577 Logger::Get().
Log(
"Releasing the display plane object", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
579 display_plane_->Shutdown();
580 delete display_plane_;
583 Logger::Get().
Log(
"Display plane object released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
589 Logger::Get().
Log(
"Releasing the position object", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
594 Logger::Get().
Log(
"Position object released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
600 Logger::Get().
Log(
"Releasing the model list object", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
602 model_list_->Shutdown();
606 Logger::Get().
Log(
"Model list object released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
610 if (render_count_string_)
612 Logger::Get().
Log(
"Releasing the render count string object", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
614 render_count_string_->Shutdown();
615 delete render_count_string_;
616 render_count_string_ = 0;
618 Logger::Get().
Log(
"render count string object released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
624 Logger::Get().
Log(
"Releasing the mouse strings", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
626 mouse_strings_[0].Shutdown();
627 mouse_strings_[1].Shutdown();
628 mouse_strings_[2].Shutdown();
630 delete[] mouse_strings_;
633 Logger::Get().
Log(
"Mouse strings released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
639 Logger::Get().
Log(
"Releasing the fps string object", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
641 fps_string_->Shutdown();
645 Logger::Get().
Log(
"Fps string object released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
651 Logger::Get().
Log(
"Releasing the fps object", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
656 Logger::Get().
Log(
"Fps object released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
662 Logger::Get().
Log(
"Releasing the font object", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
668 Logger::Get().
Log(
"Font object released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
674 Logger::Get().
Log(
"Releasing the font shader object", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
676 font_shader_->shutdown();
680 Logger::Get().
Log(
"Font shader object released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
686 Logger::Get().
Log(
"Releasing the timer object", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
691 Logger::Get().
Log(
"Timer object released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
697 Logger::Get().
Log(
"Releasing the sprite object", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
703 Logger::Get().
Log(
"Sprite object released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
706 for (
auto light : lights_)
708 Logger::Get().
Log(
"Releasing the light object", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
714 Logger::Get().
Log(
"Light object released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
720 Logger::Get().
Log(
"Releasing the light object", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
723 Logger::Get().
Log(
"Light object released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
729 Logger::Get().
Log(
"Releasing the model object", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
733 Logger::Get().
Log(
"Model object released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
738 scene_texture_->Shutdown();
739 delete scene_texture_;
740 scene_texture_ =
nullptr;
745 Logger::Get().
Log(
"Releasing the sun camera object", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
747 sun_camera_ =
nullptr;
748 Logger::Get().
Log(
"Sun camera object released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
752 shadow_map_->shutdown();
754 shadow_map_ =
nullptr;
757 Logger::Get().
Log(
"Application class shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
762 stats_->reset_draw_call_count();
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;
771 static int lastMouseX = 0, lastMouseY = 0;
773 static float rotation = 360.0f;
774 static float x = 0.0f;
775 static float y = 3.0f;
776 static float z = 0.0f;
782 frameTime = timer_->GetTime();
785 if (Input->IsEscapePressed())
787 Logger::Get().
Log(
"User pressed escape, exiting application", __FILE__, __LINE__, Logger::LogLevel::Input);
792 Input->GetMouseLocation(mouseX, mouseY);
795 leftMouseDown = Input->IsLeftMousePressed();
796 rightMouseDown = Input->IsRightMousePressed();
798 currentMouseX = mouseX;
800 int deltaX = currentMouseX - lastMouseX;
801 lastMouseX = currentMouseX;
803 currentMouseY = mouseY;
805 int deltaY = currentMouseY - lastMouseY;
806 lastMouseY = currentMouseY;
809 position_->SetFrameTime(timer_->GetTime());
811 position_->TurnMouse((
float)deltaX, (
float)deltaY, 0.1f, rightMouseDown);
814 position_->GetRotation(rotationY, rotationX);
816 scrollUp = Input->IsScrollUp();
817 scrollDown = Input->IsScrollDown();
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);
829 XMFLOAT3 dir = sun_light_->GetDirection();
830 float pitch = asinf(-dir.y) * (180.0f / XM_PI);
831 float yaw = atan2f(dir.x, dir.z) * (180.0f / XM_PI);
834 if (Input->is_key_pressed(DIK_TAB)) {
835 if (!tab_was_pressed_) {
837 if (active_camera_ == camera_)
838 active_camera_ = sun_camera_;
840 active_camera_ = camera_;
841 tab_was_pressed_ =
true;
844 tab_was_pressed_ =
false;
847 if (active_camera_ == camera_) {
853 sun_camera_->
set_position(sun_light_->GetPosition().x, sun_light_->GetPosition().y, sun_light_->GetPosition().z);
863 result = render(rotation, x, y, z, textureTranslation);
866 Logger::Get().
Log(
"Could not render the graphics scene", __FILE__, __LINE__, Logger::LogLevel::Error);
871 result = update_fps();
874 Logger::Get().
Log(
"Could not update the frames per second", __FILE__, __LINE__, Logger::LogLevel::Error);
879 rotation -= 0.0174532925f * speed_;
886 water_translation_ += 0.001f;
887 if (water_translation_ > 1.0f)
889 water_translation_ -= 1.0f;
893 result = render_refraction_to_texture();
900 result = render_reflection_to_texture();
906 inputs_.key_left = Input->IsLeftArrowPressed();
907 inputs_.key_right = Input->IsRightArrowPressed();
908 inputs_.key_up = Input->IsUpArrowPressed();
909 inputs_.key_down = Input->IsDownArrowPressed();
912 result = render_scene_to_texture(rotation);
915 Logger::Get().
Log(
"Could not render the scene to the render texture", __FILE__, __LINE__, Logger::LogLevel::Error);
920 result = update_mouse_strings(mouseX, mouseY, leftMouseDown);
923 Logger::Get().
Log(
"Could not update the mouse strings", __FILE__, __LINE__, Logger::LogLevel::Error);
928 sprite_->Update(frameTime);
931 textureTranslation += 0.01f;
932 if (textureTranslation > 1.0f)
934 textureTranslation -= 1.0f;
940bool application_class::render_refraction_to_texture()
942 XMMATRIX worldMatrix, viewMatrix, projectionMatrix;
943 XMFLOAT4 diffuseColor[4], lightPosition[4], ambientColor[4];
949 clipPlane = XMFLOAT4(0.0f, -1.0f, 0.0f, water_height_ + 0.1f);
953 refraction_texture_->ClearRenderTarget(direct_3d_->
get_device_context(), 0.0f, 0.0f, 0.0f, 1.0f);
961 for (i = 0; i < num_lights_; i++)
964 diffuseColor[i] = lights_[i]->GetDiffuseColor();
967 lightPosition[i] = lights_[i]->GetPosition();
970 ambientColor[i] = lights_[i]->GetAmbientColor();
974 worldMatrix = XMMatrixTranslation(0.0f, -10.0f, 0.0f);
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);
993bool application_class::render_reflection_to_texture()
995 XMMATRIX reflectionViewMatrix;
999 reflection_texture_->ClearRenderTarget(direct_3d_->
get_device_context(), 0.0f, 0.0f, 0.0f, 1.0f);
1014bool application_class::render_scene_to_texture(
float rotation)
1016 XMMATRIX worldMatrix, viewMatrix, projectionMatrix;
1021 render_texture_->ClearRenderTarget(direct_3d_->
get_device_context(), 0.0f, 0.5f, 1.0f, 1.0f);
1027 render_texture_->GetProjectionMatrix(projectionMatrix);
1030 worldMatrix = XMMatrixRotationY(rotation);
1035 result = shader_manager_->render_texture_shader(direct_3d_->
get_device_context(), model_->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix,
1036 model_->GetTexture(TextureType::Diffuse,0));
1049bool application_class::render(
float rotation,
float x,
float y,
float z,
float textureTranslation)
1051 XMMATRIX worldMatrix, viewMatrix, orthoMatrix, projectionMatrix, rotateMatrix, translateMatrix, scaleMatrix, srMatrix, reflectionMatrix;
1052 XMFLOAT4 diffuseColor[4], lightPosition[4], ambientColor[4];
1061 active_camera_->
render();
1073 for (i = 0; i < num_lights_; i++)
1076 diffuseColor[i] = lights_[i]->GetDiffuseColor();
1079 lightPosition[i] = lights_[i]->GetPosition();
1082 ambientColor[i] = lights_[i]->GetPosition();
1088 if ((
float)scene_texture_->GetTextureWidth() != window_size_.x || (
float)scene_texture_->GetTextureHeight() != window_size_.y)
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);
1104 scaleMatrix = XMMatrixScaling(0.5f, 0.5f, 0.5f);
1105 rotateMatrix = XMMatrixRotationY(rotation);
1106 translateMatrix = XMMatrixTranslation(x, y, z);
1109 srMatrix = XMMatrixMultiply(scaleMatrix, rotateMatrix);
1110 worldMatrix = XMMatrixMultiply(srMatrix, translateMatrix);
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);
1119 update_skybox_position();
1132 result = render_pass(diffuseColor, lightPosition, ambientColor, viewMatrix, projectionMatrix);
1135 Logger::Get().
Log(
"Could not render the model using any shader", __FILE__, __LINE__, Logger::LogLevel::Error);
1158 Logger::Get().
Log(
"Could not update the render count string", __FILE__, __LINE__, Logger::LogLevel::Error);
1164 worldMatrix = XMMatrixTranslation(0.0f, -10.0f, 0.0f);
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);
1184 worldMatrix = XMMatrixTranslation(0.0f, water_height_, 0.0f);
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);
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());
1212 Logger::Get().
Log(
"Could not render the render count text string using the font shader", __FILE__, __LINE__, Logger::LogLevel::Error);
1219 result = font_shader_->render(direct_3d_->
get_device_context(), fps_string_->GetIndexCount(), worldMatrix, base_view_matrix_, orthoMatrix,
1220 font_->GetTexture(), fps_string_->GetPixelColor());
1223 Logger::Get().
Log(
"Could not render the fps text string using the font shader", __FILE__, __LINE__, Logger::LogLevel::Error);
1228 for (i = 0; i < 3; i++)
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());
1236 Logger::Get().
Log(
"Could not render the mouse text strings using the font shader", __FILE__, __LINE__, Logger::LogLevel::Error);
1249 result = shader_manager_->render_texture_shader(direct_3d_->
get_device_context(), model_->GetIndexCount(), worldMatrix, viewMatrix, orthoMatrix,
1250 sprite_->GetTexture());
1253 Logger::Get().
Log(
"Could not render the sprite using the texture shader", __FILE__, __LINE__, Logger::LogLevel::Error);
1264 for (i = 0; i < num_lights_; i++)
1267 diffuseColor[i] = lights_[i]->GetDiffuseColor();
1270 lightPosition[i] = lights_[i]->GetPosition();
1278d_3d_class* application_class::get_direct_3d()
1285 return GetSystemMetrics(SM_CXSCREEN);
1290 return GetSystemMetrics(SM_CYSCREEN);
1295 Logger::Get().
Log(
"Génération du terrain avec ECS", __FILE__, __LINE__, Logger::LogLevel::Info);
1301 float scaleX = 10.0f;
1302 float scaleY = 1.0f;
1303 float scaleZ = 10.0f;
1308 std::string modelName =
"assets/Model/OBJ/plane.obj";
1309 std::shared_ptr<model_class> sharedModel;
1311 auto it = g_model_cache.find(modelName);
1312 if (it != g_model_cache.end()) {
1314 Logger::Get().
Log(
"Using cached model for terrain: " + modelName, __FILE__, __LINE__);
1315 sharedModel = it->second;
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");
1325 char modelFilename[128];
1326 strcpy_s(modelFilename, modelName.c_str());
1328 auto newModel = std::make_shared<model_class>();
1332 Logger::Get().
Log(
"Impossible d'initialiser le modèle du terrain", __FILE__, __LINE__, Logger::LogLevel::Error);
1337 g_model_cache[modelName] = newModel;
1338 sharedModel = newModel;
1339 Logger::Get().
Log(
"Added terrain model to cache: " + modelName, __FILE__, __LINE__);
1343 if (entity_manager_) {
1345 for (
int i = 0; i < gridSizeX; i++) {
1346 for (
int j = 0; j < gridSizeZ; j++) {
1348 auto entity = entity_manager_->CreateEntity();
1352 identity->
SetName(
"TerrainTile_" + std::to_string(i) +
"_" + std::to_string(j));
1353 identity->SetType(ecs::ObjectType::Terrain);
1357 transform->
SetPosition(XMVectorSet(i * scaleX, -12.0f, j * scaleZ, 0.0f));
1358 transform->SetScale(XMVectorSet(scaleX, scaleY, scaleZ, 0.0f));
1359 transform->UpdateWorldMatrix();
1363 render->InitializeWithModel(sharedModel);
1374 int totalTiles = gridSizeX * gridSizeZ;
1375 Logger::Get().
Log(
"Terrain généré avec " + std::to_string(totalTiles) +
" tuiles", __FILE__, __LINE__, Logger::LogLevel::Info);
1380 std::lock_guard<std::mutex> lock(objects_mutex_);
1383 char modelFilename[128];
1385 filesystem::path p(filepath);
1386 string filename = p.stem().string();
1388 size_t convertedChars = 0;
1389 (void)wcstombs_s(&convertedChars, modelFilename,
sizeof(modelFilename), filepath.c_str(), _TRUNCATE);
1391 filesystem::current_path(w_folder_);
1394 std::vector<std::wstring> kobjTexture = {
1395 L
"assets/Texture/Bricks2K.png",
1396 L
"assets/Texture/BricksNRM2K.png",
1397 L
"assets/Texture/BricksGLOSS2K.png"
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]);
1406 std::string modelKey = std::string(modelFilename);
1407 std::shared_ptr<model_class> sharedModel;
1409 auto it = g_model_cache.find(modelKey);
1410 if (it != g_model_cache.end()) {
1412 Logger::Get().
Log(
"Using cached model for " + modelKey, __FILE__, __LINE__);
1413 sharedModel = it->second;
1417 sharedModel = std::make_shared<model_class>();
1424 Logger::Get().
Log(
"Failed to initialize model for object: " + modelKey, __FILE__, __LINE__, Logger::LogLevel::Error);
1429 g_model_cache[modelKey] = sharedModel;
1430 Logger::Get().
Log(
"Added model to cache: " + modelKey, __FILE__, __LINE__);
1434 auto entity = entity_manager_->CreateEntity();
1439 identity->SetType(ecs::ObjectType::Unknown);
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();
1449 render->InitializeWithModel(sharedModel);
1459 Logger::Get().
Log(
"ECS entity created with ID: " + std::to_string(identity->GetId()), __FILE__, __LINE__);
1466 std::lock_guard<std::mutex> lock(objects_mutex_);
1469 std::string model_name =
"assets/Model/TXT/cube.txt";
1470 std::shared_ptr<model_class> sharedModel;
1472 auto it = g_model_cache.find(model_name);
1473 if (it != g_model_cache.end())
1475 Logger::Get().
Log(
"Using cached model: " + model_name, __FILE__, __LINE__);
1476 sharedModel = it->second;
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");
1485 char model_filename[128];
1486 strcpy_s(model_filename, model_name.c_str());
1488 auto newModel = std::make_shared<model_class>();
1491 Logger::Get().
Log(
"Failed to initialize cube model", __FILE__, __LINE__, Logger::LogLevel::Error);
1495 g_model_cache[model_name] = newModel;
1496 sharedModel = newModel;
1497 Logger::Get().
Log(
"Added cube model to cache: " + model_name, __FILE__, __LINE__);
1500 if (entity_manager_)
1502 auto entity = entity_manager_->CreateEntity();
1506 identity->SetType(ecs::ObjectType::Cube);
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();
1514 render->InitializeWithModel(sharedModel);
1522 Logger::Get().
Log(
"Cube added successfully", __FILE__, __LINE__, Logger::LogLevel::Info);
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);
1531 if (entity_manager_) {
1534 for (
auto& entity : entities_with_identity) {
1536 if (identity && identity->GetId() == entity_id) {
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);
1550 std::lock_guard<std::mutex> lock(objects_mutex_);
1551 Logger::Get().
Log(
"Deleting terrain", __FILE__, __LINE__, Logger::LogLevel::Info);
1555 for (
auto& entity : entities_with_terrain) {
1557 if (identity && identity->GetType() == ecs::ObjectType::Terrain) {
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);
1567bool application_class::update_mouse_strings(
int mouseX,
int mouseY,
bool mouseDown)
1569 char tempString[16], finalString[32];
1574 sprintf_s(tempString,
"%d", mouseX);
1577 strcpy_s(finalString,
"Mouse X: ");
1578 strcat_s(finalString, tempString);
1581 result = mouse_strings_[0].UpdateText(direct_3d_->
get_device_context(), font_, finalString, 10, 50, 1.0f, 1.0f, 1.0f);
1584 Logger::Get().
Log(
"Could not update the mouse X string", __FILE__, __LINE__, Logger::LogLevel::Error);
1589 sprintf_s(tempString,
"%d", mouseY);
1592 strcpy_s(finalString,
"Mouse Y: ");
1593 strcat_s(finalString, tempString);
1596 result = mouse_strings_[1].UpdateText(direct_3d_->
get_device_context(), font_, finalString, 10, 75, 1.0f, 1.0f, 1.0f);
1599 Logger::Get().
Log(
"Could not update the mouse Y string", __FILE__, __LINE__, Logger::LogLevel::Error);
1606 strcpy_s(finalString,
"Mouse Button: Yes");
1610 strcpy_s(finalString,
"Mouse Button: No");
1614 result = mouse_strings_[2].UpdateText(direct_3d_->
get_device_context(), font_, finalString, 10, 100, 1.0f, 1.0f, 1.0f);
1618 Logger::Get().
Log(
"Could not update the mouse button string", __FILE__, __LINE__, Logger::LogLevel::Error);
1625bool application_class::update_fps()
1628 char tempString[16], finalString[16];
1629 float red, green, blue;
1636 stats_->update_display_stats();
1639 fps = fps_->GetFps();
1642 if (previous_fps_ == fps)
1648 previous_fps_ = fps;
1657 sprintf_s(tempString,
"%d", fps);
1660 strcpy_s(finalString,
"Fps: ");
1661 strcat_s(finalString, tempString);
1688 result = fps_string_->UpdateText(direct_3d_->
get_device_context(), font_, finalString, 10, 10, red, green, blue);
1691 Logger::Get().
Log(
"Could not update the fps string", __FILE__, __LINE__, Logger::LogLevel::Error);
1698bool application_class::update_render_count_string(
int renderCount)
1700 char tempString[16], finalString[32];
1705 sprintf_s(tempString,
"%d", renderCount);
1708 strcpy_s(finalString,
"render Count: ");
1709 strcat_s(finalString, tempString);
1712 result = render_count_string_->UpdateText(direct_3d_->
get_device_context(), font_, finalString, 10, 30, 1.0f, 1.0f, 1.0f);
1715 Logger::Get().
Log(
"Could not update the render count string", __FILE__, __LINE__, Logger::LogLevel::Error);
1725 XMVECTOR lightColor = XMVectorSet(lights_[index]->GetDiffuseColor().x, lights_[index]->GetDiffuseColor().y, lights_[index]->GetDiffuseColor().z, 1.0f);
1733 XMVECTOR lightPosition = XMVectorSet(lights_[index]->GetPosition().x, lights_[index]->GetPosition().y, lights_[index]->GetPosition().z, 1.0f);
1735 return lightPosition;
1741 XMFLOAT4 lightColor;
1742 XMStoreFloat4(&lightColor, color);
1745 lights_[index]->SetDiffuseColor(lightColor.x, lightColor.y, lightColor.z, 1.0f);
1751 XMFLOAT4 lightPosition;
1752 XMStoreFloat4(&lightPosition, position);
1755 lights_[index]->SetPosition(lightPosition.x, lightPosition.y, lightPosition.z);
1761 Logger::Get().
Log(
"Setting screen height to " + std::to_string(height), __FILE__, __LINE__);
1762 screen_height_ = height;
1768 Logger::Get().
Log(
"Setting screen width to " + std::to_string(width), __FILE__, __LINE__);
1769 screen_width_ = width;
1772void application_class::culling_thread_function()
1774 Logger::Get().
Log(
"Thread de culling démarré", __FILE__, __LINE__, Logger::LogLevel::Info);
1776 while (culling_active_)
1783 std::lock_guard<std::mutex> lock(objects_mutex_);
1784 for (
auto* skyboxObject : skybox_)
1788 skyboxObject->SetVisible(
true);
1794 auto all_entity = entity_manager_->GetAllEntities();
1796 for (
auto& entity : all_entity)
1798 std::lock_guard<std::mutex> lock(objects_mutex_);
1800 if (renderComponent && renderComponent->GetModel())
1804 if (transformComponent)
1806 XMVECTOR transformPosition = transformComponent->GetPosition();
1807 float x = XMVectorGetX(transformPosition);
1808 float y = XMVectorGetY(transformPosition);
1809 float z = XMVectorGetZ(transformPosition);
1812 XMVECTOR scale = transformComponent->GetScale();
1813 float radius = max(max(XMVectorGetX(scale), XMVectorGetY(scale)), XMVectorGetZ(scale));
1817 renderComponent->SetVisible(visible);
1824 std::this_thread::sleep_for(std::chrono::milliseconds(16));
1827 Logger::Get().
Log(
"Thread de culling terminé", __FILE__, __LINE__, Logger::LogLevel::Info);
1832bool application_class::render_pass(XMFLOAT4* diffuse, XMFLOAT4* position, XMFLOAT4* ambient, XMMATRIX view, XMMATRIX projection)
1834 std::lock_guard<std::mutex> lock(objects_mutex_);
1835 XMMATRIX scaleMatrix, rotateMatrix, translateMatrix;
1838 int renderCount = 0;
1842 for (
auto& skyboxObject : skybox_)
1844 if (skyboxObject ==
nullptr)
1846 Logger::Get().
Log(
"skyboxObject is null", __FILE__, __LINE__, Logger::LogLevel::Error);
1850 if (!skyboxObject->IsVisible())
1857 scaleMatrix = skyboxObject->GetScaleMatrix();
1858 rotateMatrix = skyboxObject->GetRotateMatrix();
1859 translateMatrix = skyboxObject->GetTranslateMatrix();
1861 XMMATRIX worldMatrix = XMMatrixMultiply(
1862 XMMatrixMultiply(scaleMatrix, rotateMatrix),
1870 result = shader_manager_->render_skybox_shader(
1872 skyboxObject->get_model()->GetIndexCount(),
1876 skyboxObject->get_model()->GetTexture(TextureType::Diffuse,0),
1877 sun_light_->GetDiffuseColor(),
1878 sun_light_->GetAmbientColor(),
1879 sun_light_->GetDirection(),
1880 sun_light_->GetIntensity()
1884 Logger::Get().
Log(
"Could not render the object model using the skybox shader", __FILE__, __LINE__, Logger::LogLevel::Error);
1894 if (entity_manager_) {
1899 XMFLOAT4 sunlightDiffuse = sun_light_->GetDiffuseColor();
1900 XMFLOAT4 sunlightAmbient = sun_light_->GetAmbientColor();
1901 XMFLOAT3 sunlightDirection = sun_light_->GetDirection();
1902 float sunlightIntensity = sun_light_->GetIntensity();
1905 int entitiesRendered = renderSystem.RenderAllEntities(
1906 entity_manager_.get(),
1919 renderCount += entitiesRendered;
1943 XMMATRIX viewMatrix;
1946 frustum_culling_.
ConstructFrustum(screen_depth, projectionMatrix, viewMatrix);
1950void application_class::update_skybox_position()
1953 if (skybox_.empty())
1955 Logger::Get().
Log(
"Skybox is empty", __FILE__, __LINE__, Logger::LogLevel::Error);
1963bool application_class::render_physics(
float delta_time) {
1967 for (
auto& entity : entities_with_physics) {
1969 if (physicsComponent) {
1971 physicsComponent->Update(delta_time);
1980 auto fixedUpdateInterval = std::chrono::milliseconds(1000 / physics_tick_rate_);
1981 auto lastTime = std::chrono::steady_clock::now();
1983 while (!should_quit_)
1985 auto now = std::chrono::steady_clock::now();
1986 if (now - lastTime >= fixedUpdateInterval)
1990 float deltaTime = 1.0f /
static_cast<float>(physics_tick_rate_);
1991 bool result = render_physics(deltaTime);
1994 Logger::Get().
Log(
"Could not render the physics scene", __FILE__, __LINE__, Logger::LogLevel::Error);
1999 std::this_thread::sleep_for(std::chrono::milliseconds(1));
2005 std::string modelName =
"assets/Model/TXT/cube.txt";
2006 std::shared_ptr<model_class> sharedModel;
2009 auto it = g_model_cache.find(modelName);
2010 if (it != g_model_cache.end()) {
2011 sharedModel = it->second;
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);
2019 auto newModel = std::make_shared<model_class>();
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");
2026 Logger::Get().
Log(
"Impossible d'initialiser le modèle du gros cube", __FILE__, __LINE__, Logger::LogLevel::Error);
2029 g_model_cache[modelName] = newModel;
2030 sharedModel = newModel;
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++) {
2037 auto entity = entity_manager_->CreateEntity();
2041 identity->
SetName(
"CubePart_" + std::to_string(x) +
"_" + std::to_string(y) +
"_" + std::to_string(z));
2042 identity->SetType(ecs::ObjectType::Terrain);
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();
2052 render->InitializeWithModel(sharedModel);
2070 stats_ -> update_geometric_stats();
2076 std::lock_guard<std::mutex> lock(objects_mutex_);
2077 int terrainCount = 0;
2081 for (
auto& entity : entities_with_terrain) {
2083 if (identity && identity->GetType() == ecs::ObjectType::Terrain) {
2088 return terrainCount;
void Log(const std::string &message, const std::string &fileName, int lineNumber, LogLevel level=LogLevel::Info)
object * ConstructSkybox(application_class *app)
void Initialize(d_3d_class *d3dClassRef)
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)
int get_screen_height() const
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 update_stats_after_modification()
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
int get_screen_width() const
void set_screen_height(int screen_height)
int get_terrain_entity_count()
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.
ID3D11Device * get_device()
Gets the Direct3D device.
XMMATRIX get_world_matrix() const
void set_back_buffer_render_target()
ID3D11DeviceContext * get_device_context()
Gets the Direct3D device context.
XMMATRIX get_projection_matrix() const
void enable_alpha_blending()
void disable_alpha_blending()
XMMATRIX get_ortho_matrix() const
virtual bool initialize(int, int, bool, HWND, bool, float, float)
Initializes the Direct3D device and related resources.
void SetName(const std::string &name)
void SetPath(const std::wstring &path)
void SetActiveShader(ShaderType shader)
void ConstructFrustum(float screenDepth, XMMATRIX projectionMatrix, XMMATRIX viewMatrix)
bool CheckCube(float xCenter, float yCenter, float zCenter, float radius, float tolerance)