mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-10 23:01:59 +00:00
- Fix sprite spot light calculation
This commit is contained in:
parent
bae3620540
commit
79440d7014
1 changed files with 5 additions and 4 deletions
|
@ -107,11 +107,12 @@ void gl_SetDynSpriteLight(AActor *self, float x, float y, float z, subsector_t *
|
||||||
|
|
||||||
if (light->IsSpot())
|
if (light->IsSpot())
|
||||||
{
|
{
|
||||||
|
L *= -1.0f / dist;
|
||||||
DAngle negPitch = -light->Angles.Pitch;
|
DAngle negPitch = -light->Angles.Pitch;
|
||||||
double xzLen = negPitch.Cos();
|
double xyLen = negPitch.Cos();
|
||||||
double spotDirX = -light->Angles.Yaw.Cos() * xzLen;
|
double spotDirX = -light->Angles.Yaw.Cos() * xyLen;
|
||||||
double spotDirY = -negPitch.Sin();
|
double spotDirY = -light->Angles.Yaw.Sin() * xyLen;
|
||||||
double spotDirZ = -light->Angles.Yaw.Sin() * xzLen;
|
double spotDirZ = -negPitch.Sin();
|
||||||
double cosDir = L.X * spotDirX + L.Y * spotDirY + L.Z * spotDirZ;
|
double cosDir = L.X * spotDirX + L.Y * spotDirY + L.Z * spotDirZ;
|
||||||
frac *= (float)smoothstep(light->SpotOuterAngle.Cos(), light->SpotInnerAngle.Cos(), cosDir);
|
frac *= (float)smoothstep(light->SpotOuterAngle.Cos(), light->SpotInnerAngle.Cos(), cosDir);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue