| 153 | |
| 154 | template<typename T = RenderLightData> |
| 155 | bool 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 | |
| 172 | void LightPass::SetupLights(RenderContext& renderContext, RenderContextBatch& renderContextBatch) |
| 173 | { |