Files
fs2open.github.com/code/lab/labv2.cpp
the-eandClaude Sonnet 5.5 c5b761ca5d Apply review feedback on softer shadows
- Bind the GL raw-depth sampler on unit 11 in the deferred pass and
  unbind it after the pass.
- Enable RTAO only when shadows are on, and remove the RTAO option when
  ray tracing is not supported.
- Use every second Poisson tap in the PCSS blocker search.
- Use TLAS-relative ray origins for RTAO.
- Gate +AngularSize: at version 27.0.
- Measure an .eff sun from its first frame, and skip the measurement
  when shadows are off.
- Guard the GL 3.3 sampler check for GLES builds.
- Restore the lab session overrides when the lab closes.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-11-07 19:45:48 +01:00

70 lines
1.8 KiB
C++

#include "lab/labv2.h"
#include "lab/labv2_internal.h"
#include "lab/manager/lab_manager.h"
#include "gamesequence/gamesequence.h"
#include "graphics/rtao.h"
#include "graphics/shadows.h"
#include "starfield/starfield.h"
static std::unique_ptr<LabManager> LMGR;
const std::unique_ptr<LabManager> &getLabManager() {
if (LMGR == nullptr) {
LMGR.reset(new LabManager());
}
return LMGR;
}
namespace {
// The lab changes these settings directly, so we save them when the lab opens and restore them when it closes.
struct LabSavedSettings {
RTShadowQuality rt_shadow_quality;
float rt_shadow_bias_min;
float rt_shadow_bias_max;
int rt_shadow_samples_override;
float sun_angular_size_override;
int rtao_samples;
bool shadow_contact_hardening_enabled;
};
bool Lab_settings_saved = false;
LabSavedSettings Lab_saved_settings;
}
void lab_init() {
gr_set_clear_color(0, 0, 0);
Lab_saved_settings = {Rt_shadow_quality,
Rt_shadow_bias_min,
Rt_shadow_bias_max,
Rt_shadow_samples_override,
Sun_angular_size_override,
Rtao_samples,
Shadow_contact_hardening_enabled};
Lab_settings_saved = true;
}
void lab_close(bool reset) {
if (Lab_settings_saved) {
Rt_shadow_quality = Lab_saved_settings.rt_shadow_quality;
Rt_shadow_bias_min = Lab_saved_settings.rt_shadow_bias_min;
Rt_shadow_bias_max = Lab_saved_settings.rt_shadow_bias_max;
Rt_shadow_samples_override = Lab_saved_settings.rt_shadow_samples_override;
Sun_angular_size_override = Lab_saved_settings.sun_angular_size_override;
Rtao_samples = Lab_saved_settings.rtao_samples;
Shadow_contact_hardening_enabled = Lab_saved_settings.shadow_contact_hardening_enabled;
Lab_settings_saved = false;
}
if (reset) {
LMGR.reset();
}
gameseq_post_event(GS_EVENT_PREVIOUS_STATE);
}
void lab_do_frame(float frametime) {
getLabManager()->onFrame(frametime);
}