Add AddViewOriginToStreaming to blueprint library

This commit is contained in:
Steve Streeting 2024-07-24 15:57:47 +01:00
parent b9ab8feb16
commit 956d6b764c
2 changed files with 40 additions and 0 deletions

View File

@ -20,3 +20,20 @@ FStevesBalancedRandomStream UStevesBPL::MakeBalancedRandomStream(int64 Seed)
{
return FStevesBalancedRandomStream(Seed);
}
void UStevesBPL::AddViewOriginToStreaming(const FVector& ViewOrigin,
float ScreenWidth,
float FOV,
float BoostFactor,
bool bOverrideLocation,
float Duration,
AActor* ActorToBoost)
{
IStreamingManager::Get().AddViewInformation(ViewOrigin,
ScreenWidth,
ScreenWidth / FMath::Tan(FMath::DegreesToRadians(FOV * 0.5f)),
BoostFactor,
bOverrideLocation,
Duration,
ActorToBoost);
}

View File

@ -75,4 +75,27 @@ public:
UFUNCTION(BlueprintCallable, Category="StevesUEHelpers|Random")
static FVector BalancedRandomPointInBox(const FStevesBalancedRandomStream& Stream, const FVector& Min, const FVector& Max) { return Stream.RandPointInBox(FBox(Min, Max)); }
/**
* Let the content streaming system know that there is a viewpoint other than a possessed camera that should be taken
* into account when deciding what to stream in. This can be useful when you're using a scene capture component,
* which if it's capturing a scene that isn't close to a player, can result in blurry textures.
* @param ViewOrigin The world space view point
* @param ScreenWidth The width in pixels of the screen being rendered
* @param FOV Horizontal field of view, in degrees
* @param BoostFactor How much to boost the LOD by (1 being normal, higher being higher detail)
* @param bOverrideLocation Whether this is an override location, which forces the streaming system to ignore all other regular locations
* @param Duration How long the streaming system should keep checking this location (in seconds). 0 means just for the next Tick.
* @param ActorToBoost Optional pointer to an actor who's textures should have their streaming priority boosted
*/
UFUNCTION(BlueprintCallable, Category="StevesUEHelpers|Streaming")
static void AddViewOriginToStreaming(const FVector& ViewOrigin,
float ScreenWidth,
float FOV,
float BoostFactor = 1.0f,
bool bOverrideLocation = false,
float Duration = 0.0f,
AActor* ActorToBoost = nullptr);
};