mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-01-22 01:11:49 +00:00
Add missing file and only include static lights in the lightmaps
This commit is contained in:
parent
8fa46c722d
commit
04941cab43
2 changed files with 55 additions and 29 deletions
|
@ -305,38 +305,41 @@ void DoomLevelMesh::CreateLightList(DoomLevelMeshSurface* surface, FLightNode* n
|
||||||
{
|
{
|
||||||
FDynamicLight* light = node->lightsource;
|
FDynamicLight* light = node->lightsource;
|
||||||
|
|
||||||
DVector3 pos = light->PosRelative(portalgroup);
|
if (light->Trace())
|
||||||
|
|
||||||
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();
|
DVector3 pos = light->PosRelative(portalgroup);
|
||||||
meshlight.OuterAngleCos = (float)light->pSpotOuterAngle->Cos();
|
|
||||||
|
|
||||||
DAngle negPitch = -*light->pPitch;
|
LevelMeshLight meshlight;
|
||||||
DAngle Angle = light->target->Angles.Yaw;
|
meshlight.Origin = { (float)pos.X, (float)pos.Y, (float)pos.Z };
|
||||||
double xzLen = negPitch.Cos();
|
meshlight.RelativeOrigin = meshlight.Origin; // ?? what is the difference between this and Origin?
|
||||||
meshlight.SpotDir.X = float(-Angle.Cos() * xzLen);
|
meshlight.Radius = (float)light->GetRadius();
|
||||||
meshlight.SpotDir.Y = float(-negPitch.Sin());
|
meshlight.Intensity = 1.0f;
|
||||||
meshlight.SpotDir.Z = float(-Angle.Sin() * xzLen);
|
if (light->IsSpot())
|
||||||
}
|
{
|
||||||
else
|
meshlight.InnerAngleCos = (float)light->pSpotInnerAngle->Cos();
|
||||||
{
|
meshlight.OuterAngleCos = (float)light->pSpotOuterAngle->Cos();
|
||||||
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);
|
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;
|
node = node->nextLight;
|
||||||
}
|
}
|
||||||
|
|
23
wadsrc/static/shaders/lightmap/frag_blur.glsl
Normal file
23
wadsrc/static/shaders/lightmap/frag_blur.glsl
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
|
||||||
|
layout(set = 0, binding = 0) uniform sampler2D tex;
|
||||||
|
|
||||||
|
layout(location = 0) in vec3 worldpos;
|
||||||
|
layout(location = 0) out vec4 fragcolor;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
ivec2 size = textureSize(tex, 0);
|
||||||
|
vec2 texCoord = gl_FragCoord.xy / vec2(size);
|
||||||
|
|
||||||
|
#if defined(BLUR_HORIZONTAL)
|
||||||
|
fragcolor =
|
||||||
|
textureOffset(tex, texCoord, ivec2( 0, 0)) * 0.5 +
|
||||||
|
textureOffset(tex, texCoord, ivec2( 1, 0)) * 0.25 +
|
||||||
|
textureOffset(tex, texCoord, ivec2(-1, 0)) * 0.25;
|
||||||
|
#else
|
||||||
|
fragcolor =
|
||||||
|
textureOffset(tex, texCoord, ivec2(0, 0)) * 0.5 +
|
||||||
|
textureOffset(tex, texCoord, ivec2(0, 1)) * 0.25 +
|
||||||
|
textureOffset(tex, texCoord, ivec2(0,-1)) * 0.25;
|
||||||
|
#endif
|
||||||
|
}
|
Loading…
Reference in a new issue