mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-22 20:21:26 +00:00
Read ZDRay info thing
This commit is contained in:
parent
efbbdc2925
commit
18a873923f
6 changed files with 42 additions and 5 deletions
|
@ -178,6 +178,7 @@ public:
|
|||
|
||||
FVector3 SunDirection = FVector3(0.0f, 0.0f, -1.0f);
|
||||
FVector3 SunColor = FVector3(0.0f, 0.0f, 0.0f);
|
||||
uint16_t LightmapSampleDistance = 16;
|
||||
|
||||
bool Trace(const FVector3& start, FVector3 direction, float maxDist)
|
||||
{
|
||||
|
|
|
@ -458,6 +458,7 @@ public:
|
|||
TArray<DoomLevelMeshSurface*> LMSurfaces;
|
||||
FVector3 SunDirection;
|
||||
FVector3 SunColor;
|
||||
uint16_t LightmapSampleDistance;
|
||||
|
||||
// Portal information.
|
||||
FDisplacementTable Displacements;
|
||||
|
|
|
@ -2940,9 +2940,6 @@ void MapLoader::CalcIndices()
|
|||
|
||||
void MapLoader::InitLevelMesh()
|
||||
{
|
||||
Level->SunColor = FVector3(1.f, 1.f, 1.f);
|
||||
Level->SunDirection = FVector3(0.45f, 0.3f, 0.9f);
|
||||
|
||||
// Propagate sample distance where it isn't yet set
|
||||
for (auto& line : Level->lines)
|
||||
{
|
||||
|
@ -2978,6 +2975,11 @@ void MapLoader::LoadLevel(MapData *map, const char *lumpname, int position)
|
|||
{
|
||||
const int *oldvertextable = nullptr;
|
||||
|
||||
// Reset defaults for lightmapping
|
||||
Level->SunColor = FVector3(1.f, 1.f, 1.f);
|
||||
Level->SunDirection = FVector3(0.45f, 0.3f, 0.9f);
|
||||
Level->LightmapSampleDistance = 16;
|
||||
|
||||
// note: most of this ordering is important
|
||||
ForceNodeBuild = gennodes;
|
||||
|
||||
|
|
|
@ -754,9 +754,31 @@ public:
|
|||
break;
|
||||
|
||||
case NAME_lm_suncolor:
|
||||
CHECK_N(Zd | Zdt)
|
||||
if (CheckInt(key) < 0 || CheckInt(key) > 0xFFFFFF)
|
||||
{
|
||||
DPrintf(DMSG_WARNING, "Sun Color '%x' is out of range %s\n", CheckInt(key));
|
||||
}
|
||||
else
|
||||
{
|
||||
auto n = uint32_t(CheckInt(key));
|
||||
Level->SunColor = FVector3(float((n >> 16) & 0xFF) / 0xFF, float((n >> 8) & 0xFF) / 0xFF, float(n & 0xFF) / 0xFF);
|
||||
}
|
||||
break;
|
||||
case NAME_lm_sampledistance:
|
||||
CHECK_N(Zd | Zdt)
|
||||
break;
|
||||
if (CheckInt(key) >= 0 && CheckInt(key) <= 0xFFFF)
|
||||
{
|
||||
Level->LightmapSampleDistance = CheckInt(key);
|
||||
}
|
||||
else
|
||||
{
|
||||
DPrintf(DMSG_WARNING, "Can't set the global lm_sampledistance to %s\n", key.GetChars());
|
||||
}
|
||||
break;
|
||||
case NAME_lm_gridsize:
|
||||
CHECK_N(Zd | Zdt)
|
||||
break;
|
||||
|
||||
default:
|
||||
CHECK_N(Zd | Zdt)
|
||||
|
@ -805,6 +827,15 @@ public:
|
|||
th->special = 0;
|
||||
memset(th->args, 0, sizeof (th->args));
|
||||
}
|
||||
|
||||
if (th->EdNum == 9890) // ZDRAY INFO thing
|
||||
{
|
||||
FAngle angle = FAngle::fromDeg(float(th->angle));
|
||||
FAngle pitch = FAngle::fromDeg(float(th->pitch));
|
||||
|
||||
auto pc = pitch.Cos();
|
||||
Level->SunDirection = -FVector3 { pc * angle.Cos(), pc * angle.Sin(), -pitch.Sin() }; // [RaveYard]: is there a dedicated function for this?
|
||||
}
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
|
|
@ -857,5 +857,6 @@ xx(lm_sampledist_floor)
|
|||
xx(lm_sampledist_ceiling)
|
||||
xx(lm_suncolor)
|
||||
xx(lm_sampledistance)
|
||||
xx(lm_gridsize)
|
||||
|
||||
xx(Corona)
|
||||
|
|
|
@ -27,6 +27,7 @@ DoomLevelMesh::DoomLevelMesh(FLevelLocals &doomMap)
|
|||
{
|
||||
SunColor = doomMap.SunColor; // TODO keep only one copy?
|
||||
SunDirection = doomMap.SunDirection;
|
||||
LightmapSampleDistance = doomMap.LightmapSampleDistance;
|
||||
|
||||
for (unsigned int i = 0; i < doomMap.sides.Size(); i++)
|
||||
{
|
||||
|
@ -890,7 +891,7 @@ void DoomLevelMesh::BuildSurfaceParams(int lightMapTextureWidth, int lightMapTex
|
|||
|
||||
if (surface.sampleDimension <= 0)
|
||||
{
|
||||
surface.sampleDimension = 16;
|
||||
surface.sampleDimension = LightmapSampleDistance;
|
||||
}
|
||||
//surface->sampleDimension = Math::RoundPowerOfTwo(surface->sampleDimension);
|
||||
|
||||
|
|
Loading…
Reference in a new issue