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

Retained per-model render proxy data used by the culling/LOD code. More...

#include <render_proxy.h>

Public Member Functions

void clear ()
 
void begin_refresh (size_t submesh_count)
 
void add_instance_bounds (uint32_t submesh_index, const math::bbox &world_bounds)
 
auto get_instance_bounds (uint32_t submesh_index, size_t instance_index) const -> const math::bbox *
 Gets the cached world bounds for a (submesh, instance) pair.
 
auto get_skinned_bounds (uint32_t submesh_index) const -> const math::bbox *
 Gets the cached animated world bounds for a skinned submesh.
 
auto has_animated_bounds () const -> bool
 
auto has_instance_bounds () const -> bool
 
auto has_pose_bounds () const -> bool
 

Public Attributes

hpp::small_vector< hpp::small_vector< math::bbox > > instance_bounds
 
std::vector< math::bboxskinned_bounds
 Cached world-space animated bounds per skinned submesh index.
 
math::bbox animated_bounds
 
math::bbox instance_bounds_union
 
uint64_t version {0}
 Increments on every refresh so consumers can detect staleness.
 

Detailed Description

Retained per-model render proxy data used by the culling/LOD code.

Stores cached world-space bounds for every renderable surface of a model:

  • one AABB per (submesh, transform instance) pair for non-skinned submeshes, mirroring the layout of submesh_pose_mat4 (outer index = submesh index, inner index = transform instance),
  • one animated AABB per submesh index for skinned submeshes, derived from the per-bone bind-space bounds transformed by the current bone world transforms.

The data is refreshed by model_component whenever poses/transforms are updated (dirty tracking via version), and consumed by the model submit paths so per-submesh visibility tests become cheap AABB-vs-frustum checks instead of per-draw OBB classification. Unpopulated bounds mean "no cached data" and consumers must fall back to conservative behavior (draw).

Definition at line 29 of file render_proxy.h.

Member Function Documentation

◆ add_instance_bounds()

void unravel::submesh_render_proxies::add_instance_bounds ( uint32_t submesh_index,
const math::bbox & world_bounds )
inline

Definition at line 67 of file render_proxy.h.

◆ begin_refresh()

void unravel::submesh_render_proxies::begin_refresh ( size_t submesh_count)
inline

Definition at line 57 of file render_proxy.h.

◆ clear()

void unravel::submesh_render_proxies::clear ( )
inline

Definition at line 49 of file render_proxy.h.

◆ get_instance_bounds()

auto unravel::submesh_render_proxies::get_instance_bounds ( uint32_t submesh_index,
size_t instance_index ) const -> const math::bbox*
inline

Gets the cached world bounds for a (submesh, instance) pair.

Returns
Pointer to populated bounds, or nullptr when no cached data exists.

Definition at line 85 of file render_proxy.h.

◆ get_skinned_bounds()

auto unravel::submesh_render_proxies::get_skinned_bounds ( uint32_t submesh_index) const -> const math::bbox*
inline

Gets the cached animated world bounds for a skinned submesh.

Returns
Pointer to populated bounds, or nullptr when no cached data exists.

Definition at line 104 of file render_proxy.h.

◆ has_animated_bounds()

auto unravel::submesh_render_proxies::has_animated_bounds ( ) const -> bool
inline

Definition at line 114 of file render_proxy.h.

◆ has_instance_bounds()

auto unravel::submesh_render_proxies::has_instance_bounds ( ) const -> bool
inline

Definition at line 119 of file render_proxy.h.

◆ has_pose_bounds()

auto unravel::submesh_render_proxies::has_pose_bounds ( ) const -> bool
inline

True when any cached bounds exist that can diverge from the static mesh box (node-driven submesh placements or skinned pose bounds).

Definition at line 126 of file render_proxy.h.

Member Data Documentation

◆ animated_bounds

math::bbox unravel::submesh_render_proxies::animated_bounds

Union of all skinned submesh bounds (world space). Unpopulated when the model has no skinned submeshes or bone bounds are unavailable.

Definition at line 40 of file render_proxy.h.

◆ instance_bounds

hpp::small_vector<hpp::small_vector<math::bbox> > unravel::submesh_render_proxies::instance_bounds

Cached world-space bounds per (submesh, transform instance). Mirrors submesh_pose_mat4::submesh_to_transform_indices layout.

Definition at line 33 of file render_proxy.h.

◆ instance_bounds_union

math::bbox unravel::submesh_render_proxies::instance_bounds_union

Union of all populated per-instance bounds (world space), accumulated during refresh so whole-model bounds don't need to walk the per-instance lists.

Definition at line 44 of file render_proxy.h.

◆ skinned_bounds

std::vector<math::bbox> unravel::submesh_render_proxies::skinned_bounds

Cached world-space animated bounds per skinned submesh index.

Definition at line 36 of file render_proxy.h.

◆ version

uint64_t unravel::submesh_render_proxies::version {0}

Increments on every refresh so consumers can detect staleness.

Definition at line 47 of file render_proxy.h.


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