Unravel Engine C++ Reference
Loading...
Searching...
No Matches
unravel::batch_group Struct Reference

A group of instances that can be rendered together. More...

#include <batch_collector.h>

Public Member Functions

 batch_group ()=default
 Default constructor.
 
 batch_group (const batch_key &key)
 Constructor with key.
 
void add_instance (const batch_instance &instance)
 Add an instance to this batch.
 
void calculate_camera_distance (const math::vec3 &camera_pos)
 Calculate distance from camera for sorting.
 
auto is_valid () const -> bool
 Check if this batch is valid for rendering.
 
auto get_gpu_memory_size () const -> size_t
 Get memory size required for GPU data.
 

Public Attributes

batch_key key
 Key identifying this batch (mesh, material, LOD, submesh)
 
batch_instance_collection instances
 Collection of instances in this batch.
 
float camera_distance = 0.0f
 Distance from camera (for sorting)
 
bool is_split_batch = false
 Whether this batch was split from a larger one.
 

Detailed Description

A group of instances that can be rendered together.

Definition at line 88 of file batch_collector.h.

Constructor & Destructor Documentation

◆ batch_group() [1/2]

unravel::batch_group::batch_group ( )
default

Default constructor.

◆ batch_group() [2/2]

unravel::batch_group::batch_group ( const batch_key & key)
explicit

Constructor with key.

Parameters
keyBatch key for this group

Definition at line 66 of file batch_collector.cpp.

Member Function Documentation

◆ add_instance()

void unravel::batch_group::add_instance ( const batch_instance & instance)

Add an instance to this batch.

Parameters
instanceInstance to add

Definition at line 71 of file batch_collector.cpp.

◆ calculate_camera_distance()

void unravel::batch_group::calculate_camera_distance ( const math::vec3 & camera_pos)

Calculate distance from camera for sorting.

Parameters
camera_posCamera position

Definition at line 76 of file batch_collector.cpp.

◆ get_gpu_memory_size()

auto unravel::batch_group::get_gpu_memory_size ( ) const -> size_t

Get memory size required for GPU data.

Returns
Size in bytes needed for instance buffer

Definition at line 111 of file batch_collector.cpp.

◆ is_valid()

auto unravel::batch_group::is_valid ( ) const -> bool

Check if this batch is valid for rendering.

Returns
True if batch has valid key and instances

Definition at line 106 of file batch_collector.cpp.

Member Data Documentation

◆ camera_distance

float unravel::batch_group::camera_distance = 0.0f

Distance from camera (for sorting)

Definition at line 97 of file batch_collector.h.

◆ instances

batch_instance_collection unravel::batch_group::instances

Collection of instances in this batch.

Definition at line 94 of file batch_collector.h.

◆ is_split_batch

bool unravel::batch_group::is_split_batch = false

Whether this batch was split from a larger one.

Definition at line 100 of file batch_collector.h.

◆ key

batch_key unravel::batch_group::key

Key identifying this batch (mesh, material, LOD, submesh)

Definition at line 91 of file batch_collector.h.


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