浏览代码

Added nicer debug output in VS watch panel

/main
Thomas 7 年前
当前提交
46fcb147
共有 1 个文件被更改,包括 29 次插入21 次删除
  1. 50
      ScriptableRenderPipeline/Core/Volume/VolumeParameter.cs

50
ScriptableRenderPipeline/Core/Volume/VolumeParameter.cs


using System;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Linq;
using System.Reflection;

// of the following is a bit hacky...
public abstract class VolumeParameter
{
public const string k_DebuggerDisplay = "{m_Value} ({m_OverrideState})";
[SerializeField]
protected bool m_OverrideState;

}
}
[Serializable]
[Serializable, DebuggerDisplay(k_DebuggerDisplay)]
public class VolumeParameter<T> : VolumeParameter
{
[SerializeField]

}
}
public override string ToString()
{
return string.Format("{0} ({1})", value, overrideState);
}
//
// Implicit conversion; assuming the following:
//

// public enum MyEnum { One, Two }
//
[Serializable]
[Serializable, DebuggerDisplay(k_DebuggerDisplay)]
[Serializable]
[Serializable, DebuggerDisplay(k_DebuggerDisplay)]
public sealed class IntParameter : VolumeParameter<int>
{
public override void Interp(int from, int to, float t)

}
}
[Serializable]
[Serializable, DebuggerDisplay(k_DebuggerDisplay)]
[Serializable]
[Serializable, DebuggerDisplay(k_DebuggerDisplay)]
public sealed class ClampedIntParameter : VolumeParameter<int>
{
public ParameterClampMode clampMode = ParameterClampMode.MinMax;

}
}
[Serializable]
[Serializable, DebuggerDisplay(k_DebuggerDisplay)]
public sealed class InstantClampedIntParameter : VolumeParameter<int>
{
public ParameterClampMode clampMode = ParameterClampMode.MinMax;

}
}
[Serializable]
[Serializable, DebuggerDisplay(k_DebuggerDisplay)]
public sealed class FloatParameter : VolumeParameter<float>
{
public override void Interp(float from, float to, float t)

}
[Serializable]
[Serializable, DebuggerDisplay(k_DebuggerDisplay)]
[Serializable]
[Serializable, DebuggerDisplay(k_DebuggerDisplay)]
public sealed class ClampedFloatParameter : VolumeParameter<float>
{
public ParameterClampMode clampMode = ParameterClampMode.MinMax;

}
}
[Serializable]
[Serializable, DebuggerDisplay(k_DebuggerDisplay)]
public sealed class InstantClampedFloatParameter : VolumeParameter<float>
{
public ParameterClampMode clampMode = ParameterClampMode.MinMax;

}
// Holds a min & a max values clamped in a range (MinMaxSlider in the editor)
[Serializable]
[Serializable, DebuggerDisplay(k_DebuggerDisplay)]
public sealed class RangeParameter : VolumeParameter<Vector2>
{
public float min = 0;

}
}
[Serializable]
[Serializable, DebuggerDisplay(k_DebuggerDisplay)]
public sealed class InstantRangeParameter : VolumeParameter<Vector2>
{
public float min = 0;

}
// 32-bit RGBA
[Serializable]
[Serializable, DebuggerDisplay(k_DebuggerDisplay)]
public sealed class ColorParameter : VolumeParameter<Color>
{
public bool hdr = false;

}
}
[Serializable]
[Serializable, DebuggerDisplay(k_DebuggerDisplay)]
[Serializable]
[Serializable, DebuggerDisplay(k_DebuggerDisplay)]
public sealed class Vector2Parameter : VolumeParameter<Vector2>
{
public override void Interp(Vector2 from, Vector2 to, float t)

}
}
[Serializable]
[Serializable, DebuggerDisplay(k_DebuggerDisplay)]
[Serializable]
[Serializable, DebuggerDisplay(k_DebuggerDisplay)]
public sealed class Vector3Parameter : VolumeParameter<Vector3>
{
public override void Interp(Vector3 from, Vector3 to, float t)

}
}
[Serializable]
[Serializable, DebuggerDisplay(k_DebuggerDisplay)]
[Serializable]
[Serializable, DebuggerDisplay(k_DebuggerDisplay)]
public sealed class Vector4Parameter : VolumeParameter<Vector4>
{
public override void Interp(Vector4 from, Vector4 to, float t)

}
}
[Serializable]
[Serializable, DebuggerDisplay(k_DebuggerDisplay)]
[Serializable]
[Serializable, DebuggerDisplay(k_DebuggerDisplay)]
public class ObjectParameter<T> : VolumeParameter<T>
{
internal ReadOnlyCollection<VolumeParameter> parameters { get; private set; }

正在加载...
取消
保存