Minor - Ajoute le culling par la lumière du soleil - V14.7.0

Implémente un système de culling basé sur la position de la lumière du soleil pour améliorer les performances du rendu des ombres.

Crée un thread dédié au culling des objets non visibles par la lumière du soleil.
Ajoute une structure de frustum spécifique au culling par la lumière du soleil.
Modifie le RenderComponent pour suivre si un objet est visible par la lumière du soleil.
This commit is contained in:
2025-10-14 18:45:57 +02:00
parent 37bba7866c
commit 5ab98c9a0a
6 changed files with 85 additions and 14 deletions

View File

@@ -381,7 +381,7 @@ public:
* Construct the frustum for culling.
* This function will calculate the frustum based on the current camera view and projection matrices.
*/
void construct_frustum();
void construct_frustum(frustum& frustum, float screen_depth, XMMATRIX projectionMatrix, XMMATRIX viewMatrix);
/**
* Get the number of objects rendered in the current frame.
@@ -582,6 +582,11 @@ private:
*/
void culling_thread_function();
/**
* A thread function to handle culling of objects no visible by sun light.
*/
void sun_culling_thread_function();
/**
* Create the skysphere entity.
*/
@@ -596,6 +601,11 @@ private :
std::thread culling_thread_;
std::atomic<bool> culling_active_;
std::mutex objects_mutex_;
// Thread de culling pour les shadows
std::thread culling_sun_thread_;
std::atomic<bool> culling_sun_active_;
std::mutex objects_sun_mutex_;
std::mutex terrain_mutex_;
std::vector<std::tuple<float, float, float, std::string, int>> terrain_generation_data_;
@@ -715,6 +725,7 @@ private :
// ------------------------------------------------- //
frustum frustum_culling_;
frustum sun_culling_;
int render_count_;
float frustum_culling_tolerance_ = 5.f;