Files
KopMap/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/ExposureNode.cs

42 lines
1.2 KiB
C#
Raw Normal View History

2025-04-03 02:30:16 +08:00
// Amplify Shader Editor - Visual Shader Editing Tool
// Copyright (c) Amplify Creations, Lda <info@amplify.pt>
using System;
using UnityEngine;
using UnityEditor;
namespace AmplifyShaderEditor
{
[Serializable]
[NodeAttributes( "Exposure", "Lighting", "Get camera exposure value." )]
public sealed class Exposure : ParentNode
{
protected override void CommonInit( int uniqueId )
{
base.CommonInit( uniqueId );
AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue );
}
public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar )
{
if ( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) )
return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory );
bool isHDRP = ( dataCollector.CurrentSRPType == TemplateSRPType.HDRP );
bool isURP17xOrAbove = ( dataCollector.CurrentSRPType == TemplateSRPType.URP && ASEPackageManagerHelper.CurrentSRPVersion >= ( int )ASESRPBaseline.ASE_SRP_17 );
string result;
if ( isHDRP || isURP17xOrAbove )
{
result = "GetCurrentExposureMultiplier()";
}
else
{
result = "( 1.0 )";
}
return CreateOutputLocalVariable( 0, result, ref dataCollector );
}
}
}