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
1 change: 1 addition & 0 deletions resource/dist/ModelExtras.ini
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ CoronaNearClip = 0.45 # Minimum camera clipping di
LightShadowDistance = 120.0 # Maximum draw distance for vehicle ground light shadows
HighBeamPointLightMul = 2.0 # Multiplier for high beam point light reach (1.0 matches low beam, up to 4.0)
PointLightIntensity = 0.8 # Brightness multiplier for dynamic point lights (0.0 to 1.0)
SirenPointLightMul = 1.0 # Multiplier for siren point light reach (up to 4.0)
LightHeightLimit = 1.4 # Light height limit (0.0 to disable)
MaterialAmbientMul = 1.0 # Multiplier for illuminated light material ambient brightness
LightCoronaSize = 0.3 # Standard base of coronas size for turn and other lights
Expand Down
4 changes: 4 additions & 0 deletions src/ModelExtrasAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -432,5 +432,9 @@ float ME_GetPointLightIntensity() {
return LightsConfig::Get().fPointLightIntensity;
}

float ME_GetSirenPointLightMul() {
return LightsConfig::Get().fSirenPointLightMul;
}

} // extern "C"

1 change: 1 addition & 0 deletions src/ModelExtrasAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ extern "C"

// Visual & Render Configuration
ME_WRAPPER float ME_GetPointLightIntensity();
ME_WRAPPER float ME_GetSirenPointLightMul();

#ifdef __cplusplus
}
Expand Down
4 changes: 4 additions & 0 deletions src/features/lights/data.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ struct LightsConfig {
bool bPlayerIdleBrakeLights = false;
float fHighBeamPointLightMul = 2.0f;
float fPointLightIntensity = 0.8f;
float fSirenPointLightMul = 1.0f;

void InitConfig() {
gbGlobalIndicatorLights = gConfig.ReadBoolean("LIGHTS", "StandardLights_GlobalIndicatorLights", gConfig.ReadBoolean("FEATURES", "StandardLights_GlobalIndicatorLights", false));
Expand Down Expand Up @@ -88,6 +89,9 @@ struct LightsConfig {

float rawIntensity = gConfig.ReadFloat("LIGHTS", "PointLightIntensity", gConfig.ReadFloat("TWEAKS", "PointLightIntensity", 0.8f));
fPointLightIntensity = std::clamp(rawIntensity, 0.0f, 1.0f);

float rawSirenMul = gConfig.ReadFloat("LIGHTS", "SirenPointLightMul", gConfig.ReadFloat("TWEAKS", "SirenPointLightMul", 1.0f));
fSirenPointLightMul = (rawSirenMul < 0.1f) ? 0.1f : ((rawSirenMul > 4.0f) ? 4.0f : rawSirenMul);
}

private:
Expand Down
7 changes: 4 additions & 3 deletions src/features/sirens.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1292,7 +1292,7 @@ void Sirens::ProcessPointLights(CVehicle *pVeh)
} else if (mat.second->Size > 0.0f) {
sirenRadius = mat.second->Size * 3.0f;
}
sirenRadius = std::clamp(sirenRadius, 5.0f, 15.0f);
sirenRadius = std::clamp(sirenRadius, 5.0f, 15.0f) * LightsConfig::Get().fSirenPointLightMul;

float intensity = LightsConfig::Get().fPointLightIntensity;
float r = std::clamp((activeColor.r / 255.0f) * intensity, 0.0f, 1.0f);
Expand Down Expand Up @@ -1371,21 +1371,22 @@ void Sirens::ProcessPointLights(CVehicle *pVeh)
uint32_t step = (CTimer::m_snTimeInMilliseconds / 120) % 4;
CMatrix vehMat = pVeh->GetMatrix();
float intensity = LightsConfig::Get().fPointLightIntensity;
float bikeSirenRadius = 8.5f * LightsConfig::Get().fSirenPointLightMul;
if (step == 0 || step == 1)
{
CVector localLeft(-0.35f, 0.70f, 0.45f);
CVector plightPos = pVeh->TransformFromObjectSpace(localLeft);
CVector worldDir = vehMat.up - vehMat.at * 0.25f;
worldDir.Normalize();
CPointLights::AddLight(PLTYPE_SPOTLIGHT, plightPos, worldDir, 8.5f, 1.0f * intensity, 0.1f * intensity, 0.1f * intensity, 0, false, nullptr);
CPointLights::AddLight(PLTYPE_SPOTLIGHT, plightPos, worldDir, bikeSirenRadius, 1.0f * intensity, 0.1f * intensity, 0.1f * intensity, 0, false, nullptr);
}
else if (step == 2 || step == 3)
{
CVector localRight(0.35f, 0.70f, 0.45f);
CVector plightPos = pVeh->TransformFromObjectSpace(localRight);
CVector worldDir = vehMat.up - vehMat.at * 0.25f;
worldDir.Normalize();
CPointLights::AddLight(PLTYPE_SPOTLIGHT, plightPos, worldDir, 8.5f, 0.1f * intensity, 0.1f * intensity, 1.0f * intensity, 0, false, nullptr);
CPointLights::AddLight(PLTYPE_SPOTLIGHT, plightPos, worldDir, bikeSirenRadius, 0.1f * intensity, 0.1f * intensity, 1.0f * intensity, 0, false, nullptr);
}
}
}
Expand Down