Add light max effective radius method

This commit is contained in:
Jarrod Doyle 2024-12-10 16:55:22 +00:00
parent 9fd33efeed
commit 06803fa07f
Signed by: Jayrude
GPG Key ID: 38B57B16E7C0ADF7
1 changed files with 12 additions and 0 deletions

View File

@ -7,6 +7,7 @@ public class Light
{ {
public Vector3 Position; public Vector3 Position;
public Vector3 Color; public Vector3 Color;
public float Brightness;
public float InnerRadius; public float InnerRadius;
public float Radius; public float Radius;
public float R2; public float R2;
@ -81,4 +82,15 @@ public class Light
return strength; return strength;
} }
public float CalculateMaxRadius(float minLightCutoff)
{
// TODO: Should it be ceiling'd? Do we need to care about hdr? (I don't think so)
var radius = 8 * Brightness / minLightCutoff;
return radius;
// 2 / (x / 4.0f) = minLightCutoff;
// 2 / minLightCutOff = x / 4.0f;
// x = 8 * rgb / minLightCutOff;
}
} }