Major - Architecture Rework - 11.0.0

This commit is contained in:
2025-06-03 16:29:44 +02:00
parent ce51c11b31
commit d364517633
1441 changed files with 1914 additions and 856805 deletions

View File

@@ -69,7 +69,8 @@ class application_class
public:
application_class();
~application_class();
d_3d_class* get_direct_3d();
virtual d_3d_class* get_direct_3d();
void set_direct_3d(d_3d_class* direct_3d) { direct_3d_ = direct_3d; };
render_texture_class* get_scene_texture() const { return scene_texture_; };
render_texture_class* get_render_texture() const { return render_texture_; };
@@ -82,9 +83,9 @@ public:
void create_big_cube(int side_count);
void process_terrain_generation();
bool initialize(int, int, HWND, bool is_vulkan);
virtual bool initialize(int, int, HWND, bool is_vulkan);
void shutdown();
bool frame(input_class*);
virtual bool frame(input_class*);
void physics_thread_function();
int get_physics_tick_rate() const { return physics_tick_rate_; };
void set_physics_tick_rate(int physics_tick_rate) { physics_tick_rate_ = physics_tick_rate; };
@@ -104,9 +105,14 @@ public:
std::vector<object*> get_cubes() const { return cubes_; };
std::vector<object*> get_terrain_cubes() const { return terrain_chunk_; };
std::vector<object*> get_kobjects() const { return object_; };
void set_kobjects(std::vector<object*> kobjects) { object_ = kobjects; };
void add_kobject(std::wstring& filepath);
void set_path(WCHAR* path) { path_ = path; };
void set_w_folder(const std::filesystem::path& w_folder) { w_folder_ = w_folder; };
std::filesystem::path get_w_folder() const { return w_folder_; };
int get_object_id() const { return object_id_; };
void set_object_id(int object_id) { object_id_ = object_id; };
void generate_terrain();
void delete_terrain();
@@ -142,14 +148,13 @@ public:
// --------------- Stats --------------- //
// ------------------------------------- //
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 reset_fps_stats();
void increment_draw_call_count();
void reset_draw_call_count();
int get_current_fps() const { return fps_ ? fps_->GetFps() : 0; };
int get_min_fps() const { return fps_ ? fps_->GetMinFps() : 0; };
int get_max_fps() const { return fps_ ? fps_->GetMaxFps() : 0; };
float get_frame_time() const { return fps_ ? fps_->GetFrameTime() : 0.0f; };
int get_draw_calls() const { return drawcalls_; };
void increment_draw_call_count() { drawcalls_++; };
void reset_draw_call_count() { drawcalls_ = 0; };
// ----------------------------------- //
// ------------- Culling ------------- //
@@ -168,15 +173,6 @@ public:
void set_can_fixed_update(bool can_fixed_update) { can_fixed_update_ = can_fixed_update; };
ID3D11ShaderResourceView* get_back_buffer_srv() const {return back_buffer_srv_;};
// Save and load scene
void save_scene();
bool load_scene();
void set_scene_path(const std::string& path) { scene_path_ = path; };
std::wstring get_scene_path();
std::string convert_w_string_to_string(const std::wstring& w_str);
private:
bool render(float, float, float, float, float);
@@ -221,8 +217,6 @@ private :
HWND hwnd_;
bool windowed_;
std::string scene_path_;
// ------------------------------------- //
// ------------- RENDERING ------------- //
// ------------------------------------- //

View File

@@ -34,7 +34,7 @@ public:
d_3d_class(const d_3d_class&);
~d_3d_class();
bool initialize(int, int, bool, HWND, bool, float, float);
virtual bool initialize(int, int, bool, HWND, bool, float, float);
void shutdown();
virtual void begin_scene(float, float, float, float);

View File

@@ -14,6 +14,7 @@
#include <functional>
#include "render_texture_class.h"
#include "scene_manager.h"
class application_class;
@@ -74,6 +75,7 @@ private:
std::vector<widget_entry> widgets_;
application_class* app_;
scene_manager* scene_manager_;
bool showObjectWindow;
bool showTerrainWindow;

View File

@@ -28,9 +28,9 @@ public:
input_class(const input_class&);
~input_class();
bool Initialize(HINSTANCE, HWND, int, int);
void Shutdown();
bool Frame();
virtual bool Initialize(HINSTANCE, HWND, int, int);
virtual void Shutdown();
virtual bool Frame();
bool IsEscapePressed() const;
void GetMouseLocation(int&, int&) const;

View File

@@ -102,8 +102,7 @@ public:
std::string ObjectTypeToString(ObjectType objectType);
void LaunchObject();
bool LoadTexturesFromPath(std::vector<std::wstring>& texturePaths, TextureContainer& texturesContainer,
d_3d_class* m_Direct3D);
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);

View File

@@ -0,0 +1,35 @@
#pragma once
#include <filesystem>
#include <string>
#include <vector>
class d_3d_class;
class object;
class application_class;
class scene_manager
{
public:
scene_manager();
~scene_manager();
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);
private:
application_class* app_;
std::string scene_path_;
std::vector<object*> object_vec_;
int object_id_;
std::filesystem::path w_folder_;
d_3d_class* direct_3d_;
};

View File

@@ -32,6 +32,25 @@ public:
void send_path(wchar_t* path, std::filesystem::path w_folder);
application_class* get_application_class() const { return application_; }
void set_application_class(application_class* application) {
if (application_) {
delete application_;
}
application_ = application;
}
input_class* get_input_class() const { return input_; }
void set_input(input_class* input) {
if (input_) {
delete input_;
}
input_ = input;
}
HWND get_hwnd() const { return hwnd_; }
void set_d_3D_mock(d_3d_class* mock) {application_->set_direct_3d(mock);}
protected:
bool frame();
void initialize_windows(int&, int&);