浏览代码

draft

/Add-physical-light-unity-support
sebastienlagarde 7 年前
当前提交
5a41c4fd
共有 2 个文件被更改,包括 33 次插入9 次删除
  1. 29
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/HDLightEditor.cs
  2. 13
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/HDAdditionalLightData.cs

29
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/HDLightEditor.cs


{
sealed class SerializedLightData
{
public SerializedProperty directionalIntensity;
public SerializedProperty punctualIntensity;
public SerializedProperty spotInnerPercent;
public SerializedProperty lightDimmer;
public SerializedProperty fadeDistance;

using (var o = new PropertyFetcher<HDAdditionalLightData>(m_SerializedAdditionalLightData))
m_AdditionalLightData = new SerializedLightData
{
directionalIntensity = o.Find(x => x.directionalIntensity),
punctualIntensity = o.Find(x => x.punctualIntensity),
spotInnerPercent = o.Find(x => x.m_InnerSpotPercent),
lightDimmer = o.Find(x => x.lightDimmer),
fadeDistance = o.Find(x => x.fadeDistance),

void DrawLightSettings()
{
settings.DrawColor();
// Customize the
// Customize the
/*
EditorGUILayout.PropertyField(settings.intensity, s_Styles.intensityPhysicalUnit);
switch (m_LightShape)
{
case LightShape.Directional:
settings.lightType.enumValueIndex = (int)LightType.Directional;
m_AdditionalLightData.lightTypeExtent.enumValueIndex = (int)LightTypeExtent.Punctual;
break;
case LightShape.Point:
case LightShape.Spot:
settings.lightType.enumValueIndex = (int)LightType.Point;
m_AdditionalLightData.lightTypeExtent.enumValueIndex = (int)LightTypeExtent.Punctual;
EditorGUILayout.PropertyField(m_AdditionalLightData.maxSmoothness, s_Styles.maxSmoothness);
break;
}
EditorGUILayout.PropertyField(settings.punctualIntensity, s_Styles.intensityPhysicalUnit);
//settings.intensity.floatValue =
//settings.intensity.floatValue =
*/
settings.DrawIntensity();
settings.DrawBounceIntensity();
settings.DrawLightmapping();

13
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/HDAdditionalLightData.cs


// We can't rely on Unity for our additional data, we need to version it ourself.
[SerializeField]
float m_Version = 1.0f;
#pragma warning restore 414
#pragma warning restore 414
// To be able to have correct default values for our lights and to also control the conversion of intensity from the light editor (so it is compatible with GI)
// we add intensity (for each type of light we want to manage).
public float directionalIntensity = 10000.0f; // Sun Light default to 10000 lux
public float punctualIntensity = 600.0f; // Light default to 600 lumens
[FormerlySerializedAs("m_innerSpotPercent")]
public float m_InnerSpotPercent = 0.0f; // To display this field in the UI this need to be public
public float GetInnerSpotPercent01()

public bool affectDiffuse = true;
public bool affectSpecular = true;
[FormerlySerializedAs("archetype")]
public LightTypeExtent lightTypeExtent = LightTypeExtent.Punctual;
// Only for Spotlight, should be hide for other light

[FormerlySerializedAs("lightWidth")]
[FormerlySerializedAs("lightHeight")]
public float shapeHeight = 0.5f;
// Only for pyramid projector

正在加载...
取消
保存