Minor - bigcube generation + using shared model - V11.4.0
This commit is contained in:
125
.idea/.idea.KhaoticEngineReborn/.idea/workspace.xml
generated
125
.idea/.idea.KhaoticEngineReborn/.idea/workspace.xml
generated
@@ -6,19 +6,15 @@
|
|||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="e81d6e08-efc7-40a0-909d-ec4943d948e9" name="Changes" comment="">
|
<list default="true" id="e81d6e08-efc7-40a0-909d-ec4943d948e9" name="Changes" comment="">
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/.idea.KhaoticEngineReborn/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.KhaoticEngineReborn/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/.idea.KhaoticEngineReborn/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.KhaoticEngineReborn/.idea/workspace.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/enginecustom/assets/Texture/imgui.ini" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/enginecustom/assets/imgui.ini" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/enginecustom/imgui.ini" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/imgui.ini" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/enginecustom/imgui.ini" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/imgui.ini" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/enginecustom/src/inc/system/Skybox.h" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/inc/system/Skybox.h" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/enginecustom/src/inc/system/application_class.h" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/inc/system/application_class.h" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/enginecustom/src/inc/system/application_class.h" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/inc/system/application_class.h" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/enginecustom/src/inc/system/imguiManager.h" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/inc/system/imguiManager.h" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/enginecustom/src/inc/system/object.h" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/inc/system/object.h" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/enginecustom/src/inc/system/object.h" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/inc/system/object.h" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/enginecustom/src/inc/system/system_class.h" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/inc/system/system_class.h" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/enginecustom/src/inc/system/stats.h" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/inc/system/stats.h" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/enginecustom/src/src/system/Skybox.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/src/system/Skybox.cpp" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/enginecustom/src/src/system/application_class.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/src/system/application_class.cpp" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/enginecustom/src/src/system/application_class.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/src/system/application_class.cpp" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/enginecustom/src/src/system/imguiManager.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/src/system/imguiManager.cpp" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/enginecustom/src/src/system/object.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/src/system/object.cpp" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/enginecustom/src/src/system/object.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/src/system/object.cpp" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/enginecustom/src/src/system/scene_manager.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/src/system/scene_manager.cpp" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/enginecustom/src/src/system/stats.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/src/system/stats.cpp" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/enginecustom/src/src/system/stats.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/src/system/stats.cpp" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/enginecustom/src/src/system/system_class.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/src/system/system_class.cpp" afterDir="false" />
|
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
@@ -38,9 +34,83 @@
|
|||||||
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
<setting file="cidr-memory-view://4" root0="FORCE_HIGHLIGHTING" />
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
<setting file="file://C:/Program Files (x86)/Windows Kits/10/Include/10.0.26100.0/um/d3d11.h" root0="SKIP_HIGHLIGHTING" />
|
<setting file="file://C:/Program Files (x86)/Windows Kits/10/Include/10.0.26100.0/um/d3d11.h" root0="SKIP_HIGHLIGHTING" />
|
||||||
<setting file="file://C:/Program Files (x86)/Windows Kits/10/Include/10.0.26100.0/um/dinput.h" root0="SKIP_HIGHLIGHTING" />
|
<setting file="file://C:/Program Files (x86)/Windows Kits/10/Include/10.0.26100.0/um/dinput.h" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="file://C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.44.35207/include/memory" root0="SKIP_HIGHLIGHTING" />
|
||||||
<setting file="file://$PROJECT_DIR$/enginecustom/include/Inc/VertexTypes.h" root0="SKIP_HIGHLIGHTING" />
|
<setting file="file://$PROJECT_DIR$/enginecustom/include/Inc/VertexTypes.h" root0="SKIP_HIGHLIGHTING" />
|
||||||
<setting file="file://$PROJECT_DIR$/enginecustom/include/Vulkan/Include/vulkan/vulkan_core.h" root0="SKIP_HIGHLIGHTING" />
|
<setting file="file://$PROJECT_DIR$/enginecustom/include/Vulkan/Include/vulkan/vulkan_core.h" root0="SKIP_HIGHLIGHTING" />
|
||||||
<setting file="file://$PROJECT_DIR$/../../IDE_VS/VC/Tools/MSVC/14.38.33130/include/type_traits" root0="SKIP_HIGHLIGHTING" />
|
<setting file="file://$PROJECT_DIR$/../../IDE_VS/VC/Tools/MSVC/14.38.33130/include/type_traits" root0="SKIP_HIGHLIGHTING" />
|
||||||
@@ -64,26 +134,26 @@
|
|||||||
<option name="hideEmptyMiddlePackages" value="true" />
|
<option name="hideEmptyMiddlePackages" value="true" />
|
||||||
<option name="showLibraryContents" value="true" />
|
<option name="showLibraryContents" value="true" />
|
||||||
</component>
|
</component>
|
||||||
<component name="PropertiesComponent">{
|
<component name="PropertiesComponent"><![CDATA[{
|
||||||
"keyToString": {
|
"keyToString": {
|
||||||
"ASKED_SHARE_PROJECT_CONFIGURATION_FILES": "true",
|
"ASKED_SHARE_PROJECT_CONFIGURATION_FILES": "true",
|
||||||
"C++ Project.enginecustom.executor": "Run",
|
"C++ Project.enginecustom.executor": "Run",
|
||||||
"C/C++ Project.KhaoticDemo.executor": "Run",
|
"C/C++ Project.KhaoticDemo.executor": "Run",
|
||||||
"C/C++ Project.enginecustom.executor": "Run",
|
"C/C++ Project.enginecustom.executor": "Debug",
|
||||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||||
"RunOnceActivity.git.unshallow": "true",
|
"RunOnceActivity.git.unshallow": "true",
|
||||||
"SHARE_PROJECT_CONFIGURATION_FILES": "true",
|
"SHARE_PROJECT_CONFIGURATION_FILES": "true",
|
||||||
"git-widget-placeholder": "main",
|
"git-widget-placeholder": "main",
|
||||||
"ignore.virus.scanning.warn.message": "true",
|
"ignore.virus.scanning.warn.message": "true",
|
||||||
"node.js.detected.package.eslint": "true",
|
"node.js.detected.package.eslint": "true",
|
||||||
"node.js.detected.package.tslint": "true",
|
"node.js.detected.package.tslint": "true",
|
||||||
"node.js.selected.package.eslint": "(autodetect)",
|
"node.js.selected.package.eslint": "(autodetect)",
|
||||||
"node.js.selected.package.tslint": "(autodetect)",
|
"node.js.selected.package.tslint": "(autodetect)",
|
||||||
"nodejs_package_manager_path": "npm",
|
"nodejs_package_manager_path": "npm",
|
||||||
"settings.editor.selected.configurable": "preferences.pluginManager",
|
"settings.editor.selected.configurable": "preferences.pluginManager",
|
||||||
"vue.rearranger.settings.migration": "true"
|
"vue.rearranger.settings.migration": "true"
|
||||||
}
|
}
|
||||||
}</component>
|
}]]></component>
|
||||||
<component name="RunManager" selected="C/C++ Project.enginecustom">
|
<component name="RunManager" selected="C/C++ Project.enginecustom">
|
||||||
<configuration name="KhaoticDemo" type="CppProject" factoryName="C++ Project">
|
<configuration name="KhaoticDemo" type="CppProject" factoryName="C++ Project">
|
||||||
<configuration_1 setup="1">
|
<configuration_1 setup="1">
|
||||||
@@ -229,6 +299,7 @@
|
|||||||
<workItem from="1750248915365" duration="442000" />
|
<workItem from="1750248915365" duration="442000" />
|
||||||
<workItem from="1750335650897" duration="2051000" />
|
<workItem from="1750335650897" duration="2051000" />
|
||||||
<workItem from="1750344288223" duration="1751000" />
|
<workItem from="1750344288223" duration="1751000" />
|
||||||
|
<workItem from="1750351735497" duration="9648000" />
|
||||||
</task>
|
</task>
|
||||||
<task id="LOCAL-00001" summary="Minor update - viewport window tweak">
|
<task id="LOCAL-00001" summary="Minor update - viewport window tweak">
|
||||||
<option name="closed" value="true" />
|
<option name="closed" value="true" />
|
||||||
|
@@ -10,13 +10,13 @@ Collapsed=0
|
|||||||
|
|
||||||
[Window][Khaotic Engine]
|
[Window][Khaotic Engine]
|
||||||
Pos=1267,19
|
Pos=1267,19
|
||||||
Size=317,842
|
Size=317,609
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x00000002,0
|
DockId=0x00000002,0
|
||||||
|
|
||||||
[Window][render Stats]
|
[Window][render Stats]
|
||||||
Pos=0,630
|
Pos=0,630
|
||||||
Size=792,231
|
Size=1584,231
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x00000009,0
|
DockId=0x00000009,0
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@ DockId=0x0000000B,0
|
|||||||
|
|
||||||
[Window][Terrain]
|
[Window][Terrain]
|
||||||
Pos=0,19
|
Pos=0,19
|
||||||
Size=266,842
|
Size=266,609
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x00000007,0
|
DockId=0x00000007,0
|
||||||
|
|
||||||
|
@@ -13,7 +13,7 @@ public:
|
|||||||
|
|
||||||
void Initialize(d_3d_class* d3dClassRef); // Get all the required references
|
void Initialize(d_3d_class* d3dClassRef); // Get all the required references
|
||||||
|
|
||||||
object* ConstructSkybox();
|
object* ConstructSkybox(application_class* app);
|
||||||
|
|
||||||
|
|
||||||
// Variables
|
// Variables
|
||||||
|
@@ -55,6 +55,8 @@ constexpr bool full_screen = false;
|
|||||||
constexpr float screen_depth = 1000.0f;
|
constexpr float screen_depth = 1000.0f;
|
||||||
constexpr float screen_near = 0.3f;
|
constexpr float screen_near = 0.3f;
|
||||||
|
|
||||||
|
static std::map<std::string, std::shared_ptr<model_class>> g_model_cache;
|
||||||
|
|
||||||
struct input
|
struct input
|
||||||
{
|
{
|
||||||
bool key_left = false;
|
bool key_left = false;
|
||||||
@@ -79,8 +81,7 @@ public:
|
|||||||
render_texture_class* get_refraction_texture() const { return refraction_texture_; };
|
render_texture_class* get_refraction_texture() const { return refraction_texture_; };
|
||||||
render_texture_class* get_reflection_texture() const { return reflection_texture_; };
|
render_texture_class* get_reflection_texture() const { return reflection_texture_; };
|
||||||
|
|
||||||
void create_big_cube(int side_count);
|
bool create_big_cube(int side_count);
|
||||||
void process_terrain_generation();
|
|
||||||
virtual bool initialize(int, int, HWND, bool is_vulkan);
|
virtual bool initialize(int, int, HWND, bool is_vulkan);
|
||||||
void shutdown();
|
void shutdown();
|
||||||
virtual bool frame(input_class*);
|
virtual bool frame(input_class*);
|
||||||
|
@@ -29,6 +29,7 @@ enum class ShaderType
|
|||||||
class object
|
class object
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
object(application_class& app);
|
||||||
object();
|
object();
|
||||||
~object();
|
~object();
|
||||||
|
|
||||||
@@ -137,6 +138,9 @@ public :
|
|||||||
bool m_gravityEnabled = true;
|
bool m_gravityEnabled = true;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
application_class& m_Application;
|
||||||
|
|
||||||
XMMATRIX m_scaleMatrix;
|
XMMATRIX m_scaleMatrix;
|
||||||
XMMATRIX m_rotateMatrix;
|
XMMATRIX m_rotateMatrix;
|
||||||
XMMATRIX m_translateMatrix;
|
XMMATRIX m_translateMatrix;
|
||||||
|
@@ -6,6 +6,7 @@
|
|||||||
#include "object.h"
|
#include "object.h"
|
||||||
#include <intrin.h> // Pour __cpuid
|
#include <intrin.h> // Pour __cpuid
|
||||||
#include <dxgi.h> // Pour DXGI
|
#include <dxgi.h> // Pour DXGI
|
||||||
|
#include <mutex>
|
||||||
#pragma comment(lib, "dxgi.lib")
|
#pragma comment(lib, "dxgi.lib")
|
||||||
|
|
||||||
class stats
|
class stats
|
||||||
@@ -36,7 +37,6 @@ public:
|
|||||||
std::string get_gpu_driver_version(ID3D11Device* device);
|
std::string get_gpu_driver_version(ID3D11Device* device);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::thread update_geometric_thread_;
|
|
||||||
std::thread update_display_thread_;
|
std::thread update_display_thread_;
|
||||||
|
|
||||||
fps_class* fps_;
|
fps_class* fps_;
|
||||||
|
@@ -23,7 +23,7 @@ void Skybox::Initialize(d_3d_class* d3dClassRef)
|
|||||||
m_d3dClassRef = d3dClassRef;
|
m_d3dClassRef = d3dClassRef;
|
||||||
}
|
}
|
||||||
|
|
||||||
object* Skybox::ConstructSkybox()
|
object* Skybox::ConstructSkybox(application_class* app)
|
||||||
{
|
{
|
||||||
Logger::Get().Log("Construct skybox", __FILE__, __LINE__, Logger::LogLevel::Initialize);
|
Logger::Get().Log("Construct skybox", __FILE__, __LINE__, Logger::LogLevel::Initialize);
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@ object* Skybox::ConstructSkybox()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create the model object
|
// Create the model object
|
||||||
m_Skybox = new object();
|
m_Skybox = new object(*app);
|
||||||
HRESULT result = m_Skybox->Initialize(m_d3dClassRef->get_device(), m_d3dClassRef->get_device_context(), modelFilename, SkyboxTextures);
|
HRESULT result = m_Skybox->Initialize(m_d3dClassRef->get_device(), m_d3dClassRef->get_device_context(), modelFilename, SkyboxTextures);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
|
@@ -505,7 +505,7 @@ bool application_class::initialize(int screenWidth, int screenHeight, HWND hwnd,
|
|||||||
//ConstructSkyboxWithPlanes();
|
//ConstructSkyboxWithPlanes();
|
||||||
Skybox* skybox = new Skybox;
|
Skybox* skybox = new Skybox;
|
||||||
skybox->Initialize(direct_3d_);
|
skybox->Initialize(direct_3d_);
|
||||||
skybox_.push_back(skybox->ConstructSkybox());
|
skybox_.push_back(skybox->ConstructSkybox(this));
|
||||||
|
|
||||||
culling_active_ = true;
|
culling_active_ = true;
|
||||||
culling_thread_ = std::thread(&application_class::culling_thread_function, this);
|
culling_thread_ = std::thread(&application_class::culling_thread_function, this);
|
||||||
@@ -765,8 +765,6 @@ void application_class::shutdown()
|
|||||||
|
|
||||||
bool application_class::frame(input_class* Input)
|
bool application_class::frame(input_class* Input)
|
||||||
{
|
{
|
||||||
|
|
||||||
process_terrain_generation();
|
|
||||||
stats_->reset_draw_call_count();
|
stats_->reset_draw_call_count();
|
||||||
|
|
||||||
int mouseX, mouseY, currentMouseX, currentMouseY;
|
int mouseX, mouseY, currentMouseX, currentMouseY;
|
||||||
@@ -1133,10 +1131,10 @@ bool application_class::render(float rotation, float x, float y, float z, float
|
|||||||
// -------------------------------------------------------- //
|
// -------------------------------------------------------- //
|
||||||
|
|
||||||
// set the active camera to the sun camera for rendering the shadow map.
|
// set the active camera to the sun camera for rendering the shadow map.
|
||||||
active_camera_ = sun_camera_;
|
// active_camera_ = sun_camera_;
|
||||||
active_camera_->render();
|
// active_camera_->render();
|
||||||
// Render the objects in the render queues. with depth only pass.
|
// // Render the objects in the render queues. with depth only pass.
|
||||||
active_camera_->get_view_matrix(viewMatrix);
|
// active_camera_->get_view_matrix(viewMatrix);
|
||||||
result = render_pass(render_queues_, diffuseColor, lightPosition, ambientColor, viewMatrix, projectionMatrix);
|
result = render_pass(render_queues_, diffuseColor, lightPosition, ambientColor, viewMatrix, projectionMatrix);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
@@ -1145,18 +1143,19 @@ bool application_class::render(float rotation, float x, float y, float z, float
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Reset the active camera to the main camera.
|
// Reset the active camera to the main camera.
|
||||||
active_camera_ = camera_;
|
// active_camera_ = camera_;
|
||||||
active_camera_->render();
|
// active_camera_->render();
|
||||||
active_camera_->get_view_matrix(viewMatrix);
|
// active_camera_->get_view_matrix(viewMatrix);
|
||||||
|
//
|
||||||
// render the objects in the render queues. with standard pass.
|
// // render the objects in the render queues. with standard pass.
|
||||||
result = render_pass(render_queues_, diffuseColor, lightPosition, ambientColor, viewMatrix, projectionMatrix);
|
// result = render_pass(render_queues_, diffuseColor, lightPosition, ambientColor, viewMatrix, projectionMatrix);
|
||||||
if (!result)
|
// if (!result)
|
||||||
{
|
// {
|
||||||
Logger::Get().Log("Could not render the model using any shader", __FILE__, __LINE__, Logger::LogLevel::Error);
|
// Logger::Get().Log("Could not render the model using any shader", __FILE__, __LINE__, Logger::LogLevel::Error);
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
stats_->update_geometric_stats();
|
||||||
|
|
||||||
// Update the render count text.
|
// Update the render count text.
|
||||||
result = update_render_count_string(get_render_count());
|
result = update_render_count_string(get_render_count());
|
||||||
@@ -1329,7 +1328,7 @@ void application_class::generate_terrain()
|
|||||||
for (int j = 0; j < gridSizeZ; j++)
|
for (int j = 0; j < gridSizeZ; j++)
|
||||||
{
|
{
|
||||||
// Cr<43>er un nouvel objet de terrain
|
// Cr<43>er un nouvel objet de terrain
|
||||||
object* terrain = new object();
|
object* terrain = new object(*this);
|
||||||
|
|
||||||
// Initialiser avec le mod<6F>le et les textures_ pr<70>charg<72>es
|
// Initialiser avec le mod<6F>le et les textures_ pr<70>charg<72>es
|
||||||
if (!terrain->Initialize(direct_3d_->get_device(), direct_3d_->get_device_context(), modelFilename, textureContainer))
|
if (!terrain->Initialize(direct_3d_->get_device(), direct_3d_->get_device_context(), modelFilename, textureContainer))
|
||||||
@@ -1362,6 +1361,7 @@ void application_class::generate_terrain()
|
|||||||
|
|
||||||
void application_class::add_kobject(std::wstring& filepath)
|
void application_class::add_kobject(std::wstring& filepath)
|
||||||
{
|
{
|
||||||
|
std::lock_guard<std::mutex> lock(objects_mutex_);
|
||||||
Logger::Get().Log("Adding object", __FILE__, __LINE__);
|
Logger::Get().Log("Adding object", __FILE__, __LINE__);
|
||||||
|
|
||||||
char modelFilename[128];
|
char modelFilename[128];
|
||||||
@@ -1382,7 +1382,7 @@ void application_class::add_kobject(std::wstring& filepath)
|
|||||||
L"assets/Texture/BricksGLOSS2K.png"
|
L"assets/Texture/BricksGLOSS2K.png"
|
||||||
};
|
};
|
||||||
|
|
||||||
object* newObject = new object();
|
object* newObject = new object(*this);
|
||||||
newObject->LoadTexturesFromPath(kobjTexture,KobjectsTextures, direct_3d_); // Load textures_ from the path
|
newObject->LoadTexturesFromPath(kobjTexture,KobjectsTextures, direct_3d_); // Load textures_ from the path
|
||||||
newObject->Initialize(direct_3d_->get_device(), direct_3d_->get_device_context(), modelFilename, KobjectsTextures);
|
newObject->Initialize(direct_3d_->get_device(), direct_3d_->get_device_context(), modelFilename, KobjectsTextures);
|
||||||
newObject->SetMass(1.0f);
|
newObject->SetMass(1.0f);
|
||||||
@@ -1404,6 +1404,7 @@ void application_class::add_kobject(std::wstring& filepath)
|
|||||||
|
|
||||||
void application_class::add_cube()
|
void application_class::add_cube()
|
||||||
{
|
{
|
||||||
|
std::lock_guard<std::mutex> lock(objects_mutex_);
|
||||||
Logger::Get().Log("Adding cube", __FILE__, __LINE__);
|
Logger::Get().Log("Adding cube", __FILE__, __LINE__);
|
||||||
|
|
||||||
char modelFilename[128];
|
char modelFilename[128];
|
||||||
@@ -1418,7 +1419,7 @@ void application_class::add_cube()
|
|||||||
|
|
||||||
static int cubeCount = 0;
|
static int cubeCount = 0;
|
||||||
float position = cubeCount * 2.0f;
|
float position = cubeCount * 2.0f;
|
||||||
object* newCube = new object();
|
object* newCube = new object(*this);
|
||||||
newCube->LoadTexturesFromPath(cubeTexture, CubeTexture, direct_3d_); // Load textures_ from the path
|
newCube->LoadTexturesFromPath(cubeTexture, CubeTexture, direct_3d_); // Load textures_ from the path
|
||||||
newCube->Initialize(direct_3d_->get_device(), direct_3d_->get_device_context(), modelFilename, CubeTexture);
|
newCube->Initialize(direct_3d_->get_device(), direct_3d_->get_device_context(), modelFilename, CubeTexture);
|
||||||
newCube->SetTranslateMatrix(XMMatrixTranslation(position, 0.0f, 0.0f));
|
newCube->SetTranslateMatrix(XMMatrixTranslation(position, 0.0f, 0.0f));
|
||||||
@@ -1429,6 +1430,7 @@ void application_class::add_cube()
|
|||||||
|
|
||||||
void application_class::delete_kobject(int index)
|
void application_class::delete_kobject(int index)
|
||||||
{
|
{
|
||||||
|
std::lock_guard<std::mutex> lock(objects_mutex_);
|
||||||
Logger::Get().Log("Deleting object", __FILE__, __LINE__);
|
Logger::Get().Log("Deleting object", __FILE__, __LINE__);
|
||||||
|
|
||||||
if (index < object_.size())
|
if (index < object_.size())
|
||||||
@@ -1439,6 +1441,7 @@ void application_class::delete_kobject(int index)
|
|||||||
|
|
||||||
void application_class::delete_terrain()
|
void application_class::delete_terrain()
|
||||||
{
|
{
|
||||||
|
std::lock_guard<std::mutex> lock(objects_mutex_);
|
||||||
Logger::Get().Log("Deleting terrain", __FILE__, __LINE__);
|
Logger::Get().Log("Deleting terrain", __FILE__, __LINE__);
|
||||||
terrain_chunk_.clear();
|
terrain_chunk_.clear();
|
||||||
}
|
}
|
||||||
@@ -2151,126 +2154,56 @@ void application_class::physics_thread_function()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void application_class::create_big_cube(int side_count)
|
bool application_class::create_big_cube(int side_count)
|
||||||
{
|
{
|
||||||
Logger::Get().Log("Lancement de la g<>n<EFBFBD>ration du terrain dans un thread s<>par<61>", __FILE__, __LINE__, Logger::LogLevel::Info);
|
std::string modelName = "assets/Model/TXT/cube.txt";
|
||||||
|
std::shared_ptr<model_class> sharedModel;
|
||||||
// Cr<43>er un thread qui ex<65>cutera la g<>n<EFBFBD>ration du terrain
|
|
||||||
std::thread generationThread([this, side_count]() {
|
// V<>rifier si le mod<6F>le existe d<>j<EFBFBD>
|
||||||
Logger::Get().Log("Thread de g<>n<EFBFBD>ration de terrain d<>marr<72>", __FILE__, __LINE__, Logger::LogLevel::Info);
|
auto it = g_model_cache.find(modelName);
|
||||||
|
if (it != g_model_cache.end()) {
|
||||||
|
sharedModel = it->second;
|
||||||
|
} else {
|
||||||
|
// copy le string en char*
|
||||||
|
char model_file[128];
|
||||||
|
size_t convertedChars = 0;
|
||||||
|
(void)wcstombs_s(&convertedChars, model_file, sizeof(model_file), std::wstring(modelName.begin(), modelName.end()).c_str(), _TRUNCATE);
|
||||||
|
|
||||||
// Stockage temporaire pour les nouveaux objets
|
// Cr<EFBFBD>er et initialiser le mod<6F>le si non trouv<75>
|
||||||
std::vector<object*> newTerrainChunks;
|
auto newModel = std::make_shared<model_class>();
|
||||||
|
TextureContainer textures;
|
||||||
|
textures.diffusePaths.push_back(L"assets/Texture/Bricks2K.png");
|
||||||
|
textures.normalPaths.push_back(L"assets/Texture/BricksNRM2K.png");
|
||||||
|
textures.specularPaths.push_back(L"assets/Texture/BricksGLOSS2K.png");
|
||||||
|
newModel->PreloadTextures(direct_3d_->get_device(), direct_3d_->get_device_context(), textures);
|
||||||
|
if (!newModel->Initialize(direct_3d_->get_device(), direct_3d_->get_device_context(),model_file, textures)) {
|
||||||
|
Logger::Get().Log("Impossible d'initialiser le mod<6F>le du gros cube", __FILE__, __LINE__, Logger::LogLevel::Error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
g_model_cache[modelName] = newModel;
|
||||||
|
sharedModel = newModel;
|
||||||
|
}
|
||||||
|
|
||||||
// Dimensions du terrain
|
// Cr<EFBFBD>er temporairement les cubes dans un vecteur local
|
||||||
float scaleX = 1.0f;
|
std::vector<object*> tempCubes;
|
||||||
float scaleY = 1.0f;
|
tempCubes.reserve(side_count * side_count * side_count);
|
||||||
float scaleZ = 1.0f;
|
|
||||||
|
|
||||||
// Pr<EFBFBD>parer les donn<6E>es pour la cr<63>ation des cubes
|
// G<EFBFBD>n<EFBFBD>rer side_count<6E> cubes
|
||||||
std::vector<std::tuple<float, float, float, std::string, int>> cubeData;
|
for (int x = 0; x < side_count; x++)
|
||||||
int objectId = object_id_;
|
{
|
||||||
|
for (int y = 0; y < side_count; y++)
|
||||||
// G<>n<EFBFBD>rer les donn<6E>es des cubes
|
{
|
||||||
for (int i = 0; i < side_count; i++) {
|
for (int z = 0; z < side_count; z++)
|
||||||
for (int j = 0; j < side_count; j++) {
|
{
|
||||||
for (int k = 0; k < side_count; k++) {
|
object* cubePart = new object(*this);
|
||||||
// V<>rifier si nous devons arr<72>ter le thread
|
cubePart->SetModel(sharedModel);
|
||||||
if (should_quit_) {
|
cubePart->SetTranslateMatrix(XMMatrixTranslation(static_cast<float>(x),static_cast<float>(y),static_cast<float>(z)));
|
||||||
Logger::Get().Log("G<EFBFBD>n<EFBFBD>ration de terrain annul<75>e", __FILE__, __LINE__, Logger::LogLevel::Info);
|
tempCubes.push_back(cubePart);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Position et nom du cube
|
|
||||||
float posX = i * scaleX;
|
|
||||||
float posY = k * scaleY;
|
|
||||||
float posZ = j * scaleZ;
|
|
||||||
std::string name = "TerrainTile_" + std::to_string(i) + "_" + std::to_string(j) + "_" + std::to_string(k);
|
|
||||||
|
|
||||||
// Stocker les donn<6E>es du cube
|
|
||||||
cubeData.push_back(std::make_tuple(posX, posY, posZ, name, objectId++));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Synchroniser avec le thread principal pour cr<63>er les objets
|
|
||||||
// Cette partie doit <20>tre ex<65>cut<75>e dans le thread principal (via une file d'attente ou autre m<>canisme)
|
|
||||||
std::lock_guard<std::mutex> lock(terrain_mutex_);
|
|
||||||
terrain_generation_data_ = std::move(cubeData);
|
|
||||||
terrain_generation_ready_ = true;
|
|
||||||
next_terrain_object_id_ = objectId;
|
|
||||||
|
|
||||||
Logger::Get().Log("Donn<EFBFBD>es de g<>n<EFBFBD>ration de terrain pr<70>par<61>es (" + std::to_string(terrain_generation_data_.size()) + " cubes)", __FILE__, __LINE__, Logger::LogLevel::Info);
|
|
||||||
});
|
|
||||||
|
|
||||||
// D<>tacher le thread pour qu'il s'ex<65>cute en arri<72>re-plan
|
|
||||||
generationThread.detach();
|
|
||||||
}
|
|
||||||
|
|
||||||
void application_class::process_terrain_generation()
|
|
||||||
{
|
|
||||||
// V<>rifier si des donn<6E>es de terrain sont pr<70>tes <20> <20>tre trait<69>es
|
|
||||||
if (!terrain_generation_ready_) {
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
// Transf<73>rer les cubes du vecteur temporaire au vecteur membre
|
||||||
// Acqu<71>rir les donn<6E>es g<>n<EFBFBD>r<EFBFBD>es
|
cubes_ = std::move(tempCubes);
|
||||||
std::vector<std::tuple<float, float, float, std::string, int>> cubeData;
|
|
||||||
{
|
|
||||||
std::lock_guard<std::mutex> lock(terrain_mutex_);
|
|
||||||
cubeData = std::move(terrain_generation_data_);
|
|
||||||
terrain_generation_data_.clear();
|
|
||||||
terrain_generation_ready_ = false;
|
|
||||||
object_id_ = next_terrain_object_id_;
|
|
||||||
}
|
|
||||||
|
|
||||||
Logger::Get().Log("Cr<EFBFBD>ation des objets terrain <20> partir des donn<6E>es pr<70>par<61>es", __FILE__, __LINE__, Logger::LogLevel::Info);
|
|
||||||
|
|
||||||
terrain_chunk_.clear();
|
return true;
|
||||||
|
|
||||||
// Cr<43>er un conteneur de textures_ partag<61>
|
|
||||||
TextureContainer textureContainer;
|
|
||||||
textureContainer.diffusePaths.push_back(L"assets/Texture/Bricks2K.png");
|
|
||||||
textureContainer.normalPaths.push_back(L"assets/Texture/BricksNRM2K.png");
|
|
||||||
textureContainer.specularPaths.push_back(L"assets/Texture/BricksGLOSS2K.png");
|
|
||||||
|
|
||||||
// Pr<50>charger les textures_ une seule fois
|
|
||||||
model_class* sharedModel = new model_class();
|
|
||||||
sharedModel->PreloadTextures(direct_3d_->get_device(), direct_3d_->get_device_context(), textureContainer);
|
|
||||||
|
|
||||||
char modelFilename[128];
|
|
||||||
strcpy_s(modelFilename, "assets/Model/TXT/cube.txt");
|
|
||||||
|
|
||||||
// Cr<43>er les objets <20> partir des donn<6E>es
|
|
||||||
for (const auto& [posX, posY, posZ, name, id] : cubeData)
|
|
||||||
{
|
|
||||||
// Cr<43>er un nouvel objet de terrain
|
|
||||||
object* terrain = new object();
|
|
||||||
|
|
||||||
// Initialiser avec le mod<6F>le et les textures_
|
|
||||||
if (!terrain->Initialize(direct_3d_->get_device(), direct_3d_->get_device_context(), modelFilename, textureContainer))
|
|
||||||
{
|
|
||||||
Logger::Get().Log("<EFBFBD>chec de l'initialisation d'une tuile de terrain", __FILE__, __LINE__, Logger::LogLevel::Error);
|
|
||||||
delete terrain;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Configurer l'objet
|
|
||||||
XMFLOAT3 position(posX, posY, posZ);
|
|
||||||
XMFLOAT3 scale(1.0f, 1.0f, 1.0f);
|
|
||||||
|
|
||||||
terrain->SetPosition(XMLoadFloat3(&position));
|
|
||||||
terrain->SetScale(XMLoadFloat3(&scale));
|
|
||||||
terrain->SetName(name);
|
|
||||||
terrain->SetType(ObjectType::Cube);
|
|
||||||
terrain->SetActiveShader(ShaderType::TEXTURE);
|
|
||||||
terrain->SetId(id);
|
|
||||||
|
|
||||||
// Ajouter <20> la liste des chunks de terrain
|
|
||||||
terrain_chunk_.push_back(terrain);
|
|
||||||
}
|
|
||||||
|
|
||||||
delete sharedModel;
|
|
||||||
|
|
||||||
Logger::Get().Log("G<EFBFBD>n<EFBFBD>ration du terrain termin<69>e avec " + std::to_string(terrain_chunk_.size()) + " cubes", __FILE__, __LINE__, Logger::LogLevel::Info);
|
|
||||||
}
|
}
|
@@ -2,9 +2,27 @@
|
|||||||
|
|
||||||
#include <comdef.h>
|
#include <comdef.h>
|
||||||
|
|
||||||
|
#include "application_class.h"
|
||||||
#include "d_3d_class.h"
|
#include "d_3d_class.h"
|
||||||
|
|
||||||
object::object()// initialize the reference here
|
object::object(application_class& app) : m_Application(app)// initialize the reference here
|
||||||
|
{
|
||||||
|
m_scaleMatrix = XMMatrixIdentity();
|
||||||
|
m_rotateMatrix = XMMatrixIdentity();
|
||||||
|
m_translateMatrix = XMMatrixIdentity();
|
||||||
|
m_srMatrix = XMMatrixIdentity();
|
||||||
|
m_worldMatrix = XMMatrixIdentity();
|
||||||
|
m_previousPosition = XMVectorZero();
|
||||||
|
m_velocity = XMVectorZero();
|
||||||
|
m_acceleration = XMVectorZero();
|
||||||
|
m_mass = NULL;
|
||||||
|
m_isGrounded = false;
|
||||||
|
m_id = NULL;
|
||||||
|
m_boundingRadius = 1.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
object::object()
|
||||||
|
: m_Application(*static_cast<application_class*>(nullptr)) // Remplacer suivant votre logique
|
||||||
{
|
{
|
||||||
m_scaleMatrix = XMMatrixIdentity();
|
m_scaleMatrix = XMMatrixIdentity();
|
||||||
m_rotateMatrix = XMMatrixIdentity();
|
m_rotateMatrix = XMMatrixIdentity();
|
||||||
@@ -31,8 +49,25 @@ bool object::Initialize(
|
|||||||
TextureContainer& texturesContainer
|
TextureContainer& texturesContainer
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
m_model_ = std::make_shared<model_class>();
|
|
||||||
return m_model_->Initialize(device, deviceContext, modelFilename, texturesContainer);
|
std::string filename(modelFilename);
|
||||||
|
auto it = g_model_cache.find(filename);
|
||||||
|
if (it != g_model_cache.end())
|
||||||
|
{
|
||||||
|
m_model_ = it->second;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
auto new_model = std::make_shared<model_class>();
|
||||||
|
if (!new_model->Initialize(device, deviceContext, modelFilename, texturesContainer))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
g_model_cache[filename] = new_model;
|
||||||
|
m_model_ = new_model;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void object::SetScaleMatrix(XMMATRIX scaleMatrix)
|
void object::SetScaleMatrix(XMMATRIX scaleMatrix)
|
||||||
|
@@ -26,11 +26,6 @@ bool stats::initialize(application_class* app)
|
|||||||
Logger::Get().Log("FPS object is null", __FILE__, __LINE__, Logger::LogLevel::Error);
|
Logger::Get().Log("FPS object is null", __FILE__, __LINE__, Logger::LogLevel::Error);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// call update() in a separate thread
|
|
||||||
std::thread update_geometric_thread(&stats::update_geometric_stats, this);
|
|
||||||
update_geometric_thread_ = std::move(update_geometric_thread); // Move the thread to the member variable
|
|
||||||
update_geometric_thread_.detach(); // Detach the thread to run independently
|
|
||||||
|
|
||||||
Logger::Get().Log("Stats initialized successfully", __FILE__, __LINE__, Logger::LogLevel::Initialize);
|
Logger::Get().Log("Stats initialized successfully", __FILE__, __LINE__, Logger::LogLevel::Initialize);
|
||||||
|
|
||||||
@@ -39,8 +34,7 @@ bool stats::initialize(application_class* app)
|
|||||||
|
|
||||||
void stats::update_geometric_stats()
|
void stats::update_geometric_stats()
|
||||||
{
|
{
|
||||||
while (true)
|
|
||||||
{
|
|
||||||
object_vec_ = app_->get_kobjects();
|
object_vec_ = app_->get_kobjects();
|
||||||
cubes_vec_ = app_->get_cubes();
|
cubes_vec_ = app_->get_cubes();
|
||||||
terrain_chunk_vec_ = app_->get_terrain_cubes();
|
terrain_chunk_vec_ = app_->get_terrain_cubes();
|
||||||
@@ -48,10 +42,6 @@ void stats::update_geometric_stats()
|
|||||||
total_vertex_count_ = get_total_vertex_count();
|
total_vertex_count_ = get_total_vertex_count();
|
||||||
total_triangle_count_ = get_total_triangle_count();
|
total_triangle_count_ = get_total_triangle_count();
|
||||||
visible_triangle_count_ = get_visible_triangle_count();
|
visible_triangle_count_ = get_visible_triangle_count();
|
||||||
|
|
||||||
// call update_stats() every second
|
|
||||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void stats::update_display_stats()
|
void stats::update_display_stats()
|
||||||
|
Reference in New Issue
Block a user