| 251 | } |
| 252 | |
| 253 | void SceneRenderTask::OnCollectDrawCalls(RenderContextBatch& renderContextBatch, byte category) |
| 254 | { |
| 255 | // Setup PostFx in the render list |
| 256 | if (category == SceneRendering::DrawCategory::PreRender) |
| 257 | { |
| 258 | const RenderContext& renderContext = renderContextBatch.GetMainContext(); |
| 259 | auto& postFx = renderContext.List->PostFx; |
| 260 | |
| 261 | // Collect all post effects |
| 262 | if (AllowGlobalCustomPostFx) |
| 263 | { |
| 264 | for (PostProcessEffect* fx : GlobalCustomPostFx) |
| 265 | { |
| 266 | if (fx && fx->CanRender(renderContext)) |
| 267 | postFx.Add(fx); |
| 268 | } |
| 269 | } |
| 270 | for (PostProcessEffect* fx : CustomPostFx) |
| 271 | { |
| 272 | if (fx && fx->CanRender(renderContext)) |
| 273 | postFx.Add(fx); |
| 274 | } |
| 275 | if (const auto* camera = Camera.Get()) |
| 276 | { |
| 277 | for (Script* script : camera->Scripts) |
| 278 | { |
| 279 | auto* fx = Cast<PostProcessEffect>(script); |
| 280 | if (fx && fx->CanRender(renderContext)) |
| 281 | postFx.Add(fx); |
| 282 | } |
| 283 | } |
| 284 | |
| 285 | // Sort by order |
| 286 | Sorting::QuickSort(postFx.Get(), postFx.Count(), &SortPostFx); |
| 287 | } |
| 288 | |
| 289 | // Draw actors (collect draw calls) |
| 290 | if (EnumHasAllFlags(ActorsSource, ActorsSources::CustomActors)) |
| 291 | { |
| 292 | if (category == SceneRendering::DrawCategory::PreRender) |
| 293 | { |
| 294 | if (_customActorsScene == nullptr) |
| 295 | _customActorsScene = New<SceneRendering>(); |
| 296 | else |
| 297 | _customActorsScene->Clear(); |
| 298 | for (Actor* a : CustomActors) |
| 299 | AddActorToSceneRendering(_customActorsScene, a); |
| 300 | } |
| 301 | ASSERT_LOW_LAYER(_customActorsScene); |
| 302 | _customActorsScene->Draw(renderContextBatch, (SceneRendering::DrawCategory)category); |
| 303 | } |
| 304 | if (EnumHasAllFlags(ActorsSource, ActorsSources::CustomScenes)) |
| 305 | { |
| 306 | for (Scene* scene : CustomScenes) |
| 307 | { |
| 308 | if (scene && scene->IsActiveInHierarchy()) |
| 309 | scene->Rendering.Draw(renderContextBatch, (SceneRendering::DrawCategory)category); |
| 310 | } |
nothing calls this directly
no test coverage detected