diff --git a/03-UnrealEngine/Rendering/RenderFeature/平面反射.md b/03-UnrealEngine/Rendering/RenderFeature/平面反射.md new file mode 100644 index 0000000..336453b --- /dev/null +++ b/03-UnrealEngine/Rendering/RenderFeature/平面反射.md @@ -0,0 +1,68 @@ +--- +title: Untitled +date: 2024-07-19 22:09:12 +excerpt: +tags: +rating: ⭐ +--- + +```c++ +for (auto It = SceneCaptureComponent->HiddenActors.CreateConstIterator(); It; ++It) +{ + AActor* Actor = *It; + + if (Actor) + { + for (UActorComponent* Component : Actor->GetComponents()) + { + if (UPrimitiveComponent* PrimComp = Cast(Component)) + { + View->HiddenPrimitives.Add(PrimComp->ComponentId); + } + } + } +} + +if (SceneCaptureComponent->PrimitiveRenderMode == ESceneCapturePrimitiveRenderMode::PRM_UseShowOnlyList) +{ + View->ShowOnlyPrimitives.Emplace(); + + for (auto It = SceneCaptureComponent->ShowOnlyComponents.CreateConstIterator(); It; ++It) + { + // If the primitive component was destroyed, the weak pointer will return NULL. + UPrimitiveComponent* PrimitiveComponent = It->Get(); + if (PrimitiveComponent) + { + View->ShowOnlyPrimitives->Add(PrimitiveComponent->ComponentId); + } + } + + for (auto It = SceneCaptureComponent->ShowOnlyActors.CreateConstIterator(); It; ++It) + { + AActor* Actor = *It; + + if (Actor) + { + for (UActorComponent* Component : Actor->GetComponents()) + { + if (UPrimitiveComponent* PrimComp = Cast(Component)) + { + View->ShowOnlyPrimitives->Add(PrimComp->ComponentId); + } + } + } + } +} +else if (SceneCaptureComponent->ShowOnlyComponents.Num() > 0 || SceneCaptureComponent->ShowOnlyActors.Num() > 0) +{ + static bool bWarned = false; + + if (!bWarned) + { + UE_LOG(LogRenderer, Log, TEXT("Scene Capture has ShowOnlyComponents or ShowOnlyActors ignored by the PrimitiveRenderMode setting! %s"), *SceneCaptureComponent->GetPathName()); + bWarned = true; + } +} + +ViewFamily.Views.Add(View); +``` \ No newline at end of file