From 50183606d24e1ac11b6322c243f612803a931c86 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Wed, 9 Jul 2025 15:44:04 +0200 Subject: [PATCH] Correctly display the light probe locations --- src/rendering/hwrenderer/scene/hw_drawinfo.cpp | 13 +++++-------- src/rendering/hwrenderer/scene/hw_drawinfo.h | 2 +- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/rendering/hwrenderer/scene/hw_drawinfo.cpp b/src/rendering/hwrenderer/scene/hw_drawinfo.cpp index ddc1402b4..4eae82a7c 100644 --- a/src/rendering/hwrenderer/scene/hw_drawinfo.cpp +++ b/src/rendering/hwrenderer/scene/hw_drawinfo.cpp @@ -907,25 +907,22 @@ void HWDrawInfo::RenderScene(FRenderState &state) if (r_showlights && !IsEnvironmentMapRendering) { - auto it_lightprobe = level.GetThinkerIterator(NAME_LightProbe, STAT_INFO); - while (AActor* probe = it_lightprobe.Next()) + for (auto& probe : level.lightProbes) { - DrawIcosahedron(state, probe->Pos(), 10.0f, false, 0xff00ff00); + DrawIcosahedron(state, probe.position, 10.0f, false, 0xff00ff00); } for (FDynamicLight* light = Level->lights; light; light = light->next) { - DrawIcosahedron(state, light->Pos, 10.0f, false, 0xffffffff); + DrawIcosahedron(state, FVector3((float)light->Pos.X, (float)light->Pos.Y, (float)light->Pos.Z), 10.0f, false, 0xffffffff); } } RenderAll.Unclock(); } -void HWDrawInfo::DrawIcosahedron(FRenderState& state, DVector3 pos, float radius, bool useRadiusOfInscribedSphere, PalEntry color) +void HWDrawInfo::DrawIcosahedron(FRenderState& state, FVector3 pos, float radius, bool useRadiusOfInscribedSphere, PalEntry color) { - FVector3 fPos((float)pos.X, (float)pos.Y, (float)pos.Z); - // radius of a circumscribed sphere (one that touches the icosahedron at all vertices) float x = 0.525731112119133606f; float z = 0.850650808352039932f; @@ -979,7 +976,7 @@ void HWDrawInfo::DrawIcosahedron(FRenderState& state, DVector3 pos, float radius auto verts = state.AllocVertices(20 * 3); for (int i = 0; i < 20 * 3; i++) { - const FVector3& v = vertices[elements[i]] * radius + fPos; + const FVector3& v = vertices[elements[i]] * radius + pos; verts.first[i].Set(v.X, v.Z, v.Y, 0.0f, 0.0f); } diff --git a/src/rendering/hwrenderer/scene/hw_drawinfo.h b/src/rendering/hwrenderer/scene/hw_drawinfo.h index 76db52ccf..7e9c4c53c 100644 --- a/src/rendering/hwrenderer/scene/hw_drawinfo.h +++ b/src/rendering/hwrenderer/scene/hw_drawinfo.h @@ -429,7 +429,7 @@ private: void AddSpecialPortalLines(subsector_t* sub, sector_t* sector, linebase_t* line, FRenderState& state); void UpdateLightmaps(); - void DrawIcosahedron(FRenderState& state, DVector3 pos, float radius, bool useRadiusOfInscribedSphere, PalEntry color); + void DrawIcosahedron(FRenderState& state, FVector3 pos, float radius, bool useRadiusOfInscribedSphere, PalEntry color); }; void CleanSWDrawer();