Rename SourceRadius to SoftShadowRadius

This commit is contained in:
nashmuhandes 2024-06-15 18:08:20 +08:00
parent 6bdb4c28ca
commit 3750bdd79a
10 changed files with 15 additions and 15 deletions

View file

@ -57,13 +57,13 @@ thing // ZDRayInfo (ZDRay properties for the map)
thing // Lightmap point light (Light color and distance properties use the same args as dynamic lights) thing // Lightmap point light (Light color and distance properties use the same args as dynamic lights)
{ {
type = 9876; type = 9876;
sourceradius = <float> (default: 5, radius of the light source in map units; controls the softness) SoftShadowRadius = <float> (default: 5, radius of the light source in map units; controls the shadow softness. Note that dynamic raytraced lights can also use this feature)
} }
thing // Lightmap spotlight (Light color, distance and angle properties use the same args as dynamic lights) thing // Lightmap spotlight (Light color, distance and angle properties use the same args as dynamic lights)
{ {
type = 9881; type = 9881;
SourceRadius = <float> (default: 5, radius of the light source in map units; controls the shadow softness. Note that dynamic raytraced lights can also use this feature) SoftShadowRadius = <float> (default: 5, radius of the light source in map units; controls the shadow softness. Note that dynamic raytraced lights can also use this feature)
} }
linedef linedef

View file

@ -432,7 +432,7 @@ struct ThingLight
float outerAngleCos; float outerAngleCos;
float height; float height;
float radius; float radius;
float sourceRadius; float softShadowRadius;
bool bCeiling; bool bCeiling;
IntSector *sector; IntSector *sector;
MapSubsectorEx *ssect; MapSubsectorEx *ssect;

View file

@ -247,7 +247,7 @@ void FLevel::CreateLights()
float lightDistance = 0.0f; float lightDistance = 0.0f;
float innerAngleCos = -1.0f; float innerAngleCos = -1.0f;
float outerAngleCos = -1.0f; float outerAngleCos = -1.0f;
float sourceradius = 5.0f; float softshadowradius = 5.0f;
// need to process point lights and spot lights differently due to their // need to process point lights and spot lights differently due to their
// inconsistent arg usage... // inconsistent arg usage...
@ -282,9 +282,9 @@ void FLevel::CreateLights()
for (const auto& prop : thing->props) for (const auto& prop : thing->props)
{ {
if (!stricmp(prop.key, "sourceradius")) if (!stricmp(prop.key, "softshadowradius"))
{ {
sourceradius = atof(prop.value); softshadowradius = atof(prop.value);
} }
} }
@ -313,7 +313,7 @@ void FLevel::CreateLights()
thingLight.origin.X = x; thingLight.origin.X = x;
thingLight.origin.Y = y; thingLight.origin.Y = y;
thingLight.sectorGroup = thingLight.sector->group; thingLight.sectorGroup = thingLight.sector->group;
thingLight.sourceRadius = sourceradius; thingLight.softShadowRadius = softshadowradius;
ThingLights.Push(thingLight); ThingLights.Push(thingLight);
} }

View file

@ -148,7 +148,7 @@ int DoomLevelMesh::GetLightIndex(ThingLight* light, int portalgroup)
meshlight.OuterAngleCos = light->outerAngleCos; meshlight.OuterAngleCos = light->outerAngleCos;
meshlight.SpotDir = light->SpotDir(); meshlight.SpotDir = light->SpotDir();
meshlight.Color = light->rgb; meshlight.Color = light->rgb;
meshlight.SourceRadius = light->sourceRadius; meshlight.SoftShadowRadius = light->softShadowRadius;
meshlight.SectorGroup = 0; meshlight.SectorGroup = 0;
// if (light->sector) // if (light->sector)

View file

@ -38,7 +38,7 @@ struct LightInfo
float InnerAngleCos; float InnerAngleCos;
float OuterAngleCos; float OuterAngleCos;
vec3 SpotDir; vec3 SpotDir;
float SourceRadius; float SoftShadowRadius;
vec3 Color; vec3 Color;
float Padding3; float Padding3;
}; };

View file

@ -30,7 +30,7 @@ struct LightInfo
float InnerAngleCos; float InnerAngleCos;
float OuterAngleCos; float OuterAngleCos;
vec3 SpotDir; vec3 SpotDir;
float SourceRadius; float SoftShadowRadius;
vec3 Color; vec3 Color;
float Padding3; float Padding3;
}; };

View file

@ -30,13 +30,13 @@ vec3 TraceLight(vec3 origin, vec3 normal, LightInfo light, float extraDistance)
#if defined(USE_SOFTSHADOWS) #if defined(USE_SOFTSHADOWS)
if (light.SourceRadius != 0.0) if (light.SoftShadowRadius != 0.0)
{ {
vec3 v = (abs(dir.x) > abs(dir.y)) ? vec3(0.0, 1.0, 0.0) : vec3(1.0, 0.0, 0.0); vec3 v = (abs(dir.x) > abs(dir.y)) ? vec3(0.0, 1.0, 0.0) : vec3(1.0, 0.0, 0.0);
vec3 xdir = normalize(cross(dir, v)); vec3 xdir = normalize(cross(dir, v));
vec3 ydir = cross(dir, xdir); vec3 ydir = cross(dir, xdir);
float lightsize = light.SourceRadius; float lightsize = light.SoftShadowRadius;
int step_count = 10; int step_count = 10;
for (int i = 0; i < step_count; i++) for (int i = 0; i < step_count; i++)
{ {

View file

@ -15,5 +15,5 @@ public:
FVector3 SpotDir; FVector3 SpotDir;
FVector3 Color; FVector3 Color;
int SectorGroup; int SectorGroup;
float SourceRadius; float SoftShadowRadius;
}; };

View file

@ -670,7 +670,7 @@ void VkLevelMeshUploader::UploadLights()
info.OuterAngleCos = light.OuterAngleCos; info.OuterAngleCos = light.OuterAngleCos;
info.SpotDir = SwapYZ(light.SpotDir); info.SpotDir = SwapYZ(light.SpotDir);
info.Color = light.Color; info.Color = light.Color;
info.SourceRadius = light.SourceRadius; info.SoftShadowRadius = light.SoftShadowRadius;
*(lights++) = info; *(lights++) = info;
} }

View file

@ -57,7 +57,7 @@ struct LightInfo
float InnerAngleCos; float InnerAngleCos;
float OuterAngleCos; float OuterAngleCos;
FVector3 SpotDir; FVector3 SpotDir;
float SourceRadius; float SoftShadowRadius;
FVector3 Color; FVector3 Color;
float Padding3; float Padding3;
}; };