CPU raytrace basic test

This commit is contained in:
RaveYard 2023-08-31 16:09:31 +02:00 committed by Christoph Oelckers
parent 73030b9315
commit 3af8f477e7

View file

@ -3338,8 +3338,13 @@ void MapLoader::InitLightmap(MapData* map)
Level->LMTextureSize = 1024; // TODO cvar
// TODO read from ZDRayInfoThing
Level->SunColor = FVector3(1.f, 1.f, 1.f);
Level->SunDirection = FVector3(0.45f, 0.3f, 0.9f);
Level->LMTextureCount = Level->levelMesh->SetupLightmapUvs(Level->LMTextureSize);
// Debug placeholder stuff
{
auto constructDebugTexture = [&](TArray<uint16_t>& buffer, int layers, int width, int height) {
@ -3409,6 +3414,19 @@ void MapLoader::InitLightmap(MapData* map)
ptr[1] = floatToHalf(0.0f);
ptr[2] = floatToHalf(0.0f);
}
if (Level->levelMesh->TraceSky(surface.worldOrigin - surface.worldStepX - surface.worldStepY + surface.worldStepX * x + surface.worldStepY * y + FVector3(surface.plane.Normal()), Level->SunDirection, 32000.0f))
{
ptr[0] = floatToHalf(Level->SunColor.X);
ptr[1] = floatToHalf(Level->SunColor.Y);
ptr[2] = floatToHalf(Level->SunColor.Z);
}
else
{
ptr[0] = 0;
ptr[1] = 0;
ptr[2] = 0;
}
}
}
}