6#include <unordered_map>
73 math::vec3 camera_position = math::vec3(0.0f);
76 bool enable_distance_sorting =
false;
79 uint32_t max_instances_per_batch = 1024;
82 bool enable_profiling =
true;
97 float camera_distance = 0.0f;
100 bool is_split_batch =
false;
123 void calculate_camera_distance(
const math::vec3& camera_pos);
129 auto is_valid() const ->
bool;
135 auto get_gpu_memory_size() const ->
size_t;
156 static auto is_static_mesh_batching_enabled() -> bool;
162 static void set_static_mesh_batching_enabled(
bool enabled);
187 void collect_renderable(const
batch_key& key, const
math::mat4& world_transform);
199 auto get_prepared_batches() const -> const
batch_list_t&;
216 auto get_batch_count() const ->
size_t;
222 auto get_instance_count() const ->
size_t;
228 auto has_batches() const ->
bool;
234 void set_max_instances_per_batch(uint32_t max_instances);
240 void set_profiling_enabled(
bool enabled);
253 uint32_t max_instances_per_batch_ = 1024;
256 bool profiling_enabled_ = true;
259 static
bool enable_static_mesh_batching_;
277 void calculate_camera_distances(const
math::vec3& camera_pos);
282 void update_statistics();
Core batch collection system for grouping compatible draw calls.
batch_collector(const batch_collector &)=delete
std::vector< batch_group * > batch_list_t
std::unordered_map< batch_key, batch_group > batch_map_t
~batch_collector()=default
Destructor.
batch_collector(batch_collector &&) noexcept=default
auto operator=(const batch_collector &) -> batch_collector &=delete
Collection of batch instances with utilities.
Hash specialization for batch_key to enable use in std::unordered_map.
A group of instances that can be rendered together.
batch_instance_collection instances
Collection of instances in this batch.
batch_group()=default
Default constructor.
batch_key key
Key identifying this batch (mesh, material, LOD, submesh)
Instance data for a single object in a batch.
Batch key structure for grouping compatible draw calls.
Statistics for batch collection and rendering performance.
uint32_t total_instances
Total number of instances across all batches.
uint32_t split_batches
Number of batches that were split due to size limits.
float average_batch_size
Average number of instances per batch.
float batching_efficiency
Batching efficiency (instances / batches)
size_t instance_buffer_memory_used
Memory used for instance buffers (bytes)
float preparation_time_ms
Time spent preparing batches (milliseconds)
auto to_string() const -> std::string
Get string representation for debugging.
void calculate_derived_stats()
Calculate derived statistics (efficiency, averages)
uint32_t draw_calls_saved
Number of draw calls saved by batching (instances - batches)
void reset()
Reset all statistics to zero.
float submission_time_ms
Time spent submitting batches (milliseconds)
uint32_t total_batches
Total number of batches created.
float collection_time_ms
Time spent collecting instances (milliseconds)
Context information for batch submission.