mirror of
https://github.com/Eragon-Brisingr/UShaderLab.git
synced 2026-09-15 14:54:36 +00:00
35 lines
1.5 KiB
C++
35 lines
1.5 KiB
C++
// Copyright UShaderLab. All Rights Reserved.
|
|
//
|
|
// Atmosphere / sky-light intrinsics.
|
|
|
|
#include "ShaderLabIntrinsics.h"
|
|
|
|
#include "Materials/MaterialExpressionAtmosphericLightColor.h"
|
|
#include "Materials/MaterialExpressionAtmosphericLightVector.h"
|
|
#include "Materials/MaterialExpressionSkyAtmosphereLightDirection.h"
|
|
|
|
void RegisterAtmosphereIntrinsics(FShaderLabIntrinsicRegistry& Registry)
|
|
{
|
|
using namespace ShaderLabIntrinsic_Private;
|
|
using EFreq = EShaderLabIntrinsicFrequency;
|
|
|
|
AddSimple(Registry, TEXT("AtmosphericLightVector"), EFreq::Any, TEXT("float3"), [](UMaterial& M) { return MakeSimple<UMaterialExpressionAtmosphericLightVector>(M); });
|
|
AddSimple(Registry, TEXT("AtmosphericLightColor"), EFreq::Any, TEXT("float3"), [](UMaterial& M) { return MakeSimple<UMaterialExpressionAtmosphericLightColor>(M); });
|
|
|
|
// SkyAtmosphereLightDirection(LightIndex) — const int selects the atmosphere light.
|
|
{
|
|
FShaderLabIntrinsicDesc Desc;
|
|
Desc.Name = FName(TEXT("SkyAtmosphereLightDirection"));
|
|
Desc.ReturnType = TEXT("float3");
|
|
Desc.Params = { { TEXT("int"), TEXT("LightIndex"), TEXT("0") } };
|
|
Desc.MakeNode = [](UMaterial& M, const TArray<FString>& Args, FString&) -> UMaterialExpression*
|
|
{
|
|
UMaterialExpressionSkyAtmosphereLightDirection* E = NewObject<UMaterialExpressionSkyAtmosphereLightDirection>(&M);
|
|
if (Args.Num() >= 1) { E->LightIndex = FCString::Atoi(*Args[0]); }
|
|
M.GetExpressionCollection().AddExpression(E);
|
|
return E;
|
|
};
|
|
Registry.Register(MoveTemp(Desc));
|
|
}
|
|
}
|