You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
75 lines
3.9 KiB
75 lines
3.9 KiB
using UnityEngine.Rendering.Universal; |
|
|
|
namespace UnityEditor.Rendering.Universal |
|
{ |
|
internal class UniversalRenderPipelineSerializedLight : ISerializedLight |
|
{ |
|
/// <summary>The base settings of the light</summary> |
|
public LightEditor.Settings settings { get; } |
|
/// <summary>The light serialized</summary> |
|
public SerializedObject serializedObject { get; } |
|
/// <summary>The additional light data serialized</summary> |
|
public SerializedObject serializedAdditionalDataObject { get; private set; } |
|
|
|
public UniversalAdditionalLightData additionalLightData => lightsAdditionalData[0]; |
|
public UniversalAdditionalLightData[] lightsAdditionalData { get; private set; } |
|
|
|
// Common SRP's Lights properties |
|
public SerializedProperty intensity { get; } |
|
|
|
// URP Light Properties |
|
public SerializedProperty useAdditionalDataProp { get; } // Does light use shadow bias settings defined in UniversalRP asset file? |
|
public SerializedProperty additionalLightsShadowResolutionTierProp { get; } // Index of the AdditionalLights ShadowResolution Tier |
|
public SerializedProperty lightCookieSizeProp { get; } // Multi dimensional light cookie size replacing `cookieSize` in legacy light. |
|
public SerializedProperty lightCookieOffsetProp { get; } // Multi dimensional light cookie offset. |
|
|
|
// Light layers related |
|
public SerializedProperty lightLayerMask { get; } |
|
public SerializedProperty customShadowLayers { get; } |
|
public SerializedProperty shadowLayerMask { get; } |
|
|
|
/// <summary>Method that updates the <see cref="SerializedObject"/> of the Light and the Additional Light Data</summary> |
|
public void Update() |
|
{ |
|
serializedObject.Update(); |
|
serializedAdditionalDataObject.Update(); |
|
settings.Update(); |
|
} |
|
|
|
/// <summary>Method that applies the modified properties the <see cref="SerializedObject"/> of the Light and the Light Camera Data</summary> |
|
public void Apply() |
|
{ |
|
serializedObject.ApplyModifiedProperties(); |
|
serializedAdditionalDataObject.ApplyModifiedProperties(); |
|
settings.ApplyModifiedProperties(); |
|
} |
|
|
|
/// <summary>Constructor</summary> |
|
/// <param name="serializedObject"><see cref="SerializedObject"/> with the light</param> |
|
/// <param name="settings"><see cref="LightEditor.Settings"/>with the settings</param> |
|
public UniversalRenderPipelineSerializedLight(SerializedObject serializedObject, LightEditor.Settings settings) |
|
{ |
|
this.settings = settings; |
|
settings.OnEnable(); |
|
|
|
this.serializedObject = serializedObject; |
|
|
|
lightsAdditionalData = CoreEditorUtils |
|
.GetAdditionalData<UniversalAdditionalLightData>(serializedObject.targetObjects); |
|
serializedAdditionalDataObject = new SerializedObject(lightsAdditionalData); |
|
|
|
intensity = serializedObject.FindProperty("m_Intensity"); |
|
|
|
useAdditionalDataProp = serializedAdditionalDataObject.FindProperty("m_UsePipelineSettings"); |
|
additionalLightsShadowResolutionTierProp = serializedAdditionalDataObject.FindProperty("m_AdditionalLightsShadowResolutionTier"); |
|
lightCookieSizeProp = serializedAdditionalDataObject.FindProperty("m_LightCookieSize"); |
|
lightCookieOffsetProp = serializedAdditionalDataObject.FindProperty("m_LightCookieOffset"); |
|
|
|
lightLayerMask = serializedAdditionalDataObject.FindProperty("m_LightLayerMask"); |
|
customShadowLayers = serializedAdditionalDataObject.FindProperty("m_CustomShadowLayers"); |
|
shadowLayerMask = serializedAdditionalDataObject.FindProperty("m_ShadowLayerMask"); |
|
|
|
settings.ApplyModifiedProperties(); |
|
} |
|
} |
|
}
|
|
|