Files
UnrealEngine/Engine/Source/Runtime/AugmentedReality/Private/ARLightEstimate.cpp
2025-05-18 13:04:45 +08:00

47 lines
1.3 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "ARLightEstimate.h"
#include UE_INLINE_GENERATED_CPP_BY_NAME(ARLightEstimate)
//
//
//
void UARBasicLightEstimate::SetLightEstimate(float InAmbientIntensityLumens, float InColorTemperatureKelvin)
{
AmbientIntensityLumens = InAmbientIntensityLumens;
AmbientColorTemperatureKelvin = InColorTemperatureKelvin;
AmbientColor = FLinearColor::MakeFromColorTemperature(GetAmbientColorTemperatureKelvin());
}
void UARBasicLightEstimate::SetLightEstimate(FVector InRGBScaleFactor, float InPixelIntensity)
{
// Try to convert ARCore average pixel intensity to lumen and set the color tempature to pure white.
AmbientIntensityLumens = InPixelIntensity / 0.18f * 1000;
AmbientColor = FLinearColor(InRGBScaleFactor);
// TODO: Try to convert ambient color to color tempature?
}
void UARBasicLightEstimate::SetLightEstimate(float InColorTemperatureKelvin, FLinearColor InAmbientColor)
{
AmbientColorTemperatureKelvin = InColorTemperatureKelvin;
AmbientColor = InAmbientColor;
}
float UARBasicLightEstimate::GetAmbientIntensityLumens() const
{
return AmbientIntensityLumens;
}
float UARBasicLightEstimate::GetAmbientColorTemperatureKelvin() const
{
return AmbientColorTemperatureKelvin;
}
FLinearColor UARBasicLightEstimate::GetAmbientColor() const
{
return AmbientColor;
}