mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-05-31 09:11:43 +00:00
- Add dynamic spot lights
This commit is contained in:
parent
4b044e30d7
commit
5f36b86013
7 changed files with 134 additions and 13 deletions
|
@ -128,7 +128,26 @@ void gl_AddLightToList(int group, ADynamicLight * light, FDynLightData &ldata)
|
|||
|
||||
if (attenuate) shadowIndex = -shadowIndex;
|
||||
|
||||
float *data = &ldata.arrays[i][ldata.arrays[i].Reserve(8)];
|
||||
float lightType = 0.0f;
|
||||
float spotInnerAngle = 0.0f;
|
||||
float spotOuterAngle = 0.0f;
|
||||
float spotDirX = 0.0f;
|
||||
float spotDirY = 0.0f;
|
||||
float spotDirZ = 0.0f;
|
||||
if (light->IsSpot())
|
||||
{
|
||||
lightType = 1.0f;
|
||||
spotInnerAngle = light->SpotInnerAngle.Cos();
|
||||
spotOuterAngle = light->SpotOuterAngle.Cos();
|
||||
|
||||
DAngle negPitch = -light->Angles.Pitch;
|
||||
float xyLen = negPitch.Cos();
|
||||
spotDirX = light->Angles.Yaw.Cos() * xyLen;
|
||||
spotDirY = light->Angles.Yaw.Sin() * xyLen;
|
||||
spotDirZ = negPitch.Sin();
|
||||
}
|
||||
|
||||
float *data = &ldata.arrays[i][ldata.arrays[i].Reserve(16)];
|
||||
data[0] = pos.X;
|
||||
data[1] = pos.Z;
|
||||
data[2] = pos.Y;
|
||||
|
@ -137,5 +156,13 @@ void gl_AddLightToList(int group, ADynamicLight * light, FDynLightData &ldata)
|
|||
data[5] = g;
|
||||
data[6] = b;
|
||||
data[7] = shadowIndex;
|
||||
data[8] = spotDirX;
|
||||
data[9] = spotDirY;
|
||||
data[10] = spotDirZ;
|
||||
data[11] = lightType;
|
||||
data[12] = spotInnerAngle;
|
||||
data[13] = spotOuterAngle;
|
||||
data[14] = 0.0f; // unused
|
||||
data[15] = 0.0f; // unused
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue