|
|
|
|
|
|
|
|
|
|
namespace UnityEngine.Experimental.Rendering.HDPipeline |
|
|
|
{ |
|
|
|
[CustomEditor(typeof(Light))] |
|
|
|
[CustomEditorForRenderPipeline(typeof(Light), typeof(HDRenderPipelineAsset))] |
|
|
|
[CanEditMultipleObjects] |
|
|
|
public class HDLightEditor : Editor |
|
|
|
{ |
|
|
|
|
|
|
SerializedProperty m_SpotLightShape; |
|
|
|
SerializedProperty m_ShapeLength; |
|
|
|
SerializedProperty m_ShapeWidth; |
|
|
|
SerializedProperty m_ShapeRadius; |
|
|
|
SerializedProperty m_ShapeRadius; |
|
|
|
SerializedProperty m_ShowAdditionalSettings; |
|
|
|
SerializedProperty m_ShowAdditionalSettings; |
|
|
|
|
|
|
|
SerializedProperty m_ShadowDimmer; |
|
|
|
SerializedProperty m_ShadowFadeDistance; |
|
|
|
|
|
|
//Area, <= offline type of Unity not dispay in our case but reuse for GI of our area light
|
|
|
|
Rectangle, |
|
|
|
Line, |
|
|
|
// Sphere,
|
|
|
|
// Sphere,
|
|
|
|
// Disc,
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Note: There is no Lightmapping enum, the code C# side must use int
|
|
|
|
// Light.h file: int m_Lightmapping; ///< enum { Dynamic=4, Stationary=1, Static=2 }
|
|
|
|
// Lighting.h file:
|
|
|
|
// Lighting.h file:
|
|
|
|
// enum LightmapBakeType (not accessible in C#)
|
|
|
|
//{
|
|
|
|
// kLightRealtime = 1 << 2, // Light is realtime
|
|
|
|
|
|
|
m_FadeDistance = additionalDataSerializedObject.FindProperty("fadeDistance"); |
|
|
|
m_AffectDiffuse = additionalDataSerializedObject.FindProperty("affectDiffuse"); |
|
|
|
m_AffectSpecular = additionalDataSerializedObject.FindProperty("affectSpecular"); |
|
|
|
m_LightTypeExtent = additionalDataSerializedObject.FindProperty("lightTypeExtent"); |
|
|
|
m_LightTypeExtent = additionalDataSerializedObject.FindProperty("lightTypeExtent"); |
|
|
|
m_SpotLightShape = additionalDataSerializedObject.FindProperty("spotLightShape"); |
|
|
|
m_ShapeLength = additionalDataSerializedObject.FindProperty("shapeLength"); |
|
|
|
m_ShapeWidth = additionalDataSerializedObject.FindProperty("shapeWidth"); |
|
|
|
|
|
|
m_ShadowCascadeCount = shadowDataSerializedObject.FindProperty("shadowCascadeCount"); |
|
|
|
m_ShadowCascadeRatios = shadowDataSerializedObject.FindProperty("shadowCascadeRatios"); |
|
|
|
m_ShadowCascadeBorders = shadowDataSerializedObject.FindProperty("shadowCascadeBorders"); |
|
|
|
m_ShadowResolution = shadowDataSerializedObject.FindProperty("shadowResolution"); |
|
|
|
m_ShadowResolution = shadowDataSerializedObject.FindProperty("shadowResolution"); |
|
|
|
} |
|
|
|
|
|
|
|
void ResolveLightShape() |
|
|
|
|
|
|
|
|
|
|
// We need to overwrite the name of the default enum that doesn't make any sense
|
|
|
|
// EditorGUILayout.PropertyField(m_Lightmapping, Styles.LightmappingMode);
|
|
|
|
m_Lightmapping.enumValueIndex = EditorGUILayout.Popup(Styles.lightmappingModeText, (int)m_Lightmapping.enumValueIndex, Styles.lightmappingModeNames); |
|
|
|
m_Lightmapping.enumValueIndex = EditorGUILayout.Popup(Styles.lightmappingModeText, (int)m_Lightmapping.enumValueIndex, Styles.lightmappingModeNames); |
|
|
|
|
|
|
|
// Warning if GI Baking disabled and m_Lightmapping isn't realtime
|
|
|
|
if (bakingWarningValue) |
|
|
|
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
EditorGUILayout.PropertyField(m_ShadowResolution, Styles.ShadowResolution); |
|
|
|
EditorGUILayout.Slider(m_ShadowsBias, 0.001f, 1, Styles.ShadowBias); |
|
|
|
|
|
|
// Light features
|
|
|
|
EditorGUI.indentLevel++; |
|
|
|
EditorGUILayout.LabelField(new GUIContent("Light features"), EditorStyles.boldLabel); |
|
|
|
|
|
|
|
|
|
|
|
// Do not display option for shadow if we are fully bake
|
|
|
|
if (m_Lightmapping.enumValueIndex != (int)LightMappingType.Baked) |
|
|
|
{ |
|
|
|
|
|
|
{ |
|
|
|
LightGUI(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Shadows
|
|
|
|
if (m_ShadowsType.enumValueIndex != (int)LightShadows.None) |
|
|
|
{ |
|
|
|