// SpecialEffectsDelayConfig.h
#ifndef SPECIAL_EFFECTS_DELAY_CONFIG_H
#define SPECIAL_EFFECTS_DELAY_CONFIG_H

// 特效延迟配置结构体
typedef struct {
    // 粒子系统延迟设置
    float particle_spawn_delay;           // 粒子生成延迟（毫秒）
    float particle_update_interval;       // 粒子更新间隔
    int max_particles_per_frame;         // 每帧最大粒子数
    float particle_LOD_distance;          // LOD距离阈值
    
    // 光影特效延迟
    float light_fade_in_delay;            // 光源淡入延迟
    float light_fade_out_delay;           // 光源淡出延迟
    int dynamic_light_limit;             // 动态光源数量限制
    float shadow_update_frequency;       // 阴影更新频率
    
    // 后期处理特效延迟
    float bloom_delay;                    // 泛光效果延迟
    float motion_blur_delay;              // 运动模糊延迟
    float depth_of_field_delay;           // 景深效果延迟
    int post_processing_quality;         // 后期处理质量等级
    
    // 物理特效延迟
    float physics_update_rate;           // 物理更新频率
    int ragdoll_delay_frames;            // 布娃娃系统延迟帧数
    float debris_cleanup_delay;          // 碎片清理延迟
    
    // 声音特效延迟
    float sound_fade_delay;               // 声音淡入淡出延迟
    float echo_effect_delay;             // 回声效果延迟
    int max_concurrent_sounds;           // 最大并发音效数
    
    // 性能优化设置
    int effect_LOD_level;                // 特效细节等级
    float distance_culling;              // 距离裁剪
    int texture_streaming_delay;         // 纹理流送延迟
} EffectDelayConfig;

// 预设配置
typedef enum {
    EFFECT_DELAY_LOW = 0,    // 低延迟 - 高性能
    EFFECT_DELAY_MEDIUM,     // 平衡模式
    EFFECT_DELAY_HIGH,       // 高延迟 - 高质量
    EFFECT_DELAY_ULTRA       // 超高质量
} EffectDelayPreset;

// 全局配置实例
extern EffectDelayConfig g_effectDelayConfig;

// 函数声明
void InitEffectDelayConfig(EffectDelayPreset preset);
void ApplyEffectDelaySettings(void);
void UpdateEffectDelayForPerformance(float currentFPS);
void SetParticleDelay(float delay);
void SetLightEffectDelay(float fadeIn, float fadeOut);

// 预设配置初始化
static const EffectDelayConfig PRESET_LOW = {
    // 粒子系统
    .particle_spawn_delay = 0.1f,
    .particle_update_interval = 0.033f,  // 30Hz
    .max_particles_per_frame = 500,
    .particle_LOD_distance = 50.0f,
    
    // 光影
    .light_fade_in_delay = 0.2f,
    .light_fade_out_delay = 0.3f,
    .dynamic_light_limit = 8,
    .shadow_update_frequency = 0.1f,     // 10Hz
    
    // 后期处理
    .bloom_delay = 0.05f,
    .motion_blur_delay = 0.02f,
    .depth_of_field_delay = 0.1f,
    .post_processing_quality = 1,
    
    // 物理
    .physics_update_rate = 0.016f,      // 60Hz
    .ragdoll_delay_frames = 2,
    .debris_cleanup_delay = 5.0f,
    
    // 声音
    .sound_fade_delay = 0.15f,
    .echo_effect_delay = 0.08f,
    .max_concurrent_sounds = 16,
    
    // 性能
    .effect_LOD_level = 1,
    .distance_culling = 100.0f,
    .texture_streaming_delay = 2
};

static const EffectDelayConfig PRESET_MEDIUM = {
    .particle_spawn_delay = 0.05f,
    .particle_update_interval = 0.016f,  // 60Hz
    .max_particles_per_frame = 1000,
    .particle_LOD_distance = 100.0f,
    
    .light_fade_in_delay = 0.1f,
    .light_fade_out_delay = 0.15f,
    .dynamic_light_limit = 16,
    .shadow_update_frequency = 0.05f,    // 20Hz
    
    .bloom_delay = 0.03f,
    .motion_blur_delay = 0.01f,
    .depth_of_field_delay = 0.05f,
    .post_processing_quality = 2,
    
    .physics_update_rate = 0.008f,       // 120Hz
    .ragdoll_delay_frames = 1,
    .debris_cleanup_delay = 3.0f,
    
    .sound_fade_delay = 0.1f,
    .echo_effect_delay = 0.05f,
    .max_concurrent_sounds = 24,
    
    .effect_LOD_level = 2,
    .distance_culling = 150.0f,
    .texture_streaming_delay = 1
};

static const EffectDelayConfig PRESET_HIGH = {
    .particle_spawn_delay = 0.02f,
    .particle_update_interval = 0.008f,  // 120Hz
    .max_particles_per_frame = 2000,
    .particle_LOD_distance = 200.0f,
    
    .light_fade_in_delay = 0.05f,
    .light_fade_out_delay = 0.08f,
    .dynamic_light_limit = 32,
    .shadow_update_frequency = 0.033f,   // 30Hz
    
    .bloom_delay = 0.01f,
    .motion_blur_delay = 0.005f,
    .depth_of_field_delay = 0.02f,
    .post_processing_quality = 3,
    
    .physics_update_rate = 0.004f,       // 240Hz
    .ragdoll_delay_frames = 0,
    .debris_cleanup_delay = 1.0f,
    
    .sound_fade_delay = 0.05f,
    .echo_effect_delay = 0.02f,
    .max_concurrent_sounds = 32,
    
    .effect_LOD_level = 3,
    .distance_culling = 200.0f,
    .texture_streaming_delay = 0
};

#endif // SPECIAL_EFFECTS_DELAY_CONFIG_H
