mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-10 14:51:46 +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())
|
||||
{
|
||||
L *= -1.0f / dist;
|
||||
DAngle negPitch = -light->Angles.Pitch;
|
||||
double xzLen = negPitch.Cos();
|
||||
double spotDirX = -light->Angles.Yaw.Cos() * xzLen;
|
||||
double spotDirY = -negPitch.Sin();
|
||||
double spotDirZ = -light->Angles.Yaw.Sin() * xzLen;
|
||||
double xyLen = negPitch.Cos();
|
||||
double spotDirX = -light->Angles.Yaw.Cos() * xyLen;
|
||||
double spotDirY = -light->Angles.Yaw.Sin() * xyLen;
|
||||
double spotDirZ = -negPitch.Sin();
|
||||
double cosDir = L.X * spotDirX + L.Y * spotDirY + L.Z * spotDirZ;
|
||||
frac *= (float)smoothstep(light->SpotOuterAngle.Cos(), light->SpotInnerAngle.Cos(), cosDir);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue