Unravel Engine C++ Reference
Loading...
Searching...
No Matches
unravel::batch_collector Class Reference

Core batch collection system for grouping compatible draw calls. More...

#include <batch_collector.h>

Public Types

using batch_map_t = std::unordered_map<batch_key, batch_group>
 
using batch_list_t = std::vector<batch_group*>
 

Public Member Functions

 batch_collector ()
 Default constructor.
 
 ~batch_collector ()=default
 Destructor.
 
 batch_collector (const batch_collector &)=delete
 
auto operator= (const batch_collector &) -> batch_collector &=delete
 
 batch_collector (batch_collector &&) noexcept=default
 
auto operator= (batch_collector &&) noexcept -> batch_collector &=default
 
void collect_renderable (const batch_key &key, const batch_instance &instance)
 Collect a renderable object for batching.
 
void collect_renderable (const batch_key &key, const math::mat4 &world_transform)
 Collect a renderable with just world transform.
 
void prepare_batches (const submit_context &context)
 Prepare batches for rendering (sort, split, optimize)
 
auto get_prepared_batches () const -> const batch_list_t &
 Get prepared batches for rendering.
 
void clear ()
 Clear all collected data and reset for next frame.
 
auto get_stats () const -> const batch_stats &
 Get current statistics.
 
auto get_batch_count () const -> size_t
 Get number of collected batches.
 
auto get_instance_count () const -> size_t
 Get total number of instances collected.
 
auto has_batches () const -> bool
 Check if any batches have been collected.
 
void set_max_instances_per_batch (uint32_t max_instances)
 Set maximum instances per batch.
 
void set_profiling_enabled (bool enabled)
 Enable or disable performance profiling.
 

Static Public Member Functions

static auto is_static_mesh_batching_enabled () -> bool
 Check if static mesh batching is enabled globally.
 
static void set_static_mesh_batching_enabled (bool enabled)
 Enable or disable static mesh batching globally.
 

Detailed Description

Core batch collection system for grouping compatible draw calls.

Definition at line 141 of file batch_collector.h.

Member Typedef Documentation

◆ batch_list_t

Definition at line 145 of file batch_collector.h.

◆ batch_map_t

Definition at line 144 of file batch_collector.h.

Constructor & Destructor Documentation

◆ batch_collector() [1/3]

unravel::batch_collector::batch_collector ( )

Default constructor.

Definition at line 118 of file batch_collector.cpp.

◆ ~batch_collector()

unravel::batch_collector::~batch_collector ( )
default

Destructor.

◆ batch_collector() [2/3]

unravel::batch_collector::batch_collector ( const batch_collector & )
delete

◆ batch_collector() [3/3]

unravel::batch_collector::batch_collector ( batch_collector && )
defaultnoexcept

Member Function Documentation

◆ clear()

void unravel::batch_collector::clear ( )

Clear all collected data and reset for next frame.

Definition at line 202 of file batch_collector.cpp.

◆ collect_renderable() [1/2]

void unravel::batch_collector::collect_renderable ( const batch_key & key,
const batch_instance & instance )

Collect a renderable object for batching.

Parameters
keyBatch key identifying the renderable
instanceInstance data for the object

Definition at line 123 of file batch_collector.cpp.

◆ collect_renderable() [2/2]

void unravel::batch_collector::collect_renderable ( const batch_key & key,
const math::mat4 & world_transform )

Collect a renderable with just world transform.

Parameters
keyBatch key identifying the renderable
world_transformWorld transformation matrix

Definition at line 143 of file batch_collector.cpp.

◆ get_batch_count()

auto unravel::batch_collector::get_batch_count ( ) const -> size_t

Get number of collected batches.

Returns
Number of unique batch keys collected

Definition at line 214 of file batch_collector.cpp.

◆ get_instance_count()

auto unravel::batch_collector::get_instance_count ( ) const -> size_t

Get total number of instances collected.

Returns
Total instances across all batches

Definition at line 219 of file batch_collector.cpp.

◆ get_prepared_batches()

auto unravel::batch_collector::get_prepared_batches ( ) const -> const batch_list_t&

Get prepared batches for rendering.

Returns
Vector of batch groups ready for submission

Definition at line 197 of file batch_collector.cpp.

◆ get_stats()

auto unravel::batch_collector::get_stats ( ) const -> const batch_stats&

Get current statistics.

Returns
Current batch statistics

Definition at line 209 of file batch_collector.cpp.

◆ has_batches()

auto unravel::batch_collector::has_batches ( ) const -> bool

Check if any batches have been collected.

Returns
True if there are batches to render

Definition at line 229 of file batch_collector.cpp.

◆ is_static_mesh_batching_enabled()

auto unravel::batch_collector::is_static_mesh_batching_enabled ( ) -> bool
static

Check if static mesh batching is enabled globally.

Returns
True if static mesh batching is enabled

Definition at line 377 of file batch_collector.cpp.

◆ operator=() [1/2]

auto unravel::batch_collector::operator= ( batch_collector && ) -> batch_collector &=default
defaultnoexcept

◆ operator=() [2/2]

auto unravel::batch_collector::operator= ( const batch_collector & ) -> batch_collector &=delete
delete

◆ prepare_batches()

void unravel::batch_collector::prepare_batches ( const submit_context & context)

Prepare batches for rendering (sort, split, optimize)

Parameters
contextSubmit context with rendering parameters

Definition at line 149 of file batch_collector.cpp.

◆ set_max_instances_per_batch()

void unravel::batch_collector::set_max_instances_per_batch ( uint32_t max_instances)

Set maximum instances per batch.

Parameters
max_instancesMaximum instances (0 = no limit)

Definition at line 234 of file batch_collector.cpp.

◆ set_profiling_enabled()

void unravel::batch_collector::set_profiling_enabled ( bool enabled)

Enable or disable performance profiling.

Parameters
enabledWhether to enable profiling

Definition at line 239 of file batch_collector.cpp.

◆ set_static_mesh_batching_enabled()

void unravel::batch_collector::set_static_mesh_batching_enabled ( bool enabled)
static

Enable or disable static mesh batching globally.

Parameters
enabledTrue to enable batching, false to disable

Definition at line 382 of file batch_collector.cpp.


The documentation for this class was generated from the following files: