Add missing file and only include static lights in the lightmaps

This commit is contained in:
Magnus Norddahl 2023-09-05 17:47:55 +02:00
commit 10a5e4d466
2 changed files with 56 additions and 30 deletions

View file

@ -305,38 +305,41 @@ void DoomLevelMesh::CreateLightList(DoomLevelMeshSurface* surface, FLightNode* n
{
FDynamicLight* light = node->lightsource;
DVector3 pos = light->PosRelative(portalgroup);
LevelMeshLight meshlight;
meshlight.Origin = { (float)pos.X, (float)pos.Y, (float)pos.Z };
meshlight.RelativeOrigin = meshlight.Origin; // ?? what is the difference between this and Origin?
meshlight.Radius = (float)light->GetRadius();
meshlight.Intensity = 1.0f;
if (light->IsSpot())
if (light->Trace())
{
meshlight.InnerAngleCos = (float)light->pSpotInnerAngle->Cos();
meshlight.OuterAngleCos = (float)light->pSpotOuterAngle->Cos();
DVector3 pos = light->PosRelative(portalgroup);
DAngle negPitch = -*light->pPitch;
DAngle Angle = light->target->Angles.Yaw;
double xzLen = negPitch.Cos();
meshlight.SpotDir.X = float(-Angle.Cos() * xzLen);
meshlight.SpotDir.Y = float(-negPitch.Sin());
meshlight.SpotDir.Z = float(-Angle.Sin() * xzLen);
}
else
{
meshlight.InnerAngleCos = -1.0f;
meshlight.OuterAngleCos = -1.0f;
meshlight.SpotDir.X = 0.0f;
meshlight.SpotDir.Y = 0.0f;
meshlight.SpotDir.Z = 0.0f;
}
meshlight.Color.X = light->GetRed() * (1.0f / 255.0f);
meshlight.Color.Y = light->GetGreen() * (1.0f / 255.0f);
meshlight.Color.Z = light->GetBlue() * (1.0f / 255.0f);
LevelMeshLight meshlight;
meshlight.Origin = { (float)pos.X, (float)pos.Y, (float)pos.Z };
meshlight.RelativeOrigin = meshlight.Origin; // ?? what is the difference between this and Origin?
meshlight.Radius = (float)light->GetRadius();
meshlight.Intensity = 1.0f;
if (light->IsSpot())
{
meshlight.InnerAngleCos = (float)light->pSpotInnerAngle->Cos();
meshlight.OuterAngleCos = (float)light->pSpotOuterAngle->Cos();
surface->LightListBuffer.push_back(meshlight);
DAngle negPitch = -*light->pPitch;
DAngle Angle = light->target->Angles.Yaw;
double xzLen = negPitch.Cos();
meshlight.SpotDir.X = float(-Angle.Cos() * xzLen);
meshlight.SpotDir.Y = float(-negPitch.Sin());
meshlight.SpotDir.Z = float(-Angle.Sin() * xzLen);
}
else
{
meshlight.InnerAngleCos = -1.0f;
meshlight.OuterAngleCos = -1.0f;
meshlight.SpotDir.X = 0.0f;
meshlight.SpotDir.Y = 0.0f;
meshlight.SpotDir.Z = 0.0f;
}
meshlight.Color.X = light->GetRed() * (1.0f / 255.0f);
meshlight.Color.Y = light->GetGreen() * (1.0f / 255.0f);
meshlight.Color.Z = light->GetBlue() * (1.0f / 255.0f);
surface->LightListBuffer.push_back(meshlight);
}
node = node->nextLight;
}