Minor - Optimisation stats - V11.5.0

This commit is contained in:
2025-06-23 22:39:58 +02:00
parent de16b97f8e
commit 688fe7ff1c
8 changed files with 124 additions and 127 deletions

View File

@@ -9,8 +9,6 @@
#include "camera_class.h"
#include "object.h"
#include "light_class.h"
#include <vector>
#include <filesystem>
#include "bitmap_class.h"
#include "sprite_class.h"
@@ -31,6 +29,8 @@
#include "physics.h"
#include "frustum.h"
#include "skybox.h"
#include "shadow_map.h"
#include "stats.h"
#include <fstream>
@@ -43,9 +43,8 @@
#include <DirectXMath.h>
#include <mutex>
#include <memory>
#include "shadow_map.h"
#include "stats.h"
#include <vector>
#include <filesystem>
/////////////
@@ -128,14 +127,20 @@ public:
void set_cel_shading(const bool enable) { enable_cel_shading_ = enable; };
void set_vsync(bool vsync);
void set_vsync(bool vsync) {
vsync_enabled_ = vsync;
if (direct_3d_) {
direct_3d_->set_vsync(vsync);
Logger::Get().Log("Setting Vsync to " + std::to_string(vsync), __FILE__, __LINE__);
}
};
bool get_vsync() const { return vsync_enabled_; };
HWND get_hwnd() const;
void set_hwnd(HWND hwnd);
HWND get_hwnd() const { return hwnd_; };
void set_hwnd(HWND hwnd) { hwnd_ = hwnd; };
bool is_windowed() const;
void set_windowed(bool windowed);
bool is_windowed() const { return windowed_; };
void set_windowed(bool windowed) { windowed_ = windowed; };
void set_window_size(const ImVec2 size) { window_size_ = size; };
ImVec2 get_window_size() const { return window_size_; };
@@ -151,6 +156,7 @@ public:
void set_frustum(const frustum& frustum) { frustum_culling_ = frustum; };
void construct_frustum();
int get_render_count() const { return render_count_; };
void set_render_count(const int render_count) { render_count_ = render_count; };
float get_frustum_tolerance() const { return frustum_culling_tolerance_; };
@@ -176,6 +182,8 @@ private:
bool render_pass(const std::vector<std::reference_wrapper<std::vector<object*>>>& RenderQueues, XMFLOAT4* diffuse, XMFLOAT4* position, XMFLOAT4* ambient, XMMATRIX view, XMMATRIX projection);
void update_skybox_position();
void culling_thread_function();
void update_stats_after_modification();
public :
std::vector<ID3D11ShaderResourceView*> textures;
@@ -186,9 +194,7 @@ private :
std::thread culling_thread_;
std::atomic<bool> culling_active_;
std::mutex objects_mutex_;
void culling_thread_function();
std::mutex terrain_mutex_;
std::vector<std::tuple<float, float, float, std::string, int>> terrain_generation_data_;
bool terrain_generation_ready_;
@@ -231,8 +237,9 @@ private :
object* selected_object_;
std::vector<object*> cubes_;
std::vector<object*> terrain_chunk_;
float speed_ = 0.1f; // speed for the demo spinning object
std::vector<object*> object_;
float speed_ = 0.1f; // speed for the demo spinning object
std::vector<object*> imported_object_;
int object_id_ = 0;
std::vector<std::reference_wrapper<std::vector<object*>>> render_queues_;