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

Shadow mapping generator with improved algorithms for high-altitude cameras. More...

#include <shadow.h>

Public Member Functions

 shadowmap_generator ()
 
 ~shadowmap_generator ()
 
void init (rtti::context &ctx)
 
void deinit ()
 
void deinit_textures ()
 
void deinit_uniforms ()
 
void update (const camera &cam, const light &l, const math::transform &ltrans, bool is_active)
 
auto already_updated () const -> bool
 
void generate_shadowmaps (const shadow_map_models_t &model)
 
auto get_depth_type () const -> PackDepth::Enum
 
auto get_rt_texture (uint8_t split) const -> bgfx::TextureHandle
 
auto get_depth_render_program (PackDepth::Enum depth) const -> gpu_program::ptr
 
void submit_uniforms (uint8_t stage) const
 
void set_frustum_calculation_method (frustum_calculation_method::Enum method)
 
auto get_frustum_calculation_method () const -> frustum_calculation_method::Enum
 
void set_csm_optimization_flags (uint32_t flags)
 
auto get_csm_optimization_flags () const -> uint32_t
 
void enable_adaptive_shadows (bool enable)
 
void set_adaptive_params (const adaptive_shadow_params &params)
 
auto get_adaptive_params () const -> const adaptive_shadow_params &
 
void set_altitude_scale_factor (float factor)
 
auto get_altitude_scale_factor () const -> float
 
void set_altitude_boost_range (float min_boost, float max_boost)
 
auto get_min_altitude_boost () const -> float
 
auto get_max_altitude_boost () const -> float
 

Detailed Description

Shadow mapping generator with improved algorithms for high-altitude cameras.

This class provides three different frustum calculation methods:

  1. Legacy: Original fixed frustum calculation
  2. Adaptive: Camera altitude-aware frustum extension
  3. Hybrid: Blend between legacy and adaptive approaches

Usage examples:

// Enable adaptive shadows for high-altitude cameras shadowmap_generator generator; generator.enable_adaptive_shadows(true);

// Fine-tune adaptive parameters adaptive_shadow_params params; params.altitude_scale_factor = 0.3f; // Less aggressive altitude compensation params.max_altitude_boost = 50.0f; // Cap the maximum boost generator.set_adaptive_params(params);

// Use hybrid mode for gradual transition generator.set_frustum_calculation_method(frustum_calculation_method::hybrid);

// Switch back to legacy for comparison generator.set_frustum_calculation_method(frustum_calculation_method::legacy);

Definition at line 596 of file shadow.h.

Constructor & Destructor Documentation

◆ shadowmap_generator()

unravel::shadow::shadowmap_generator::shadowmap_generator ( )

Definition at line 513 of file shadow.cpp.

◆ ~shadowmap_generator()

unravel::shadow::shadowmap_generator::~shadowmap_generator ( )

Definition at line 518 of file shadow.cpp.

Member Function Documentation

◆ already_updated()

auto unravel::shadow::shadowmap_generator::already_updated ( ) const -> bool

Definition at line 1231 of file shadow.cpp.

◆ deinit()

void unravel::shadow::shadowmap_generator::deinit ( )

Definition at line 523 of file shadow.cpp.

◆ deinit_textures()

void unravel::shadow::shadowmap_generator::deinit_textures ( )

Definition at line 529 of file shadow.cpp.

◆ deinit_uniforms()

void unravel::shadow::shadowmap_generator::deinit_uniforms ( )

Definition at line 554 of file shadow.cpp.

◆ enable_adaptive_shadows()

void unravel::shadow::shadowmap_generator::enable_adaptive_shadows ( bool enable)
inline

Definition at line 624 of file shadow.h.

◆ generate_shadowmaps()

void unravel::shadow::shadowmap_generator::generate_shadowmaps ( const shadow_map_models_t & model)

begin generating

RENDERVIEW_SHADOWMAP_0_ID - Clear shadow map. (used as convenience, otherwise render_pass_1 could be cleared) RENDERVIEW_SHADOWMAP_1_ID - Craft shadow map. RENDERVIEW_VBLUR_0_ID - Vertical blur. RENDERVIEW_HBLUR_0_ID - Horizontal blur.

RENDERVIEW_SHADOWMAP_0_ID - Clear entire shadow map. RENDERVIEW_SHADOWMAP_1_ID - Craft green tetrahedron shadow face. RENDERVIEW_SHADOWMAP_2_ID - Craft yellow tetrahedron shadow face. RENDERVIEW_SHADOWMAP_3_ID - Craft blue tetrahedron shadow face. RENDERVIEW_SHADOWMAP_4_ID - Craft red tetrahedron shadow face. RENDERVIEW_VBLUR_0_ID - Vertical blur. RENDERVIEW_HBLUR_0_ID - Horizontal blur.

