mirror of
https://github.com/Eragon-Brisingr/UShaderLab.git
synced 2026-09-15 14:54:36 +00:00
48 lines
1.9 KiB
C++
48 lines
1.9 KiB
C++
// Copyright UShaderLab. All Rights Reserved.
|
|
//
|
|
// Internal shared helpers + per-category registration entry points for the builtin `UE_` intrinsics.
|
|
// Registration is split by category (mesh/view/object/instancing/time/particle/decal/atmosphere) into
|
|
// separate .cpp files for maintainability; each defines one RegisterXxxIntrinsics(registry) that the
|
|
// registry's RegisterBuiltins() calls.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "Materials/Material.h"
|
|
#include "ShaderLabIntrinsicRegistry.h"
|
|
|
|
namespace ShaderLabIntrinsic_Private
|
|
{
|
|
/** NewObject a no-config expression node and add it to the material's collection. */
|
|
template <typename T>
|
|
UMaterialExpression* MakeSimple(UMaterial& Material)
|
|
{
|
|
T* Expr = NewObject<T>(&Material);
|
|
Material.GetExpressionCollection().AddExpression(Expr);
|
|
return Expr;
|
|
}
|
|
|
|
/**
|
|
* Register a no-arg intrinsic that maps to a source node. `OutputIndex` selects which output pin to
|
|
* connect (non-zero for one facet of a multi-output node, e.g. a directional light's Direction).
|
|
*/
|
|
void AddSimple(
|
|
FShaderLabIntrinsicRegistry& Registry,
|
|
const TCHAR* Name,
|
|
EShaderLabIntrinsicFrequency Frequency,
|
|
const TCHAR* ReturnType,
|
|
TFunction<UMaterialExpression*(UMaterial&)> Make,
|
|
int32 OutputIndex = 0);
|
|
}
|
|
|
|
// Per-category registration (defined in ShaderLabIntrinsics_<Category>.cpp).
|
|
void RegisterMeshIntrinsics(FShaderLabIntrinsicRegistry& Registry);
|
|
void RegisterViewIntrinsics(FShaderLabIntrinsicRegistry& Registry);
|
|
void RegisterObjectIntrinsics(FShaderLabIntrinsicRegistry& Registry);
|
|
void RegisterInstancingIntrinsics(FShaderLabIntrinsicRegistry& Registry);
|
|
void RegisterTimeIntrinsics(FShaderLabIntrinsicRegistry& Registry);
|
|
void RegisterParticleIntrinsics(FShaderLabIntrinsicRegistry& Registry);
|
|
void RegisterDecalIntrinsics(FShaderLabIntrinsicRegistry& Registry);
|
|
void RegisterAtmosphereIntrinsics(FShaderLabIntrinsicRegistry& Registry);
|
|
void RegisterDistanceFieldIntrinsics(FShaderLabIntrinsicRegistry& Registry);
|