您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
38 行
1.4 KiB
38 行
1.4 KiB
using UnityEngine;
|
|
using UnityEngine.Rendering.Universal;
|
|
|
|
namespace UnityEditor.Rendering.Universal
|
|
{
|
|
[VolumeComponentEditor(typeof(LiftGammaGain))]
|
|
sealed class LiftGammaGainEditor : VolumeComponentEditor
|
|
{
|
|
SerializedDataParameter m_Lift;
|
|
SerializedDataParameter m_Gamma;
|
|
SerializedDataParameter m_Gain;
|
|
|
|
readonly TrackballUIDrawer m_TrackballUIDrawer = new TrackballUIDrawer();
|
|
|
|
public override void OnEnable()
|
|
{
|
|
var o = new PropertyFetcher<LiftGammaGain>(serializedObject);
|
|
|
|
m_Lift = Unpack(o.Find(x => x.lift));
|
|
m_Gamma = Unpack(o.Find(x => x.gamma));
|
|
m_Gain = Unpack(o.Find(x => x.gain));
|
|
}
|
|
|
|
public override void OnInspectorGUI()
|
|
{
|
|
using (new EditorGUILayout.HorizontalScope())
|
|
{
|
|
m_TrackballUIDrawer.OnGUI(m_Lift.value, m_Lift.overrideState, EditorGUIUtility.TrTextContent("Lift"), GetLiftValue);
|
|
GUILayout.Space(4f);
|
|
m_TrackballUIDrawer.OnGUI(m_Gamma.value, m_Gamma.overrideState, EditorGUIUtility.TrTextContent("Gamma"), GetLiftValue);
|
|
GUILayout.Space(4f);
|
|
m_TrackballUIDrawer.OnGUI(m_Gain.value, m_Gain.overrideState, EditorGUIUtility.TrTextContent("Gain"), GetLiftValue);
|
|
}
|
|
}
|
|
|
|
static Vector3 GetLiftValue(Vector4 x) => new Vector3(x.x + x.w, x.y + x.w, x.z + x.w);
|
|
}
|
|
}
|