MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / SortLights

Function SortLights

Source/Engine/Renderer/LightPass.cpp:155–170  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

153
154template<typename T = RenderLightData>
155bool SortLights(T const& p1, T const& p2)
156{
157 // Compare by screen size
158 int32 res = static_cast<int32>(p2.ScreenSize * 100 - p1.ScreenSize * 100);
159 if (res == 0)
160 {
161 // Compare by brightness
162 res = static_cast<int32>(p2.Color.SumValues() * 100 - p1.Color.SumValues() * 100);
163 if (res == 0)
164 {
165 // Compare by ID to stabilize order
166 res = GetHash(p2.ID) - GetHash(p1.ID);
167 }
168 }
169 return res < 0;
170}
171
172void LightPass::SetupLights(RenderContext& renderContext, RenderContextBatch& renderContextBatch)
173{

Callers

nothing calls this directly

Calls 2

GetHashFunction · 0.70
SumValuesMethod · 0.45

Tested by

no test coverage detected