RENDERVIEW_SHADOWMAP_1_ID - Craft shadow map for first split. RENDERVIEW_SHADOWMAP_2_ID - Craft shadow map for second split. RENDERVIEW_SHADOWMAP_3_ID - Craft shadow map for third split. RENDERVIEW_SHADOWMAP_4_ID - Craft shadow map for fourth split. RENDERVIEW_VBLUR_0_ID - Vertical blur for first split. RENDERVIEW_HBLUR_0_ID - Horizontal blur for first split. RENDERVIEW_VBLUR_1_ID - Vertical blur for second split. RENDERVIEW_HBLUR_1_ID - Horizontal blur for second split. RENDERVIEW_VBLUR_2_ID - Vertical blur for third split. RENDERVIEW_HBLUR_2_ID - Horizontal blur for third split. RENDERVIEW_VBLUR_3_ID - Vertical blur for fourth split. RENDERVIEW_HBLUR_3_ID - Horizontal blur for fourth split.

Definition at line 1907 of file shadow.cpp.

◆ get_adaptive_params()

auto unravel::shadow::shadowmap_generator::get_adaptive_params ( ) const -> const adaptive_shadow_params&
inline

Definition at line 636 of file shadow.h.

◆ get_altitude_scale_factor()

auto unravel::shadow::shadowmap_generator::get_altitude_scale_factor ( ) const -> float
inline

Definition at line 639 of file shadow.h.

◆ get_csm_optimization_flags()

auto unravel::shadow::shadowmap_generator::get_csm_optimization_flags ( ) const -> uint32_t
inline

Definition at line 622 of file shadow.h.

◆ get_depth_render_program()

auto unravel::shadow::shadowmap_generator::get_depth_render_program ( PackDepth::Enum depth) const -> gpu_program::ptr

Definition at line 1206 of file shadow.cpp.

◆ get_depth_type()

auto unravel::shadow::shadowmap_generator::get_depth_type ( ) const -> PackDepth::Enum

Definition at line 1190 of file shadow.cpp.

◆ get_frustum_calculation_method()

auto unravel::shadow::shadowmap_generator::get_frustum_calculation_method ( ) const -> frustum_calculation_method::Enum
inline

Definition at line 619 of file shadow.h.

◆ get_max_altitude_boost()

auto unravel::shadow::shadowmap_generator::get_max_altitude_boost ( ) const -> float
inline

Definition at line 647 of file shadow.h.

◆ get_min_altitude_boost()

auto unravel::shadow::shadowmap_generator::get_min_altitude_boost ( ) const -> float
inline

Definition at line 646 of file shadow.h.

◆ get_rt_texture()

auto unravel::shadow::shadowmap_generator::get_rt_texture ( uint8_t split) const -> bgfx::TextureHandle

Definition at line 1196 of file shadow.cpp.

◆ init()

void unravel::shadow::shadowmap_generator::init ( rtti::context & ctx)

Definition at line 570 of file shadow.cpp.

◆ set_adaptive_params()

void unravel::shadow::shadowmap_generator::set_adaptive_params ( const adaptive_shadow_params & params)
inline

Definition at line 635 of file shadow.h.

◆ set_altitude_boost_range()

void unravel::shadow::shadowmap_generator::set_altitude_boost_range ( float min_boost,
float max_boost )
inline

Definition at line 641 of file shadow.h.

◆ set_altitude_scale_factor()

void unravel::shadow::shadowmap_generator::set_altitude_scale_factor ( float factor)
inline

Definition at line 638 of file shadow.h.

◆ set_csm_optimization_flags()

void unravel::shadow::shadowmap_generator::set_csm_optimization_flags ( uint32_t flags)
inline

Definition at line 621 of file shadow.h.

◆ set_frustum_calculation_method()

void unravel::shadow::shadowmap_generator::set_frustum_calculation_method ( frustum_calculation_method::Enum method)
inline

Definition at line 618 of file shadow.h.

◆ submit_uniforms()

void unravel::shadow::shadowmap_generator::submit_uniforms ( uint8_t stage) const

Definition at line 1211 of file shadow.cpp.

◆ update()

void unravel::shadow::shadowmap_generator::update ( const camera & cam,
const light & l,
const math::transform & ltrans,
bool is_active )

Definition at line 1236 of file shadow.cpp.


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