Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set(CMAKE_POLICY_WARNING_CMP0116 OFF)
project(
# gersemi: ignore
CommunityShaders
VERSION 1.4.10
VERSION 1.4.11
LANGUAGES CXX
)

Expand Down
12 changes: 10 additions & 2 deletions src/Features/LightLimitFix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
static constexpr uint CLUSTER_MAX_LIGHTS = 128;
static constexpr uint MAX_LIGHTS = 1024;

NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(
LightLimitFix::Settings,
EnableContactShadows,
Comment thread
alandtse marked this conversation as resolved.
LightsVisualisationMode)

void LightLimitFix::DrawSettings()
{
auto shaderCache = globals::shaderCache;
Expand Down Expand Up @@ -165,16 +170,19 @@ void LightLimitFix::SetupResources()
}
}

void LightLimitFix::LoadSettings(json&)
void LightLimitFix::LoadSettings(json& o_json)
{
settings = o_json;
}

void LightLimitFix::SaveSettings(json&)
void LightLimitFix::SaveSettings(json& o_json)
{
o_json = settings;
}

void LightLimitFix::RestoreDefaultSettings()
{
settings = {};
}

RE::NiNode* GetParentRoomNode(RE::NiAVObject* object)
Expand Down
1 change: 1 addition & 0 deletions src/Features/LightLimitFix.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ struct LightLimitFix : OverlayFeature

struct Settings
{
bool EnableContactShadows = false;
bool EnableLightsVisualisation = false;
uint LightsVisualisationMode = 0;
};
Comment thread
alandtse marked this conversation as resolved.
Expand Down
18 changes: 18 additions & 0 deletions src/State.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,12 @@ void State::SaveToJson(nlohmann::json& settings)
auto& upscalingJson = settings[upscaling.GetShortName()];
upscaling.SaveSettings(upscalingJson);

json originalShaders;
ForEachShaderTypeWithIndex([&](auto type, int classIndex) {
originalShaders[magic_enum::enum_name(type)] = enabledClasses[classIndex];
});
settings["Replace Original Shaders"] = originalShaders;

json disabledFeaturesJson;
for (const auto& [featureName, isDisabled] : disabledFeatures) {
disabledFeaturesJson[featureName] = isDisabled;
Expand Down Expand Up @@ -473,6 +479,18 @@ void State::LoadFromJson(nlohmann::json& settings)
shaderCache->SetAsync(general["Enable Async"]);
}

if (settings.contains("Replace Original Shaders") && settings["Replace Original Shaders"].is_object()) {
json& originalShaders = settings["Replace Original Shaders"];
ForEachShaderTypeWithIndex([&](auto type, int classIndex) {
auto name = magic_enum::enum_name(type);
if (originalShaders.contains(name) && originalShaders[name].is_boolean()) {
enabledClasses[classIndex] = originalShaders[name];
} else {
logger::warn("Invalid entry for shader class '{}', using current value", name);
Comment thread
alandtse marked this conversation as resolved.
}
});
}

// Load feature settings (only for already-loaded features)
for (auto* feature : Feature::GetFeatureList()) {
if (feature->loaded) {
Expand Down
1 change: 1 addition & 0 deletions src/State.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class State
for (auto& v : drawCalls) v = 0;
for (auto& v : frameTimePerType) v = 0.0f;
for (auto& v : smoothFrameTimePerType) v = 0.0f;
for (auto& v : enabledClasses) v = true;

// Initialize QueryPerformanceCounter frequency
frameTimingFrequency.QuadPart = 0;
Expand Down